#include "accuracy.qh"
-#include "../mutators/all.qh"
-#include "../../common/constants.qh"
-#include "../../common/teams.qh"
-#include "../../common/util.qh"
-#include "../../common/weapons/all.qh"
+#include "../mutators/_mod.qh"
+#include <common/constants.qh>
+#include <common/net_linked.qh>
+#include <common/teams.qh>
+#include <common/util.qh>
+#include <common/weapons/_all.qh>
int accuracy_byte(float n, float d)
{
entity a = this.owner;
if (IS_SPEC(a)) a = a.enemy;
- a = a.accuracy;
+ a = CS(a).accuracy;
if (to != a.owner)
- if (!autocvar_sv_accuracy_data_share && !a.owner.cvar_cl_accuracy_data_share)
+ if (!autocvar_sv_accuracy_data_share && !CS(a.owner).cvar_cl_accuracy_data_share)
sf = 0;
// note: zero sendflags can never be sent... so we can use that to say that we send no accuracy!
WriteInt24_t(MSG_ENTITY, sf);
// init/free
void accuracy_init(entity e)
{
- entity a = e.accuracy = new(accuracy);
- make_pure(a);
+ entity a = CS(e).accuracy = new_pure(accuracy);
a.owner = e;
a.drawonlytoclient = e;
Net_LinkEntity(a, false, 0, accuracy_send);
void accuracy_free(entity e)
{
- remove(e.accuracy);
+ delete(CS(e).accuracy);
}
// force a resend of a player's accuracy stats
void accuracy_resend(entity e)
{
- e.accuracy.SendFlags = 0xFFFFFF;
+ CS(e).accuracy.SendFlags = 0xFFFFFF;
}
// update accuracy stats
void accuracy_add(entity this, int w, int fired, int hit)
{
if (IS_INDEPENDENT_PLAYER(this)) return;
- entity a = this.accuracy;
+ entity a = CS(this).accuracy;
if (!a) return;
if (!hit && !fired) return;
w -= WEP_FIRST;
if (b == accuracy_byte(a.accuracy_hit[w], a.accuracy_fired[w])) return; // no change
int sf = 1 << (w % 24);
a.SendFlags |= sf;
- entity e; FOR_EACH_CLIENT(e) if (IS_SPEC(e)) if (e.enemy == this) {
- e.accuracy.SendFlags |= sf;
- }
+ FOREACH_CLIENT(IS_SPEC(it) && it.enemy == this, { CS(it).accuracy.SendFlags |= sf; });
}
bool accuracy_isgooddamage(entity attacker, entity targ)
int mutator_check = MUTATOR_CALLHOOK(AccuracyTargetValid, attacker, targ);
if (warmup_stage) return false;
- if (targ.deadflag != DEAD_NO) return false;
- if (targ.frozen) return false;
+ if (IS_DEAD(targ)) return false;
+ if (STAT(FROZEN, targ)) return false;
if (SAME_TEAM(attacker, targ)) return false;
if (mutator_check == MUT_ACCADD_INVALID) return true;