}
#endif
#ifdef SVQC
-.float metertime = _STAT(NB_METERSTART);
-
.entity ballcarried;
int autocvar_g_nexball_goalleadlimit;
ownr.effects &= ~autocvar_g_nexball_basketball_effects_default;
ownr.ballcarried = NULL;
GameRules_scoring_vip(ownr, false);
- if(ownr.metertime)
+ if(STAT(NB_METERSTART, ownr))
{
- ownr.metertime = 0;
+ STAT(NB_METERSTART, ownr) = 0;
ownr.(weaponentity).state = WS_READY;
}
WaypointSprite_Kill(ownr.waypointsprite_attachedforcarrier);
setthink(ball, ResetBall);
ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.teamtime);
- if(ball.owner.metertime)
+ if(STAT(NB_METERSTART, ball.owner))
{
- ball.owner.metertime = 0;
+ STAT(NB_METERSTART, ball.owner) = 0;
.entity weaponentity = ball.weaponentity_fld;
ball.owner.(weaponentity).state = WS_READY;
}
entity spectatee = M_ARGV(0, entity);
entity client = M_ARGV(1, entity);
- client.metertime = spectatee.metertime;
+ STAT(NB_METERSTART, client) = STAT(NB_METERSTART, spectatee);
}
MUTATOR_HOOKFUNCTION(nb, PlayerSpawn)
{
entity player = M_ARGV(0, entity);
- player.metertime = 0;
+ STAT(NB_METERSTART, player) = 0;
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
if(autocvar_g_nexball_basketball_meter)
{
- if(actor.ballcarried && !actor.metertime)
- actor.metertime = time;
+ if(actor.ballcarried && !STAT(NB_METERSTART, actor))
+ STAT(NB_METERSTART, actor) = time;
else
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
}
- if(!(fire & 1) && actor.metertime && actor.ballcarried)
+ if(!(fire & 1) && STAT(NB_METERSTART, actor) && actor.ballcarried)
{
- W_Nexball_Attack(actor, weaponentity, time - actor.metertime);
+ W_Nexball_Attack(actor, weaponentity, time - STAT(NB_METERSTART, actor));
// DropBall or stealing will set metertime back to 0
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, NULL);
if(trace_startsolid)
{
- if(actor.metertime)
- actor.metertime = 0; // Shot failed, hide the power meter
+ if(STAT(NB_METERSTART, actor))
+ STAT(NB_METERSTART, actor) = 0; // Shot failed, hide the power meter
return;
}
{
if(STAT(FROZEN, this) == 2)
{
- this.revive_progress = bound(0, this.revive_progress + this.ticrate * this.revive_speed, 1);
- this.health = max(1, this.revive_progress * this.max_health);
- this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
+ STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + this.ticrate * this.revive_speed, 1);
+ this.health = max(1, STAT(REVIVE_PROGRESS, this) * this.max_health);
+ this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1);
if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite)
WaypointSprite_UpdateHealth(this.sprite, this.health);
- if(this.revive_progress >= 1)
+ if(STAT(REVIVE_PROGRESS, this) >= 1)
Unfreeze(this);
}
else if(STAT(FROZEN, this) == 3)
{
- this.revive_progress = bound(0, this.revive_progress - this.ticrate * this.revive_speed, 1);
- this.health = max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * this.revive_progress );
+ STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - this.ticrate * this.revive_speed, 1);
+ this.health = max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this) );
if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite)
WaypointSprite_UpdateHealth(this.sprite, this.health);
this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, DMG_NOWEP, this.origin, '0 0 0');
}
- else if ( this.revive_progress <= 0 )
+ else if ( STAT(REVIVE_PROGRESS, this) <= 0 )
Unfreeze(this);
}
// otherwise, no revival!
}
#ifdef SVQC
- // .int buffs = _STAT(BUFFS);
void buff_Init(entity ent);
void buff_Init_Compat(entity ent, entity replacement);
#define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
- this.buffs = b.m_itemid; \
+ STAT(BUFFS, this) = b.m_itemid; \
this.team = t; \
buff_Init(this); \
}
#include <common/triggers/target/music.qh>
#include <common/gamemodes/_mod.qh>
-.float buff_time = _STAT(BUFF_TIME);
void buffs_DelayedInit(entity this);
AUTOCVAR(g_buffs, int, -1, "Enable buffs, -1: enabled but no auto location or replacing powerups, 1: enabled and can replace them");
if(!this.owner.buff_active && !this.owner.buff_activetime)
return false;
- if (view.buffs)
+ if (STAT(BUFFS, view))
{
- return CS(view).cvar_cl_buffs_autoreplace == false || view.buffs != this.owner.buffs;
+ return CS(view).cvar_cl_buffs_autoreplace == false || STAT(BUFFS, view) != STAT(BUFFS, this.owner);
}
return WaypointSprite_visible_for_player(this, player, view);
void buff_Waypoint_Spawn(entity e)
{
- entity buff = buff_FirstFromFlags(e.buffs);
+ entity buff = buff_FirstFromFlags(STAT(BUFFS, e));
entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, NULL, e.team, e, buff_waypoint, true, RADARICON_Buff);
wp.wp_extra = buff.m_id;
WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_Buff, e.glowmod);
return;
}
- if (toucher.buffs)
+ if (STAT(BUFFS, toucher))
{
- if (CS(toucher).cvar_cl_buffs_autoreplace && toucher.buffs != this.buffs)
+ if (CS(toucher).cvar_cl_buffs_autoreplace && STAT(BUFFS, toucher) != STAT(BUFFS, this))
{
- int buffid = buff_FirstFromFlags(toucher.buffs).m_id;
- //Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_DROP, toucher.buffs);
+ int buffid = buff_FirstFromFlags(STAT(BUFFS, toucher)).m_id;
+ //Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_DROP, STAT(BUFFS, toucher));
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ITEM_BUFF_LOST, toucher.netname, buffid);
- toucher.buffs = 0;
+ STAT(BUFFS, toucher) = 0;
//sound(toucher, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
}
else { return; } // do nothing
this.owner = toucher;
this.buff_active = false;
this.lifetime = 0;
- int buffid = buff_FirstFromFlags(this.buffs).m_id;
+ int buffid = buff_FirstFromFlags(STAT(BUFFS, this)).m_id;
Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_GOT, buffid);
Send_Notification(NOTIF_ALL_EXCEPT, toucher, MSG_INFO, INFO_ITEM_BUFF, toucher.netname, buffid);
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
sound(toucher, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM);
- toucher.buffs |= (this.buffs);
+ STAT(BUFFS, toucher) |= (STAT(BUFFS, this));
}
float buff_Available(entity buff)
});
entity newbuff = RandomSelection_chosen_ent;
newbuff.buff_seencount += 1; // lower chances of seeing this buff again soon
- ent.buffs = newbuff.m_itemid;
+ STAT(BUFFS, ent) = newbuff.m_itemid;
}
void buff_Think(entity this)
{
- if(this.buffs != this.oldbuffs)
+ if(STAT(BUFFS, this) != this.oldbuffs)
{
- entity buff = buff_FirstFromFlags(this.buffs);
+ entity buff = buff_FirstFromFlags(STAT(BUFFS, this));
this.color = buff.m_color;
this.glowmod = buff_GlowColor(buff);
this.skin = buff.m_skin;
WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + this.buff_activetime - frametime);
}
- this.oldbuffs = this.buffs;
+ this.oldbuffs = STAT(BUFFS, this);
}
if(!game_stopped)
}
if(!this.buff_active && !this.buff_activetime)
- if(!this.owner || STAT(FROZEN, this.owner) || IS_DEAD(this.owner) || !this.owner.iscreature || this.owner.vehicle || !(this.owner.buffs & this.buffs) || this.pickup_anyway > 0 || (this.pickup_anyway >= 0 && autocvar_g_buffs_pickup_anyway))
+ if(!this.owner || STAT(FROZEN, this.owner) || IS_DEAD(this.owner) || !this.owner.iscreature || this.owner.vehicle || !(STAT(BUFFS, this.owner) & STAT(BUFFS, this)) || this.pickup_anyway > 0 || (this.pickup_anyway >= 0 && autocvar_g_buffs_pickup_anyway))
{
buff_SetCooldown(this, autocvar_g_buffs_cooldown_respawn + frametime);
this.owner = NULL;
if(!teamplay && this.team) { this.team = 0; }
- entity buff = buff_FirstFromFlags(this.buffs);
+ entity buff = buff_FirstFromFlags(STAT(BUFFS, this));
- if(!this.buffs || !buff_Available(buff))
+ if(!STAT(BUFFS, this) || !buff_Available(buff))
buff_NewType(this);
this.classname = "item_buff";
else if (ent.spawnflags & 4)
ent.team = NUM_TEAM_2;
- ent.buffs = replacement.m_itemid;
+ STAT(BUFFS, ent) = replacement.m_itemid;
buff_Init(ent);
}
if(frag_deathtype == DEATH_BUFF.m_id) { return; }
- if(frag_target.buffs & BUFF_RESISTANCE.m_itemid)
+ if(STAT(BUFFS, frag_target) & BUFF_RESISTANCE.m_itemid)
{
float reduced = frag_damage * autocvar_g_buffs_resistance_blockpercent;
frag_damage = bound(0, frag_damage - reduced, frag_damage);
}
- if(frag_target.buffs & BUFF_SPEED.m_itemid)
+ if(STAT(BUFFS, frag_target) & BUFF_SPEED.m_itemid)
if(frag_target != frag_attacker)
frag_damage *= autocvar_g_buffs_speed_damage_take;
- if(frag_target.buffs & BUFF_MEDIC.m_itemid)
+ if(STAT(BUFFS, frag_target) & BUFF_MEDIC.m_itemid)
if((GetResourceAmount(frag_target, RESOURCE_HEALTH) - frag_damage) <= 0)
if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
if(frag_attacker)
if(random() <= autocvar_g_buffs_medic_survive_chance)
frag_damage = max(5, GetResourceAmount(frag_target, RESOURCE_HEALTH) - autocvar_g_buffs_medic_survive_health);
- if(frag_target.buffs & BUFF_JUMP.m_itemid)
+ if(STAT(BUFFS, frag_target) & BUFF_JUMP.m_itemid)
if(frag_deathtype == DEATH_FALL.m_id)
frag_damage = 0;
- if(frag_target.buffs & BUFF_VENGEANCE.m_itemid)
+ if(STAT(BUFFS, frag_target) & BUFF_VENGEANCE.m_itemid)
if(frag_attacker)
if(frag_attacker != frag_target)
if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
dmgent.nextthink = time + 0.1;
}
- if(frag_target.buffs & BUFF_BASH.m_itemid)
+ if(STAT(BUFFS, frag_target) & BUFF_BASH.m_itemid)
if(frag_attacker != frag_target)
frag_force = '0 0 0';
- if(frag_attacker.buffs & BUFF_BASH.m_itemid)
+ if(STAT(BUFFS, frag_attacker) & BUFF_BASH.m_itemid)
if(frag_force)
if(frag_attacker == frag_target)
frag_force *= autocvar_g_buffs_bash_force_self;
else
frag_force *= autocvar_g_buffs_bash_force;
- if(frag_attacker.buffs & BUFF_DISABILITY.m_itemid)
+ if(STAT(BUFFS, frag_attacker) & BUFF_DISABILITY.m_itemid)
if(frag_target != frag_attacker)
frag_target.buff_disability_time = time + autocvar_g_buffs_disability_slowtime;
- if(frag_target.buffs & BUFF_INFERNO.m_itemid)
+ if(STAT(BUFFS, frag_target) & BUFF_INFERNO.m_itemid)
{
if(frag_deathtype == DEATH_FIRE.m_id)
frag_damage = 0;
frag_damage *= 0.5; // TODO: cvarize?
}
- if(frag_attacker.buffs & BUFF_LUCK.m_itemid)
+ if(STAT(BUFFS, frag_attacker) & BUFF_LUCK.m_itemid)
if(frag_attacker != frag_target)
if(autocvar_g_buffs_luck_damagemultiplier > 0)
if(random() <= autocvar_g_buffs_luck_chance)
frag_damage *= autocvar_g_buffs_luck_damagemultiplier;
- if(frag_attacker.buffs & BUFF_INFERNO.m_itemid)
+ if(STAT(BUFFS, frag_attacker) & BUFF_INFERNO.m_itemid)
if(frag_target != frag_attacker) {
float btime = buff_Inferno_CalculateTime(
frag_damage,
}
// this... is ridiculous (TODO: fix!)
- if(frag_attacker.buffs & BUFF_VAMPIRE.m_itemid)
+ if(STAT(BUFFS, frag_attacker) & BUFF_VAMPIRE.m_itemid)
if(!frag_target.vehicle)
if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
if(!IS_DEAD(frag_target))
{
entity player = M_ARGV(0, entity);
- player.buffs = 0;
- player.buff_time = 0;
+ STAT(BUFFS, player) = 0;
+ STAT(BUFF_TIME, player) = 0;
PS(player).buff_shield = time + 0.5; // prevent picking up buffs immediately
// reset timers here to prevent them continuing after re-spawn
player.buff_disability_time = 0;
entity player = M_ARGV(0, entity);
// these automatically reset, no need to worry
- if(player.buffs & BUFF_SPEED.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_SPEED.m_itemid)
STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_buffs_speed_speed;
if(time < player.buff_disability_time)
entity player = M_ARGV(0, entity);
// these automatically reset, no need to worry
- if(player.buffs & BUFF_JUMP.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_JUMP.m_itemid)
STAT(MOVEVARS_JUMPVELOCITY, player) = autocvar_g_buffs_jump_height;
}
{
entity frag_target = M_ARGV(2, entity);
- if(frag_target.buffs)
+ if(STAT(BUFFS, frag_target))
{
- int buffid = buff_FirstFromFlags(frag_target.buffs).m_id;
+ int buffid = buff_FirstFromFlags(STAT(BUFFS, frag_target)).m_id;
Send_Notification(NOTIF_ALL_EXCEPT, frag_target, MSG_INFO, INFO_ITEM_BUFF_LOST, frag_target.netname, buffid);
- frag_target.buffs = 0;
+ STAT(BUFFS, frag_target) = 0;
if(frag_target.buff_model)
{
entity player = M_ARGV(0, entity);
- if(player.buffs)
+ if(STAT(BUFFS, player))
{
- int buffid = buff_FirstFromFlags(player.buffs).m_id;
+ int buffid = buff_FirstFromFlags(STAT(BUFFS, player)).m_id;
Send_Notification(NOTIF_ONE, player, MSG_MULTI, ITEM_BUFF_DROP, buffid);
Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
- player.buffs = 0;
+ STAT(BUFFS, player) = 0;
PS(player).buff_shield = time + max(0, autocvar_g_buffs_pickup_delay);
- //player.buff_time = 0; // already notified
+ //STAT(BUFF_TIME, player) = 0; // already notified
sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
return true;
}
if(MUTATOR_RETURNVALUE || game_stopped) return;
entity player = M_ARGV(0, entity);
- if(player.buffs & BUFF_SWAPPER.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_SWAPPER.m_itemid)
{
float best_distance = autocvar_g_buffs_swapper_range;
entity closest = NULL;
sound(closest, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM);
// TODO: add a counter to handle how many times one can teleport, and a delay to prevent spam
- player.buffs = 0;
+ STAT(BUFFS, player) = 0;
return true;
}
}
// if you have the invisibility powerup, sprites ALWAYS are restricted to your team
// but only apply this to real players, not to spectators
- if((wp.owner.flags & FL_CLIENT) && (wp.owner.buffs & BUFF_INVISIBLE.m_itemid) && (e == player))
+ if((wp.owner.flags & FL_CLIENT) && (STAT(BUFFS, wp.owner) & BUFF_INVISIBLE.m_itemid) && (e == player))
if(DIFF_TEAM(wp.owner, e))
return true;
}
{
entity player = M_ARGV(1, entity);
- if(player.buffs & BUFF_SPEED.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_SPEED.m_itemid)
M_ARGV(0, float) *= autocvar_g_buffs_speed_rate;
if(time < player.buff_disability_time)
{
entity player = M_ARGV(1, entity);
- if(player.buffs & BUFF_SPEED.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_SPEED.m_itemid)
M_ARGV(0, float) *= autocvar_g_buffs_speed_weaponspeed;
if(time < player.buff_disability_time)
if(game_stopped || IS_DEAD(player) || frametime || !IS_PLAYER(player)) return;
- if(player.buffs & BUFF_FLIGHT.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_FLIGHT.m_itemid)
{
if(!PHYS_INPUT_BUTTON_CROUCH(player))
player.buff_flight_crouchheld = false;
// 2: notify carrier as well
int buff_lost = 0;
- if(player.buff_time && player.buffs)
- if(time >= player.buff_time)
+ if(STAT(BUFF_TIME, player) && STAT(BUFFS, player))
+ if(time >= STAT(BUFF_TIME, player))
{
- player.buff_time = 0;
+ STAT(BUFF_TIME, player) = 0;
buff_lost = 2;
}
if(buff_lost)
{
- if(player.buffs)
+ if(STAT(BUFFS, player))
{
- int buffid = buff_FirstFromFlags(player.buffs).m_id;
+ int buffid = buff_FirstFromFlags(STAT(BUFFS, player)).m_id;
if(buff_lost == 2)
{
Send_Notification(NOTIF_ONE, player, MSG_MULTI, ITEM_BUFF_DROP, buffid); // TODO: special timeout message?
}
else
Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
- player.buffs = 0;
+ STAT(BUFFS, player) = 0;
PS(player).buff_shield = time + max(0, autocvar_g_buffs_pickup_delay); // always put in a delay, even if small
}
}
- if(player.buffs & BUFF_MAGNET.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_MAGNET.m_itemid)
{
vector pickup_size;
IL_EACH(g_items, it.itemdef,
{
- if(it.buffs)
+ if(STAT(BUFFS, it))
pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_buff;
else
pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_item;
});
}
- if(player.buffs & BUFF_AMMO.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_AMMO.m_itemid)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
}
}
- if((player.buffs & BUFF_INVISIBLE.m_itemid) && (player.oldbuffs & BUFF_INVISIBLE.m_itemid))
+ if((STAT(BUFFS, player) & BUFF_INVISIBLE.m_itemid) && (player.oldbuffs & BUFF_INVISIBLE.m_itemid))
player.alpha = ((autocvar_g_buffs_invisible_alpha) ? autocvar_g_buffs_invisible_alpha : -1); // powerups reset alpha, so we must enforce this (TODO)
- if(player.buffs & BUFF_MEDIC.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_MEDIC.m_itemid)
if(time >= player.buff_medic_healtime)
{
buff_Medic_Heal(player);
player.buff_medic_healtime = time + autocvar_g_buffs_medic_heal_delay;
}
-#define BUFF_ONADD(b) if ( (player.buffs & (b).m_itemid) && !(player.oldbuffs & (b).m_itemid))
-#define BUFF_ONREM(b) if (!(player.buffs & (b).m_itemid) && (player.oldbuffs & (b).m_itemid))
+#define BUFF_ONADD(b) if ( (STAT(BUFFS, player) & (b).m_itemid) && !(player.oldbuffs & (b).m_itemid))
+#define BUFF_ONREM(b) if (!(STAT(BUFFS, player) & (b).m_itemid) && (player.oldbuffs & (b).m_itemid))
- if(player.buffs != player.oldbuffs)
+ if(STAT(BUFFS, player) != player.oldbuffs)
{
- entity buff = buff_FirstFromFlags(player.buffs);
+ entity buff = buff_FirstFromFlags(STAT(BUFFS, player));
float bufftime = buff != BUFF_Null ? buff.m_time(buff) : 0;
- player.buff_time = (bufftime) ? time + bufftime : 0;
+ STAT(BUFF_TIME, player) = (bufftime) ? time + bufftime : 0;
BUFF_ONADD(BUFF_AMMO)
{
player.buff_ammo_prev_infitems = (player.items & IT_UNLIMITED_WEAPON_AMMO);
player.items |= IT_UNLIMITED_WEAPON_AMMO;
- if(player.buffs & BUFF_AMMO.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_AMMO.m_itemid)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
else
player.items &= ~IT_UNLIMITED_WEAPON_AMMO;
- if(player.buffs & BUFF_AMMO.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_AMMO.m_itemid)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
BUFF_ONREM(BUFF_FLIGHT)
player.gravity = ((player.trigger_gravity_check) ? player.trigger_gravity_check.enemy.gravity : player.buff_flight_oldgravity);
- player.oldbuffs = player.buffs;
- if(player.buffs)
+ player.oldbuffs = STAT(BUFFS, player);
+ if(STAT(BUFFS, player))
{
if(!player.buff_model)
buffs_BuffModel_Spawn(player);
entity spectatee = M_ARGV(0, entity);
entity client = M_ARGV(1, entity);
- client.buffs = spectatee.buffs;
- client.buff_time = spectatee.buff_time;
+ STAT(BUFFS, client) = STAT(BUFFS, spectatee);
+ STAT(BUFF_TIME, client) = STAT(BUFF_TIME, spectatee);
}
MUTATOR_HOOKFUNCTION(buffs, PlayerRegen)
{
entity player = M_ARGV(0, entity);
- if(player.buffs & BUFF_MEDIC.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_MEDIC.m_itemid)
{
M_ARGV(2, float) = autocvar_g_buffs_medic_rot; // rot_mod
M_ARGV(4, float) = M_ARGV(1, float) = autocvar_g_buffs_medic_max; // limit_mod = max_mod
M_ARGV(2, float) = autocvar_g_buffs_medic_regen; // regen_mod
}
- if(player.buffs & BUFF_SPEED.m_itemid)
+ if(STAT(BUFFS, player) & BUFF_SPEED.m_itemid)
M_ARGV(2, float) = autocvar_g_buffs_speed_regen; // regen_mod
}
void nade_burn_spawn(entity _nade)
{
- CSQCProjectile(_nade, true, Nades_from(_nade.nade_type).m_projectile[true], true);
+ CSQCProjectile(_nade, true, Nades_from(STAT(NADE_BONUS_TYPE, _nade)).m_projectile[true], true);
}
void nade_spawn(entity _nade)
_nade.effects |= EF_LOWPRECISION;
- CSQCProjectile(_nade, true, Nades_from(_nade.nade_type).m_projectile[false], true);
+ CSQCProjectile(_nade, true, Nades_from(STAT(NADE_BONUS_TYPE, _nade)).m_projectile[false], true);
}
void napalm_damage(entity this, float dist, float damage, float edgedamage, float burntime)
if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) )
{
entity show_red = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
- show_red.stat_healing_orb = time+0.1;
- show_red.stat_healing_orb_alpha = 0.75 * (this.ltime - time) / this.orb_lifetime;
+ STAT(HEALING_ORB, show_red) = time+0.1;
+ STAT(HEALING_ORB_ALPHA, show_red) = 0.75 * (this.ltime - time) / this.orb_lifetime;
}
}
entity expef = NULL;
bool nade_blast = true;
- switch ( Nades_from(this.nade_type) )
+ switch ( Nades_from(STAT(NADE_BONUS_TYPE, this)) )
{
case NADE_TYPE_NAPALM:
nade_blast = autocvar_g_nades_napalm_blast;
}
if(this.takedamage)
- switch ( Nades_from(this.nade_type) )
+ switch ( Nades_from(STAT(NADE_BONUS_TYPE, this)) )
{
case NADE_TYPE_NAPALM: nade_napalm_boom(this); break;
case NADE_TYPE_ICE: nade_ice_boom(this); break;
void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype);
void nade_pickup(entity this, entity thenade)
{
- spawn_held_nade(this, thenade.realowner, autocvar_g_nades_pickup_time, thenade.nade_type, thenade.pokenade_type);
+ spawn_held_nade(this, thenade.realowner, autocvar_g_nades_pickup_time, STAT(NADE_BONUS_TYPE, thenade), thenade.pokenade_type);
// set refire so player can't even
this.nade_refire = time + autocvar_g_nades_nade_refire;
- this.nade_timer = 0;
+ STAT(NADE_TIMER, this) = 0;
if(this.nade)
this.nade.nade_time_primed = thenade.nade_time_primed;
return;
}
- if(this.nade_type == NADE_TYPE_TRANSLOCATE.m_id || this.nade_type == NADE_TYPE_SPAWN.m_id)
+ if(STAT(NADE_BONUS_TYPE, this) == NADE_TYPE_TRANSLOCATE.m_id || STAT(NADE_BONUS_TYPE, this) == NADE_TYPE_SPAWN.m_id)
return;
if (MUTATOR_CALLHOOK(Nade_Damage, this, DEATH_WEAPONOF(deathtype), force, damage)) {}
SetResourceAmount(this, RESOURCE_HEALTH, hp);
- if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
+ if ( STAT(NADE_BONUS_TYPE, this) != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
this.realowner = attacker;
if(hp <= 0)
IL_PUSH(g_bot_dodge, _nade);
_nade.projectiledeathtype = DEATH_NADE.m_id;
_nade.toss_time = time;
- _nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX);
+ _nade.solid = SOLID_CORPSE; //((STAT(NADE_BONUS_TYPE, _nade) == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX);
- if(_nade.nade_type == NADE_TYPE_TRANSLOCATE.m_id || _nade.nade_type == NADE_TYPE_SPAWN.m_id)
+ if(STAT(NADE_BONUS_TYPE, _nade) == NADE_TYPE_TRANSLOCATE.m_id || STAT(NADE_BONUS_TYPE, _nade) == NADE_TYPE_SPAWN.m_id)
_nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
else
_nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
}
e.nade_refire = time + autocvar_g_nades_nade_refire;
- e.nade_timer = 0;
+ STAT(NADE_TIMER, e) = 0;
}
void nades_GiveBonus(entity player, float score)
if (autocvar_g_nades)
if (autocvar_g_nades_bonus)
if (IS_REAL_CLIENT(player))
- if (IS_PLAYER(player) && player.bonus_nades < autocvar_g_nades_bonus_max)
+ if (IS_PLAYER(player) && STAT(NADE_BONUS, player) < autocvar_g_nades_bonus_max)
if (STAT(FROZEN, player) == 0)
if (!IS_DEAD(player))
{
- if ( player.bonus_nade_score < 1 )
- player.bonus_nade_score += score/autocvar_g_nades_bonus_score_max;
+ if ( STAT(NADE_BONUS_SCORE, player) < 1 )
+ STAT(NADE_BONUS_SCORE, player) += score/autocvar_g_nades_bonus_score_max;
- if ( player.bonus_nade_score >= 1 )
+ if ( STAT(NADE_BONUS_SCORE, player) >= 1 )
{
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_BONUS);
play2(player, SND(KH_ALARM));
- player.bonus_nades++;
- player.bonus_nade_score -= 1;
+ STAT(NADE_BONUS, player)++;
+ STAT(NADE_BONUS_SCORE, player) -= 1;
}
}
}
/** Remove all bonus nades from a player */
void nades_RemoveBonus(entity player)
{
- player.bonus_nades = player.bonus_nade_score = 0;
+ STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0;
}
MUTATOR_HOOKFUNCTION(nades, PutClientInServer)
{
//this.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
if(!this.traileffectnum)
- this.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(this.nade_type).m_projectile[false], this.team).eent_eff_name);
+ this.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(STAT(NADE_BONUS_TYPE, this)).m_projectile[false], this.team).eent_eff_name);
this.alpha = 1;
}
{
entity n = new(nade), fn = new(fake_nade);
- n.nade_type = max(1, ntype);
+ STAT(NADE_BONUS_TYPE, n) = max(1, ntype);
n.pokenade_type = pntype;
- if(Nades_from(n.nade_type) == NADE_TYPE_Null)
- n.nade_type = NADE_TYPE_NORMAL.m_id;
+ if(Nades_from(STAT(NADE_BONUS_TYPE, n)) == NADE_TYPE_Null)
+ STAT(NADE_BONUS_TYPE, n) = NADE_TYPE_NORMAL.m_id;
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
//setattachment(n, player, "bip01 l hand");
n.exteriormodeltoclient = player;
setcefc(n, nade_customize);
- n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], player.team).eent_eff_name);
- n.colormod = Nades_from(n.nade_type).m_color;
+ n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(STAT(NADE_BONUS_TYPE, n)).m_projectile[false], player.team).eent_eff_name);
+ n.colormod = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_color;
n.realowner = nowner;
n.colormap = player.colormap;
n.glowmod = player.glowmod;
setmodel(fn, MDL_NADE_VIEW);
setattachment(fn, player.(weaponentity), "");
fn.realowner = fn.owner = player;
- fn.colormod = Nades_from(n.nade_type).m_color;
+ fn.colormod = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_color;
fn.colormap = player.colormap;
fn.glowmod = player.glowmod;
setthink(fn, SUB_Remove);
void nade_prime(entity this)
{
if(autocvar_g_nades_bonus_only)
- if(!this.bonus_nades)
+ if(!STAT(NADE_BONUS, this))
return; // only allow bonus nades
if(this.nade)
int ntype;
string pntype = this.pokenade_type;
- if(this.items & ITEM_Strength.m_itemid && autocvar_g_nades_bonus_onstrength)
- ntype = this.nade_type;
- else if (this.bonus_nades >= 1)
+ if((this.items & ITEM_Strength.m_itemid) && autocvar_g_nades_bonus_onstrength)
+ ntype = STAT(NADE_BONUS_TYPE, this);
+ else if (STAT(NADE_BONUS, this) >= 1)
{
- ntype = this.nade_type;
+ ntype = STAT(NADE_BONUS_TYPE, this);
pntype = this.pokenade_type;
- this.bonus_nades -= 1;
+ STAT(NADE_BONUS, this) -= 1;
}
else
{
delete(player.fake_nade);
player.nade = player.fake_nade = NULL;
- player.nade_timer = 0;
+ STAT(NADE_TIMER, player) = 0;
}
MUTATOR_HOOKFUNCTION(nades, VehicleEnter)
entity held_nade = player.nade;
if (held_nade)
{
- player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / held_nade.nade_lifetime, 1);
- // LOG_TRACEF("%d %d", player.nade_timer, time - held_nade.nade_time_primed);
+ STAT(NADE_TIMER, player) = bound(0, (time - held_nade.nade_time_primed) / held_nade.nade_lifetime, 1);
+ // LOG_TRACEF("%d %d", STAT(NADE_TIMER, player), time - held_nade.nade_time_primed);
makevectors(player.angles);
held_nade.velocity = player.velocity;
setorigin(held_nade, player.origin + player.view_ofs + v_forward * 8 + v_right * -8 + v_up * 0);
if(autocvar_g_nades_bonus_client_select)
{
- player.nade_type = CS(player).cvar_cl_nade_type;
+ STAT(NADE_BONUS_TYPE, player) = CS(player).cvar_cl_nade_type;
player.pokenade_type = CS(player).cvar_cl_pokenade_type;
}
else
{
- player.nade_type = autocvar_g_nades_bonus_type;
+ STAT(NADE_BONUS_TYPE, player) = autocvar_g_nades_bonus_type;
player.pokenade_type = autocvar_g_nades_pokenade_monster_type;
}
- player.nade_type = bound(1, player.nade_type, Nades_COUNT);
+ STAT(NADE_BONUS_TYPE, player) = bound(1, STAT(NADE_BONUS_TYPE, player), Nades_COUNT);
- if(player.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
+ if(STAT(NADE_BONUS_SCORE, player) >= 0 && autocvar_g_nades_bonus_score_max)
nades_GiveBonus(player, time_score / autocvar_g_nades_bonus_score_max);
}
else
{
- player.bonus_nades = player.bonus_nade_score = 0;
+ STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0;
}
}
if(n > 0 && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
{
- player.revive_progress = bound(0, player.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
- SetResourceAmount(player, RESOURCE_HEALTH, max(1, player.revive_progress * start_health));
+ STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
+ SetResourceAmount(player, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
- if(player.revive_progress >= 1)
+ if(STAT(REVIVE_PROGRESS, player) >= 1)
{
Unfreeze(player);
}
FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
- it.revive_progress = player.revive_progress;
+ STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
it.reviving = false;
});
}
player.nade_refire = time + autocvar_g_nades_nade_refire;
if(autocvar_g_nades_bonus_client_select)
- player.nade_type = CS(player).cvar_cl_nade_type;
+ STAT(NADE_BONUS_TYPE, player) = CS(player).cvar_cl_nade_type;
- player.nade_timer = 0;
+ STAT(NADE_TIMER, player) = 0;
if (!player.offhand) player.offhand = OFFHAND_NADE;
entity spectatee = M_ARGV(0, entity);
entity client = M_ARGV(1, entity);
- client.nade_timer = spectatee.nade_timer;
- client.nade_type = spectatee.nade_type;
+ STAT(NADE_TIMER, client) = STAT(NADE_TIMER, spectatee);
+ STAT(NADE_BONUS_TYPE, client) = STAT(NADE_BONUS_TYPE, spectatee);
client.pokenade_type = spectatee.pokenade_type;
- client.bonus_nades = spectatee.bonus_nades;
- client.bonus_nade_score = spectatee.bonus_nade_score;
- client.stat_healing_orb = spectatee.stat_healing_orb;
- client.stat_healing_orb_alpha = spectatee.stat_healing_orb_alpha;
+ STAT(NADE_BONUS, client) = STAT(NADE_BONUS, spectatee);
+ STAT(NADE_BONUS_SCORE, client) = STAT(NADE_BONUS_SCORE, spectatee);
+ STAT(HEALING_ORB, client) = STAT(HEALING_ORB, spectatee);
+ STAT(HEALING_ORB_ALPHA, client) = STAT(HEALING_ORB_ALPHA, spectatee);
STAT(ENTRAP_ORB, client) = STAT(ENTRAP_ORB, spectatee);
STAT(ENTRAP_ORB_ALPHA, client) = STAT(ENTRAP_ORB_ALPHA, spectatee);
}
.entity nade;
.entity fake_nade;
-.float nade_timer = _STAT(NADE_TIMER);
.float nade_refire;
-.float bonus_nades = _STAT(NADE_BONUS);
.float nade_special_time;
-.float bonus_nade_score = _STAT(NADE_BONUS_SCORE);
-.int nade_type = _STAT(NADE_BONUS_TYPE);
.string pokenade_type;
.entity nade_damage_target;
.float cvar_cl_nade_type;
.string cvar_cl_pokenade_type;
.float toss_time;
-.float stat_healing_orb = _STAT(HEALING_ORB);
-.float stat_healing_orb_alpha = _STAT(HEALING_ORB_ALPHA);
.float nade_show_particles;
bool orb_send(entity this, entity to, int sf);
.float lastflags;
.float lastground;
.float wasFlying;
-#ifdef SVQC
-.float spectatorspeed = _STAT(SPECTATORSPEED);
-#elif defined(CSQC)
-.float spectatorspeed;
-#endif
.int buttons_old;
.vector movement_old;
void PM_UpdateButtons(entity this, entity store);
+ // TODO: modify maxspeed_mod and get rid of these!
.float stat_sv_airspeedlimit_nonqw = _STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW);
.float stat_sv_maxspeed = _STAT(MOVEVARS_MAXSPEED);
LABEL(pickup)
- toucher.last_pickup = time;
+ STAT(LAST_PICKUP, toucher) = time;
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
_sound (toucher, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
s = Buff_UndeprecateName(argv(j));
if(s == it.m_name)
{
- this.buffs |= (it.m_itemid);
+ STAT(BUFFS, this) |= (it.m_itemid);
break;
}
});
if(this.ammo_fuel != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_fuel), "fuel");
if(this.health != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.health), "health");
if(this.armorvalue != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.armorvalue), "armor");
- FOREACH(Buffs, it != BUFF_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(this.buffs & (it.m_itemid)), it.m_name));
+ FOREACH(Buffs, it != BUFF_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(STAT(BUFFS, this) & (it.m_itemid)), it.m_name));
FOREACH(Weapons, it != WEP_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(this.weapons & (it.m_wepset)), it.netname));
}
this.netname = strzone(this.netname);
bool GiveBuff(entity e, Buff thebuff, int op, int val)
{
- bool had_buff = (e.buffs & thebuff.m_itemid);
+ bool had_buff = (STAT(BUFFS, e) & thebuff.m_itemid);
switch(op)
{
case OP_SET:
if(val > 0)
- e.buffs |= thebuff.m_itemid;
+ STAT(BUFFS, e) |= thebuff.m_itemid;
else
- e.buffs &= ~thebuff.m_itemid;
+ STAT(BUFFS, e) &= ~thebuff.m_itemid;
break;
case OP_MIN:
case OP_PLUS:
if(val > 0)
- e.buffs |= thebuff.m_itemid;
+ STAT(BUFFS, e) |= thebuff.m_itemid;
break;
case OP_MAX:
if(val <= 0)
- e.buffs &= ~thebuff.m_itemid;
+ STAT(BUFFS, e) &= ~thebuff.m_itemid;
break;
case OP_MINUS:
if(val > 0)
- e.buffs &= ~thebuff.m_itemid;
+ STAT(BUFFS, e) &= ~thebuff.m_itemid;
break;
}
- bool have_buff = (e.buffs & thebuff.m_itemid);
+ bool have_buff = (STAT(BUFFS, e) & thebuff.m_itemid);
return (had_buff != have_buff);
}
void secrets_setstatus(entity this)
{
- this.stat_secrets_total = secrets_total;
- this.stat_secrets_found = secrets_found;
+ // TODO: use global stats!
+ STAT(SECRETS_TOTAL, this) = secrets_total;
+ STAT(SECRETS_FOUND, this) = secrets_found;
}
/**
float secrets_found;
-.float stat_secrets_total = _STAT(SECRETS_TOTAL);
-.float stat_secrets_found = _STAT(SECRETS_FOUND);
-
/**
* update secrets status.
*/
_slot.PlayerPhysplug = _framefunc;
_slot.vehicle_exit = _exitfunc;
_slot.vehicle_enter = _enterfunc;
- _slot.hud = _hud;
+ STAT(HUD, _slot) = _hud;
_slot.vehicle_flags = VHF_PLAYERSLOT;
_slot.vehicle_viewport = spawn();
_slot.vehicle_hudmodel = spawn();
player.solid = SOLID_SLIDEBOX;
set_movetype(player, MOVETYPE_WALK);
player.effects &= ~EF_NODRAW;
- player.teleportable = TELEPORT_NORMAL;
+ player.teleportable = TELEPORT_NORMAL;
player.alpha = 1;
player.PlayerPhysplug = func_null;
player.vehicle = NULL;
- player.view_ofs = STAT(PL_VIEW_OFS, player);
- player.event_damage = PlayerDamage;
- player.hud = HUD_NORMAL;
+ player.view_ofs = STAT(PL_VIEW_OFS, player);
+ player.event_damage = PlayerDamage;
+ STAT(HUD, player) = HUD_NORMAL;
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++ slot)
{
.entity weaponentity = weaponentities[slot];
veh.(weaponentity) = new(temp_wepent);
veh.(weaponentity).m_switchweapon = pl.(weaponentity).m_switchweapon;
}
- pl.hud = veh.vehicleid;
+ STAT(HUD, pl) = veh.vehicleid;
pl.PlayerPhysplug = veh.PlayerPhysplug;
pl.vehicle_ammo1 = veh.vehicle_ammo1;
this.nextthink = time + autocvar_g_vehicles_thinkrate;
if(this.owner)
- this.owner.vehicle_weapon2mode = this.vehicle_weapon2mode;
+ STAT(VEHICLESTAT_W2MODE, this.owner) = STAT(VEHICLESTAT_W2MODE, this);
Vehicle info = Vehicles_from(this.vehicleid);
info.vr_think(info, this);
const float VHSF_NORMAL = 0;
const float VHSF_FACTORY = 2;
-.int hud = _STAT(HUD);
.float dmg_time;
.float play_time;
// vehicle functions
.void(int _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
.bool(entity this, int _imp) vehicles_impulse;
-.int vehicle_weapon2mode = _STAT(VEHICLESTAT_W2MODE);
.void(entity this, int exit_flags) vehicle_exit;
.bool(entity this, entity player) vehicle_enter;
const int VHEF_NORMAL = 0; /// User pressed exit key
player.PlayerPhysplug = func_null;
player.view_ofs = STAT(PL_VIEW_OFS, player);
player.event_damage = PlayerDamage;
- player.hud = HUD_NORMAL;
+ STAT(HUD, player) = HUD_NORMAL;
player.teleportable = TELEPORT_NORMAL;
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
set_movetype(player, MOVETYPE_NOCLIP);
player.event_damage = func_null;
player.view_ofs = '0 0 0';
- player.hud = gunner.hud;
+ STAT(HUD, player) = STAT(HUD, gunner);
player.teleportable = false;
player.PlayerPhysplug = gunner.PlayerPhysplug;
player.vehicle_ammo1 = vehic.vehicle_ammo1;
WriteAngle(MSG_ONE, 0); // roll
}
- CSQCVehicleSetup(player, player.hud);
+ CSQCVehicleSetup(player, STAT(HUD, player));
MUTATOR_CALLHOOK(VehicleEnter, player, gunner);
setorigin(this, vehic.origin + '0 0 32');
this.oldorigin = this.origin; // negate fall damage
- this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
+ STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
vector vf, ad;
// Target lock & predict
Weapon wep2a = WEP_RAPTOR_BOMB;
if(!forbidWeaponUse(this))
- if(vehic.vehicle_weapon2mode == RSM_BOMB)
+ if(STAT(VEHICLESTAT_W2MODE, vehic) == RSM_BOMB)
{
if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
if(PHYS_INPUT_BUTTON_ATCK2(this))
else
this.PlayerPhysplug = raptor_frame;
- this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
+ STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
if(vehic.vehicle_flags & VHF_SHIELDREGEN)
vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true);
switch(_imp)
{
case IMP_weapon_group_1.impulse:
- this.vehicle.vehicle_weapon2mode = RSM_BOMB;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_BOMB;
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_group_2.impulse:
- this.vehicle.vehicle_weapon2mode = RSM_FLARE;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_FLARE;
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_next_byid.impulse:
case IMP_weapon_next_bypriority.impulse:
case IMP_weapon_next_bygroup.impulse:
- this.vehicle.vehicle_weapon2mode += 1;
- if(this.vehicle.vehicle_weapon2mode > RSM_LAST)
- this.vehicle.vehicle_weapon2mode = RSM_FIRST;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) += 1;
+ if(STAT(VEHICLESTAT_W2MODE, this.vehicle) > RSM_LAST)
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_FIRST;
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_prev_byid.impulse:
case IMP_weapon_prev_bypriority.impulse:
case IMP_weapon_prev_bygroup.impulse:
- this.vehicle.vehicle_weapon2mode -= 1;
- if(this.vehicle.vehicle_weapon2mode < RSM_FIRST)
- this.vehicle.vehicle_weapon2mode = RSM_LAST;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) -= 1;
+ if(STAT(VEHICLESTAT_W2MODE, this.vehicle) < RSM_FIRST)
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_LAST;
CSQCVehicleSetup(this, 0);
return true;
}
METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
{
- instance.vehicle_weapon2mode = RSM_BOMB;
+ STAT(VEHICLESTAT_W2MODE, instance) = RSM_BOMB;
instance.owner.PlayerPhysplug = raptor_takeoff;
set_movetype(instance, MOVETYPE_BOUNCEMISSILE);
instance.solid = SOLID_SLIDEBOX;
.entity weaponentity = weaponentities[slot];
this.(weaponentity).m_switchweapon = WEP_Null;
}
- this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
+ STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
#if 1 // 0 to enable per-gun impact aux crosshairs
switch(_imp)
{
case IMP_weapon_group_1.impulse:
- this.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_VOLLY;
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_group_2.impulse:
- this.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_GUIDE;
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_group_3.impulse:
- this.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_ARTILLERY;
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_next_byid.impulse:
case IMP_weapon_next_bypriority.impulse:
case IMP_weapon_next_bygroup.impulse:
- this.vehicle.vehicle_weapon2mode += 1;
- if(this.vehicle.vehicle_weapon2mode > SBRM_LAST)
- this.vehicle.vehicle_weapon2mode = SBRM_FIRST;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) += 1;
+ if(STAT(VEHICLESTAT_W2MODE, this.vehicle) > SBRM_LAST)
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_FIRST;
- //centerprint(this, strcat("Rocket mode is ", ftos(this.vehicle.vehicle_weapon2mode)));
+ //centerprint(this, strcat("Rocket mode is ", ftos(STAT(VEHICLESTAT_W2MODE, this.vehicle))));
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_last.impulse:
case IMP_weapon_prev_byid.impulse:
case IMP_weapon_prev_bypriority.impulse:
case IMP_weapon_prev_bygroup.impulse:
- this.vehicle.vehicle_weapon2mode -= 1;
- if(this.vehicle.vehicle_weapon2mode < SBRM_FIRST)
- this.vehicle.vehicle_weapon2mode = SBRM_LAST;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) -= 1;
+ if(STAT(VEHICLESTAT_W2MODE, this.vehicle) < SBRM_FIRST)
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_LAST;
- //centerprint(this, strcat("Rocket mode is ", ftos(this.vehicle.vehicle_weapon2mode)));
+ //centerprint(this, strcat("Rocket mode is ", ftos(STAT(VEHICLESTAT_W2MODE, this.vehicle))));
CSQCVehicleSetup(this, 0);
return true;
}
METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
{
- instance.vehicle_weapon2mode = SBRM_GUIDE;
+ STAT(VEHICLESTAT_W2MODE, instance) = SBRM_GUIDE;
set_movetype(instance, MOVETYPE_WALK);
CSQCVehicleSetup(instance.owner, 0);
instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
if (this.wait != -10)
{
- if (PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.vehicle_weapon2mode == SBRM_GUIDE)
+ if (PHYS_INPUT_BUTTON_ATCK2(this.owner) && STAT(VEHICLESTAT_W2MODE, this) == SBRM_GUIDE)
{
if (this.wait == 1)
if (this.tur_head.frame == 9 || this.tur_head.frame == 1)
v = gettaginfo(this.tur_head,gettagindex(this.tur_head,"tag_fire"));
- switch(this.vehicle_weapon2mode)
+ switch(STAT(VEHICLESTAT_W2MODE, this))
{
case SBRM_VOLLY:
rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
if (this.tur_head.frame == 9)
this.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
else
- this.attack_finished_single[0] = ((this.vehicle_weapon2mode == SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
+ this.attack_finished_single[0] = ((STAT(VEHICLESTAT_W2MODE, this) == SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
this.gun2.cnt = time + this.attack_finished_single[0];
}
// make them match perfectly
#ifdef SVQC
// null during init
- if (this.owner) this.owner.stat_shotorg = compressed_shotorg;
+ if (this.owner) STAT(SHOTORG, this.owner) = compressed_shotorg;
this.movedir = decompressShotOrigin(compressed_shotorg);
#else
this.movedir = decompressShotOrigin(compressed_shotorg);
PHYS_WATERJUMP_TIME(this) -= dt;
this.movement = PHYS_INPUT_MOVEVALUES(this);
this.items = STAT(ITEMS, this);
- this.spectatorspeed = STAT(SPECTATORSPEED, this);
if (!(PHYS_INPUT_BUTTON_JUMP(this))) // !jump
UNSET_JUMP_HELD(this); // canjump = true
PM_ClientMovement_UpdateStatus(this);
if (!IS_PLAYER(this)) {
sys_phys_spectator_control(this);
- maxspeed_mod = this.spectatorspeed;
+ maxspeed_mod = STAT(SPECTATORSPEED, this);
}
sys_phys_fixspeed(this, maxspeed_mod);
void sys_phys_spectator_control(entity this)
{
float maxspeed_mod = autocvar_sv_spectator_speed_multiplier;
- if (!this.spectatorspeed) { this.spectatorspeed = maxspeed_mod; }
+ if (!STAT(SPECTATORSPEED, this)) { STAT(SPECTATORSPEED, this) = maxspeed_mod; }
if ((CS(this).impulse >= 1 && CS(this).impulse <= 19)
|| (CS(this).impulse >= 200 && CS(this).impulse <= 209)
|| (CS(this).impulse >= 220 && CS(this).impulse <= 229)
|| CS(this).impulse == 18
|| (CS(this).impulse >= 200 && CS(this).impulse <= 209)
) {
- this.spectatorspeed = bound(autocvar_sv_spectator_speed_multiplier_min, this.spectatorspeed + 0.5, autocvar_sv_spectator_speed_multiplier_max);
+ STAT(SPECTATORSPEED, this) = bound(autocvar_sv_spectator_speed_multiplier_min, STAT(SPECTATORSPEED, this) + 0.5, autocvar_sv_spectator_speed_multiplier_max);
} else if (CS(this).impulse == 11) {
- this.spectatorspeed = maxspeed_mod;
+ STAT(SPECTATORSPEED, this) = maxspeed_mod;
} else if (CS(this).impulse == 12
|| CS(this).impulse == 16
|| CS(this).impulse == 19
|| (CS(this).impulse >= 220 && CS(this).impulse <= 229)
) {
- this.spectatorspeed = bound(autocvar_sv_spectator_speed_multiplier_min, this.spectatorspeed - 0.5, autocvar_sv_spectator_speed_multiplier_max);
+ STAT(SPECTATORSPEED, this) = bound(autocvar_sv_spectator_speed_multiplier_min, STAT(SPECTATORSPEED, this) - 0.5, autocvar_sv_spectator_speed_multiplier_max);
} else if (CS(this).impulse >= 1 && CS(this).impulse <= 9) {
- this.spectatorspeed = 1 + 0.5 * (CS(this).impulse - 1);
+ STAT(SPECTATORSPEED, this) = 1 + 0.5 * (CS(this).impulse - 1);
}
} // otherwise just clear
CS(this).impulse = 0;
if(this.bot_attack)
IL_REMOVE(g_bot_targets, this);
this.bot_attack = false;
- this.hud = HUD_NORMAL;
+ STAT(HUD, this) = HUD_NORMAL;
TRANSMUTE(Observer, this);
this.iscreature = false;
this.teleportable = TELEPORT_SIMPLE;
this.death_time = 0;
this.respawn_flags = 0;
this.respawn_time = 0;
- this.stat_respawn_time = 0;
+ STAT(RESPAWN_TIME, this) = 0;
this.alpha = 0;
this.scale = 0;
this.fade_time = 0;
this.nextthink = 0;
this.deadflag = DEAD_NO;
this.crouch = false;
- this.revive_progress = 0;
+ STAT(REVIVE_PROGRESS, this) = 0;
this.revival_time = 0;
this.items = 0;
this.death_time = 0;
this.respawn_flags = 0;
this.respawn_time = 0;
- this.stat_respawn_time = 0;
+ STAT(RESPAWN_TIME, this) = 0;
this.scale = autocvar_sv_player_scale;
this.fade_time = 0;
this.pain_frame = 0;
this.strength_finished = 0;
this.invincible_finished = 0;
this.fire_endtime = -1;
- this.revive_progress = 0;
+ STAT(REVIVE_PROGRESS, this) = 0;
this.revival_time = 0;
this.air_finished = time + 12;
if(this.conveyor)
IL_REMOVE(g_conveyed, this);
this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
- this.hud = HUD_NORMAL;
+ STAT(HUD, this) = HUD_NORMAL;
this.event_damage = PlayerDamage;
this.health = spectatee.health;
CS(this).impulse = 0;
this.items = spectatee.items;
- this.last_pickup = spectatee.last_pickup;
- this.hit_time = spectatee.hit_time;
+ STAT(LAST_PICKUP, this) = STAT(LAST_PICKUP, spectatee);
+ STAT(HIT_TIME, this) = STAT(HIT_TIME, spectatee);
this.strength_finished = spectatee.strength_finished;
this.invincible_finished = spectatee.invincible_finished;
this.superweapons_finished = spectatee.superweapons_finished;
this.v_angle = spectatee.v_angle;
this.angles = spectatee.v_angle;
STAT(FROZEN, this) = STAT(FROZEN, spectatee);
- this.revive_progress = spectatee.revive_progress;
+ STAT(REVIVE_PROGRESS, this) = STAT(REVIVE_PROGRESS, spectatee);
this.viewloc = spectatee.viewloc;
if(!PHYS_INPUT_BUTTON_USE(this) && STAT(CAMERA_SPECTATOR, this) != 2)
this.fixangle = true;
SetZoomState(this, CS(spectatee).zoomstate);
anticheat_spectatecopy(this, spectatee);
- this.hud = spectatee.hud;
+ STAT(HUD, this) = STAT(HUD, spectatee);
if(spectatee.vehicle)
{
this.angles = spectatee.v_angle;
{
if (STAT(FROZEN, this) == 2)
{
- this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
- this.health = max(1, this.revive_progress * start_health);
- this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
+ STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + frametime * this.revive_speed, 1);
+ this.health = max(1, STAT(REVIVE_PROGRESS, this) * start_health);
+ this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1);
- if (this.revive_progress >= 1)
+ if (STAT(REVIVE_PROGRESS, this) >= 1)
Unfreeze(this);
}
else if (STAT(FROZEN, this) == 3)
{
- this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
- this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
+ STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - frametime * this.revive_speed, 1);
+ this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this) );
if (this.health < 1)
{
if(this.event_damage)
this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, DMG_NOWEP, this.origin, '0 0 0');
}
- else if (this.revive_progress <= 0)
+ else if (STAT(REVIVE_PROGRESS, this) <= 0)
Unfreeze(this);
}
}
{
actor.strength_finished = 0;
actor.invincible_finished = 0;
- actor.buffs = 0;
+ STAT(BUFFS, actor) = 0;
}
if (!(this.spawnflags & 16))
.float floodcontrol_voice;
.float floodcontrol_voiceteam;
-.float stat_shotorg = _STAT(SHOTORG); // networked stat for trueaim HUD
-
string matchid;
-.float last_pickup = _STAT(LAST_PICKUP);
-
-.float hit_time = _STAT(HIT_TIME);
-.float typehit_time = _STAT(TYPEHIT_TIME);
-.float kill_time = _STAT(KILL_TIME);
-
-.float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
-
bool radar_showennemies;
#ifdef PROFILING
.float player_blocked;
-.float revive_progress = _STAT(REVIVE_PROGRESS);
.float revival_time; // time at which player was last revived
.float revive_speed; // NOTE: multiplier (anything above 1 is instaheal)
.entity iceblock;
.entity muzzle_flash;
.float misc_bulletcounter; // replaces uzi & hlac bullet counter.
-.float stat_respawn_time = _STAT(RESPAWN_TIME); // shows respawn time, and is negative when awaiting respawn
-
.int killindicator_teamchange;
void PlayerUseKey(entity this);
return MUTATOR_CALLHOOK(FragCenterMessage, attacker, targ, deathtype, kill_count_to_attacker, kill_count_to_target);
}
-.int buffs = _STAT(BUFFS); // TODO: remove
entity buff_FirstFromFlags(int _buffs);
void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .entity weaponentity)
{
int f3 = 0;
if(deathtype == DEATH_BUFF.m_id)
- f3 = buff_FirstFromFlags(attacker.buffs).m_id;
+ f3 = buff_FirstFromFlags(STAT(BUFFS, attacker)).m_id;
if (!Obituary_WeaponDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, CS(targ).killcount, kill_count_to_attacker))
Obituary_SpecialDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, CS(targ).killcount, kill_count_to_attacker, f3);
float targ_maxhealth = ((IS_MONSTER(targ)) ? targ.max_health : start_health);
STAT(FROZEN, targ) = frozen_type;
- targ.revive_progress = ((frozen_type == 3) ? 1 : 0);
+ STAT(REVIVE_PROGRESS, targ) = ((frozen_type == 3) ? 1 : 0);
SetResourceAmount(targ, RESOURCE_HEALTH, ((frozen_type == 3) ? targ_maxhealth : 1));
targ.revive_speed = freeze_time;
if(targ.bot_attack)
}
STAT(FROZEN, targ) = 0;
- targ.revive_progress = 0;
+ STAT(REVIVE_PROGRESS, targ) = 0;
targ.revival_time = time;
if(!targ.bot_attack)
IL_PUSH(g_bot_targets, targ);
FOREACH_CLIENT(IS_REAL_CLIENT(it), {
entity e = IS_SPEC(it) ? it.enemy : it;
if (e.typehitsound) {
- it.typehit_time = time;
+ STAT(TYPEHIT_TIME, it) = time;
} else if (e.killsound) {
- it.kill_time = time;
+ STAT(KILL_TIME, it) = time;
} else if (e.damage_dealt) {
- it.hit_time = time;
- it.damage_dealt_total += ceil(e.damage_dealt);
+ STAT(HIT_TIME, it) = time;
+ STAT(DAMAGE_DEALT_TOTAL, it) += ceil(e.damage_dealt);
}
});
// add 1 frametime because after this, engine SV_Physics
.float lastground;
float total_players;
float redalive, bluealive, yellowalive, pinkalive;
-.float redalive_stat = _STAT(REDALIVE);
-.float bluealive_stat = _STAT(BLUEALIVE);
-.float yellowalive_stat = _STAT(YELLOWALIVE);
-.float pinkalive_stat = _STAT(PINKALIVE);
}
});
FOREACH_CLIENT(IS_REAL_CLIENT(it), {
- it.redalive_stat = redalive;
- it.bluealive_stat = bluealive;
- it.yellowalive_stat = yellowalive;
- it.pinkalive_stat = pinkalive;
+ STAT(REDALIVE, it) = redalive;
+ STAT(BLUEALIVE, it) = bluealive;
+ STAT(YELLOWALIVE, it) = yellowalive;
+ STAT(PINKALIVE, it) = pinkalive;
});
}
bool b1 = false, b2 = false, b3 = false, b4 = false, b5 = false; // TODO: kill this, we WANT to show the other flags, somehow! (note: also means you don't see if you're FC)
// initially clear items so they can be set as necessary later.
- player.ctf_flagstatus &= ~(CTF_RED_FLAG_CARRYING | CTF_RED_FLAG_TAKEN | CTF_RED_FLAG_LOST
+ STAT(CTF_FLAGSTATUS, player) &= ~(CTF_RED_FLAG_CARRYING | CTF_RED_FLAG_TAKEN | CTF_RED_FLAG_LOST
| CTF_BLUE_FLAG_CARRYING | CTF_BLUE_FLAG_TAKEN | CTF_BLUE_FLAG_LOST
| CTF_YELLOW_FLAG_CARRYING | CTF_YELLOW_FLAG_TAKEN | CTF_YELLOW_FLAG_LOST
| CTF_PINK_FLAG_CARRYING | CTF_PINK_FLAG_TAKEN | CTF_PINK_FLAG_LOST
if(flag.team == NUM_TEAM_2 && !b2) { b2 = true; t = CTF_BLUE_FLAG_CARRYING; t2 = CTF_BLUE_FLAG_TAKEN; t3 = CTF_BLUE_FLAG_LOST; }
if(flag.team == NUM_TEAM_3 && !b3) { b3 = true; t = CTF_YELLOW_FLAG_CARRYING; t2 = CTF_YELLOW_FLAG_TAKEN; t3 = CTF_YELLOW_FLAG_LOST; }
if(flag.team == NUM_TEAM_4 && !b4) { b4 = true; t = CTF_PINK_FLAG_CARRYING; t2 = CTF_PINK_FLAG_TAKEN; t3 = CTF_PINK_FLAG_LOST; }
- if(flag.team == 0 && !b5) { b5 = true; t = CTF_NEUTRAL_FLAG_CARRYING; t2 = CTF_NEUTRAL_FLAG_TAKEN; t3 = CTF_NEUTRAL_FLAG_LOST; player.ctf_flagstatus |= CTF_FLAG_NEUTRAL; }
+ if(flag.team == 0 && !b5) { b5 = true; t = CTF_NEUTRAL_FLAG_CARRYING; t2 = CTF_NEUTRAL_FLAG_TAKEN; t3 = CTF_NEUTRAL_FLAG_LOST; STAT(CTF_FLAGSTATUS, player) |= CTF_FLAG_NEUTRAL; }
switch(flag.ctf_status)
{
case FLAG_CARRY:
{
if((flag.owner == player) || (flag.pass_sender == player))
- player.ctf_flagstatus |= t; // carrying: player is currently carrying the flag
+ STAT(CTF_FLAGSTATUS, player) |= t; // carrying: player is currently carrying the flag
else
- player.ctf_flagstatus |= t2; // taken: someone else is carrying the flag
+ STAT(CTF_FLAGSTATUS, player) |= t2; // taken: someone else is carrying the flag
break;
}
case FLAG_DROPPED:
{
- player.ctf_flagstatus |= t3; // lost: the flag is dropped somewhere on the map
+ STAT(CTF_FLAGSTATUS, player) |= t3; // lost: the flag is dropped somewhere on the map
break;
}
}
// item for stopping players from capturing the flag too often
if(player.ctf_captureshielded)
- player.ctf_flagstatus |= CTF_SHIELDED;
+ STAT(CTF_FLAGSTATUS, player) |= CTF_SHIELDED;
if(ctf_stalemate)
- player.ctf_flagstatus |= CTF_STALEMATE;
+ STAT(CTF_FLAGSTATUS, player) |= CTF_STALEMATE;
// update the health of the flag carrier waypointsprite
if(player.wps_flagcarrier)
entity spectatee = M_ARGV(0, entity);
entity client = M_ARGV(1, entity);
- client.ctf_flagstatus = spectatee.ctf_flagstatus;
+ STAT(CTF_FLAGSTATUS, client) = STAT(CTF_FLAGSTATUS, spectatee);
}
MUTATOR_HOOKFUNCTION(ctf, GetRecords)
// team checking
#define CTF_SAMETEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? DIFF_TEAM(a,b) : SAME_TEAM(a,b))
#define CTF_DIFFTEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? SAME_TEAM(a,b) : DIFF_TEAM(a,b))
-
-// networked flag statuses
-.int ctf_flagstatus = _STAT(CTF_FLAGSTATUS);
#endif
const int CTF_RED_FLAG_TAKEN = 1;
void set_dom_state(entity e)
{
- e.dom_total_pps = total_pps;
- e.dom_pps_red = pps_red;
- e.dom_pps_blue = pps_blue;
+ STAT(DOM_TOTAL_PPS, e) = total_pps;
+ STAT(DOM_PPS_RED, e) = pps_red;
+ STAT(DOM_PPS_BLUE, e) = pps_blue;
if(domination_teams >= 3)
- e.dom_pps_yellow = pps_yellow;
+ STAT(DOM_PPS_YELLOW, e) = pps_yellow;
if(domination_teams >= 4)
- e.dom_pps_pink = pps_pink;
+ STAT(DOM_PPS_PINK, e) = pps_pink;
}
void dompoint_captured(entity this)
const float ST_DOM_CAPS = 1;
// pps: points per second
-.float dom_total_pps = _STAT(DOM_TOTAL_PPS);
-.float dom_pps_red = _STAT(DOM_PPS_RED);
-.float dom_pps_blue = _STAT(DOM_PPS_BLUE);
-.float dom_pps_yellow = _STAT(DOM_PPS_YELLOW);
-.float dom_pps_pink = _STAT(DOM_PPS_PINK);
float total_pps;
float pps_red;
float pps_blue;
}
});
FOREACH_CLIENT(IS_REAL_CLIENT(it), {
- it.redalive_stat = redalive;
- it.bluealive_stat = bluealive;
- it.yellowalive_stat = yellowalive;
- it.pinkalive_stat = pinkalive;
+ STAT(REDALIVE, it) = redalive;
+ STAT(BLUEALIVE, it) = bluealive;
+ STAT(YELLOWALIVE, it) = yellowalive;
+ STAT(PINKALIVE, it) = pinkalive;
});
eliminatedPlayers.SendFlags |= 1;
if(n && STAT(FROZEN, player) == 1) // OK, there is at least one teammate reviving us
{
- player.revive_progress = bound(0, player.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
- player.health = max(1, player.revive_progress * ((warmup_stage) ? warmup_start_health : start_health));
+ STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
+ player.health = max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health));
- if(player.revive_progress >= 1)
+ if(STAT(REVIVE_PROGRESS, player) >= 1)
{
freezetag_Unfreeze(player);
freezetag_count_alive_players();
}
FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
- it.revive_progress = player.revive_progress;
+ STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
it.reviving = false;
});
}
else if(!n && STAT(FROZEN, player) == 1) // only if no teammate is nearby will we reset
{
- player.revive_progress = bound(0, player.revive_progress - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
- player.health = max(1, player.revive_progress * ((warmup_stage) ? warmup_start_health : start_health));
+ STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
+ player.health = max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health));
}
else if(!n && !STAT(FROZEN, player))
{
- player.revive_progress = 0; // thawing nobody
+ STAT(REVIVE_PROGRESS, player) = 0; // thawing nobody
}
return true;
// bits 5- 9: team of key 2, or 0 for no such key, or 30 for dropped, or 31 for self
// bits 10-14: team of key 3, or 0 for no such key, or 30 for dropped, or 31 for self
// bits 15-19: team of key 4, or 0 for no such key, or 30 for dropped, or 31 for self
-.int kh_state = _STAT(KH_KEYS);
.float siren_time; // time delay the siren
//.float stuff_time; // time delay to stuffcmd a cvar
s |= (32 ** key.count) * f;
}
- FOREACH_CLIENT(true, { it.kh_state = s; });
+ FOREACH_CLIENT(true, { STAT(KH_KEYS, it) = s; });
FOR_EACH_KH_KEY(key)
{
if(key.owner)
- key.owner.kh_state |= (32 ** key.count) * 31;
+ STAT(KH_KEYS, key.owner) |= (32 ** key.count) * 31;
}
//print(ftos((nextent(NULL)).kh_state), "\n");
}
entity spectatee = M_ARGV(0, entity);
entity client = M_ARGV(1, entity);
- client.kh_state = spectatee.kh_state;
+ STAT(KH_KEYS, client) = STAT(KH_KEYS, spectatee);
}
MUTATOR_HOOKFUNCTION(kh, PlayerUseKey)
if (hit) a.accuracy_hit [w] += hit;
if (fired) a.accuracy_fired[w] += fired;
- if (hit && a.hit_time != time) { // only run this once per frame
+ if (hit && STAT(HIT_TIME, a) != time) { // only run this once per frame
a.accuracy_cnt_hit[w] += 1;
- a.hit_time = time;
+ STAT(HIT_TIME, a) = time;
}
if (fired && a.fired_time != time) { // only run this once per frame