2 .float accuracy_hit[WEP_MAXCOUNT];
3 .float accuracy_fired[WEP_MAXCOUNT];
4 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(accuracy_hit);
5 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(accuracy_fired);
7 float accuracy_send(entity to, float sf)
11 WriteByte(MSG_ENTITY, ENT_CLIENT_ACCURACY);
14 if(a.classname == "spectator")
19 if not(self.owner.cvar_cl_accuracy_data_share && autocvar_sv_accuracy_data_share)
21 // note: zero sendflags can never be sent... so we can use that to say that we send no accuracy!
22 WriteInt24_t(MSG_ENTITY, sf);
25 // note: we know that client and server agree about SendFlags...
26 for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w, f *= 2)
30 if(self.(accuracy_fired[w]))
31 WriteByte(MSG_ENTITY, 0);
33 WriteByte(MSG_ENTITY, 1 + bound(0, (254.0 * self.(accuracy_hit[w])) / self.(accuracy_fired[w]), 254));
40 void accuracy_init(entity e)
44 e.accuracy.classname = "accuracy";
45 e.accuracy.drawonlytoclient = e;
46 Net_LinkEntity(e.accuracy, FALSE, 0, accuracy_send);
49 void accuracy_free(entity e)
54 // force a resend of a player's accuracy stats
55 void accuracy_resend(entity e)
57 e.accuracy.SendFlags = 0xFFFFFF;
60 // update accuracy stats
61 void accuracy_set(entity e, float w, float hit, float fired)
68 a.(accuracy_hit[w]) = hit;
69 a.(accuracy_fired[w]) = fired;
73 if(a.classname == "spectator")
78 void accuracy_add(entity e, float w, float hit, float fired)
85 a.(accuracy_hit[w]) += hit;
86 a.(accuracy_fired[w]) += fired;
90 if(a.classname == "spectator")