|
|
@ -107,7 +107,7 @@ BOOL CWeaponEinarShovel::Deploy() |
|
|
|
|
|
|
|
|
|
|
|
void CWeaponEinarShovel::Holster( int skiplocal /* = 0 */ ) |
|
|
|
void CWeaponEinarShovel::Holster( int skiplocal /* = 0 */ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; |
|
|
|
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; |
|
|
|
SendWeaponAnim( SHOVEL_HOLSTER ); |
|
|
|
SendWeaponAnim( SHOVEL_HOLSTER ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -116,7 +116,7 @@ void CWeaponEinarShovel::PrimaryAttack() |
|
|
|
if( !Swing( 1 ) ) |
|
|
|
if( !Swing( 1 ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SetThink( &CWeaponEinarShovel::SwingAgain ); |
|
|
|
SetThink( &CWeaponEinarShovel::SwingAgain ); |
|
|
|
pev->nextthink = gpGlobals->time + 0.1; |
|
|
|
pev->nextthink = gpGlobals->time + 0.1f; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -143,10 +143,10 @@ int CWeaponEinarShovel::Swing( int fFirst ) |
|
|
|
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr ); |
|
|
|
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr ); |
|
|
|
|
|
|
|
|
|
|
|
#ifndef CLIENT_DLL |
|
|
|
#ifndef CLIENT_DLL |
|
|
|
if( tr.flFraction >= 1.0 ) |
|
|
|
if( tr.flFraction >= 1.0f ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr ); |
|
|
|
UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr ); |
|
|
|
if( tr.flFraction < 1.0 ) |
|
|
|
if( tr.flFraction < 1.0f ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Calculate the point of intersection of the line (or hull) and the object we hit
|
|
|
|
// Calculate the point of intersection of the line (or hull) and the object we hit
|
|
|
|
// This is and approximation of the "best" intersection
|
|
|
|
// This is and approximation of the "best" intersection
|
|
|
@ -157,12 +157,12 @@ int CWeaponEinarShovel::Swing( int fFirst ) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
if( tr.flFraction >= 1.0 ) |
|
|
|
if( tr.flFraction >= 1.0f ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( fFirst ) |
|
|
|
if( fFirst ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// miss
|
|
|
|
// miss
|
|
|
|
if( RANDOM_FLOAT( 0.0, 1.0 ) <= 0.25 ) |
|
|
|
if( RANDOM_FLOAT( 0.0f, 1.0f ) <= 0.25f ) |
|
|
|
++m_iSwing; |
|
|
|
++m_iSwing; |
|
|
|
switch( ( m_iSwing++ ) % 2 ) |
|
|
|
switch( ( m_iSwing++ ) % 2 ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -176,7 +176,7 @@ int CWeaponEinarShovel::Swing( int fFirst ) |
|
|
|
SendWeaponAnim( SHOVEL_ATTACK3MISS ); |
|
|
|
SendWeaponAnim( SHOVEL_ATTACK3MISS ); |
|
|
|
break;*/ |
|
|
|
break;*/ |
|
|
|
} |
|
|
|
} |
|
|
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; |
|
|
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f; |
|
|
|
|
|
|
|
|
|
|
|
// player "shoot" animation
|
|
|
|
// player "shoot" animation
|
|
|
|
m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); |
|
|
|
m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); |
|
|
@ -211,7 +211,7 @@ int CWeaponEinarShovel::Swing( int fFirst ) |
|
|
|
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit ); |
|
|
|
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit ); |
|
|
|
|
|
|
|
|
|
|
|
// play thwack, smack, or dong sound
|
|
|
|
// play thwack, smack, or dong sound
|
|
|
|
float flVol = 1.0; |
|
|
|
float flVol = 1.0f; |
|
|
|
int fHitWorld = TRUE; |
|
|
|
int fHitWorld = TRUE; |
|
|
|
|
|
|
|
|
|
|
|
if( pEntity ) |
|
|
|
if( pEntity ) |
|
|
@ -222,17 +222,17 @@ int CWeaponEinarShovel::Swing( int fFirst ) |
|
|
|
if( g_pGameRules->IsMultiplayer() ) |
|
|
|
if( g_pGameRules->IsMultiplayer() ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// more damage in multiplayer
|
|
|
|
// more damage in multiplayer
|
|
|
|
flDmg = gSkillData.plrDmgCrowbar * 1.6; |
|
|
|
flDmg = gSkillData.plrDmgCrowbar * 1.6f; |
|
|
|
} |
|
|
|
} |
|
|
|
else if( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) |
|
|
|
else if( m_flNextPrimaryAttack + 1.0f < UTIL_WeaponTimeBase() ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// first swing does full damage
|
|
|
|
// first swing does full damage
|
|
|
|
flDmg = gSkillData.plrDmgCrowbar * 1.2; |
|
|
|
flDmg = gSkillData.plrDmgCrowbar * 1.2f; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
// subsequent swings do half
|
|
|
|
// subsequent swings do half
|
|
|
|
flDmg = gSkillData.plrDmgCrowbar * 0.6; |
|
|
|
flDmg = gSkillData.plrDmgCrowbar * 0.6f; |
|
|
|
} |
|
|
|
} |
|
|
|
pEntity->TraceAttack( m_pPlayer->pev, flDmg, gpGlobals->v_forward, &tr, DMG_CLUB ); |
|
|
|
pEntity->TraceAttack( m_pPlayer->pev, flDmg, gpGlobals->v_forward, &tr, DMG_CLUB ); |
|
|
|
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev ); |
|
|
|
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev ); |
|
|
@ -277,7 +277,7 @@ int CWeaponEinarShovel::Swing( int fFirst ) |
|
|
|
if( !pEntity->IsAlive() ) |
|
|
|
if( !pEntity->IsAlive() ) |
|
|
|
return TRUE; |
|
|
|
return TRUE; |
|
|
|
else |
|
|
|
else |
|
|
|
flVol = 0.1; |
|
|
|
flVol = 0.1f; |
|
|
|
|
|
|
|
|
|
|
|
fHitWorld = FALSE; |
|
|
|
fHitWorld = FALSE; |
|
|
|
} |
|
|
|
} |
|
|
@ -315,10 +315,10 @@ int CWeaponEinarShovel::Swing( int fFirst ) |
|
|
|
|
|
|
|
|
|
|
|
m_pPlayer->m_iWeaponVolume = flVol * SHOVEL_WALLHIT_VOLUME; |
|
|
|
m_pPlayer->m_iWeaponVolume = flVol * SHOVEL_WALLHIT_VOLUME; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; |
|
|
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f; |
|
|
|
|
|
|
|
|
|
|
|
SetThink( &CWeaponEinarShovel::Smack ); |
|
|
|
SetThink( &CWeaponEinarShovel::Smack ); |
|
|
|
pev->nextthink = UTIL_WeaponTimeBase() + 0.2; |
|
|
|
pev->nextthink = UTIL_WeaponTimeBase() + 0.2f; |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef CROWBAR_IDLE_ANIM |
|
|
|
#ifdef CROWBAR_IDLE_ANIM |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); |
|
|
@ -333,22 +333,22 @@ void CWeaponEinarShovel::WeaponIdle( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int iAnim; |
|
|
|
int iAnim; |
|
|
|
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 ); |
|
|
|
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 ); |
|
|
|
if( flRand > 0.9 ) |
|
|
|
if( flRand > 0.9f ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
iAnim = SHOVEL_IDLE2; |
|
|
|
iAnim = SHOVEL_IDLE2; |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0; |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0f / 30.0f; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( flRand > 0.5 ) |
|
|
|
if( flRand > 0.5f ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
iAnim = SHOVEL_IDLE; |
|
|
|
iAnim = SHOVEL_IDLE; |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0 / 30.0; |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 30.0f; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
iAnim = SHOVEL_IDLE3; |
|
|
|
iAnim = SHOVEL_IDLE3; |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0; |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0f / 30.0f; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
SendWeaponAnim( iAnim ); |
|
|
|
SendWeaponAnim( iAnim ); |
|
|
|