From: TimePath Date: Sat, 20 Dec 2014 10:39:09 +0000 (+1100) Subject: Improve reliability by using total damage X-Git-Tag: xonotic-v0.8.0~51^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=466ca3100f637b4faa58bd7f80ff0a2fe738ad1f;p=xonotic%2Fxonotic-data.pk3dir.git Improve reliability by using total damage --- diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 3fa921d29..bec4f9e3f 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -423,7 +423,11 @@ float unaccounted_damage = 0; void UpdateDamage() { // accumulate damage with each stat update - float unaccounted_damage_new = getstati(STAT_DAMAGE_DEALT_TOTAL); + static float damage_total_prev = 0; + float damage_total = getstati(STAT_DAMAGE_DEALT_TOTAL); + float unaccounted_damage_new = COMPARE_INCREASING(damage_total, damage_total_prev); + damage_total_prev = damage_total; + static float damage_dealt_time_prev = 0; float damage_dealt_time = getstatf(STAT_HIT_TIME); if (damage_dealt_time != damage_dealt_time_prev) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 4b14ef3a1..12118a2ff 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -2204,27 +2204,13 @@ void EndFrame() float altime; FOR_EACH_REALCLIENT(self) { - self.damage_dealt_total = 0; - - if(IS_SPEC(self)) - { - if(self.enemy.typehitsound) - self.typehit_time = time; - else if(self.enemy.damage_dealt) - { - self.hit_time = time; - self.damage_dealt_total = ceil(self.enemy.damage_dealt); - } - } - else + entity e = IS_SPEC(self) ? self.enemy : self; + if(e.typehitsound) + self.typehit_time = time; + else if(e.damage_dealt) { - if(self.typehitsound) - self.typehit_time = time; - else if(self.damage_dealt) - { - self.hit_time = time; - self.damage_dealt_total = ceil(self.damage_dealt); - } + self.hit_time = time; + self.damage_dealt_total += ceil(e.damage_dealt); } } altime = time + frametime * (1 + autocvar_g_antilag_nudge);