Exemplo n.º 1
0
void UI_SaberAttachToChar( itemDef_t *item )
{
	int	numSabers = 1;
 	int	saberNum = 0;

	if ( trap_G2API_HasGhoul2ModelOnIndex(&(item->ghoul2),2) )
	{//remove any extra models
		trap_G2API_RemoveGhoul2Model(&(item->ghoul2), 2);
	}
	if ( trap_G2API_HasGhoul2ModelOnIndex(&(item->ghoul2),1) )
	{//remove any extra models
		trap_G2API_RemoveGhoul2Model(&(item->ghoul2), 1);
	}

	if ( uiInfo.movesTitleIndex == 4 /*MD_DUAL_SABERS*/ )
	{
		numSabers = 2;
	}

	for ( saberNum = 0; saberNum < numSabers; saberNum++ )
	{
		//bolt sabers
		char modelPath[MAX_QPATH];
		char skinPath[MAX_QPATH];
		char saber[MAX_QPATH]; 

		UI_GetSaberForMenu( saber, saberNum );

		if ( UI_SaberModelForSaber( saber, modelPath ) )
		{//successfully found a model
			int g2Saber = trap_G2API_InitGhoul2Model( &(item->ghoul2), modelPath, 0, 0, 0, 0, 0 ); //add the model
			if ( g2Saber )
			{
				int boltNum;
				//get the customSkin, if any
				if ( UI_SaberSkinForSaber( saber, skinPath ) )
				{
					int g2skin = trap_R_RegisterSkin(skinPath);
					trap_G2API_SetSkin( item->ghoul2, g2Saber, 0, g2skin );//this is going to set the surfs on/off matching the skin file
				}
				else
				{
					trap_G2API_SetSkin( item->ghoul2, g2Saber, 0, 0 );//turn off custom skin
				}
				if ( saberNum == 0 )
				{
					boltNum = trap_G2API_AddBolt( item->ghoul2, 0, "*r_hand");
				}
				else
				{
					boltNum = trap_G2API_AddBolt( item->ghoul2, 0, "*l_hand");
				}
				trap_G2API_AttachG2Model( item->ghoul2, g2Saber, item->ghoul2, boltNum, 0);
			}
		}
	}
}
Exemplo n.º 2
0
void turretG2_set_models( gentity_t *self, qboolean dying )
{
    if ( dying )
    {
        if ( !(self->spawnflags&SPF_TURRETG2_TURBO) )
        {
            self->s.modelindex = G_ModelIndex( name2 );
            self->s.modelindex2 = G_ModelIndex( name );
        }

        trap_G2API_RemoveGhoul2Model( &self->ghoul2, 0 );
        G_KillG2Queue( self->s.number );
        self->s.modelGhoul2 = 0;
        /*
        trap_G2API_InitGhoul2Model( &self->ghoul2,
        							name2,
        							0, //base->s.modelindex,
        							//note, this is not the same kind of index - this one's referring to the actual
        							//index of the model in the g2 instance, whereas modelindex is the index of a
        							//configstring -rww
        							0,
        							0,
        							0,
        							0);
        */
    }
    else
    {
        if ( !(self->spawnflags&SPF_TURRETG2_TURBO) )
        {
            self->s.modelindex = G_ModelIndex( name );
            self->s.modelindex2 = G_ModelIndex( name2 );
            //set the new onw
            trap_G2API_InitGhoul2Model( &self->ghoul2,
                                        name,
                                        0, //base->s.modelindex,
                                        //note, this is not the same kind of index - this one's referring to the actual
                                        //index of the model in the g2 instance, whereas modelindex is the index of a
                                        //configstring -rww
                                        0,
                                        0,
                                        0,
                                        0);
        }
        else
        {
            self->s.modelindex = G_ModelIndex( name3 );
            //set the new onw
            trap_G2API_InitGhoul2Model( &self->ghoul2,
                                        name3,
                                        0, //base->s.modelindex,
                                        //note, this is not the same kind of index - this one's referring to the actual
                                        //index of the model in the g2 instance, whereas modelindex is the index of a
                                        //configstring -rww
                                        0,
                                        0,
                                        0,
                                        0);
        }

        self->s.modelGhoul2 = 1;
        if ( (self->spawnflags&SPF_TURRETG2_TURBO) )
        {   //larger
            self->s.g2radius = 128;
        }
        else
        {
            self->s.g2radius = 80;
        }

        if ( (self->spawnflags&SPF_TURRETG2_TURBO) )
        {   //different pitch bone and muzzle flash points
            G2Tur_SetBoneAngles(self, "pitch", vec3_origin);
            self->genericValue11 = trap_G2API_AddBolt( self->ghoul2, 0, "*muzzle1" );
            self->genericValue12 = trap_G2API_AddBolt( self->ghoul2, 0, "*muzzle2" );
        }
        else
        {
            G2Tur_SetBoneAngles(self, "Bone_body", vec3_origin);
            self->genericValue11 = trap_G2API_AddBolt( self->ghoul2, 0, "*flash03" );
        }
    }
}
Exemplo n.º 3
0
static void CG_BodyQueueCopy(centity_t *cent, int clientNum, int knownWeapon)
{
	centity_t		*source;
	animation_t		*anim;
	float			animSpeed;
	int				flags=BONE_ANIM_OVERRIDE_FREEZE;
	clientInfo_t	*ci;

	if (cent->ghoul2)
	{
		trap_G2API_CleanGhoul2Models(&cent->ghoul2);
	}

	if (clientNum < 0 || clientNum >= MAX_CLIENTS)
	{
		return;
	}

	source = &cg_entities[ clientNum ];
	ci = &cgs.clientinfo[ clientNum ];

	if (!source)
	{
		return;
	}

	if (!source->ghoul2)
	{
		return;
	}

	cent->isRagging = qfalse; //reset in case it's still set from another body that was in this cent slot.
	cent->ownerRagging = source->isRagging; //if the owner was in ragdoll state, then we want to go into it too right away.

#if 0
	VectorCopy(source->lerpOriginOffset, cent->lerpOriginOffset);
#endif

	cent->bodyFadeTime = 0;
	cent->bodyHeight = 0;

	cent->dustTrailTime = source->dustTrailTime;

	trap_G2API_DuplicateGhoul2Instance(source->ghoul2, &cent->ghoul2);

	if (source->isRagging)
	{ //just reset it now.
		source->isRagging = qfalse;
		trap_G2API_SetRagDoll(source->ghoul2, NULL); //calling with null parms resets to no ragdoll.
	}

	//either force the weapon from when we died or remove it if it was a dropped weapon
	if (knownWeapon > WP_BRYAR_PISTOL && trap_G2API_HasGhoul2ModelOnIndex(&(cent->ghoul2), 1))
	{
		trap_G2API_RemoveGhoul2Model(&(cent->ghoul2), 1);
	}
	else if (trap_G2API_HasGhoul2ModelOnIndex(&(cent->ghoul2), 1))
	{
		trap_G2API_CopySpecificGhoul2Model(CG_G2WeaponInstance(cent, knownWeapon), 0, cent->ghoul2, 1);
	}

	if (!cent->ownerRagging)
	{
		int aNum;
		int eFrame;
		qboolean fallBack = qfalse;

		//anim = &bgAllAnims[cent->localAnimIndex].anims[ cent->currentState.torsoAnim ];
		if (!BG_InDeathAnim(source->currentState.torsoAnim))
		{ //then just snap the corpse into a default
			anim = &bgAllAnims[source->localAnimIndex].anims[ BOTH_DEAD1 ];
			fallBack = qtrue;
		}
		else
		{
			anim = &bgAllAnims[source->localAnimIndex].anims[ source->currentState.torsoAnim ];
		}
		animSpeed = 50.0f / anim->frameLerp;

		if (!fallBack)
		{
			//this will just set us to the last frame of the animation, in theory
			aNum = cgs.clientinfo[source->currentState.number].frame+1;

			while (aNum >= anim->firstFrame+anim->numFrames)
			{
				aNum--;
			}

			if (aNum < anim->firstFrame-1)
			{ //wrong animation...?
				aNum = (anim->firstFrame+anim->numFrames)-1;
			}
		}
		else
		{
			aNum = anim->firstFrame;
		}

		eFrame = anim->firstFrame + anim->numFrames;

		//if (!cgs.clientinfo[source->currentState.number].frame || (cent->currentState.torsoAnim) != (source->currentState.torsoAnim) )
		//{
		//	aNum = (anim->firstFrame+anim->numFrames)-1;
		//}

		trap_G2API_SetBoneAnim(cent->ghoul2, 0, "upper_lumbar", aNum, eFrame, flags, animSpeed, cg.time, -1, 150);
		trap_G2API_SetBoneAnim(cent->ghoul2, 0, "model_root", aNum, eFrame, flags, animSpeed, cg.time, -1, 150);
		trap_G2API_SetBoneAnim(cent->ghoul2, 0, "Motion", aNum, eFrame, flags, animSpeed, cg.time, -1, 150);
	}

	//After we create the bodyqueue, regenerate any limbs on the real instance
	if (source->torsoBolt)
	{
		CG_ReattachLimb(source);
	}
}