From bcfb2c28a83d43a76cdc18de1f00b4d191da55e5 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 18 Feb 2018 02:29:59 +1000 Subject: [PATCH] Turn most cases of _STAT into STAT --- .../gamemodes/gamemode/nexball/nexball.qc | 14 +- .../gamemodes/gamemode/nexball/sv_weapon.qc | 12 +- qcsrc/common/monsters/sv_monsters.qc | 14 +- qcsrc/common/mutators/mutator/buffs/buffs.qh | 3 +- .../common/mutators/mutator/buffs/sv_buffs.qc | 143 +++++++++--------- qcsrc/common/mutators/mutator/nades/nades.qc | 106 ++++++------- qcsrc/common/mutators/mutator/nades/nades.qh | 6 - qcsrc/common/physics/player.qh | 6 +- qcsrc/common/t_items.qc | 20 +-- qcsrc/common/triggers/trigger/secret.qc | 5 +- qcsrc/common/triggers/trigger/secret.qh | 3 - qcsrc/common/vehicles/sv_vehicles.qc | 14 +- qcsrc/common/vehicles/sv_vehicles.qh | 2 - qcsrc/common/vehicles/vehicle/bumblebee.qc | 6 +- qcsrc/common/vehicles/vehicle/raptor.qc | 24 +-- qcsrc/common/vehicles/vehicle/spiderbot.qc | 26 ++-- .../vehicles/vehicle/spiderbot_weapons.qc | 6 +- qcsrc/common/weapons/all.qc | 2 +- qcsrc/ecs/systems/cl_physics.qc | 1 - qcsrc/ecs/systems/physics.qc | 2 +- qcsrc/ecs/systems/sv_physics.qc | 10 +- qcsrc/server/client.qc | 34 ++--- qcsrc/server/compat/quake3.qc | 2 +- qcsrc/server/defs.qh | 13 -- qcsrc/server/g_damage.qc | 7 +- qcsrc/server/g_world.qc | 8 +- qcsrc/server/mutators/gamemode.qh | 4 - qcsrc/server/mutators/mutator/gamemode_ca.qc | 8 +- qcsrc/server/mutators/mutator/gamemode_ctf.qc | 16 +- qcsrc/server/mutators/mutator/gamemode_ctf.qh | 3 - .../mutators/mutator/gamemode_domination.qc | 10 +- .../mutators/mutator/gamemode_domination.qh | 5 - .../mutators/mutator/gamemode_freezetag.qc | 22 +-- .../mutators/mutator/gamemode_keyhunt.qc | 7 +- qcsrc/server/weapons/accuracy.qc | 4 +- 35 files changed, 261 insertions(+), 307 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 7eb8ecb4b..f4fcc8e1b 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -13,8 +13,6 @@ MUTATOR_HOOKFUNCTION(cl_nb, WantEventchase) } #endif #ifdef SVQC -.float metertime = _STAT(NB_METERSTART); - .entity ballcarried; int autocvar_g_nexball_goalleadlimit; @@ -154,9 +152,9 @@ void GiveBall(entity plyr, entity ball) 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); @@ -223,9 +221,9 @@ void DropBall(entity ball, vector org, vector vel) 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; } @@ -853,14 +851,14 @@ MUTATOR_HOOKFUNCTION(nb, SpectateCopy) 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]; diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc b/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc index e26af7780..838d0dd7e 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc @@ -11,8 +11,8 @@ METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity we 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); } @@ -28,9 +28,9 @@ METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity we 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); } @@ -116,8 +116,8 @@ void W_Nexball_Attack(entity actor, .entity weaponentity, float t) 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; } diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 695d11019..1197c2613 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -1151,20 +1151,20 @@ void Monster_Frozen_Think(entity this) { 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); @@ -1177,7 +1177,7 @@ void Monster_Frozen_Think(entity this) 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! diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qh b/qcsrc/common/mutators/mutator/buffs/buffs.qh index 963cf0015..d6cf1ca82 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qh @@ -43,11 +43,10 @@ STATIC_INIT(REGISTER_BUFFS) { } #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); \ } diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 0122502f4..937f4cbde 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -3,7 +3,6 @@ #include #include -.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"); @@ -83,9 +82,9 @@ bool buff_Waypoint_visible_for_player(entity this, entity player, entity view) 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); @@ -93,7 +92,7 @@ bool buff_Waypoint_visible_for_player(entity this, entity player, entity 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); @@ -177,15 +176,15 @@ void buff_Touch(entity this, entity toucher) 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 @@ -194,13 +193,13 @@ void buff_Touch(entity this, entity toucher) 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) @@ -226,14 +225,14 @@ void buff_NewType(entity ent) }); 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; @@ -250,7 +249,7 @@ void buff_Think(entity this) WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + this.buff_activetime - frametime); } - this.oldbuffs = this.buffs; + this.oldbuffs = STAT(BUFFS, this); } if(!game_stopped) @@ -262,7 +261,7 @@ void buff_Think(entity this) } 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; @@ -346,9 +345,9 @@ void buff_Init(entity this) 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"; @@ -396,7 +395,7 @@ void buff_Init_Compat(entity ent, entity replacement) else if (ent.spawnflags & 4) ent.team = NUM_TEAM_2; - ent.buffs = replacement.m_itemid; + STAT(BUFFS, ent) = replacement.m_itemid; buff_Init(ent); } @@ -454,28 +453,28 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) 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)) @@ -489,22 +488,22 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) 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; @@ -512,13 +511,13 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) 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, @@ -532,7 +531,7 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) } // 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)) @@ -561,8 +560,8 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn) { 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; @@ -574,7 +573,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics_UpdateStats) 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) @@ -586,7 +585,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics) 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; } @@ -605,11 +604,11 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDies) { 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) { @@ -625,15 +624,15 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerUseKey, CBC_ORDER_FIRST) 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; } @@ -644,7 +643,7 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) 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; @@ -702,7 +701,7 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) 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; } } @@ -734,7 +733,7 @@ MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint) // 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; } @@ -767,7 +766,7 @@ MUTATOR_HOOKFUNCTION(buffs, WeaponRateFactor) { 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) @@ -778,7 +777,7 @@ MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor) { 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) @@ -793,7 +792,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) 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; @@ -816,10 +815,10 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) // 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; } @@ -827,9 +826,9 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) 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? @@ -837,17 +836,17 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) } 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; @@ -860,7 +859,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) }); } - if(player.buffs & BUFF_AMMO.m_itemid) + if(STAT(BUFFS, player) & BUFF_AMMO.m_itemid) { for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { @@ -870,31 +869,31 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) } } - 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) { @@ -914,7 +913,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) 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) { @@ -952,8 +951,8 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) 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); @@ -992,22 +991,22 @@ MUTATOR_HOOKFUNCTION(buffs, SpectateCopy) 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 } diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index f48a5d9e9..7cc641a76 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -168,7 +168,7 @@ void nade_timer_think(entity this) 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) @@ -186,7 +186,7 @@ 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) @@ -643,8 +643,8 @@ void nade_heal_touch(entity this, entity toucher) 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; } } @@ -670,7 +670,7 @@ void nade_boom(entity this) 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; @@ -727,7 +727,7 @@ void nade_boom(entity this) } 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; @@ -749,11 +749,11 @@ void nade_boom(entity this) 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; @@ -824,7 +824,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i 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)) {} @@ -874,7 +874,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i 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) @@ -952,9 +952,9 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time) 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; @@ -968,7 +968,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time) } 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) @@ -976,19 +976,19 @@ 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; } } } @@ -996,7 +996,7 @@ void nades_GiveBonus(entity player, float score) /** 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) @@ -1021,7 +1021,7 @@ bool nade_customize(entity this, entity client) { //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; } @@ -1032,11 +1032,11 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin { 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 @@ -1044,8 +1044,8 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin //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; @@ -1060,7 +1060,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin 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); @@ -1074,7 +1074,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin 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) @@ -1086,13 +1086,13 @@ void nade_prime(entity this) 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 { @@ -1164,7 +1164,7 @@ void nades_Clear(entity player) delete(player.fake_nade); player.nade = player.fake_nade = NULL; - player.nade_timer = 0; + STAT(NADE_TIMER, player) = 0; } MUTATOR_HOOKFUNCTION(nades, VehicleEnter) @@ -1223,8 +1223,8 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) 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); @@ -1253,23 +1253,23 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) 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; } } @@ -1295,10 +1295,10 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) 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); @@ -1307,7 +1307,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) } FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, { - it.revive_progress = player.revive_progress; + STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player); it.reviving = false; }); } @@ -1345,9 +1345,9 @@ MUTATOR_HOOKFUNCTION(nades, PlayerSpawn) 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; @@ -1462,13 +1462,13 @@ MUTATOR_HOOKFUNCTION(nades, SpectateCopy) 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); } diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index 3618fd418..c5a1967e0 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -64,19 +64,13 @@ Nade Nade_FromProjectile(int proj) .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); diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 0ebea585f..6e2091649 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -16,11 +16,6 @@ .float lastflags; .float lastground; .float wasFlying; -#ifdef SVQC -.float spectatorspeed = _STAT(SPECTATORSPEED); -#elif defined(CSQC) -.float spectatorspeed; -#endif .int buttons_old; .vector movement_old; @@ -260,6 +255,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE) 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); diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 86da4a95b..249615d2d 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -934,7 +934,7 @@ void Item_Touch(entity this, entity toucher) 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); @@ -1511,7 +1511,7 @@ spawnfunc(target_items) s = Buff_UndeprecateName(argv(j)); if(s == it.m_name) { - this.buffs |= (it.m_itemid); + STAT(BUFFS, this) |= (it.m_itemid); break; } }); @@ -1571,7 +1571,7 @@ spawnfunc(target_items) 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); @@ -1620,30 +1620,30 @@ float GiveWeapon(entity e, float wpn, float op, float val) 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); } diff --git a/qcsrc/common/triggers/trigger/secret.qc b/qcsrc/common/triggers/trigger/secret.qc index c3c2c7474..9377332e2 100644 --- a/qcsrc/common/triggers/trigger/secret.qc +++ b/qcsrc/common/triggers/trigger/secret.qc @@ -10,8 +10,9 @@ 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; } /** diff --git a/qcsrc/common/triggers/trigger/secret.qh b/qcsrc/common/triggers/trigger/secret.qh index e483316a4..fcc55c395 100644 --- a/qcsrc/common/triggers/trigger/secret.qh +++ b/qcsrc/common/triggers/trigger/secret.qh @@ -12,9 +12,6 @@ float secrets_total; float secrets_found; -.float stat_secrets_total = _STAT(SECRETS_TOTAL); -.float stat_secrets_found = _STAT(SECRETS_FOUND); - /** * update secrets status. */ diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index dc217bb35..0eaf69eac 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -367,7 +367,7 @@ bool vehicle_addplayerslot( entity _owner, _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(); @@ -825,13 +825,13 @@ void vehicles_exit(entity vehic, bool eject) 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]; @@ -1025,7 +1025,7 @@ void vehicles_enter(entity pl, entity veh) 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; @@ -1086,7 +1086,7 @@ void vehicles_think(entity this) 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); diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index 22e2e4859..0ddd02aa7 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -64,7 +64,6 @@ const float SVC_UPDATEENTITY = 128; // Net.Protocol 0x80 const float VHSF_NORMAL = 0; const float VHSF_FACTORY = 2; -.int hud = _STAT(HUD); .float dmg_time; .float play_time; @@ -85,7 +84,6 @@ const float DAMAGE_TARGETDRONE = 10; // 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 diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index f0519aa21..4e842a865 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -233,7 +233,7 @@ void bumblebee_gunner_exit(entity this, int _exitflag) 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) { @@ -298,7 +298,7 @@ bool bumblebee_gunner_enter(entity this, entity player) 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; @@ -332,7 +332,7 @@ bool bumblebee_gunner_enter(entity this, entity player) WriteAngle(MSG_ONE, 0); // roll } - CSQCVehicleSetup(player, player.hud); + CSQCVehicleSetup(player, STAT(HUD, player)); MUTATOR_CALLHOOK(VehicleEnter, player, gunner); diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index a80efdab3..bf3e44362 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -254,7 +254,7 @@ bool raptor_frame(entity this, float dt) 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 @@ -376,7 +376,7 @@ bool raptor_frame(entity this, float dt) 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)) @@ -465,7 +465,7 @@ bool raptor_takeoff(entity this, float dt) 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); @@ -539,20 +539,20 @@ bool raptor_impulse(entity this, int _imp) 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; @@ -560,9 +560,9 @@ bool raptor_impulse(entity this, int _imp) 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; @@ -590,7 +590,7 @@ METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance)) } 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; diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index a0954b501..994a642d7 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -63,7 +63,7 @@ bool spiderbot_frame(entity this, float dt) .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 @@ -464,37 +464,37 @@ bool spiderbot_impulse(entity this, int _imp) 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; @@ -521,7 +521,7 @@ METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance)) } 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; diff --git a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc index 7887781ed..a18d03213 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc @@ -141,7 +141,7 @@ void spiderbot_rocket_do(entity this) 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) @@ -180,7 +180,7 @@ void spiderbot_rocket_do(entity this) 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, @@ -240,7 +240,7 @@ void spiderbot_rocket_do(entity this) 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]; } diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 6aed090db..5c51c2d87 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -531,7 +531,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim) // 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); diff --git a/qcsrc/ecs/systems/cl_physics.qc b/qcsrc/ecs/systems/cl_physics.qc index f74e9c2d5..fa087b5eb 100644 --- a/qcsrc/ecs/systems/cl_physics.qc +++ b/qcsrc/ecs/systems/cl_physics.qc @@ -6,7 +6,6 @@ void sys_phys_fix(entity this, float dt) 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); diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index ec97bb2a1..c8b459962 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -48,7 +48,7 @@ void sys_phys_update(entity this, float dt) if (!IS_PLAYER(this)) { sys_phys_spectator_control(this); - maxspeed_mod = this.spectatorspeed; + maxspeed_mod = STAT(SPECTATORSPEED, this); } sys_phys_fixspeed(this, maxspeed_mod); diff --git a/qcsrc/ecs/systems/sv_physics.qc b/qcsrc/ecs/systems/sv_physics.qc index 6677d1782..5ae47c394 100644 --- a/qcsrc/ecs/systems/sv_physics.qc +++ b/qcsrc/ecs/systems/sv_physics.qc @@ -54,7 +54,7 @@ void sys_phys_pregame_hold(entity this) 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) @@ -65,17 +65,17 @@ void sys_phys_spectator_control(entity this) || 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; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 77f863f37..f64935330 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -308,7 +308,7 @@ void PutObserverInServer(entity this) 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; @@ -331,7 +331,7 @@ void PutObserverInServer(entity this) 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; @@ -346,7 +346,7 @@ void PutObserverInServer(entity this) 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; @@ -595,7 +595,7 @@ void PutPlayerInServer(entity this) 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; @@ -621,7 +621,7 @@ void PutPlayerInServer(entity this) 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; @@ -662,7 +662,7 @@ void PutPlayerInServer(entity this) 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; @@ -1767,8 +1767,8 @@ void SpectateCopy(entity this, entity spectatee) 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; @@ -1783,7 +1783,7 @@ void SpectateCopy(entity this, entity spectatee) 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; @@ -1792,7 +1792,7 @@ void SpectateCopy(entity this, entity spectatee) 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; @@ -2539,17 +2539,17 @@ void PlayerPreThink (entity this) { 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) { @@ -2558,7 +2558,7 @@ void PlayerPreThink (entity this) 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); } } diff --git a/qcsrc/server/compat/quake3.qc b/qcsrc/server/compat/quake3.qc index 8eb827388..a1e129402 100644 --- a/qcsrc/server/compat/quake3.qc +++ b/qcsrc/server/compat/quake3.qc @@ -118,7 +118,7 @@ void target_init_use(entity this, entity actor, entity trigger) { actor.strength_finished = 0; actor.invincible_finished = 0; - actor.buffs = 0; + STAT(BUFFS, actor) = 0; } if (!(this.spawnflags & 16)) diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 185a68a85..060e1ce55 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -306,18 +306,8 @@ float servertime, serverprevtime, serverframetime; .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 @@ -374,7 +364,6 @@ const float ACTIVE_TOGGLE = 3; .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; @@ -383,8 +372,6 @@ const float ACTIVE_TOGGLE = 3; .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); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 44774a1d6..804d9fd71 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -262,7 +262,6 @@ bool frag_centermessage_override(entity attacker, entity targ, int deathtype, in 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) { @@ -443,7 +442,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en 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); @@ -530,7 +529,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo 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) @@ -581,7 +580,7 @@ void Unfreeze (entity targ) } 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); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 2eda8584e..16303bd39 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -2069,12 +2069,12 @@ void EndFrame() 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 diff --git a/qcsrc/server/mutators/gamemode.qh b/qcsrc/server/mutators/gamemode.qh index 5de2a656a..b0f42f59e 100644 --- a/qcsrc/server/mutators/gamemode.qh +++ b/qcsrc/server/mutators/gamemode.qh @@ -106,7 +106,3 @@ .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); diff --git a/qcsrc/server/mutators/mutator/gamemode_ca.qc b/qcsrc/server/mutators/mutator/gamemode_ca.qc index 919df4901..67b999e61 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ca.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ca.qc @@ -16,10 +16,10 @@ void CA_count_alive_players() } }); 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; }); } diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index cdda90724..b34e3f59f 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -2085,7 +2085,7 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink) 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 @@ -2099,7 +2099,7 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink) 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) { @@ -2107,14 +2107,14 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink) 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; } } @@ -2122,10 +2122,10 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink) // 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) @@ -2475,7 +2475,7 @@ MUTATOR_HOOKFUNCTION(ctf, SpectateCopy) 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) diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qh b/qcsrc/server/mutators/mutator/gamemode_ctf.qh index 33d64a074..14bf281e7 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qh +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qh @@ -168,9 +168,6 @@ void havocbot_role_ctf_setrole(entity bot, int role); // 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; diff --git a/qcsrc/server/mutators/mutator/gamemode_domination.qc b/qcsrc/server/mutators/mutator/gamemode_domination.qc index 0d302d0f6..38ef58b6c 100644 --- a/qcsrc/server/mutators/mutator/gamemode_domination.qc +++ b/qcsrc/server/mutators/mutator/gamemode_domination.qc @@ -21,13 +21,13 @@ void dom_EventLog(string mode, float team_before, entity actor) // use an alias 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) diff --git a/qcsrc/server/mutators/mutator/gamemode_domination.qh b/qcsrc/server/mutators/mutator/gamemode_domination.qh index cf5e54f6d..95311c98a 100644 --- a/qcsrc/server/mutators/mutator/gamemode_domination.qh +++ b/qcsrc/server/mutators/mutator/gamemode_domination.qh @@ -32,11 +32,6 @@ const float ST_DOM_TICKS = 1; 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; diff --git a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc index 2ea70c1f1..36546c43a 100644 --- a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc @@ -20,10 +20,10 @@ void freezetag_count_alive_players() } }); 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; @@ -465,10 +465,10 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) 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(); @@ -493,18 +493,18 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) } 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; diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 0610faabb..04576486b 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -49,7 +49,6 @@ bool kh_no_radar_circles; // 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 @@ -133,12 +132,12 @@ void kh_update_state() 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"); } @@ -1273,7 +1272,7 @@ MUTATOR_HOOKFUNCTION(kh, SpectateCopy) 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) diff --git a/qcsrc/server/weapons/accuracy.qc b/qcsrc/server/weapons/accuracy.qc index 0d6ecf066..f1800ae00 100644 --- a/qcsrc/server/weapons/accuracy.qc +++ b/qcsrc/server/weapons/accuracy.qc @@ -72,9 +72,9 @@ void accuracy_add(entity this, int w, int fired, int hit) 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 -- 2.39.2