- Fixed a bug with knife activate animation

This commit is contained in:
Jonathan Barkley 2011-04-14 23:31:58 +00:00
parent 2fec95c414
commit 43fece54e0

View file

@ -1319,15 +1319,18 @@ may include ANIM_TOGGLEBIT
static void CG_SetWeaponLerpFrame(clientInfo_t * ci, lerpFrame_t * lf, int newAnimation) static void CG_SetWeaponLerpFrame(clientInfo_t * ci, lerpFrame_t * lf, int newAnimation)
{ {
animation_t *anim; animation_t *anim;
qboolean isActivate;
lf->animationNumber = newAnimation; lf->animationNumber = newAnimation;
newAnimation &= ~ANIM_TOGGLEBIT; newAnimation &= ~ANIM_TOGGLEBIT;
isActivate = (newAnimation == WP_ANIM_ACTIVATE || newAnimation == WP_ANIM_THROWACTIVATE);
if (newAnimation < 0 || newAnimation >= MAX_WEAPON_ANIMATIONS) { if (newAnimation < 0 || newAnimation >= MAX_WEAPON_ANIMATIONS) {
CG_Error("Bad weapon animation number: %i", newAnimation); CG_Error("Bad weapon animation number: %i", newAnimation);
} }
// Elder: selecting the right weapon animation // Elder: selecting the right weapon animation
if (newAnimation == WP_ANIM_ACTIVATE || newAnimation == WP_ANIM_THROWACTIVATE) if (isActivate)
anim = &cg_weapons[cg.weaponSelect].animations[newAnimation]; anim = &cg_weapons[cg.weaponSelect].animations[newAnimation];
else else
anim = &cg_weapons[cg.snap->ps.weapon].animations[newAnimation]; anim = &cg_weapons[cg.snap->ps.weapon].animations[newAnimation];
@ -1344,7 +1347,7 @@ static void CG_SetWeaponLerpFrame(clientInfo_t * ci, lerpFrame_t * lf, int newAn
//Elder: reset frame so there is no lerping between new animations //Elder: reset frame so there is no lerping between new animations
// Paril: Only do this if the new animation is activation. It looked too jerky. // Paril: Only do this if the new animation is activation. It looked too jerky.
if (newAnimation == WP_ANIM_ACTIVATE) if (isActivate)
lf->oldFrame = lf->frame = lf->animation->firstFrame; lf->oldFrame = lf->frame = lf->animation->firstFrame;
} }