23 return 1 +
rint(n * 100.0 / d);
39 if (sf == 0)
return true;
44 f = (f == 0x800000) ? 1 : f * 2;
54 a.drawonlytoclient = e;
60 delete(
CS(e).accuracy);
70 a.accuracy_real[i] = 0;
71 a.accuracy_frags[i] = 0;
72 a.accuracy_hit[i] = 0;
73 a.accuracy_fired[i] = 0;
74 a.accuracy_cnt_hit[i] = 0;
75 a.accuracy_cnt_fired[i] = 0;
82 CS(e).accuracy.SendFlags = 0xFFFFFF;
107 if (!hit && !fired && !real)
return;
108 if (w == WEP_Null)
return;
110 int b =
accuracy_byte(a.accuracy_hit[wepid], a.accuracy_fired[wepid]);
111 if (real) a.accuracy_real [wepid] += real;
112 if (hit) a.accuracy_hit [wepid] += hit;
113 if (fired) a.accuracy_fired[wepid] += fired;
115 if (hit &&
STAT(HIT_TIME, a) !=
time) {
116 a.accuracy_cnt_hit[wepid] += 1;
120 if (fired && a.fired_time !=
time) {
121 a.accuracy_cnt_fired[wepid] += 1;
125 if (b ==
accuracy_byte(a.accuracy_hit[wepid], a.accuracy_fired[wepid]))
return;
126 int sf =
BIT(wepid % 24);
141 if (
IS_DEAD(targ) &&
time > targ.death_time)
return false;
142 if (
SAME_TEAM(attacker, targ))
return false;
159REPLICATE(cvar_cl_accuracy_data_share,
bool,
"cl_accuracy_data_share");
160REPLICATE(cvar_cl_accuracy_data_receive,
bool,
"cl_accuracy_data_receive");
bool accuracy_send(entity this, entity to, int sf)
void accuracy_add(entity this, Weapon w, float fired, float hit, float real)
update accuracy stats
void accuracy_free(entity e)
void accuracy_init(entity e)
init/free
bool accuracy_isgooddamage(entity attacker, entity targ)
does this damage count towards accuracy stats?
bool accuracy_canbegooddamage(entity attacker)
if damage were to occur, would accuracy_isgooddamage be able to return true?
void accuracy_reset(entity e)
void accuracy_resend(entity e)
force a resend of a player's accuracy stats
int accuracy_byte(float n, float d)
float autocvar_sv_accuracy_data_share
Weapon Accuracy stats.
#define MUTATOR_CALLHOOK(id,...)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
#define WriteHeader(to, id)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
#define REPLICATE(...)
Replicates a client cvar into a server field.
#define new_pure(class)
purely logical entities (not linked to the area grid)
#define IS_INDEPENDENT_PLAYER(e)
ClientState CS(Client this)
#define FOREACH_CLIENT(cond, body)