From 9d9cdaee729156eae5f5c3b6fd293d8476688721 Mon Sep 17 00:00:00 2001 From: FruitieX Date: Mon, 18 Apr 2011 19:26:20 +0300 Subject: [PATCH] hack that hopefully fixes the count fields for some weapons: only run them once per frame :) --- qcsrc/server/accuracy.qc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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; -- 2.39.2