From: FruitieX Date: Mon, 18 Apr 2011 16:26:20 +0000 (+0300) Subject: hack that hopefully fixes the count fields for some weapons: only run them once per... X-Git-Tag: xonotic-v0.5.0~220^2~5^2~11 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9d9cdaee729156eae5f5c3b6fd293d8476688721;p=xonotic%2Fxonotic-data.pk3dir.git hack that hopefully fixes the count fields for some weapons: only run them once per frame :) --- diff --git a/qcsrc/server/accuracy.qc b/qcsrc/server/accuracy.qc index a0a557c3c..95ddf78e1 100644 --- a/qcsrc/server/accuracy.qc +++ b/qcsrc/server/accuracy.qc @@ -80,7 +80,7 @@ void accuracy_set(entity e, float w, float fired, float hit) if(hit) a.(accuracy_cnt_hit[w]) = 1; - a.(accuracy_cnt_fired[w]) = 1; + a.(accuracy_cnt_fired[w]) = 1; if(b == accuracy_byte(hit, fired)) return; @@ -92,6 +92,9 @@ void accuracy_set(entity e, float w, float fired, float hit) a.SendFlags |= w; } +.float hit_time; +.float fired_time; + void accuracy_add(entity e, float w, float fired, float hit) { entity a; @@ -106,9 +109,17 @@ void accuracy_add(entity e, float w, float fired, float hit) if(fired) a.(accuracy_fired[w]) += fired; - if(hit) + if(hit && a.hit_time != time) // only run this once per frame + { a.(accuracy_cnt_hit[w]) += 1; - a.(accuracy_cnt_fired[w]) += 1; + a.hit_time = time; + } + + if(fired && a.fired_time != time) // only run this once per frame + { + a.(accuracy_cnt_fired[w]) += 1; + a.fired_time = time; + } if(b == accuracy_byte(a.(accuracy_hit[w]), a.(accuracy_fired[w]))) return;