mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-03 02:24:28 +00:00
Apply all an old crowbar fixes to other melee weapons.
This commit is contained in:
parent
14c157f6fc
commit
300187c7e4
@ -154,8 +154,10 @@ void CBeamKatana::PrimaryAttack()
|
|||||||
{
|
{
|
||||||
if (! Swing( 1 ))
|
if (! Swing( 1 ))
|
||||||
{
|
{
|
||||||
|
#if !CLIENT_DLL
|
||||||
SetThink( &CBeamKatana::SwingAgain );
|
SetThink( &CBeamKatana::SwingAgain );
|
||||||
pev->nextthink = gpGlobals->time + 0.1f;
|
pev->nextthink = gpGlobals->time + 0.1f;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,10 +225,12 @@ int CBeamKatana::Swing( int fFirst )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usBeamKatana,
|
if( fFirst )
|
||||||
0.0, g_vecZero, g_vecZero, 0, 0, 0,
|
{
|
||||||
0.0, 0, 0.0 );
|
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 )
|
if ( tr.flFraction >= 1.0f )
|
||||||
{
|
{
|
||||||
@ -260,33 +264,33 @@ int CBeamKatana::Swing( int fFirst )
|
|||||||
fDidHit = TRUE;
|
fDidHit = TRUE;
|
||||||
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
|
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
|
||||||
|
|
||||||
ClearMultiDamage( );
|
|
||||||
|
|
||||||
// If building with the clientside weapon prediction system,
|
|
||||||
// UTIL_WeaponTimeBase() is always 0 and m_flNextPrimaryAttack is >= -1.0f, thus making
|
|
||||||
// m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() always evaluate to false.
|
|
||||||
#ifdef CLIENT_WEAPONS
|
|
||||||
if( ( m_flNextPrimaryAttack + 1 == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
|
||||||
#else
|
|
||||||
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// first swing does full damage
|
|
||||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgBeamKatana, gpGlobals->v_forward, &tr, DMG_CLUB );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// subsequent swings do half
|
|
||||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgBeamKatana / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
|
|
||||||
}
|
|
||||||
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
|
|
||||||
|
|
||||||
// play thwack, smack, or dong sound
|
// play thwack, smack, or dong sound
|
||||||
float flVol = 1.0;
|
float flVol = 1.0;
|
||||||
int fHitWorld = TRUE;
|
int fHitWorld = TRUE;
|
||||||
|
|
||||||
if (pEntity)
|
if (pEntity)
|
||||||
{
|
{
|
||||||
|
ClearMultiDamage( );
|
||||||
|
|
||||||
|
// If building with the clientside weapon prediction system,
|
||||||
|
// UTIL_WeaponTimeBase() is always 0 and m_flNextPrimaryAttack is >= -1.0f, thus making
|
||||||
|
// m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() always evaluate to false.
|
||||||
|
#ifdef CLIENT_WEAPONS
|
||||||
|
if( ( m_flNextPrimaryAttack + 1 == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||||
|
#else
|
||||||
|
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
// first swing does full damage
|
||||||
|
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgBeamKatana, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// subsequent swings do half
|
||||||
|
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgBeamKatana / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||||
|
}
|
||||||
|
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
|
||||||
|
|
||||||
if ( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
|
if ( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
|
||||||
{
|
{
|
||||||
// play thwack or smack sound
|
// play thwack or smack sound
|
||||||
@ -301,7 +305,12 @@ int CBeamKatana::Swing( int fFirst )
|
|||||||
}
|
}
|
||||||
m_pPlayer->m_iWeaponVolume = BEAMKATANA_BODYHIT_VOLUME;
|
m_pPlayer->m_iWeaponVolume = BEAMKATANA_BODYHIT_VOLUME;
|
||||||
if ( !pEntity->IsAlive() )
|
if ( !pEntity->IsAlive() )
|
||||||
|
{
|
||||||
|
#ifdef CROWBAR_FIX_RAPID_CROWBAR
|
||||||
|
m_flNextPrimaryAttack = GetNextAttackDelay(0.25);
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
flVol = 0.1;
|
flVol = 0.1;
|
||||||
|
|
||||||
@ -340,11 +349,11 @@ int CBeamKatana::Swing( int fFirst )
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_pPlayer->m_iWeaponVolume = flVol * BEAMKATANA_WALLHIT_VOLUME;
|
m_pPlayer->m_iWeaponVolume = flVol * BEAMKATANA_WALLHIT_VOLUME;
|
||||||
#endif
|
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f;
|
|
||||||
|
|
||||||
SetThink( &CBeamKatana::Smack );
|
SetThink( &CBeamKatana::Smack );
|
||||||
pev->nextthink = UTIL_WeaponTimeBase() + 0.2f;
|
pev->nextthink = gpGlobals->time + 0.2f;
|
||||||
|
#endif
|
||||||
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f;
|
||||||
}
|
}
|
||||||
return fDidHit;
|
return fDidHit;
|
||||||
}
|
}
|
||||||
|
@ -194,8 +194,10 @@ void CFOTN::PrimaryAttack()
|
|||||||
flWataDelay = flAhDelay;
|
flWataDelay = flAhDelay;
|
||||||
if (! Swing( 1 ))
|
if (! Swing( 1 ))
|
||||||
{
|
{
|
||||||
|
#if !CLIENT_DLL
|
||||||
SetThink( &CFOTN::SwingAgain );
|
SetThink( &CFOTN::SwingAgain );
|
||||||
pev->nextthink = gpGlobals->time + 0.12f;
|
pev->nextthink = gpGlobals->time + 0.12f;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,10 +250,12 @@ int CFOTN::Swing( int fFirst )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usFOTN,
|
if (fFirst)
|
||||||
0.0, g_vecZero, g_vecZero, 0, 0, 0,
|
{
|
||||||
0.0, 0, 0.0 );
|
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 )
|
if ( tr.flFraction >= 1.0f )
|
||||||
{
|
{
|
||||||
@ -266,7 +270,7 @@ int CFOTN::Swing( int fFirst )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendWeaponAnim( FOTN_LPUNCH );
|
SendWeaponAnim( FOTN_LPUNCH );
|
||||||
|
|
||||||
// player "shoot" animation
|
// player "shoot" animation
|
||||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||||
@ -277,33 +281,33 @@ int CFOTN::Swing( int fFirst )
|
|||||||
fDidHit = TRUE;
|
fDidHit = TRUE;
|
||||||
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
|
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
|
||||||
|
|
||||||
ClearMultiDamage( );
|
|
||||||
|
|
||||||
// If building with the clientside weapon prediction system,
|
|
||||||
// UTIL_WeaponTimeBase() is always 0 and m_flNextPrimaryAttack is >= -1.0f, thus making
|
|
||||||
// m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() always evaluate to false.
|
|
||||||
#ifdef CLIENT_WEAPONS
|
|
||||||
if( ( m_flNextPrimaryAttack + 1 == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
|
||||||
#else
|
|
||||||
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// first swing does full damage
|
|
||||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgFOTN, gpGlobals->v_forward, &tr, DMG_CLUB );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// subsequent swings do half
|
|
||||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgFOTN / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
|
|
||||||
}
|
|
||||||
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
|
|
||||||
|
|
||||||
// play thwack, smack, or dong sound
|
// play thwack, smack, or dong sound
|
||||||
float flVol = 1.0;
|
float flVol = 1.0;
|
||||||
int fHitWorld = TRUE;
|
int fHitWorld = TRUE;
|
||||||
|
|
||||||
if (pEntity)
|
if( pEntity )
|
||||||
{
|
{
|
||||||
|
ClearMultiDamage( );
|
||||||
|
|
||||||
|
// If building with the clientside weapon prediction system,
|
||||||
|
// UTIL_WeaponTimeBase() is always 0 and m_flNextPrimaryAttack is >= -1.0f, thus making
|
||||||
|
// m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() always evaluate to false.
|
||||||
|
#ifdef CLIENT_WEAPONS
|
||||||
|
if( ( m_flNextPrimaryAttack + 1 == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||||
|
#else
|
||||||
|
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
// first swing does full damage
|
||||||
|
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgFOTN, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// subsequent swings do half
|
||||||
|
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgFOTN / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||||
|
}
|
||||||
|
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
|
||||||
|
|
||||||
if ( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
|
if ( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
|
||||||
{
|
{
|
||||||
// play thwack or smack sound
|
// play thwack or smack sound
|
||||||
@ -318,7 +322,12 @@ int CFOTN::Swing( int fFirst )
|
|||||||
}
|
}
|
||||||
m_pPlayer->m_iWeaponVolume = FOTN_BODYHIT_VOLUME;
|
m_pPlayer->m_iWeaponVolume = FOTN_BODYHIT_VOLUME;
|
||||||
if ( !pEntity->IsAlive() )
|
if ( !pEntity->IsAlive() )
|
||||||
return TRUE;
|
{
|
||||||
|
#if CROWBAR_FIX_RAPID_CROWBAR
|
||||||
|
m_flNextPrimaryAttack = GetNextAttackDelay(0.12);
|
||||||
|
#endif
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
flVol = 0.1;
|
flVol = 0.1;
|
||||||
|
|
||||||
@ -357,11 +366,11 @@ int CFOTN::Swing( int fFirst )
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_pPlayer->m_iWeaponVolume = flVol * FOTN_WALLHIT_VOLUME;
|
m_pPlayer->m_iWeaponVolume = flVol * FOTN_WALLHIT_VOLUME;
|
||||||
#endif
|
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.12f;
|
|
||||||
|
|
||||||
SetThink( &CFOTN::Smack );
|
SetThink( &CFOTN::Smack );
|
||||||
pev->nextthink = UTIL_WeaponTimeBase() + 0.18f;
|
pev->nextthink = gpGlobals->time + 0.18f;
|
||||||
|
#endif
|
||||||
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.12f;
|
||||||
}
|
}
|
||||||
return fDidHit;
|
return fDidHit;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user