Apply all an old crowbar fixes to other melee weapons.

This commit is contained in:
Andrey Akhmichin 2022-11-02 20:56:10 +05:00
parent 14c157f6fc
commit 300187c7e4
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
2 changed files with 77 additions and 59 deletions

View File

@ -154,8 +154,10 @@ void CBeamKatana::PrimaryAttack()
{
if (! Swing( 1 ))
{
#if !CLIENT_DLL
SetThink( &CBeamKatana::SwingAgain );
pev->nextthink = gpGlobals->time + 0.1f;
#endif
}
}
@ -223,10 +225,12 @@ int CBeamKatana::Swing( int fFirst )
}
#endif
if( fFirst )
{
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usBeamKatana,
0.0, g_vecZero, g_vecZero, 0, 0, 0,
0.0, 0, 0.0 );
}
if ( tr.flFraction >= 1.0f )
{
@ -260,6 +264,12 @@ int CBeamKatana::Swing( int fFirst )
fDidHit = TRUE;
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
// play thwack, smack, or dong sound
float flVol = 1.0;
int fHitWorld = TRUE;
if (pEntity)
{
ClearMultiDamage( );
// If building with the clientside weapon prediction system,
@ -281,12 +291,6 @@ int CBeamKatana::Swing( int fFirst )
}
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
// play thwack, smack, or dong sound
float flVol = 1.0;
int fHitWorld = TRUE;
if (pEntity)
{
if ( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
{
// play thwack or smack sound
@ -301,7 +305,12 @@ int CBeamKatana::Swing( int fFirst )
}
m_pPlayer->m_iWeaponVolume = BEAMKATANA_BODYHIT_VOLUME;
if ( !pEntity->IsAlive() )
{
#ifdef CROWBAR_FIX_RAPID_CROWBAR
m_flNextPrimaryAttack = GetNextAttackDelay(0.25);
#endif
return TRUE;
}
else
flVol = 0.1;
@ -340,11 +349,11 @@ int CBeamKatana::Swing( int fFirst )
}
m_pPlayer->m_iWeaponVolume = flVol * BEAMKATANA_WALLHIT_VOLUME;
#endif
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f;
SetThink( &CBeamKatana::Smack );
pev->nextthink = UTIL_WeaponTimeBase() + 0.2f;
pev->nextthink = gpGlobals->time + 0.2f;
#endif
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f;
}
return fDidHit;
}

View File

@ -194,8 +194,10 @@ void CFOTN::PrimaryAttack()
flWataDelay = flAhDelay;
if (! Swing( 1 ))
{
#if !CLIENT_DLL
SetThink( &CFOTN::SwingAgain );
pev->nextthink = gpGlobals->time + 0.12f;
#endif
}
}
@ -248,10 +250,12 @@ int CFOTN::Swing( int fFirst )
}
#endif
if (fFirst)
{
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usFOTN,
0.0, g_vecZero, g_vecZero, 0, 0, 0,
0.0, 0, 0.0 );
}
if ( tr.flFraction >= 1.0f )
{
@ -277,6 +281,12 @@ int CFOTN::Swing( int fFirst )
fDidHit = TRUE;
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
// play thwack, smack, or dong sound
float flVol = 1.0;
int fHitWorld = TRUE;
if( pEntity )
{
ClearMultiDamage( );
// If building with the clientside weapon prediction system,
@ -298,12 +308,6 @@ int CFOTN::Swing( int fFirst )
}
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
// play thwack, smack, or dong sound
float flVol = 1.0;
int fHitWorld = TRUE;
if (pEntity)
{
if ( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
{
// play thwack or smack sound
@ -318,7 +322,12 @@ int CFOTN::Swing( int fFirst )
}
m_pPlayer->m_iWeaponVolume = FOTN_BODYHIT_VOLUME;
if ( !pEntity->IsAlive() )
{
#if CROWBAR_FIX_RAPID_CROWBAR
m_flNextPrimaryAttack = GetNextAttackDelay(0.12);
#endif
return TRUE;
}
else
flVol = 0.1;
@ -357,11 +366,11 @@ int CFOTN::Swing( int fFirst )
}
m_pPlayer->m_iWeaponVolume = flVol * FOTN_WALLHIT_VOLUME;
#endif
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.12f;
SetThink( &CFOTN::Smack );
pev->nextthink = UTIL_WeaponTimeBase() + 0.18f;
pev->nextthink = gpGlobals->time + 0.18f;
#endif
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.12f;
}
return fDidHit;
}