|
|
|
@ -27,7 +27,7 @@ void FindHullIntersection(const Vector &vecSrc, TraceResult &tr, float *mins, fl
@@ -27,7 +27,7 @@ void FindHullIntersection(const Vector &vecSrc, TraceResult &tr, float *mins, fl
|
|
|
|
|
#define KNIFE_BODYHIT_VOLUME 128 |
|
|
|
|
#define KNIFE_WALLHIT_VOLUME 512 |
|
|
|
|
|
|
|
|
|
LINK_ENTITY_TO_CLASS(weapon_knife, CKnife); |
|
|
|
|
LINK_ENTITY_TO_CLASS(weapon_knife, CKnife) |
|
|
|
|
|
|
|
|
|
enum knife_e { |
|
|
|
|
KNIFE_IDLE1 = 0, |
|
|
|
@ -105,8 +105,10 @@ void CKnife::PrimaryAttack()
@@ -105,8 +105,10 @@ void CKnife::PrimaryAttack()
|
|
|
|
|
{ |
|
|
|
|
if (!Swing(1)) |
|
|
|
|
{ |
|
|
|
|
#ifndef CLIENT_DLL |
|
|
|
|
SetThink(&CKnife::SwingAgain); |
|
|
|
|
pev->nextthink = gpGlobals->time + 0.1; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -188,9 +190,21 @@ int CKnife::Swing(int fFirst)
@@ -188,9 +190,21 @@ int CKnife::Swing(int fFirst)
|
|
|
|
|
fDidHit = TRUE; |
|
|
|
|
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit); |
|
|
|
|
|
|
|
|
|
ClearMultiDamage(); |
|
|
|
|
// play thwack, smack, or dong sound
|
|
|
|
|
float flVol = 1.0; |
|
|
|
|
int fHitWorld = TRUE; |
|
|
|
|
|
|
|
|
|
if ((m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase()) || g_pGameRules->IsMultiplayer()) |
|
|
|
|
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.plrDmgKnife, gpGlobals->v_forward, &tr, DMG_CLUB); |
|
|
|
@ -202,12 +216,6 @@ int CKnife::Swing(int fFirst)
@@ -202,12 +216,6 @@ int CKnife::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
|
|
|
|
@ -259,13 +267,11 @@ int CKnife::Swing(int fFirst)
@@ -259,13 +267,11 @@ int CKnife::Swing(int fFirst)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
m_pPlayer->m_iWeaponVolume = flVol * KNIFE_WALLHIT_VOLUME; |
|
|
|
|
#endif |
|
|
|
|
m_flNextPrimaryAttack = GetNextAttackDelay(0.25); |
|
|
|
|
|
|
|
|
|
SetThink(&CKnife::Smack); |
|
|
|
|
pev->nextthink = UTIL_WeaponTimeBase() + 0.2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
m_flNextPrimaryAttack = GetNextAttackDelay(0.25); |
|
|
|
|
} |
|
|
|
|
return fDidHit; |
|
|
|
|
} |