mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-26 22:54:39 +00:00
Add crowbar idle animations under CROWBAR_IDLE_ANIM macro.
This commit is contained in:
parent
f78471ad1d
commit
8e799fcf6d
@ -1138,7 +1138,13 @@ enum crowbar_e
|
|||||||
CROWBAR_ATTACK2MISS,
|
CROWBAR_ATTACK2MISS,
|
||||||
CROWBAR_ATTACK2HIT,
|
CROWBAR_ATTACK2HIT,
|
||||||
CROWBAR_ATTACK3MISS,
|
CROWBAR_ATTACK3MISS,
|
||||||
|
#ifndef CROWBAR_IDLE_ANIM
|
||||||
CROWBAR_ATTACK3HIT
|
CROWBAR_ATTACK3HIT
|
||||||
|
#else
|
||||||
|
CROWBAR_ATTACK3HIT,
|
||||||
|
CROWBAR_IDLE2,
|
||||||
|
CROWBAR_IDLE3
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
int g_iSwing;
|
int g_iSwing;
|
||||||
|
@ -37,7 +37,13 @@ enum crowbar_e
|
|||||||
CROWBAR_ATTACK2MISS,
|
CROWBAR_ATTACK2MISS,
|
||||||
CROWBAR_ATTACK2HIT,
|
CROWBAR_ATTACK2HIT,
|
||||||
CROWBAR_ATTACK3MISS,
|
CROWBAR_ATTACK3MISS,
|
||||||
|
#ifndef CROWBAR_IDLE_ANIM
|
||||||
CROWBAR_ATTACK3HIT
|
CROWBAR_ATTACK3HIT
|
||||||
|
#else
|
||||||
|
CROWBAR_ATTACK3HIT,
|
||||||
|
CROWBAR_IDLE2,
|
||||||
|
CROWBAR_IDLE3
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void CCrowbar::Spawn()
|
void CCrowbar::Spawn()
|
||||||
@ -208,7 +214,9 @@ int CCrowbar::Swing( int fFirst )
|
|||||||
{
|
{
|
||||||
// miss
|
// miss
|
||||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
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
|
// player "shoot" animation
|
||||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||||
}
|
}
|
||||||
@ -324,5 +332,38 @@ int CCrowbar::Swing( int fFirst )
|
|||||||
#endif
|
#endif
|
||||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 );
|
m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 );
|
||||||
}
|
}
|
||||||
|
#ifdef CROWBAR_IDLE_ANIM
|
||||||
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||||
|
#endif
|
||||||
return fDidHit;
|
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
|
||||||
|
@ -504,6 +504,9 @@ public:
|
|||||||
int Swing( int fFirst );
|
int Swing( int fFirst );
|
||||||
BOOL Deploy( void );
|
BOOL Deploy( void );
|
||||||
void Holster( int skiplocal = 0 );
|
void Holster( int skiplocal = 0 );
|
||||||
|
#ifdef CROWBAR_IDLE_ANIM
|
||||||
|
void WeaponIdle();
|
||||||
|
#endif
|
||||||
int m_iSwing;
|
int m_iSwing;
|
||||||
TraceResult m_trHit;
|
TraceResult m_trHit;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user