Exemple #1
0
/*
===============
UI_LegsSequencing
===============
*/
static void UI_LegsSequencing( uiPlayerInfo_t *pi ) {
	int		currentAnim;

	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;

	if ( pi->legsAnimationTimer > 0 ) {
		if ( currentAnim == LEGS_JUMP ) {
			jumpHeight = JUMP_HEIGHT * sin( M_PI * ( UI_TIMER_JUMP - pi->legsAnimationTimer ) / UI_TIMER_JUMP );
		}
		return;
	}

	if ( currentAnim == LEGS_JUMP ) {
		UI_ForceLegsAnim( pi, LEGS_LAND );
#ifdef TA_PLAYERSYS // PLAYERCFG_ANIMATION_TIMES
		pi->legsAnimationTimer = BG_AnimationTime(&pi->playercfg.animations[LEGS_LAND]);
#else
		pi->legsAnimationTimer = UI_TIMER_LAND;
#endif
		jumpHeight = 0;
		return;
	}

	if ( currentAnim == LEGS_LAND ) {
#ifdef TA_WEAPSYS
		UI_SetLegsAnim( pi, BG_LegsStandForWeapon(&pi->playercfg, pi->realWeapon) );
#else
		UI_SetLegsAnim( pi, LEGS_IDLE );
#endif
		return;
	}
}
Exemple #2
0
/*
===============
UI_SetLegsAnim
===============
*/
static void UI_SetLegsAnim( playerInfo_t *pi, int anim ) {
	if ( pi->pendingLegsAnim ) {
		anim = pi->pendingLegsAnim;
		pi->pendingLegsAnim = 0;
	}
	UI_ForceLegsAnim( pi, anim );
}
Exemple #3
0
/*
===============
UI_LegsSequencing
===============
*/
static void UI_LegsSequencing( playerInfo_t *pi )
{
	int currentAnim;

	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;

	if ( pi->legsAnimationTimer > 0 )
	{
		if ( currentAnim == LEGS_JUMP )
		{
			jumpHeight = JUMP_HEIGHT * sin( M_PI * ( UI_TIMER_JUMP - pi->legsAnimationTimer ) / UI_TIMER_JUMP );
		}

		return;
	}

	if ( currentAnim == LEGS_JUMP )
	{
		UI_ForceLegsAnim( pi, LEGS_LAND );
		pi->legsAnimationTimer = UI_TIMER_LAND;
		jumpHeight = 0;
		return;
	}

	if ( currentAnim == LEGS_LAND )
	{
		UI_SetLegsAnim( pi, LEGS_IDLE );
		return;
	}
}
/*
===============
UI_LegsSequencing
===============
*/
static void UI_LegsSequencing( playerInfo_t *pi ) {
	int		currentAnim;

	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;

	if ( pi->legsAnimationTimer > 0 ) {
		if ( currentAnim == BOTH_JUMP1 ) {
			jumpHeight = JUMP_HEIGHT * sin( M_PI * ( UI_TIMER_JUMP - pi->legsAnimationTimer ) / UI_TIMER_JUMP );
		}
		return;
	}

	if ( currentAnim == BOTH_JUMP1 ) {
		UI_ForceLegsAnim( pi, BOTH_LAND1 );
		pi->legsAnimationTimer = UI_TIMER_LAND;
		jumpHeight = 0;
		return;
	}

	if ( currentAnim == BOTH_LAND1 ) {
		UI_SetLegsAnim( pi, TORSO_WEAPONREADY3 );
		return;
	}
}
Exemple #5
0
/*
===============
UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qbool chat ) {
    int			currentAnim;
    weapon_t	weaponNum;

    pi->chat = chat;

    // view angles
    VectorCopy( viewAngles, pi->viewAngles );

    // move angles
    VectorCopy( moveAngles, pi->moveAngles );

    if ( pi->newModel ) {
        pi->newModel = qfalse;

        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim( pi, legsAnim );
        pi->legs.yawAngle = viewAngles[YAW];
        pi->legs.yawing = qfalse;

        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim( pi, torsoAnim );
        pi->torso.yawAngle = viewAngles[YAW];
        pi->torso.yawing = qfalse;

        if ( weaponNumber != -1 ) {
            pi->weapon = weaponNumber;
            pi->currentWeapon = weaponNumber;
            pi->lastWeapon = weaponNumber;
            pi->pendingWeapon = -1;
            pi->weaponTimer = 0;
            UI_PlayerInfo_SetWeapon( pi, pi->weapon );
        }

        return;
    }

    // weapon
    if ( weaponNumber == -1 ) {
        pi->pendingWeapon = -1;
        pi->weaponTimer = 0;
    }
    else if ( weaponNumber != WP_NONE ) {
        pi->pendingWeapon = weaponNumber;
        pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
    }
    weaponNum = pi->lastWeapon;
    pi->weapon = weaponNum;

    if ( torsoAnim == BOTH_DEATH_DEFAULT || legsAnim == BOTH_DEATH_DEFAULT ) {
        torsoAnim = legsAnim = BOTH_DEATH_DEFAULT;
        pi->weapon = pi->currentWeapon = WP_NONE;
        UI_PlayerInfo_SetWeapon( pi, pi->weapon );

        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim( pi, legsAnim );

        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim( pi, torsoAnim );

        return;
    }

    // leg animation
    currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
    if ( legsAnim != currentAnim ) {
        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim( pi, legsAnim );
    }

    // torso animation
    if ( torsoAnim == TORSO_PISTOL_STAND || torsoAnim == TORSO_RIFLE_STAND ) {
        if ( weaponNum == WP_NONE || weaponNum == WP_KNIFE ) {
            torsoAnim = TORSO_KNIFE_STAND;
        }
        else {
            torsoAnim = TORSO_PISTOL_STAND;
        }
    }

    if ( torsoAnim == TORSO_PISTOL_ATTACK || torsoAnim == TORSO_RIFLE_ATTACK ) {
        if ( weaponNum == WP_NONE || weaponNum == WP_KNIFE ) {
            torsoAnim = TORSO_KNIFE_ATTACK;
        }
        else {
            torsoAnim = TORSO_PISTOL_ATTACK;
        }
        pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
        //FIXME play firing sound here
    }

    currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

    if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_PISTOL_RAISE || currentAnim == TORSO_PISTOL_DROP ) {
        pi->pendingTorsoAnim = torsoAnim;
    }
    else if ( ( currentAnim == TORSO_TAUNT_PISTOL || currentAnim == TORSO_PISTOL_ATTACK ) && ( torsoAnim != currentAnim ) ) {
        pi->pendingTorsoAnim = torsoAnim;
    }
    else if ( torsoAnim != currentAnim ) {
        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim( pi, torsoAnim );
    }
}
Exemple #6
0
/*
===============
UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo(playerInfo_t* pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qboolean chat) {
    int         currentAnim;
    weapon_t    weaponNum;
    int         c;

    pi->chat = chat;

    c = (int)trap_Cvar_VariableValue("color1");

    VectorClear(pi->color1);

    if (c < 1 || c > 7) {
        VectorSet(pi->color1, 1, 1, 1);
    } else {
        if (c & 1) {
            pi->color1[2] = 1.0f;
        }

        if (c & 2) {
            pi->color1[1] = 1.0f;
        }

        if (c & 4) {
            pi->color1[0] = 1.0f;
        }
    }

    pi->c1RGBA[0] = 255 * pi->color1[0];
    pi->c1RGBA[1] = 255 * pi->color1[1];
    pi->c1RGBA[2] = 255 * pi->color1[2];
    pi->c1RGBA[3] = 255;

    // view angles
    VectorCopy(viewAngles, pi->viewAngles);

    // move angles
    VectorCopy(moveAngles, pi->moveAngles);

    if (pi->newModel) {
        pi->newModel = qfalse;

        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim(pi, legsAnim);
        pi->legs.yawAngle = viewAngles[YAW];
        pi->legs.yawing = qfalse;

        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim(pi, torsoAnim);
        pi->torso.yawAngle = viewAngles[YAW];
        pi->torso.yawing = qfalse;

        if (weaponNumber != -1) {
            pi->weapon = weaponNumber;
            pi->currentWeapon = weaponNumber;
            pi->lastWeapon = weaponNumber;
            pi->pendingWeapon = -1;
            pi->weaponTimer = 0;
            UI_PlayerInfo_SetWeapon(pi, pi->weapon);
        }

        return;
    }

    // weapon
    if (weaponNumber == -1) {
        pi->pendingWeapon = -1;
        pi->weaponTimer = 0;
    } else if (weaponNumber != WP_NONE) {
        pi->pendingWeapon = weaponNumber;
        pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
    }
    weaponNum = pi->lastWeapon;
    pi->weapon = weaponNum;

    if (torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1) {
        torsoAnim = legsAnim = BOTH_DEATH1;
        pi->weapon = pi->currentWeapon = WP_NONE;
        UI_PlayerInfo_SetWeapon(pi, pi->weapon);

        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim(pi, legsAnim);

        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim(pi, torsoAnim);

        return;
    }

    // leg animation
    currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
    if (legsAnim != LEGS_JUMP && (currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND)) {
        pi->pendingLegsAnim = legsAnim;
    } else if (legsAnim != currentAnim) {
        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim(pi, legsAnim);
    }

    // torso animation
    if (torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2) {
        if (weaponNum == WP_NONE || weaponNum == WP_GAUNTLET) {
            torsoAnim = TORSO_STAND2;
        } else {
            torsoAnim = TORSO_STAND;
        }
    }

    if (torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2) {
        if (weaponNum == WP_NONE || weaponNum == WP_GAUNTLET) {
            torsoAnim = TORSO_ATTACK2;
        } else {
            torsoAnim = TORSO_ATTACK;
        }
        pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
        //FIXME play firing sound here
    }

    currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

    if (weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE || currentAnim == TORSO_DROP) {
        pi->pendingTorsoAnim = torsoAnim;
    } else if ((currentAnim == TORSO_GESTURE || currentAnim == TORSO_ATTACK) && (torsoAnim != currentAnim)) {
        pi->pendingTorsoAnim = torsoAnim;
    } else if (torsoAnim != currentAnim) {
        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim(pi, torsoAnim);
    }
}
Exemple #7
0
/*
===============
UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo( uiPlayerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qboolean chat ) {
	int			currentAnim;
	weapon_t	weaponNum;

	pi->chat = chat;

	UI_PlayerInfo_UpdateColor( pi );

	// view angles
	VectorCopy( viewAngles, pi->viewAngles );

	// move angles
	VectorCopy( moveAngles, pi->moveAngles );

	if ( pi->newModel ) {
		pi->newModel = qfalse;

#ifdef TA_WEAPSYS
		atkAnim = 0;
#endif
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
		pi->legs.yawAngle = viewAngles[YAW];
		pi->legs.yawing = qfalse;

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
		pi->torso.yawAngle = viewAngles[YAW];
		pi->torso.yawing = qfalse;

		if ( weaponNumber != WP_NUM_WEAPONS ) {
			pi->weapon = weaponNumber;
			pi->currentWeapon = weaponNumber;
			pi->lastWeapon = weaponNumber;
			pi->pendingWeapon = WP_NUM_WEAPONS;
			pi->weaponTimer = 0;
			UI_PlayerInfo_SetWeapon( pi, pi->weapon );
		}

		return;
	}

	// weapon
	if ( weaponNumber == WP_NUM_WEAPONS ) {
		pi->pendingWeapon = WP_NUM_WEAPONS;
		pi->weaponTimer = 0;
	}
	else if ( weaponNumber != WP_NONE ) {
		pi->pendingWeapon = weaponNumber;
		pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
	}
	weaponNum = pi->lastWeapon;
	pi->weapon = weaponNum;

	if ( torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1 ) {
		torsoAnim = legsAnim = BOTH_DEATH1;
		pi->weapon = pi->currentWeapon = WP_NONE;
		UI_PlayerInfo_SetWeapon( pi, pi->weapon );

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );

		return;
	}

	// leg animation
#ifdef TA_WEAPSYS
	if (BG_PlayerAttackAnim(torsoAnim))
	{
		// if torso is attacking, possibly need to animate legs too.
		currentAnim = BG_LegsAttackForWeapon(&pi->playercfg, weaponNum, atkAnim);
		if (currentAnim != -1) {
			legsAnim = currentAnim;
		}
	}
#endif

	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
	if ( legsAnim != LEGS_JUMP && ( currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND ) ) {
		pi->pendingLegsAnim = legsAnim;
	}
	else if ( legsAnim != currentAnim ) {
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
	}

	// torso animation
#ifdef TA_WEAPSYS
	if (BG_PlayerStandAnim(&pi->playercfg, AP_TORSO, torsoAnim))
	{
		torsoAnim = BG_TorsoStandForWeapon(weaponNum);
	}
#else
	if ( torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2 ) {
		if ( weaponNum == WP_NONE || weaponNum == WP_GAUNTLET ) {
			torsoAnim = TORSO_STAND2;
		}
		else {
			torsoAnim = TORSO_STAND;
		}
	}
#endif

#ifdef TA_WEAPSYS
	if (BG_PlayerAttackAnim(torsoAnim))
	{
		torsoAnim = BG_TorsoAttackForWeapon(weaponNum, atkAnim);
		if (!BG_WeaponHasMelee(weaponNum))
		{
			pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
		}
		//FIXME play firing sound here

		atkAnim++;
	}
#else
	if ( torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2 ) {
		if ( weaponNum == WP_NONE || weaponNum == WP_GAUNTLET ) {
			torsoAnim = TORSO_ATTACK2;
		}
		else {
			torsoAnim = TORSO_ATTACK;
		}
		pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
		//FIXME play firing sound here
	}
#endif

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE || currentAnim == TORSO_DROP ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( ( currentAnim == TORSO_GESTURE ||
#ifdef TA_WEAPSYS
		BG_PlayerAttackAnim(currentAnim)
#else
		currentAnim == TORSO_ATTACK
#endif
	) && ( torsoAnim != currentAnim ) ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( torsoAnim != currentAnim ) {
		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
	}
}
Exemple #8
0
/*
===============
UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qboolean chat ) {
	int			currentAnim;
	weapon_t	weaponNum;

	pi->chat = chat;

	// view angles
	VectorCopy( viewAngles, pi->viewAngles );

	// move angles
	VectorCopy( moveAngles, pi->moveAngles );

	// weapon
	if ( weaponNumber == -1 ) {
		pi->pendingWeapon = (weapon_t) -1;
		pi->weaponTimer = 0;
	}
	else if ( weaponNumber != WP_NONE ) {
		pi->pendingWeapon = weaponNumber;
		pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
	}
	weaponNum = pi->lastWeapon;
	pi->weapon = weaponNum;

	if ( torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1 ) {
		torsoAnim = legsAnim = BOTH_DEATH1;
		pi->weapon = pi->currentWeapon = WP_NONE;
		UI_PlayerInfo_SetWeapon( pi, pi->weapon );

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );

		return;
	}

	// leg animation
	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
	if ( legsAnim != BOTH_JUMP1 && ( currentAnim == BOTH_JUMP1 || currentAnim == BOTH_LAND1 ) ) {
		pi->pendingLegsAnim = legsAnim;
	}
	else if ( legsAnim != currentAnim ) {
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
	}

	// torso animation
	if ( torsoAnim == BOTH_STAND1 || torsoAnim == BOTH_STAND2 ) 
	{
		if ( weaponNum == WP_NONE || weaponNum == WP_PHASER ) 
		{
			torsoAnim = BOTH_STAND1;
		}
		else 
		{
			torsoAnim = BOTH_STAND2;
		}
	}

	if ( torsoAnim == BOTH_ATTACK1 || torsoAnim == BOTH_ATTACK2 ) {
		if ( weaponNum == WP_NONE || weaponNum == WP_PHASER ) {
			torsoAnim = BOTH_ATTACK1;
		}
		else {
			torsoAnim = BOTH_ATTACK2;
		}
		pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
	}

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISEWEAP1 || currentAnim == TORSO_DROPWEAP1) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( ( currentAnim == BOTH_GESTURE1 || currentAnim == BOTH_ATTACK1 ) && ( torsoAnim != currentAnim ) ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( torsoAnim != currentAnim ) {
		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
	}
}
Exemple #9
0
/*
 * UI_PlayerInfo_SetInfo
 */
void
UI_PlayerInfo_SetInfo(Playerinfo *pi, int legsAnim, int torsoAnim,
		      Vec3 viewAngles, Vec3 moveAngles,
		      Weapon weaponNumber,
		      qbool chat)
{
	int	currentAnim;
	Weapon weaponNum;
	int	c;

	pi->chat = chat;

	c = (int)trap_cvargetf("color1");

	clearv3(pi->color1);

	if(c < 1 || c > 7)
		setv3(pi->color1, 1, 1, 1);
	else{
		if(c & 1)
			pi->color1[2] = 1.0f;

		if(c & 2)
			pi->color1[1] = 1.0f;

		if(c & 4)
			pi->color1[0] = 1.0f;
	}

	pi->c1RGBA[0]	= 255 * pi->color1[0];
	pi->c1RGBA[1]	= 255 * pi->color1[1];
	pi->c1RGBA[2]	= 255 * pi->color1[2];
	pi->c1RGBA[3]	= 255;

	/* view angles */
	copyv3(viewAngles, pi->viewAngles);

	/* move angles */
	copyv3(moveAngles, pi->moveAngles);

	if(pi->newModel){
		pi->newModel = qfalse;

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim(pi, legsAnim);
		pi->legs.yawAngle = viewAngles[YAW];
		pi->legs.yawing = qfalse;

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim(pi, torsoAnim);
		pi->torso.yawAngle = viewAngles[YAW];
		pi->torso.yawing = qfalse;

		if(weaponNumber != -1){
			pi->weapon = weaponNumber;
			pi->currentWeapon = weaponNumber;
			pi->lastWeapon = weaponNumber;
			pi->pendingWeapon = -1;
			pi->weaponTimer = 0;
			UI_PlayerInfo_SetWeapon(pi, pi->weapon);
		}

		return;
	}

	/* weapon */
	if(weaponNumber == -1){
		pi->pendingWeapon = -1;
		pi->weaponTimer = 0;
	}else if(weaponNumber != Wnone){
		pi->pendingWeapon = weaponNumber;
		pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
	}
	weaponNum = pi->lastWeapon;
	pi->weapon = weaponNum;

	if(torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1){
		torsoAnim = legsAnim = BOTH_DEATH1;
		pi->weapon = pi->currentWeapon = Wnone;
		UI_PlayerInfo_SetWeapon(pi, pi->weapon);

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim(pi, legsAnim);

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim(pi, torsoAnim);

		return;
	}

	/* leg animation */
	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
	if(legsAnim != LEGS_JUMP &&
	   (currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND))
		pi->pendingLegsAnim = legsAnim;
	else if(legsAnim != currentAnim){
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim(pi, legsAnim);
	}

	/* torso animation */
	if(torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2){
		if(weaponNum == Wnone || weaponNum == Wmelee)
			torsoAnim = TORSO_STAND2;
		else
			torsoAnim = TORSO_STAND;
	}

	if(torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2){
		if(weaponNum == Wnone || weaponNum == Wmelee)
			torsoAnim = TORSO_ATTACK2;
		else
			torsoAnim = TORSO_ATTACK;
		pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
		/* FIXME play firing sound here */
	}

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if(weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE ||
	   currentAnim == TORSO_DROP)
		pi->pendingTorsoAnim = torsoAnim;
	else if((currentAnim == TORSO_GESTURE ||
		 currentAnim == TORSO_ATTACK) && (torsoAnim != currentAnim))
		pi->pendingTorsoAnim = torsoAnim;
	else if(torsoAnim != currentAnim){
		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim(pi, torsoAnim);
	}
}
Exemple #10
0
void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vector3 *viewAngles, vector3 *moveAngles, weapon_t weaponNumber, qboolean chat ) {
	int			currentAnim;
	weapon_t	weaponNum;

	pi->chat = chat;

	// view angles
	VectorCopy( viewAngles, &pi->viewAngles );

	// move angles
	VectorCopy( moveAngles, &pi->moveAngles );

	if ( pi->newModel ) {
		pi->newModel = qfalse;

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
		pi->legs.yawAngle = viewAngles->yaw;
		pi->legs.yawing = qfalse;

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
		pi->torso.yawAngle = viewAngles->yaw;
		pi->torso.yawing = qfalse;

		if ( weaponNumber != -1 ) {
			pi->weapon = weaponNumber;
			pi->currentWeapon = weaponNumber;
			pi->lastWeapon = weaponNumber;
			pi->pendingWeapon = -1;
			pi->weaponTimer = 0;
			UI_PlayerInfo_SetWeapon( pi, pi->weapon );
		}

		return;
	}

	// weapon
	if ( weaponNumber == -1 ) {
		pi->pendingWeapon = -1;
		pi->weaponTimer = 0;
	}
	else if ( weaponNumber != WP_NONE ) {
		pi->pendingWeapon = weaponNumber;
		pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
	}
	weaponNum = pi->lastWeapon;
	pi->weapon = weaponNum;

	if ( torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1 ) {
		torsoAnim = legsAnim = BOTH_DEATH1;
		pi->weapon = pi->currentWeapon = WP_NONE;
		UI_PlayerInfo_SetWeapon( pi, pi->weapon );

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );

		return;
	}

	// leg animation
	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
	if ( legsAnim != LEGS_JUMP && ( currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND ) ) {
		pi->pendingLegsAnim = legsAnim;
	}
	else if ( legsAnim != currentAnim ) {
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
	}

	// torso animation
	if ( torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2 ) {
		torsoAnim = TORSO_STAND;
	}

	if ( torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2 ) {
		torsoAnim = TORSO_ATTACK;
		pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
		//FIXME play firing sound here
	}

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE || currentAnim == TORSO_DROP ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( ( currentAnim == TORSO_GESTURE || currentAnim == TORSO_ATTACK ) && ( torsoAnim != currentAnim ) ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( torsoAnim != currentAnim ) {
		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
	}
}