From 97161ae0e52622be33ddc6c1dfd73afe1a82b353 Mon Sep 17 00:00:00 2001 From: wootguy Date: Thu, 19 Dec 2024 21:58:27 -0800 Subject: [PATCH] treat dmg key as a literal value, not a multiplier for custom weapon damage --- cl_dll/hl/hl_baseentity.cpp | 3 ++- dlls/CBaseEntity.cpp | 13 ++++++------- dlls/CBaseEntity.h | 2 ++ dlls/monster/CBaseMonster.cpp | 9 +++++++++ dlls/monster/CBaseMonster.h | 2 ++ dlls/monster/CHornet.cpp | 6 ++---- dlls/monster/CSqueakGrenade.cpp | 8 +++----- dlls/player/CBasePlayer.cpp | 4 ++++ dlls/player/CBasePlayer.h | 2 ++ dlls/weapon/CBasePlayerWeapon.cpp | 4 ---- dlls/weapon/CBasePlayerWeapon.h | 2 -- dlls/weapon/CCrossbow.cpp | 10 +++------- dlls/weapon/CCrowbar.cpp | 6 ++---- dlls/weapon/CDisplacerBall.cpp | 8 ++------ dlls/weapon/CEgon.cpp | 8 +++----- dlls/weapon/CGauss.cpp | 8 +++----- dlls/weapon/CGrapple.cpp | 3 +-- dlls/weapon/CGrenade.cpp | 9 +++------ dlls/weapon/CPipewrench.cpp | 8 ++------ dlls/weapon/CRpg.cpp | 4 +--- dlls/weapon/CSatchel.cpp | 4 +--- dlls/weapon/CShockBeam.cpp | 12 +++--------- dlls/weapon/CSpore.cpp | 4 +--- dlls/weapon/CTripmine.cpp | 4 +--- 24 files changed, 58 insertions(+), 85 deletions(-) diff --git a/cl_dll/hl/hl_baseentity.cpp b/cl_dll/hl/hl_baseentity.cpp index 7763cc4f..9ddda924 100644 --- a/cl_dll/hl/hl_baseentity.cpp +++ b/cl_dll/hl/hl_baseentity.cpp @@ -180,6 +180,7 @@ int CBaseMonster::TaskIsRunning( void ) { return 0; } void CBaseMonster::ScheduleChange( void ) { } void CBaseMonster::SetClassify( int ) { } void CBaseMonster::Revive( void ) { } +float CBaseMonster::GetDamage(float defaultDamage) { return defaultDamage; } int CBaseEntity::IRelationship ( CBaseEntity *pTarget ) { return 0; } BOOL CBaseMonster :: FindCover ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; } BOOL CBaseMonster :: BuildNearestRoute ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; } @@ -330,6 +331,7 @@ void CBasePlayer::AddPointsToTeam( int score, BOOL bAllowNegativeScore ) { } Vector CBasePlayer::BodyTarget(const Vector& posSrc) { return Vector(); } void CBasePlayer::Revive() { } float CBasePlayer::GetDamageModifier() { return 0; } +float CBasePlayer::GetDamage(float defaultDamage) { return defaultDamage; } void ClearMultiDamage(void) { } void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker ) { } @@ -369,7 +371,6 @@ BOOL CBasePlayerWeapon :: AddSecondaryAmmo( int iCount, char *szName, int iMax ) BOOL CBasePlayerWeapon :: IsUseable( void ) { return TRUE; } int CBasePlayerWeapon::PrimaryAmmoIndex( void ) { return -1; } int CBasePlayerWeapon::SecondaryAmmoIndex( void ) { return -1; } -float CBasePlayerWeapon::GetDamageModifier() { return 1.0f; } void CBasePlayerAmmo::Spawn( void ) { } CBaseEntity* CBasePlayerAmmo::Respawn( void ) { return this; } void CBasePlayerAmmo::Materialize( void ) { } diff --git a/dlls/CBaseEntity.cpp b/dlls/CBaseEntity.cpp index 97fe443a..26d997d8 100644 --- a/dlls/CBaseEntity.cpp +++ b/dlls/CBaseEntity.cpp @@ -750,8 +750,7 @@ Vector CBaseEntity::FireBulletsPlayer(ULONG cShots, Vector vecSrc, Vector vecDir ClearMultiDamage(); gMultiDamage.type = DMG_BULLET | DMG_NEVERGIB; - float dmg_mult = GetDamageModifier(); - iDamage *= dmg_mult; + iDamage = GetDamage(iDamage); for (ULONG iShot = 1; iShot <= cShots; iShot++) { @@ -836,24 +835,24 @@ Vector CBaseEntity::FireBulletsPlayer(ULONG cShots, Vector vecSrc, Vector vecDir { default: case BULLET_PLAYER_9MM: - pEntity->TraceAttack(pevAttacker, gSkillData.sk_plr_9mm_bullet * dmg_mult, vecDir, &tr, DMG_BULLET); + pEntity->TraceAttack(pevAttacker, GetDamage(gSkillData.sk_plr_9mm_bullet), vecDir, &tr, DMG_BULLET); break; case BULLET_PLAYER_MP5: - pEntity->TraceAttack(pevAttacker, gSkillData.sk_plr_9mmAR_bullet * dmg_mult, vecDir, &tr, DMG_BULLET); + pEntity->TraceAttack(pevAttacker, GetDamage(gSkillData.sk_plr_9mmAR_bullet), vecDir, &tr, DMG_BULLET); break; case BULLET_PLAYER_BUCKSHOT: // make distance based! - pEntity->TraceAttack(pevAttacker, gSkillData.sk_plr_buckshot * dmg_mult, vecDir, &tr, DMG_BULLET); + pEntity->TraceAttack(pevAttacker, GetDamage(gSkillData.sk_plr_buckshot), vecDir, &tr, DMG_BULLET); break; case BULLET_PLAYER_357: - pEntity->TraceAttack(pevAttacker, gSkillData.sk_plr_357_bullet * dmg_mult, vecDir, &tr, DMG_BULLET); + pEntity->TraceAttack(pevAttacker, GetDamage(gSkillData.sk_plr_357_bullet), vecDir, &tr, DMG_BULLET); break; case BULLET_NONE: // FIX - pEntity->TraceAttack(pevAttacker, 50 * dmg_mult, vecDir, &tr, DMG_CLUB); + pEntity->TraceAttack(pevAttacker, GetDamage(50), vecDir, &tr, DMG_CLUB); TEXTURETYPE_PlaySound(&tr, vecSrc, vecEnd, iBulletType); // only decal glass if (!FNullEnt(tr.pHit) && VARS(tr.pHit)->rendermode != 0) diff --git a/dlls/CBaseEntity.h b/dlls/CBaseEntity.h index 9aa98d99..4ed9afe1 100644 --- a/dlls/CBaseEntity.h +++ b/dlls/CBaseEntity.h @@ -356,6 +356,8 @@ class EXPORT CBaseEntity virtual float GetDamageModifier() { return 1.0f; } + virtual float GetDamage(float defaultDamage) { return (pev->dmg ? pev->dmg : defaultDamage) * GetDamageModifier(); } + // Smooths the movement of projectile models or sprites that use one of the following movetypes: // NONE, STEP, WALK, FLY. // Call this in a think function which has a constant interval, and pass that interval as flInterval. diff --git a/dlls/monster/CBaseMonster.cpp b/dlls/monster/CBaseMonster.cpp index e790daf7..5fa01916 100644 --- a/dlls/monster/CBaseMonster.cpp +++ b/dlls/monster/CBaseMonster.cpp @@ -7834,3 +7834,12 @@ float CBaseMonster::GetDamageModifier() { return self_damage_mult * owner_damage_mult; } + +float CBaseMonster::GetDamage(float defaultDamage) { + CBaseEntity* owner = CBaseEntity::Instance(pev->owner); + CBaseMonster* mon = owner ? owner->MyMonsterPointer() : NULL; + + // owner damage overrides self damage (snarks, grenades, etc.) + float self_damage = pev->dmg ? pev->dmg : defaultDamage; + return (mon ? mon->GetDamage(defaultDamage) : self_damage) * GetDamageModifier(); +} \ No newline at end of file diff --git a/dlls/monster/CBaseMonster.h b/dlls/monster/CBaseMonster.h index 38e1ba60..c5d77bb3 100644 --- a/dlls/monster/CBaseMonster.h +++ b/dlls/monster/CBaseMonster.h @@ -474,6 +474,8 @@ class EXPORT CBaseMonster : public CBaseToggle virtual void Revive(); virtual float GetDamageModifier(); + + virtual float GetDamage(float defaultDamage); }; diff --git a/dlls/monster/CHornet.cpp b/dlls/monster/CHornet.cpp index 66ebca48..9e37792d 100644 --- a/dlls/monster/CHornet.cpp +++ b/dlls/monster/CHornet.cpp @@ -117,16 +117,14 @@ void CHornet :: Spawn( void ) if ( !pSoundEnt ) pSoundEnt = edict(); - float dmg_mult = GetDamageModifier(); - if ( !FNullEnt(pev->owner) && (pev->owner->v.flags & FL_CLIENT) ) { - pev->dmg = gSkillData.sk_plr_hornet * dmg_mult; + pev->dmg = GetDamage(gSkillData.sk_plr_hornet); } else { // no real owner, or owner isn't a client. - pev->dmg = gSkillData.sk_hornet_dmg * dmg_mult; + pev->dmg = GetDamage(gSkillData.sk_hornet_dmg); } m_lastPos = pev->origin; diff --git a/dlls/monster/CSqueakGrenade.cpp b/dlls/monster/CSqueakGrenade.cpp index fcfb5c04..fdbcf880 100644 --- a/dlls/monster/CSqueakGrenade.cpp +++ b/dlls/monster/CSqueakGrenade.cpp @@ -132,9 +132,7 @@ void CSqueakGrenade :: Spawn( void ) pev->gravity = 0.5; pev->friction = 0.5; - float dmg_mult = GetDamageModifier(); - - pev->dmg = gSkillData.sk_snark_dmg_pop * dmg_mult; + pev->dmg = GetDamage(gSkillData.sk_snark_dmg_pop); m_flDie = gpGlobals->time + SQUEEK_DETONATE_DELAY; @@ -355,12 +353,12 @@ void CSqueakGrenade::SuperBounceTouch( CBaseEntity *pOther ) { edict_t* oldOwner = pev->owner; pev->owner = m_hOwner.GetEdict(); - float dmg_mult = GetDamageModifier(); + float dmg = GetDamage(gSkillData.sk_snark_dmg_bite); pev->owner = oldOwner; // ALERT( at_console, "hit enemy\n"); ClearMultiDamage( ); - pOther->TraceAttack(pev, gSkillData.sk_snark_dmg_bite*dmg_mult, gpGlobals->v_forward, &tr, DMG_SLASH ); + pOther->TraceAttack(pev, dmg, gpGlobals->v_forward, &tr, DMG_SLASH ); if (m_hOwner != NULL) ApplyMultiDamage( pev, m_hOwner->pev ); else diff --git a/dlls/player/CBasePlayer.cpp b/dlls/player/CBasePlayer.cpp index eeff7a07..e0b63564 100644 --- a/dlls/player/CBasePlayer.cpp +++ b/dlls/player/CBasePlayer.cpp @@ -6048,6 +6048,10 @@ float CBasePlayer::GetDamageModifier() { return CBaseMonster::GetDamageModifier() * weapon_damage_mult; } +float CBasePlayer::GetDamage(float defaultDamage) { + return m_pActiveItem ? m_pActiveItem->GetDamage(defaultDamage) : CBaseMonster::GetDamage(defaultDamage); +} + void CBasePlayer::PenalizeDeath() { m_iDeaths += 1; m_scoreMultiplier = GetScoreMultiplier(); diff --git a/dlls/player/CBasePlayer.h b/dlls/player/CBasePlayer.h index 5059f260..129beba8 100644 --- a/dlls/player/CBasePlayer.h +++ b/dlls/player/CBasePlayer.h @@ -502,6 +502,8 @@ class EXPORT CBasePlayer : public CBaseMonster float GetDamageModifier(); + float GetDamage(float defaultDamage); + // accounts for active cameras and view offset Vector GetViewPosition() { return m_hViewEntity ? m_hViewEntity->pev->origin : GetGunPosition(); } diff --git a/dlls/weapon/CBasePlayerWeapon.cpp b/dlls/weapon/CBasePlayerWeapon.cpp index 15a49838..f0796159 100644 --- a/dlls/weapon/CBasePlayerWeapon.cpp +++ b/dlls/weapon/CBasePlayerWeapon.cpp @@ -788,8 +788,4 @@ void CBasePlayerWeapon::SolidifyNearbyCorpses(bool solidState) { UTIL_SetOrigin(&ent->v, ent->v.origin); // reset abs bbox } } -} - -float CBasePlayerWeapon::GetDamageModifier() { - return pev->dmg ? pev->dmg : 1.0f; } \ No newline at end of file diff --git a/dlls/weapon/CBasePlayerWeapon.h b/dlls/weapon/CBasePlayerWeapon.h index cfddb405..be8a5a2b 100644 --- a/dlls/weapon/CBasePlayerWeapon.h +++ b/dlls/weapon/CBasePlayerWeapon.h @@ -73,8 +73,6 @@ class EXPORT CBasePlayerWeapon : public CBasePlayerItem // hack to allow corpse gibbing of non-solid corpses void SolidifyNearbyCorpses(bool solidState); - float GetDamageModifier(); - float m_flPumpTime; int m_fInSpecialReload; // Are we in the middle of a reload for the shotguns float m_flNextPrimaryAttack; // soonest time ItemPostFrame will call PrimaryAttack diff --git a/dlls/weapon/CCrossbow.cpp b/dlls/weapon/CCrossbow.cpp index 7493dafe..2afb6c4a 100644 --- a/dlls/weapon/CCrossbow.cpp +++ b/dlls/weapon/CCrossbow.cpp @@ -108,15 +108,13 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther ) // UNDONE: this needs to call TraceAttack instead ClearMultiDamage( ); - float dmg_mult = GetDamageModifier(); - if ( pOther->IsPlayer() ) { - pOther->TraceAttack(pevOwner, gSkillData.sk_plr_xbow_bolt_client*dmg_mult, pev->velocity.Normalize(), &tr, DMG_NEVERGIB ); + pOther->TraceAttack(pevOwner, GetDamage(gSkillData.sk_plr_xbow_bolt_client), pev->velocity.Normalize(), &tr, DMG_NEVERGIB ); } else { - pOther->TraceAttack(pevOwner, gSkillData.sk_plr_xbow_bolt_monster*dmg_mult, pev->velocity.Normalize(), &tr, DMG_BULLET | DMG_NEVERGIB ); + pOther->TraceAttack(pevOwner, GetDamage(gSkillData.sk_plr_xbow_bolt_monster), pev->velocity.Normalize(), &tr, DMG_BULLET | DMG_NEVERGIB ); } ApplyMultiDamage( pev, pevOwner ); @@ -381,11 +379,9 @@ void CCrossbow::FireSniperBolt() #ifndef CLIENT_DLL if ( tr.pHit->v.takedamage ) { - float dmg_mult = GetDamageModifier(); - ClearMultiDamage( ); CBaseEntity::Instance(tr.pHit)->TraceAttack(m_pPlayer->pev, - gSkillData.sk_plr_xbow_sniper_bullet * dmg_mult, vecDir, &tr, DMG_BULLET | DMG_NEVERGIB ); + GetDamage(gSkillData.sk_plr_xbow_sniper_bullet), vecDir, &tr, DMG_BULLET | DMG_NEVERGIB ); ApplyMultiDamage( pev, m_pPlayer->pev ); } #endif diff --git a/dlls/weapon/CCrowbar.cpp b/dlls/weapon/CCrowbar.cpp index 0ae05aef..2b4d8a8c 100644 --- a/dlls/weapon/CCrowbar.cpp +++ b/dlls/weapon/CCrowbar.cpp @@ -213,19 +213,17 @@ int CCrowbar::Swing( int fFirst ) ClearMultiDamage( ); - float dmg_mult = GetDamageModifier(); - // JoshA: Changed from < -> <= to fix the full swing logic since client weapon prediction. // -1.0f + 1.0f = 0.0f. UTIL_WeaponTimeBase is always 0 with client weapon prediction (0 time base vs curtime base) if ( (m_flNextPrimaryAttack + 1 <= UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() ) { // first swing does full damage - pEntity->TraceAttack(m_pPlayer->pev, gSkillData.sk_plr_crowbar* dmg_mult, gpGlobals->v_forward, &tr, DMG_CLUB ); + pEntity->TraceAttack(m_pPlayer->pev, GetDamage(gSkillData.sk_plr_crowbar), gpGlobals->v_forward, &tr, DMG_CLUB ); } else { // subsequent swings do half - pEntity->TraceAttack(m_pPlayer->pev, (gSkillData.sk_plr_crowbar / 2) * dmg_mult, gpGlobals->v_forward, &tr, DMG_CLUB ); + pEntity->TraceAttack(m_pPlayer->pev, GetDamage(gSkillData.sk_plr_crowbar) / 2, gpGlobals->v_forward, &tr, DMG_CLUB ); } ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev ); diff --git a/dlls/weapon/CDisplacerBall.cpp b/dlls/weapon/CDisplacerBall.cpp index b87da699..fb9d1119 100644 --- a/dlls/weapon/CDisplacerBall.cpp +++ b/dlls/weapon/CDisplacerBall.cpp @@ -256,9 +256,7 @@ void CDisplacerBall::FizzleThink() { ClearBeams(); - float dmg_mult = GetDamageModifier(); - - pev->dmg = gSkillData.sk_plr_displacer_other * dmg_mult; + pev->dmg = GetDamage(gSkillData.sk_plr_displacer_other); MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, pev->origin); WRITE_BYTE(TE_DLIGHT); @@ -285,9 +283,7 @@ void CDisplacerBall::ExplodeThink() { ClearBeams(); - float dmg_mult = GetDamageModifier(); - - pev->dmg = gSkillData.sk_plr_displacer_other * dmg_mult; + pev->dmg = GetDamage(gSkillData.sk_plr_displacer_other); edict_t* pOwner = pev->owner; pev->owner = nullptr; diff --git a/dlls/weapon/CEgon.cpp b/dlls/weapon/CEgon.cpp index c4bebff9..212cab91 100644 --- a/dlls/weapon/CEgon.cpp +++ b/dlls/weapon/CEgon.cpp @@ -316,8 +316,6 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir ) float timedist = 0; - float dmg_mult = GetDamageModifier(); - switch ( m_fireMode ) { case FIRE_NARROW: @@ -328,7 +326,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir ) ClearMultiDamage(); if (pEntity->pev->takedamage) { - pEntity->TraceAttack( m_pPlayer->pev, gSkillData.sk_plr_egon_narrow*dmg_mult, vecDir, &tr, DMG_ENERGYBEAM ); + pEntity->TraceAttack( m_pPlayer->pev, GetDamage(gSkillData.sk_plr_egon_narrow), vecDir, &tr, DMG_ENERGYBEAM ); } ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); @@ -365,14 +363,14 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir ) ClearMultiDamage(); if (pEntity->pev->takedamage) { - pEntity->TraceAttack( m_pPlayer->pev, gSkillData.sk_plr_egon_wide * dmg_mult, vecDir, &tr, DMG_ENERGYBEAM | DMG_ALWAYSGIB); + pEntity->TraceAttack( m_pPlayer->pev, GetDamage(gSkillData.sk_plr_egon_wide), vecDir, &tr, DMG_ENERGYBEAM | DMG_ALWAYSGIB); } ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); if ( g_pGameRules->IsMultiplayer() ) { // radius damage a little more potent in multiplayer. - ::RadiusDamage( tr.vecEndPos, pev, m_pPlayer->pev, (gSkillData.sk_plr_egon_wide/4) * dmg_mult, 128, CLASS_NONE, DMG_ENERGYBEAM | DMG_ALWAYSGIB); + ::RadiusDamage( tr.vecEndPos, pev, m_pPlayer->pev, GetDamage(gSkillData.sk_plr_egon_wide) / 4, 128, CLASS_NONE, DMG_ENERGYBEAM | DMG_ALWAYSGIB); } if ( !m_pPlayer->IsAlive() ) diff --git a/dlls/weapon/CGauss.cpp b/dlls/weapon/CGauss.cpp index 2bde2c5e..fa234482 100644 --- a/dlls/weapon/CGauss.cpp +++ b/dlls/weapon/CGauss.cpp @@ -360,16 +360,14 @@ void CGauss::StartFire( void ) UTIL_MakeVectors( m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle ); Vector vecAiming = gpGlobals->v_forward; Vector vecSrc = m_pPlayer->GetGunPosition( ); // + gpGlobals->v_up * -8 + gpGlobals->v_right * 8; - - float dmg_mult = GetDamageModifier(); if ( gpGlobals->time - m_pPlayer->m_flStartCharge > GetFullChargeTime() ) { - flDamage = secondaryBaseDamage * dmg_mult; + flDamage = GetDamage(secondaryBaseDamage); } else { - flDamage = secondaryBaseDamage * dmg_mult * + flDamage = GetDamage(secondaryBaseDamage) * (( gpGlobals->time - m_pPlayer->m_flStartCharge) / GetFullChargeTime() ); } @@ -379,7 +377,7 @@ void CGauss::StartFire( void ) #ifdef CLIENT_DLL flDamage = 20; #else - flDamage = gSkillData.sk_plr_gauss * dmg_mult; + flDamage = GetDamage(gSkillData.sk_plr_gauss); #endif } diff --git a/dlls/weapon/CGrapple.cpp b/dlls/weapon/CGrapple.cpp index 3fb4230a..0d55f09c 100644 --- a/dlls/weapon/CGrapple.cpp +++ b/dlls/weapon/CGrapple.cpp @@ -383,8 +383,7 @@ void CGrapple::PrimaryAttack() ClearMultiDamage(); //float flDamage = GetSkillFloat("plr_grapple"sv); - float dmg_mult = GetDamageModifier(); - float flDamage = 50 * dmg_mult; + float flDamage = GetDamage(50); pHit->TraceAttack(this->pev, flDamage, gpGlobals->v_forward, &tr, DMG_ALWAYSGIB | DMG_CLUB); diff --git a/dlls/weapon/CGrenade.cpp b/dlls/weapon/CGrenade.cpp index 38471072..b54262cc 100644 --- a/dlls/weapon/CGrenade.cpp +++ b/dlls/weapon/CGrenade.cpp @@ -414,8 +414,7 @@ CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector v // Explode on contact pGrenade->SetTouch( &CGrenade::ExplodeTouch ); - float dmg_mult = pGrenade->GetDamageModifier(); - pGrenade->pev->dmg = gSkillData.sk_plr_9mmAR_grenade * dmg_mult; + pGrenade->pev->dmg = pGrenade->GetDamage(gSkillData.sk_plr_9mmAR_grenade); return pGrenade; } @@ -454,8 +453,7 @@ CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector v pGrenade->pev->gravity = 0.5; pGrenade->pev->friction = 0.8; - float dmg_mult = pGrenade->GetDamageModifier(); - pGrenade->pev->dmg = 100 * dmg_mult; + pGrenade->pev->dmg = pGrenade->GetDamage(100); SET_MODEL(ENT(pGrenade->pev), model ? model : pGrenade->GetModel()); @@ -481,8 +479,7 @@ CGrenade * CGrenade :: ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart, pGrenade->pev->angles = g_vecZero; pGrenade->pev->owner = ENT(pevOwner); - float dmg_mult = pGrenade->GetDamageModifier(); - pGrenade->pev->dmg = 200 * dmg_mult; + pGrenade->pev->dmg = pGrenade->GetDamage(200); // Detonate in "time" seconds pGrenade->SetThink( &CGrenade::SUB_DoNothing ); diff --git a/dlls/weapon/CPipewrench.cpp b/dlls/weapon/CPipewrench.cpp index 7b059788..c49f69ef 100644 --- a/dlls/weapon/CPipewrench.cpp +++ b/dlls/weapon/CPipewrench.cpp @@ -291,9 +291,7 @@ bool CPipewrench::Swing(const bool bFirst) } } - float dmg_mult = GetDamageModifier(); - - pEntity->TraceAttack(m_pPlayer->pev, flDamage*dmg_mult, gpGlobals->v_forward, &tr, DMG_CLUB); + pEntity->TraceAttack(m_pPlayer->pev, GetDamage(flDamage), gpGlobals->v_forward, &tr, DMG_CLUB); ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); } @@ -476,9 +474,7 @@ void CPipewrench::BigSwing() } } - float dmg_mult = GetDamageModifier(); - - pEntity->TraceAttack(m_pPlayer->pev, flDamage * dmg_mult, gpGlobals->v_forward, &tr, DMG_CLUB); + pEntity->TraceAttack(m_pPlayer->pev, GetDamage(flDamage), gpGlobals->v_forward, &tr, DMG_CLUB); ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); } diff --git a/dlls/weapon/CRpg.cpp b/dlls/weapon/CRpg.cpp index 1060387b..6cbd8e93 100644 --- a/dlls/weapon/CRpg.cpp +++ b/dlls/weapon/CRpg.cpp @@ -194,9 +194,7 @@ void CRpgRocket :: Spawn( void ) pev->nextthink = gpGlobals->time + 0.4; - float dmg_mult = GetDamageModifier(); - - pev->dmg = gSkillData.sk_plr_rpg * dmg_mult; + pev->dmg = GetDamage(gSkillData.sk_plr_rpg); } //========================================================= diff --git a/dlls/weapon/CSatchel.cpp b/dlls/weapon/CSatchel.cpp index 67d99543..aa8b5a8b 100644 --- a/dlls/weapon/CSatchel.cpp +++ b/dlls/weapon/CSatchel.cpp @@ -82,9 +82,7 @@ void CSatchelCharge :: Spawn( void ) pev->gravity = SATCHEL_GRAVITY; pev->friction = 0.8; - float dmg_mult = GetDamageModifier(); - - pev->dmg = gSkillData.sk_plr_satchel*dmg_mult; + pev->dmg = GetDamage(gSkillData.sk_plr_satchel); // ResetSequenceInfo( ); pev->sequence = 1; diff --git a/dlls/weapon/CShockBeam.cpp b/dlls/weapon/CShockBeam.cpp index 4c3e3427..aa9805a7 100644 --- a/dlls/weapon/CShockBeam.cpp +++ b/dlls/weapon/CShockBeam.cpp @@ -163,9 +163,7 @@ void CShockBeam::WaterExplodeThink() Explode(); - float dmg_mult = GetDamageModifier(); - - ::RadiusDamage( pev->origin, pev, pOwner, 100.0 * dmg_mult, 150.0, CLASS_NONE, DMG_ALWAYSGIB | DMG_BLAST ); + ::RadiusDamage( pev->origin, pev, pOwner, GetDamage(100.0), 150.0, CLASS_NONE, DMG_ALWAYSGIB | DMG_BLAST ); CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, QUIET_GUN_VOLUME, 0.1); UTIL_Remove( this ); @@ -187,9 +185,7 @@ void CShockBeam::BallTouch( CBaseEntity* pOther ) ClearMultiDamage(); - float dmg_mult = GetDamageModifier(); - - float damage = gSkillData.sk_plr_shockrifle * dmg_mult; + float damage = GetDamage(gSkillData.sk_plr_shockrifle); auto bitsDamageTypes = DMG_SHOCK; @@ -250,9 +246,7 @@ void CShockBeam::Explode() m_hBeam1 = nullptr; } - float dmg_mult = GetDamageModifier(); - - pev->dmg = 40 * dmg_mult; + pev->dmg = GetDamage(40); MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin ); WRITE_BYTE( TE_DLIGHT ); diff --git a/dlls/weapon/CSpore.cpp b/dlls/weapon/CSpore.cpp index 52cc8489..5d169bf8 100644 --- a/dlls/weapon/CSpore.cpp +++ b/dlls/weapon/CSpore.cpp @@ -100,9 +100,7 @@ void CSpore::Spawn() pev->friction = 0.7; } - float dmg_mult = GetDamageModifier(); - - pev->dmg = gSkillData.sk_plr_spore * dmg_mult; + pev->dmg = GetDamage(gSkillData.sk_plr_spore); m_flIgniteTime = gpGlobals->time; diff --git a/dlls/weapon/CTripmine.cpp b/dlls/weapon/CTripmine.cpp index c262a43f..8770364b 100644 --- a/dlls/weapon/CTripmine.cpp +++ b/dlls/weapon/CTripmine.cpp @@ -112,10 +112,8 @@ void CTripmineGrenade :: Spawn( void ) SetThink( &CTripmineGrenade::PowerupThink ); pev->nextthink = gpGlobals->time + 0.2; - float dmg_mult = GetDamageModifier(); - pev->takedamage = DAMAGE_YES; - pev->dmg = gSkillData.sk_plr_tripmine * dmg_mult; + pev->dmg = GetDamage(gSkillData.sk_plr_tripmine); pev->health = 1; // don't let die normally if (pev->owner != NULL)