Skip to content

Commit

Permalink
[SE] Add crowbar idle anims
Browse files Browse the repository at this point in the history
  • Loading branch information
sabianroberts committed Oct 3, 2024
1 parent ae9e46c commit 485309e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
31 changes: 30 additions & 1 deletion binary/dlls/crowbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ enum gauss_e {
CROWBAR_ATTACK2MISS,
CROWBAR_ATTACK2HIT,
CROWBAR_ATTACK3MISS,
CROWBAR_ATTACK3HIT
CROWBAR_ATTACK3HIT,
CROWBAR_IDLE2,
CROWBAR_IDLE3
};


Expand Down Expand Up @@ -232,6 +234,8 @@ int CCrowbar::Swing( int fFirst )
m_flNextPrimaryAttack = GetNextAttackDelay(0.3);
else
m_flNextPrimaryAttack = GetNextAttackDelay(0.5);

m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);

// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
Expand Down Expand Up @@ -331,6 +335,7 @@ int CCrowbar::Swing( int fFirst )
m_pPlayer->m_iWeaponVolume = flVol * CROWBAR_WALLHIT_VOLUME;
#endif
m_flNextPrimaryAttack = GetNextAttackDelay(0.25);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);

SetThink( &CCrowbar::Smack );
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;
Expand All @@ -339,3 +344,27 @@ int CCrowbar::Swing( int fFirst )
}
return fDidHit;
}

void CCrowbar::WeaponIdle(void)
{
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;

int iAnim;
float flAnimTime = 5.34; // Only CROWBAR_IDLE has a different time
switch (RANDOM_LONG(0, 2))
{
case 0:
iAnim = CROWBAR_IDLE;
flAnimTime = 2.7;
break;
case 1:
iAnim = CROWBAR_IDLE2;
break;
case 2:
iAnim = CROWBAR_IDLE3;
break;
}
SendWeaponAnim(iAnim, 1);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + flAnimTime;
}
1 change: 1 addition & 0 deletions binary/dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ class CCrowbar : public CBasePlayerWeapon
int Swing( int fFirst );
BOOL Deploy( void );
void Holster( int skiplocal = 0 );
void WeaponIdle(void);
int m_iSwing;
TraceResult m_trHit;

Expand Down

0 comments on commit 485309e

Please sign in to comment.