From: terencehill Date: Thu, 13 Jan 2022 22:04:04 +0000 (+0100) Subject: Rename misleading DAMAGE_DEALT_TOTAL and damage_dealt to HITSOUND_DAMAGE_DEALT_TOTAL... X-Git-Tag: xonotic-v0.8.5~235 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8692ea7092d64826f2cc04e8d5608d71f6af03c0;p=xonotic%2Fxonotic-data.pk3dir.git Rename misleading DAMAGE_DEALT_TOTAL and damage_dealt to HITSOUND_DAMAGE_DEALT_TOTAL and hitsound_damage_dealt since damage is counted only if dealt to players that aren't typing --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 4086e1b19..34ba8595f 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -770,7 +770,7 @@ void UpdateDamage() { // accumulate damage with each stat update static float damage_total_prev = 0; - float damage_total = STAT(DAMAGE_DEALT_TOTAL); + float damage_total = STAT(HITSOUND_DAMAGE_DEALT_TOTAL); float unaccounted_damage_new = COMPARE_INCREASING(damage_total, damage_total_prev); damage_total_prev = damage_total; diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 44cd80d02..2abb0b596 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -221,8 +221,8 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, Damage_Calculate) armor -= 1; SetResource(frag_target, RES_ARMOR, armor); frag_damage = 0; - frag_target.damage_dealt += 1; - frag_attacker.damage_dealt += 1; + frag_target.hitsound_damage_dealt += 1; + frag_attacker.hitsound_damage_dealt += 1; Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, armor); } } @@ -258,7 +258,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, Damage_Calculate) armor -= 1; SetResource(frag_attacker, RES_ARMOR, armor); Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, armor); - frag_attacker.damage_dealt += frag_mirrordamage; + frag_attacker.hitsound_damage_dealt += frag_mirrordamage; } frag_mirrordamage = 0; } diff --git a/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc b/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc index b30df3790..48dcb68b1 100644 --- a/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc +++ b/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc @@ -25,7 +25,7 @@ MUTATOR_HOOKFUNCTION(vh, GrappleHookThink) if(autocvar_g_vampirehook_damage) { thehook.last_dmg = time + autocvar_g_vampirehook_damagerate; - thehook.owner.damage_dealt += autocvar_g_vampirehook_damage; + thehook.owner.hitsound_damage_dealt += autocvar_g_vampirehook_damage; Damage(dmgent, thehook, thehook.owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, DMG_NOWEP, thehook.origin, '0 0 0'); entity targ = ((SAME_TEAM(thehook.owner, thehook.aiment)) ? thehook.aiment : thehook.owner); // TODO: we can't do this due to an issue with globals and the mutator arguments diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 463d98c85..b02a013c0 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -100,7 +100,7 @@ REGISTER_STAT(LEADLIMIT_AND_FRAGLIMIT, float, autocvar_leadlimit_and_fraglimit) REGISTER_STAT(LAST_PICKUP, float) REGISTER_STAT(HUD, int) REGISTER_STAT(HIT_TIME, float) -REGISTER_STAT(DAMAGE_DEALT_TOTAL, int) +REGISTER_STAT(HITSOUND_DAMAGE_DEALT_TOTAL, int) REGISTER_STAT(TYPEHIT_TIME, float) REGISTER_STAT(AIR_FINISHED, float) REGISTER_STAT(VEHICLESTAT_HEALTH, int) diff --git a/qcsrc/server/damage.qc b/qcsrc/server/damage.qc index d480c229b..7a614bc87 100644 --- a/qcsrc/server/damage.qc +++ b/qcsrc/server/damage.qc @@ -790,7 +790,7 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de if(PHYS_INPUT_BUTTON_CHAT(victim)) attacker.typehitsound += 1; else - attacker.damage_dealt += damage; + attacker.hitsound_damage_dealt += damage; } impressive_hits += 1; @@ -1197,12 +1197,12 @@ void Fire_ApplyDamage(entity e) t = min(frametime, fireendtime - time); d = e.fire_damagepersec * t; - hi = e.fire_owner.damage_dealt; + hi = e.fire_owner.hitsound_damage_dealt; ty = e.fire_owner.typehitsound; Damage(e, e, e.fire_owner, d, e.fire_deathtype, DMG_NOWEP, e.origin, '0 0 0'); if(e.fire_hitsound && e.fire_owner) { - e.fire_owner.damage_dealt = hi; + e.fire_owner.hitsound_damage_dealt = hi; e.fire_owner.typehitsound = ty; } e.fire_hitsound = true; diff --git a/qcsrc/server/damage.qh b/qcsrc/server/damage.qh index 3d6e02481..19206daf3 100644 --- a/qcsrc/server/damage.qh +++ b/qcsrc/server/damage.qh @@ -69,7 +69,8 @@ int impressive_hits; .vector death_origin; -.float damage_dealt, typehitsound, killsound; +.float hitsound_damage_dealt; +.int typehitsound, killsound; // used for custom deathtype string deathmessage; diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 305aa305c..e2a44d2c8 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -2294,11 +2294,10 @@ void EndFrame() STAT(TYPEHIT_TIME, it) = time; } else if (e.killsound) { STAT(KILL_TIME, it) = time; - } else if (e.damage_dealt) { + } else if (e.hitsound_damage_dealt) { STAT(HIT_TIME, it) = time; - // NOTE: total damage dealt stat is not accurate as client - // code doesn't need so much accuracy for its purposes - STAT(DAMAGE_DEALT_TOTAL, it) += ceil(e.damage_dealt); + // NOTE: this is not accurate as client code doesn't need so much accuracy for its purposes + STAT(HITSOUND_DAMAGE_DEALT_TOTAL, it) += ceil(e.hitsound_damage_dealt); } }); // add 1 frametime because after this, engine SV_Physics @@ -2309,7 +2308,7 @@ void EndFrame() float altime = time + frametime * (1 + autocvar_g_antilag_nudge); FOREACH_CLIENT(true, { it.typehitsound = false; - it.damage_dealt = 0; + it.hitsound_damage_dealt = 0; it.killsound = false; antilag_record(it, CS(it), altime); });