X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Faccuracy.qc;h=d0dda35af10cc979ca3296adc0b6883d8ac6c746;hb=1217fce596f1b9769ffb6f479e3abbd4f77af5ef;hp=8a7f4c5b061d76d93d29984777bc9f4881df60f3;hpb=71e6c75bc408ae5a116f296797c49c0cef7be113;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/accuracy.qc b/qcsrc/server/weapons/accuracy.qc index 8a7f4c5b0..d0dda35af 100644 --- a/qcsrc/server/weapons/accuracy.qc +++ b/qcsrc/server/weapons/accuracy.qc @@ -1,3 +1,12 @@ +#include "accuracy.qh" +#include "../_all.qh" + +#include "../mutators/mutators_include.qh" +#include "../../common/constants.qh" +#include "../../common/teams.qh" +#include "../../common/util.qh" +#include "../../common/weapons/all.qh" + float accuracy_byte(float n, float d) { //printf("accuracy: %d / %d\n", n, d); @@ -8,9 +17,9 @@ float accuracy_byte(float n, float d) return 1 + rint(n * 100.0 / d); } -float accuracy_send(entity to, float sf) +float accuracy_send(entity to, int sf) { - float w, f; + int w, f; entity a; WriteByte(MSG_ENTITY, ENT_CLIENT_ACCURACY); @@ -25,7 +34,7 @@ float accuracy_send(entity to, float sf) // note: zero sendflags can never be sent... so we can use that to say that we send no accuracy! WriteInt24_t(MSG_ENTITY, sf); if(sf == 0) - return TRUE; + return true; // note: we know that client and server agree about SendFlags... for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w) { @@ -36,7 +45,7 @@ float accuracy_send(entity to, float sf) else f *= 2; } - return TRUE; + return true; } // init/free @@ -46,7 +55,7 @@ void accuracy_init(entity e) e.accuracy.owner = e; e.accuracy.classname = "accuracy"; e.accuracy.drawonlytoclient = e; - Net_LinkEntity(e.accuracy, FALSE, 0, accuracy_send); + Net_LinkEntity(e.accuracy, false, 0, accuracy_send); } void accuracy_free(entity e) @@ -64,7 +73,7 @@ void accuracy_resend(entity e) .float hit_time; .float fired_time; -void accuracy_add(entity e, float w, float fired, float hit) +void accuracy_add(entity e, int w, float fired, float hit) { entity a; float b; @@ -94,7 +103,7 @@ void accuracy_add(entity e, float w, float fired, float hit) if(b == accuracy_byte(a.(accuracy_hit[w]), a.(accuracy_fired[w]))) return; - w = pow(2, mod(w, 24)); + w = pow(2, w % 24); a.SendFlags |= w; FOR_EACH_CLIENT(a) if(IS_SPEC(a)) @@ -104,22 +113,20 @@ void accuracy_add(entity e, float w, float fired, float hit) float accuracy_isgooddamage(entity attacker, entity targ) { - frag_attacker = attacker; - frag_target = targ; - float mutator_check = MUTATOR_CALLHOOK(AccuracyTargetValid); + float mutator_check = MUTATOR_CALLHOOK(AccuracyTargetValid, attacker, targ); if(!warmup_stage) if(targ.deadflag == DEAD_NO) if(!targ.frozen) if(mutator_check == MUT_ACCADD_INVALID || (mutator_check == MUT_ACCADD_VALID && IS_CLIENT(targ))) if(DIFF_TEAM(attacker, targ)) - return TRUE; - return FALSE; + return true; + return false; } float accuracy_canbegooddamage(entity attacker) { if(!warmup_stage) - return TRUE; - return FALSE; + return true; + return false; }