diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 80073b27..628b5bfa 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -1138,7 +1138,13 @@ enum crowbar_e CROWBAR_ATTACK2MISS, CROWBAR_ATTACK2HIT, CROWBAR_ATTACK3MISS, +#ifndef CROWBAR_IDLE_ANIM CROWBAR_ATTACK3HIT +#else + CROWBAR_ATTACK3HIT, + CROWBAR_IDLE2, + CROWBAR_IDLE3 +#endif }; int g_iSwing; diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index f9a91978..4cc48d97 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -37,7 +37,13 @@ enum crowbar_e CROWBAR_ATTACK2MISS, CROWBAR_ATTACK2HIT, CROWBAR_ATTACK3MISS, +#ifndef CROWBAR_IDLE_ANIM CROWBAR_ATTACK3HIT +#else + CROWBAR_ATTACK3HIT, + CROWBAR_IDLE2, + CROWBAR_IDLE3 +#endif }; void CCrowbar::Spawn() @@ -208,7 +214,9 @@ int CCrowbar::Swing( int fFirst ) { // miss m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 ); - +#ifdef CROWBAR_IDLE_ANIM + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); +#endif // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); } @@ -324,5 +332,38 @@ int CCrowbar::Swing( int fFirst ) #endif m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 ); } +#ifdef CROWBAR_IDLE_ANIM + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); +#endif return fDidHit; } + +#ifdef CROWBAR_IDLE_ANIM +void CCrowbar::WeaponIdle( void ) +{ + if( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() ) + { + int iAnim; + float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 ); + if( flRand > 0.9 ) + { + iAnim = CROWBAR_IDLE2; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0; + } + else + { + if( flRand > 0.5 ) + { + iAnim = CROWBAR_IDLE; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0 / 30.0; + } + else + { + iAnim = CROWBAR_IDLE3; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0; + } + } + SendWeaponAnim( iAnim ); + } +} +#endif diff --git a/dlls/weapons.h b/dlls/weapons.h index f48767c8..6c03105b 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -504,6 +504,9 @@ public: int Swing( int fFirst ); BOOL Deploy( void ); void Holster( int skiplocal = 0 ); +#ifdef CROWBAR_IDLE_ANIM + void WeaponIdle(); +#endif int m_iSwing; TraceResult m_trHit;