From 57755aea0cb5ac02b6aa56949ad9ac1beabced0a Mon Sep 17 00:00:00 2001 From: TimePath Date: Tue, 29 Dec 2015 19:13:35 +1100 Subject: [PATCH] cpp compat --- qcsrc/client/hud/hud.qc | 22 +++++++++--------- qcsrc/client/hud/hud.qh | 2 +- qcsrc/common/constants.qh | 8 ------- qcsrc/common/csqcmodel_settings.qh | 4 ++-- qcsrc/common/effects/qc/gibs.qc | 2 +- qcsrc/common/ent_cs.qh | 3 ++- .../gamemodes/gamemode/onslaught/onslaught.qc | 6 ++--- qcsrc/common/mutators/base.qh | 3 ++- qcsrc/common/mutators/events.qh | 2 +- .../spawn_near_teammate.qc | 12 +++++----- qcsrc/common/physics/player.qc | 4 ++-- qcsrc/common/triggers/trigger/jumppads.qc | 6 ++--- qcsrc/common/vehicles/sv_vehicles.qc | 14 +++++------ qcsrc/common/vehicles/vehicle/bumblebee.qc | 10 ++++---- qcsrc/common/weapons/all.qh | 3 ++- qcsrc/common/weapons/weapon/porto.qc | 2 +- qcsrc/lib/csqcmodel/cl_player.qc | 16 ++++++------- qcsrc/lib/csqcmodel/settings.qh | 4 ++-- qcsrc/lib/csqcmodel/sv_model.qc | 2 +- qcsrc/lib/cvar.qh | 3 ++- qcsrc/lib/linkedlist.qh | 6 +++-- qcsrc/lib/oo.qh | 3 ++- qcsrc/lib/registry.qh | 9 +++++--- qcsrc/lib/replicate.qh | 3 ++- qcsrc/lib/spawnfunc.qh | 9 ++++---- qcsrc/lib/stats.qh | 23 +++++++++++-------- qcsrc/server/bot/havocbot/havocbot.qc | 2 +- qcsrc/server/bot/navigation.qc | 12 +++++----- qcsrc/server/bot/waypoints.qc | 14 +++++------ qcsrc/server/cheats.qc | 2 +- qcsrc/server/cl_client.qc | 8 +++---- qcsrc/server/cl_impulse.qc | 2 +- qcsrc/server/command/sv_cmd.qc | 12 +++++----- qcsrc/server/g_world.qc | 2 +- .../mutators/mutator/gamemode_keyhunt.qc | 2 +- qcsrc/server/portals.qc | 4 ++-- qcsrc/server/race.qc | 4 ++-- 37 files changed, 126 insertions(+), 119 deletions(-) diff --git a/qcsrc/client/hud/hud.qc b/qcsrc/client/hud/hud.qc index 920ee1ebd..8d4759b1e 100644 --- a/qcsrc/client/hud/hud.qc +++ b/qcsrc/client/hud/hud.qc @@ -1,18 +1,18 @@ #include "hud.qh" #include "hud_config.qh" -#include "mapvoting.qh" -#include "scoreboard.qh" -#include "teamradar.qh" -#include "../common/t_items.qh" -#include "../common/deathtypes/all.qh" -#include "../common/items/all.qc" -#include "../common/mapinfo.qh" -#include "../common/mutators/mutator/waypoints/all.qh" -#include "../common/stats.qh" -#include "../lib/csqcmodel/cl_player.qh" +#include "../mapvoting.qh" +#include "../scoreboard.qh" +#include "../teamradar.qh" +#include "../../common/t_items.qh" +#include "../../common/deathtypes/all.qh" +#include "../../common/items/all.qc" +#include "../../common/mapinfo.qh" +#include "../../common/mutators/mutator/waypoints/all.qh" +#include "../../common/stats.qh" +#include "../../lib/csqcmodel/cl_player.qh" // TODO: remove -#include "../server/mutators/mutator/gamemode_ctf.qc" +#include "../../server/mutators/mutator/gamemode_ctf.qc" /* diff --git a/qcsrc/client/hud/hud.qh b/qcsrc/client/hud/hud.qh index 7baed9e91..363324252 100644 --- a/qcsrc/client/hud/hud.qh +++ b/qcsrc/client/hud/hud.qh @@ -1,7 +1,7 @@ #ifndef CLIENT_HUD_H #define CLIENT_HUD_H -#include "../common/weapons/all.qh" +#include "../../common/weapons/all.qh" bool HUD_Radar_Clickable(); void HUD_Radar_Mouse(); diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 96368bd15..4bffd04ba 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -237,14 +237,6 @@ vector autocvar_sv_player_crouch_viewoffset = '0 0 20'; vector autocvar_sv_player_headsize = '24 24 12'; -// not so constant -#define PL_VIEW_OFS STAT(PL_VIEW_OFS, NULL) -#define PL_CROUCH_VIEW_OFS STAT(PL_CROUCH_VIEW_OFS, NULL) -#define PL_MIN STAT(PL_MIN, NULL) -#define PL_CROUCH_MIN STAT(PL_CROUCH_MIN, NULL) -#define PL_MAX STAT(PL_MAX, NULL) -#define PL_CROUCH_MAX STAT(PL_CROUCH_MAX, NULL) - // a bit more constant const vector PL_MAX_CONST = '16 16 45'; const vector PL_MIN_CONST = '-16 -16 -24'; diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index 9f9fa43f3..c4b88cc95 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -81,9 +81,9 @@ #define CSQCPLAYER_HOOK_POSTCAMERASETUP() \ CSQCPlayer_SetViewLocation() -// force updates of player entities that often even if unchanged +// force updates of player entities this frequently (per second) even if unchanged #ifndef CSQCPLAYER_FORCE_UPDATES -#define CSQCPLAYER_FORCE_UPDATES 0.25 +#define CSQCPLAYER_FORCE_UPDATES 4 #endif // mod must define: diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index 2e54f4396..2e01a507f 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -59,7 +59,7 @@ void Violence_GibSplash(entity source, float type, float amount, entity attacker .bool silent; #include "rubble.qh" -#include "../common/physics/movetypes/movetypes.qh" +#include "../../physics/movetypes/movetypes.qh" .float scale; .float alpha; diff --git a/qcsrc/common/ent_cs.qh b/qcsrc/common/ent_cs.qh index 389aadc1f..0d02e4b53 100644 --- a/qcsrc/common/ent_cs.qh +++ b/qcsrc/common/ent_cs.qh @@ -50,7 +50,8 @@ REGISTER_NET_TEMP(CLIENT_ENTCS) { AL_DELETE(_entcs); } - #define entcs_receiver(...) EVAL(OVERLOAD(entcs_receiver, __VA_ARGS__)) + #define entcs_receiver(...) EVAL_entcs_receiver(OVERLOAD(entcs_receiver, __VA_ARGS__)) + #define EVAL_entcs_receiver(...) __VA_ARGS__ #define entcs_receiver_1(i) AL_gete(_entcs, i) #define entcs_receiver_2(i, v) AL_sete(_entcs, i, v) #define entcs_is_self(e) ((e).sv_entnum == player_localentnum - 1) diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index bcb729dc8..64192cbcd 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -1751,7 +1751,7 @@ bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effe loc += tele_target.origin + '0 0 128' * iteration_scale; - tracebox(loc, PL_MIN, PL_MAX, loc, MOVE_NORMAL, player); + tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player); if(trace_fraction == 1.0 && !trace_startsolid) { traceline(tele_target.origin, loc, MOVE_NOMONSTERS, tele_target); // double check to make sure we're not spawning outside the world @@ -1865,7 +1865,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn) iteration_scale -= i / 10; loc = closest_target.origin + '0 0 96' * iteration_scale; loc += ('0 1 0' * random()) * 128 * iteration_scale; - tracebox(loc, PL_MIN, PL_MAX, loc, MOVE_NORMAL, self); + tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, self); if(trace_fraction == 1.0 && !trace_startsolid) { traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the world @@ -1916,7 +1916,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn) iteration_scale -= i / 10; loc = closest_target.origin + '0 0 128' * iteration_scale; loc += ('0 1 0' * random()) * 256 * iteration_scale; - tracebox(loc, PL_MIN, PL_MAX, loc, MOVE_NORMAL, self); + tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, self); if(trace_fraction == 1.0 && !trace_startsolid) { traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the world diff --git a/qcsrc/common/mutators/base.qh b/qcsrc/common/mutators/base.qh index 6e06e5590..d4a952619 100644 --- a/qcsrc/common/mutators/base.qh +++ b/qcsrc/common/mutators/base.qh @@ -289,7 +289,8 @@ STATIC_INIT_LATE(Mutators) { [[accumulate]] void RegisterCallbacks() { CALLBACK_##name = NEW(Callback, func); } #define MUTATOR_HOOKFUNCTION(...) \ - EVAL(OVERLOAD(MUTATOR_HOOKFUNCTION, __VA_ARGS__)) + EVAL_MUTATOR_HOOKFUNCTION(OVERLOAD(MUTATOR_HOOKFUNCTION, __VA_ARGS__)) +#define EVAL_MUTATOR_HOOKFUNCTION(...) __VA_ARGS__ #define MUTATOR_HOOKFUNCTION_2(mut, cb) \ MUTATOR_HOOKFUNCTION_3(mut, cb, CBC_ORDER_ANY) diff --git a/qcsrc/common/mutators/events.qh b/qcsrc/common/mutators/events.qh index 5cb5b4745..1258b6ff8 100644 --- a/qcsrc/common/mutators/events.qh +++ b/qcsrc/common/mutators/events.qh @@ -16,7 +16,7 @@ string ret_string; /**/ #define MUTATOR_ARGV(x, type) MUTATOR_ARGV_##x##_##type -#define MUTATOR_NEWGLOBAL(x, type) type MUTATOR_ARGV(x, type); +#define MUTATOR_NEWGLOBAL(x, type) type MUTATOR_ARGV_##x##_##type; MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 0) MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 1) diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc index dbbadd8e5..f8a66eaef 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc @@ -70,7 +70,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn) if(it.frozen == 0) if(it != self) { - tracebox(it.origin, PL_MIN, PL_MAX, it.origin - '0 0 100', MOVE_WORLDONLY, it); + tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - '0 0 100', MOVE_WORLDONLY, it); if(trace_fraction != 1.0) if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) { @@ -87,19 +87,19 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn) switch(pc) { case 0: - tracebox(it.origin , PL_MIN, PL_MAX, it.origin + v_right * 128, MOVE_NORMAL, it); + tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin + v_right * 128, MOVE_NORMAL, it); break; case 1: - tracebox(it.origin , PL_MIN, PL_MAX, it.origin - v_right * 128 , MOVE_NORMAL, it); + tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_right * 128 , MOVE_NORMAL, it); break; case 2: - tracebox(it.origin , PL_MIN, PL_MAX, it.origin + v_right * 64 - v_forward * 64, MOVE_NORMAL, it); + tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin + v_right * 64 - v_forward * 64, MOVE_NORMAL, it); break; case 3: - tracebox(it.origin , PL_MIN, PL_MAX, it.origin - v_right * 64 - v_forward * 64, MOVE_NORMAL, it); + tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_right * 64 - v_forward * 64, MOVE_NORMAL, it); break; case 4: - tracebox(it.origin , PL_MIN, PL_MAX, it.origin - v_forward * 128, MOVE_NORMAL, it); + tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_forward * 128, MOVE_NORMAL, it); break; } diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 1fc9ccdf3..44614c1bd 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -107,7 +107,7 @@ void PM_ClientMovement_Unstick(entity this) #define X(unstick_offset) \ { \ vector neworigin = unstick_offset + this.origin; \ - tracebox(neworigin, PL_CROUCH_MIN, PL_CROUCH_MAX, neworigin, MOVE_NORMAL, this); \ + tracebox(neworigin, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL), neworigin, MOVE_NORMAL, this); \ if (!trace_startsolid) \ { \ setorigin(this, neworigin); \ @@ -138,7 +138,7 @@ void PM_ClientMovement_UpdateStatus(entity this, bool ground) // wants to stand, if currently crouching we need to check for a low ceiling first if (IS_DUCKED(this)) { - tracebox(this.origin, PL_MIN, PL_MAX, this.origin, MOVE_NORMAL, this); + tracebox(this.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), this.origin, MOVE_NORMAL, this); if (!trace_startsolid) UNSET_DUCKED(this); } } diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index d0b8f9459..23bfcb245 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -283,7 +283,7 @@ void trigger_push_findtarget() // first calculate a typical start point for the jump org = (self.absmin + self.absmax) * 0.5; - org_z = self.absmax.z - PL_MIN.z; + org_z = self.absmax.z - STAT(PL_MIN, NULL).z; if (self.target) { @@ -294,7 +294,7 @@ void trigger_push_findtarget() #ifdef SVQC entity e = spawn(); setorigin(e, org); - setsize(e, PL_MIN, PL_MAX); + setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); e.velocity = trigger_push_calculatevelocity(org, t, self.height); tracetoss(e, e); if(e.movetype == MOVETYPE_NONE) @@ -327,7 +327,7 @@ void trigger_push_findtarget() { entity e = spawn(); setorigin(e, org); - setsize(e, PL_MIN, PL_MAX); + setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); e.velocity = self.movedir; tracetoss(e, e); waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity)); diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 819473fe1..cd9efff07 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -777,7 +777,7 @@ vector vehicles_findgoodexit(vector prefer_spot) //vector exitspot; float mysize; - tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, prefer_spot, MOVE_NORMAL, self.owner); + tracebox(self.origin + '0 0 32', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), prefer_spot, MOVE_NORMAL, self.owner); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return prefer_spot; @@ -790,7 +790,7 @@ vector vehicles_findgoodexit(vector prefer_spot) v = randomvec(); v_z = 0; v = v2 + normalize(v) * mysize; - tracebox(v2, PL_MIN, PL_MAX, v, MOVE_NORMAL, self.owner); + tracebox(v2, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v, MOVE_NORMAL, self.owner); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return v; } @@ -865,7 +865,7 @@ void vehicles_exit(bool eject) WriteAngle(MSG_ONE, 0); } - setsize(_player, PL_MIN,PL_MAX); + setsize(_player, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); _player.takedamage = DAMAGE_AIM; _player.solid = SOLID_SLIDEBOX; @@ -875,7 +875,7 @@ void vehicles_exit(bool eject) _player.alpha = 1; _player.PlayerPhysplug = func_null; _player.vehicle = world; - _player.view_ofs = PL_VIEW_OFS; + _player.view_ofs = STAT(PL_VIEW_OFS, NULL); _player.event_damage = PlayerDamage; _player.hud = HUD_NORMAL; PS(_player).m_switchweapon = _vehicle.m_switchweapon; @@ -1044,10 +1044,10 @@ void vehicles_enter(entity pl, entity veh) veh.vehicle_hudmodel.viewmodelforclient = pl; - tracebox(pl.origin, PL_MIN, PL_MAX, pl.origin, false, pl); + tracebox(pl.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), pl.origin, false, pl); pl.crouch = false; - pl.view_ofs = PL_VIEW_OFS; - setsize (pl, PL_MIN, PL_MAX); + pl.view_ofs = STAT(PL_VIEW_OFS, NULL); + setsize (pl, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); veh.event_damage = vehicles_damage; veh.nextthink = 0; diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index f279e9e2a..26e64d0d2 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -209,11 +209,11 @@ vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity p //vector exitspot; float mysize; - tracebox(gunner.origin + '0 0 32', PL_MIN, PL_MAX, prefer_spot, MOVE_NORMAL, player); + tracebox(gunner.origin + '0 0 32', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), prefer_spot, MOVE_NORMAL, player); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return prefer_spot; - mysize = 1.5 * vlen(PL_MAX - PL_MIN); // can't use gunner's size, as they don't have a size + mysize = 1.5 * vlen(STAT(PL_MAX, NULL) - STAT(PL_MIN, NULL)); // can't use gunner's size, as they don't have a size float i; vector v, v2; v2 = 0.5 * (gunner.absmin + gunner.absmax); @@ -222,7 +222,7 @@ vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity p v = randomvec(); v_z = 0; v = v2 + normalize(v) * mysize; - tracebox(v2, PL_MIN, PL_MAX, v, MOVE_NORMAL, player); + tracebox(v2, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v, MOVE_NORMAL, player); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return v; } @@ -249,7 +249,7 @@ void bumblebee_gunner_exit(int _exitflag) } CSQCVehicleSetup(player, HUD_NORMAL); - setsize(player, PL_MIN, PL_MAX); + setsize(player, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); player.takedamage = DAMAGE_AIM; player.solid = SOLID_SLIDEBOX; @@ -257,7 +257,7 @@ void bumblebee_gunner_exit(int _exitflag) player.effects &= ~EF_NODRAW; player.alpha = 1; player.PlayerPhysplug = func_null; - player.view_ofs = PL_VIEW_OFS; + player.view_ofs = STAT(PL_VIEW_OFS, NULL); player.event_damage = PlayerDamage; player.hud = HUD_NORMAL; player.teleportable = TELEPORT_NORMAL; diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 742607177..7a829d5d1 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -119,7 +119,8 @@ STATIC_INIT_LATE(W_PROP_reloader) } #endif -#define REGISTER_WEAPON(...) EVAL(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__)) +#define REGISTER_WEAPON(...) EVAL_REGISTER_WEAPON(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__)) +#define EVAL_REGISTER_WEAPON(...) __VA_ARGS__ #define REGISTER_WEAPON_2(id, inst) REGISTER(Weapons, WEP, id, m_id, inst) /** TODO: deprecated - remove */ #define REGISTER_WEAPON_3(id, sname, inst) \ diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 1782b3491..c586e907f 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -131,7 +131,7 @@ void W_Porto_Touch() norm = trace_plane_normal; if(trace_ent.iscreature) { - traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * PL_MIN.z, MOVE_WORLDONLY, self); + traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * STAT(PL_MIN, NULL).z, MOVE_WORLDONLY, self); if(trace_fraction >= 1) return; if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP) diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index d51119775..869dcd770 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qc +++ b/qcsrc/lib/csqcmodel/cl_player.qc @@ -107,15 +107,15 @@ void CSQCPlayer_SetMinsMaxs(entity this) { if ((this.flags & FL_DUCKED) || !this.isplayermodel) { - this.mins = PL_CROUCH_MIN; - this.maxs = PL_CROUCH_MAX; - this.view_ofs = PL_CROUCH_VIEW_OFS; + this.mins = STAT(PL_CROUCH_MIN, NULL); + this.maxs = STAT(PL_CROUCH_MAX, NULL); + this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, NULL); } else { - this.mins = PL_MIN; - this.maxs = PL_MAX; - this.view_ofs = PL_VIEW_OFS; + this.mins = STAT(PL_MIN, NULL); + this.maxs = STAT(PL_MAX, NULL); + this.view_ofs = STAT(PL_VIEW_OFS, NULL); } } @@ -246,8 +246,8 @@ void CSQCPlayer_SetCamera() { const vector v0 = pmove_vel; // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity const float vh = STAT(VIEWHEIGHT); - const vector pl_viewofs = PL_VIEW_OFS; - const vector pl_viewofs_crouch = PL_CROUCH_VIEW_OFS; + const vector pl_viewofs = STAT(PL_VIEW_OFS, NULL); + const vector pl_viewofs_crouch = STAT(PL_CROUCH_VIEW_OFS, NULL); const entity e = csqcplayer; if (e) { diff --git a/qcsrc/lib/csqcmodel/settings.qh b/qcsrc/lib/csqcmodel/settings.qh index 128da850f..b365d2626 100644 --- a/qcsrc/lib/csqcmodel/settings.qh +++ b/qcsrc/lib/csqcmodel/settings.qh @@ -17,8 +17,8 @@ #define CSQCMODEL_HOOK_PREDRAW #define CSQCPLAYER_HOOK_POSTCAMERASETUP -// force updates of player entities that often even if unchanged -#define CSQCPLAYER_FORCE_UPDATES 0.25 +// force updates of player entities this frequently (per second) even if unchanged +#define CSQCPLAYER_FORCE_UPDATES 4 // mod must define: //vector PL_MIN = ...; diff --git a/qcsrc/lib/csqcmodel/sv_model.qc b/qcsrc/lib/csqcmodel/sv_model.qc index cadb77467..207647e0d 100644 --- a/qcsrc/lib/csqcmodel/sv_model.qc +++ b/qcsrc/lib/csqcmodel/sv_model.qc @@ -79,7 +79,7 @@ void CSQCModel_CheckUpdate(entity e) if(isplayer && time > e.csqcmodel_nextforcedupdate) { e.SendFlags |= CSQCMODEL_PROPERTY_ORIGIN; - e.csqcmodel_nextforcedupdate = time + CSQCPLAYER_FORCE_UPDATES * (0.5 + random()); // ensure about 4 origin sends per sec + e.csqcmodel_nextforcedupdate = time + (1 / (CSQCPLAYER_FORCE_UPDATES)) * (0.5 + random()); // ensure about 4 origin sends per sec } #endif diff --git a/qcsrc/lib/cvar.qh b/qcsrc/lib/cvar.qh index d79ae1154..3a98c9606 100644 --- a/qcsrc/lib/cvar.qh +++ b/qcsrc/lib/cvar.qh @@ -84,7 +84,8 @@ const noref vector default_vector = '0 0 0'; __AUTOCVAR(file, archive, var, type, desc, default_##type) #define AUTOCVAR_6(file, archive, var, type, default, desc) \ __AUTOCVAR(file, archive, var, type, desc, default) -#define _AUTOCVAR(...) EVAL(OVERLOAD(AUTOCVAR, __FILE__, __VA_ARGS__)) +#define _AUTOCVAR(...) EVAL__AUTOCVAR(OVERLOAD(AUTOCVAR, __FILE__, __VA_ARGS__)) +#define EVAL__AUTOCVAR(...) __VA_ARGS__ #define AUTOCVAR_SAVE(...) _AUTOCVAR(true, __VA_ARGS__) #define AUTOCVAR(...) _AUTOCVAR(false, __VA_ARGS__) diff --git a/qcsrc/lib/linkedlist.qh b/qcsrc/lib/linkedlist.qh index 192ffd79a..b56493748 100644 --- a/qcsrc/lib/linkedlist.qh +++ b/qcsrc/lib/linkedlist.qh @@ -45,7 +45,8 @@ entity LL_POP(LinkedList this) return e; } -#define LL_CLEAR(...) EVAL(OVERLOAD(LL_CLEAR, __VA_ARGS__)) +#define LL_CLEAR(...) EVAL_LL_CLEAR(OVERLOAD(LL_CLEAR, __VA_ARGS__)) +#define EVAL_LL_CLEAR(...) __VA_ARGS__ #define LL_CLEAR_1(this) LL_CLEAR_2(this, LAMBDA()) #define LL_CLEAR_2(this, dtor) \ MACRO_BEGIN \ @@ -61,7 +62,8 @@ entity LL_POP(LinkedList this) } \ } MACRO_END -#define LL_DELETE(...) EVAL(OVERLOAD(LL_DELETE, __VA_ARGS__)) +#define LL_DELETE(...) EVAL_LL_DELETE(OVERLOAD(LL_DELETE, __VA_ARGS__)) +#define EVAL_LL_DELETE(...) __VA_ARGS__ #define LL_DELETE_1(this) LL_DELETE_2(this, LAMBDA()) #define LL_DELETE_2(this, dtor) \ MACRO_BEGIN \ diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index a2cc17e23..05a20dc19 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -58,7 +58,8 @@ entity __spawn(string _classname, string _sourceFile, int _sourceLine, bool pure } -#define entityclass(...) EVAL(OVERLOAD(entityclass, __VA_ARGS__)) +#define entityclass(...) EVAL_entityclass(OVERLOAD(entityclass, __VA_ARGS__)) +#define EVAL_entityclass(...) __VA_ARGS__ #define entityclass_1(name) entityclass_2(name, Object) #ifndef QCC_SUPPORT_ENTITYCLASS #define entityclass_2(name, base) typedef entity name diff --git a/qcsrc/lib/registry.qh b/qcsrc/lib/registry.qh index 344ee83fb..8f0d0740e 100644 --- a/qcsrc/lib/registry.qh +++ b/qcsrc/lib/registry.qh @@ -53,7 +53,8 @@ REGISTRY(Registries, BITS(8)) * @param fld The field to store the locally unique unique entity id * @param inst An expression to create a new instance, invoked for every registration */ -#define REGISTER(...) EVAL(OVERLOAD(REGISTER, __VA_ARGS__)) +#define REGISTER(...) EVAL_REGISTER(OVERLOAD(REGISTER, __VA_ARGS__)) +#define EVAL_REGISTER(...) __VA_ARGS__ #define REGISTER_5(registry, ns, id, fld, inst) REGISTER_4(registry, ns##_##id, fld, inst) #define REGISTER_4(registry, id, fld, inst) \ entity id; \ @@ -93,7 +94,8 @@ REGISTRY(Registries, BITS(8)) #define REGISTRY_NEXT enemy .entity REGISTRY_NEXT; -#define REGISTRY_SORT(...) EVAL(OVERLOAD(REGISTRY_SORT, __VA_ARGS__)) +#define REGISTRY_SORT(...) EVAL_REGISTRY_SORT(OVERLOAD(REGISTRY_SORT, __VA_ARGS__)) +#define EVAL_REGISTRY_SORT(...) __VA_ARGS__ #define REGISTRY_SORT_1(id) REGISTRY_SORT_2(id, 0) #define REGISTRY_SORT_2(id, skip) \ void _REGISTRY_SWAP_##id(int i, int j, entity pass) \ @@ -163,7 +165,8 @@ void Registry_send(string id, string hash); } \ void Registry_send_all() { Registry_send(#id, REGISTRY_HASH(id)); } \ -#define REGISTER_REGISTRY(...) EVAL(OVERLOAD(REGISTER_REGISTRY, __VA_ARGS__)) +#define REGISTER_REGISTRY(...) EVAL_REGISTER_REGISTRY(OVERLOAD(REGISTER_REGISTRY, __VA_ARGS__)) +#define EVAL_REGISTER_REGISTRY(...) __VA_ARGS__ #define REGISTER_REGISTRY_1(id) REGISTER_REGISTRY_2(id, #id) #define REGISTER_REGISTRY_2(id, str) \ ACCUMULATE_FUNCTION(__static_init, Register##id) \ diff --git a/qcsrc/lib/replicate.qh b/qcsrc/lib/replicate.qh index b74a881f3..a7b854cd1 100644 --- a/qcsrc/lib/replicate.qh +++ b/qcsrc/lib/replicate.qh @@ -2,7 +2,8 @@ #define REPLICATE_H #ifndef MENUQC - #define REPLICATE(...) EVAL(OVERLOAD(REPLICATE, __VA_ARGS__)) + #define REPLICATE(...) EVAL_REPLICATE(OVERLOAD(REPLICATE, __VA_ARGS__)) + #define EVAL_REPLICATE(...) __VA_ARGS__ [[accumulate]] void ReplicateVars(entity this, string thisname, int i) {} diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh index ef0d68f00..ce3c512c1 100644 --- a/qcsrc/lib/spawnfunc.qh +++ b/qcsrc/lib/spawnfunc.qh @@ -84,12 +84,13 @@ noref bool require_spawnfunc_prefix; #define FIELDS_COMMON(fld) \ FIELD_SCALAR(fld, classname) \ + FIELD_SCALAR(fld, sourceLocFile) \ + FIELD_SCALAR(fld, sourceLocLine) \ FIELD_SCALAR(fld, spawnfunc_checked) \ + FIELD_VEC(fld, origin) \ /**/ #define FIELDS_UNION(fld) \ - FIELD_SCALAR(fld, sourceLocFile) \ - FIELD_SCALAR(fld, sourceLocLine) \ FIELD_SCALAR(fld, Version) \ FIELD_SCALAR(fld, ammo_cells) \ FIELD_SCALAR(fld, ammo_nails) \ @@ -189,10 +190,10 @@ noref bool require_spawnfunc_prefix; FIELD_VEC(fld, maxs) \ FIELD_VEC(fld, mins) \ FIELD_VEC(fld, modelscale_vec) \ - FIELD_VEC(fld, origin) \ FIELD_VEC(fld, velocity) \ /**/ - #define spawnfunc(...) EVAL(OVERLOAD(spawnfunc, __VA_ARGS__)) + #define spawnfunc(...) EVAL_spawnfunc(OVERLOAD(spawnfunc, __VA_ARGS__)) + #define EVAL_spawnfunc(...) __VA_ARGS__ #endif diff --git a/qcsrc/lib/stats.qh b/qcsrc/lib/stats.qh index 7e0dec5b2..3f258df52 100644 --- a/qcsrc/lib/stats.qh +++ b/qcsrc/lib/stats.qh @@ -9,11 +9,13 @@ .int m_id; typedef vector vectori; -#define REGISTER_STAT(...) EVAL(OVERLOAD(REGISTER_STAT, __VA_ARGS__)) +#define REGISTER_STAT(...) EVAL_REGISTER_STAT(OVERLOAD(REGISTER_STAT, __VA_ARGS__)) +#define EVAL_REGISTER_STAT(...) __VA_ARGS__ #if defined(CSQC) /** Get all stats and store them as globals, access with `STAT(ID)` */ void stats_get() {} - #define STAT(...) EVAL(OVERLOAD(STAT, __VA_ARGS__)) + #define STAT(...) EVAL_STAT(OVERLOAD(STAT, __VA_ARGS__)) + #define EVAL_STAT(...) __VA_ARGS__ #define STAT_1(id) STAT_2(id, NULL) #define STAT_2(id, cl) (0, _STAT(id)) @@ -40,11 +42,11 @@ typedef vector vectori; if (it != CAT(_STAT(id), _prev)) \ CAT(_STAT(id), _prev) = _STAT(id) = it; \ } - #define REGISTER_STAT_3(x, T, expr) REGISTER_STAT(x, T) + #define REGISTER_STAT_3(x, T, expr) REGISTER_STAT_2(x, T) #elif defined(SVQC) /** Add all registered stats, access with `STAT(ID, player)` or `.type stat = _STAT(ID); player.stat` */ void stats_add() {} - #define STAT(id, cl) (cl._STAT(id)) + #define STAT(id, cl) (cl)._STAT(id) #define addstat_int(id, fld) addstat(id, AS_INT, fld) #define addstat_bool(id, fld) addstat(id, AS_INT, fld) @@ -85,16 +87,17 @@ typedef vector vectori; } \ [[accumulate]] void stats_add() \ { \ - addstat_##T(STAT_##id.m_id, _STAT(id)); \ + .T fld = _STAT(id); \ + addstat_##T(STAT_##id.m_id, fld); \ } void GlobalStats_update(entity this) {} - #define REGISTER_STAT_3(x, T, expr) \ - REGISTER_STAT(x, T); \ - [[accumulate]] void GlobalStats_update(entity this) { STAT(x, this) = (expr); } \ - STATIC_INIT(worldstat_##x) { entity this = world; STAT(x, this) = (expr); } + #define REGISTER_STAT_3(id, T, expr) \ + REGISTER_STAT_2(id, T); \ + [[accumulate]] void GlobalStats_update(entity this) { STAT(id, this) = (expr); } \ + STATIC_INIT(worldstat_##id) { entity this = world; STAT(id, this) = (expr); } #else #define REGISTER_STAT_2(id, type) - #define REGISTER_STAT_3(x, T, expr) + #define REGISTER_STAT_3(id, T, expr) #endif const int STATS_ENGINE_RESERVE = 32; diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 12efd5896..6371b6916 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -478,7 +478,7 @@ void havocbot_movetogoal() // Flying self.BUTTON_HOOK = true; - if(self.navigation_jetpack_point.z - PL_MAX.z + PL_MIN.z < self.origin.z) + if(self.navigation_jetpack_point.z - STAT(PL_MAX, NULL).z + STAT(PL_MIN, NULL).z < self.origin.z) { self.movement_x = dir * v_forward * maxspeed; self.movement_y = dir * v_right * maxspeed; diff --git a/qcsrc/server/bot/navigation.qc b/qcsrc/server/bot/navigation.qc index 437557998..7e8b8b530 100644 --- a/qcsrc/server/bot/navigation.qc +++ b/qcsrc/server/bot/navigation.qc @@ -366,12 +366,12 @@ float navigation_waypoint_will_link(vector v, vector org, entity ent, float walk { if (walkfromwp) { - if (tracewalk(ent, v, PL_MIN, PL_MAX, org, bot_navigation_movemode)) + if (tracewalk(ent, v, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), org, bot_navigation_movemode)) return true; } else { - if (tracewalk(ent, org, PL_MIN, PL_MAX, v, bot_navigation_movemode)) + if (tracewalk(ent, org, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v, bot_navigation_movemode)) return true; } } @@ -401,7 +401,7 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom } org = ent.origin + 0.5 * (ent.mins + ent.maxs); - org.z = ent.origin.z + ent.mins.z - PL_MIN.z; // player height + org.z = ent.origin.z + ent.mins.z - STAT(PL_MIN, NULL).z; // player height // TODO possibly make other code have the same support for bboxes if(ent.tag_entity) org = org + ent.tag_entity.origin; @@ -724,7 +724,7 @@ void navigation_routerating(entity e, float f, float rangebias) float zdistance, xydistance, cost, t, fuel; vector down, npa, npb; - down = '0 0 -1' * (PL_MAX.z - PL_MIN.z) * 10; + down = '0 0 -1' * (STAT(PL_MAX, NULL).z - STAT(PL_MIN, NULL).z) * 10; do{ npa = pointa + down; @@ -882,7 +882,7 @@ float navigation_routetogoal(entity e, vector startposition) return true; // if it can reach the goal there is nothing more to do - if (tracewalk(self, startposition, PL_MIN, PL_MAX, (e.absmin + e.absmax) * 0.5, bot_navigation_movemode)) + if (tracewalk(self, startposition, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), (e.absmin + e.absmax) * 0.5, bot_navigation_movemode)) return true; // see if there are waypoints describing a path to the item @@ -1092,7 +1092,7 @@ void navigation_unstuck() // evaluate the next goal on the queue float d = vlen(self.origin - bot_waypoint_queue_goal.origin); bot_debug(strcat(self.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d), "\n")); - if(tracewalk(bot_waypoint_queue_goal, self.origin, PL_MIN, PL_MAX, bot_waypoint_queue_goal.origin, bot_navigation_movemode)) + if(tracewalk(bot_waypoint_queue_goal, self.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), bot_waypoint_queue_goal.origin, bot_navigation_movemode)) { if( d > bot_waypoint_queue_bestgoalrating) { diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/waypoints.qc index d159cba58..b4b614967 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/waypoints.qc @@ -38,7 +38,7 @@ entity waypoint_spawn(vector m1, vector m2, float f) if(!w.wpisbox) { - setsize(w, PL_MIN - '1 1 0', PL_MAX + '1 1 0'); + setsize(w, STAT(PL_MIN, NULL) - '1 1 0', STAT(PL_MAX, NULL) + '1 1 0'); if(!move_out_of_solid(w)) { if(!(f & WAYPOINTFLAG_GENERATED)) @@ -208,7 +208,7 @@ void waypoint_think() navigation_testtracewalk = 0; if (!self.wpisbox) { - tracebox(sv - PL_MIN.z * '0 0 1', PL_MIN, PL_MAX, sv, false, self); + tracebox(sv - STAT(PL_MIN, NULL).z * '0 0 1', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), sv, false, self); if (!trace_startsolid) { //dprint("sv deviation", vtos(trace_endpos - sv), "\n"); @@ -217,7 +217,7 @@ void waypoint_think() } if (!e.wpisbox) { - tracebox(ev - PL_MIN.z * '0 0 1', PL_MIN, PL_MAX, ev, false, e); + tracebox(ev - STAT(PL_MIN, NULL).z * '0 0 1', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), ev, false, e); if (!trace_startsolid) { //dprint("ev deviation", vtos(trace_endpos - ev), "\n"); @@ -226,11 +226,11 @@ void waypoint_think() } //traceline(self.origin, e.origin, false, world); //if (trace_fraction == 1) - if (!self.wpisbox && tracewalk(self, sv, PL_MIN, PL_MAX, ev, MOVE_NOMONSTERS)) + if (!self.wpisbox && tracewalk(self, sv, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), ev, MOVE_NOMONSTERS)) waypoint_addlink(self, e); else relink_walkculled += 0.5; - if (!e.wpisbox && tracewalk(e, ev, PL_MIN, PL_MAX, sv, MOVE_NOMONSTERS)) + if (!e.wpisbox && tracewalk(e, ev, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), sv, MOVE_NOMONSTERS)) waypoint_addlink(e, self); else relink_walkculled += 0.5; @@ -713,7 +713,7 @@ float waypoint_loadall() vector waypoint_fixorigin(vector position) { - tracebox(position + '0 0 1' * (1 - PL_MIN.z), PL_MIN, PL_MAX, position + '0 0 -512', MOVE_NOMONSTERS, world); + tracebox(position + '0 0 1' * (1 - STAT(PL_MIN, NULL).z), STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), position + '0 0 -512', MOVE_NOMONSTERS, world); if(trace_fraction < 1) position = trace_endpos; //traceline(position, position + '0 0 -512', MOVE_NOMONSTERS, world); @@ -867,7 +867,7 @@ void botframe_showwaypointlinks() float botframe_autowaypoints_fixdown(vector v) { - tracebox(v, PL_MIN, PL_MAX, v + '0 0 -64', MOVE_NOMONSTERS, world); + tracebox(v, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v + '0 0 -64', MOVE_NOMONSTERS, world); if(trace_fraction >= 1) return 0; return 1; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index cb1387a9c..453b2ca2b 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -448,7 +448,7 @@ float CheatCommand(float argc) e.nextthink = time; e.solid = 0; // nothing special setmodel(e, MDL_MARKER); - setsize(e, PL_MIN, PL_MAX); + setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); e.skin = 2; if(argc == 3) e.cnt = stof(argv(1)); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index bb4fc2335..ffbfe02ff 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -273,7 +273,7 @@ void PutObserverInServer() self.crouch = false; self.revival_time = 0; - setorigin (self, (spot.origin + PL_VIEW_OFS)); // offset it so that the spectator spawns higher off the ground, looks better this way + setorigin (self, (spot.origin + STAT(PL_VIEW_OFS, NULL))); // offset it so that the spectator spawns higher off the ground, looks better this way self.prevorigin = self.origin; self.items = 0; self.weapons = '0 0 0'; @@ -282,7 +282,7 @@ void PutObserverInServer() setmodel(self, MDL_Null); self.drawonlytoclient = self; - setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX); // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY + setsize (self, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL)); // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY self.view_ofs = '0 0 0'; // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS" PS(self).m_weapon = WEP_Null; @@ -542,8 +542,8 @@ void PutClientInServer() this.drawonlytoclient = NULL; this.crouch = false; - this.view_ofs = PL_VIEW_OFS; - setsize(this, PL_MIN, PL_MAX); + this.view_ofs = STAT(PL_VIEW_OFS, NULL); + setsize(this, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); this.spawnorigin = spot.origin; setorigin(this, spot.origin + '0 0 1' * (1 - this.mins.z - 24)); // don't reset back to last position, even if new position is stuck in solid diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index 96e48cb64..c29c10f26 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -515,7 +515,7 @@ IMPULSE(navwaypoint_unreachable) for (entity e = findchain(classname, "info_player_deathmatch"); e; e = e.chain) { vector org = e.origin; - tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world); + tracebox(e.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), e.origin - '0 0 512', MOVE_NOMONSTERS, world); setorigin(e, trace_endpos); if (navigation_findnearestwaypoint(e, false)) { diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 521dad5b5..b75eb5514 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1536,15 +1536,15 @@ void GameCommand_trace(float request, float argc) start = stov(vtos(start)); end = stov(vtos(end)); - tracebox(start, PL_MIN, PL_MAX, end, MOVE_NOMONSTERS, world); + tracebox(start, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), end, MOVE_NOMONSTERS, world); if (!trace_startsolid && trace_fraction < 1) { p = trace_endpos; - tracebox(p, PL_MIN, PL_MAX, p, MOVE_NOMONSTERS, world); + tracebox(p, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), p, MOVE_NOMONSTERS, world); if (trace_startsolid) { rint(42); // do an engine breakpoint on VM_rint so you can get the trace that errnoeously returns startsolid - tracebox(start, PL_MIN, PL_MAX, end, MOVE_NOMONSTERS, world); + tracebox(start, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), end, MOVE_NOMONSTERS, world); // how much do we need to back off? safe = 1; @@ -1552,7 +1552,7 @@ void GameCommand_trace(float request, float argc) for ( ; ; ) { pos = p * (1 - (safe + unsafe) * 0.5) + start * ((safe + unsafe) * 0.5); - tracebox(pos, PL_MIN, PL_MAX, pos, MOVE_NOMONSTERS, world); + tracebox(pos, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), pos, MOVE_NOMONSTERS, world); if (trace_startsolid) { if ((safe + unsafe) * 0.5 == unsafe) break; @@ -1568,7 +1568,7 @@ void GameCommand_trace(float request, float argc) LOG_INFO("safe distance to back off: ", ftos(safe * vlen(p - start)), "qu\n"); LOG_INFO("unsafe distance to back off: ", ftos(unsafe * vlen(p - start)), "qu\n"); - tracebox(p, PL_MIN + '0.1 0.1 0.1', PL_MAX - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, world); + tracebox(p, STAT(PL_MIN, NULL) + '0.1 0.1 0.1', STAT(PL_MAX, NULL) - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, world); if (trace_startsolid) LOG_INFO("trace_endpos much in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n"); else LOG_INFO("trace_endpos just in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n"); if (++hitcount >= 10) break; @@ -1582,7 +1582,7 @@ void GameCommand_trace(float request, float argc) { q = p + normalize(end - p) * (dq + dqf); if (q == q0) break; - tracebox(p, PL_MIN, PL_MAX, q, MOVE_NOMONSTERS, world); + tracebox(p, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), q, MOVE_NOMONSTERS, world); if (trace_startsolid) error("THIS ONE cannot happen"); if (trace_fraction > 0) dq += dqf * trace_fraction; dqf *= 0.5; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 95a07a520..c536ceaa2 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -480,7 +480,7 @@ void detect_maptype() o.y += random() * (world.maxs.y - world.mins.y); o.z += random() * (world.maxs.z - world.mins.z); - tracebox(o, PL_MIN, PL_MAX, o - '0 0 32768', MOVE_WORLDONLY, world); + tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 32768', MOVE_WORLDONLY, world); if(trace_fraction == 1) continue; diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 042497254..6a4812e58 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -336,7 +336,7 @@ void kh_Key_Detach(entity key) // runs every time a key is dropped or lost. Runs } // in any case: setattachment(key, world, ""); - setorigin(key, key.owner.origin + '0 0 1' * (PL_MIN.z - KH_KEY_MIN_z)); + setorigin(key, key.owner.origin + '0 0 1' * (STAT(PL_MIN, NULL).z - KH_KEY_MIN_z)); key.angles = key.owner.angles; #else setorigin(key, key.owner.origin + key.origin.z * '0 0 1'); diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 8f311f169..1b09ac450 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -208,8 +208,8 @@ float Portal_FindSafeOrigin(entity portal) { vector o; o = portal.origin; - portal.mins = PL_MIN - SAFERNUDGE; - portal.maxs = PL_MAX + SAFERNUDGE; + portal.mins = STAT(PL_MIN, NULL) - SAFERNUDGE; + portal.maxs = STAT(PL_MAX, NULL) + SAFERNUDGE; fixedmakevectors(portal.mangle); portal.origin += 16 * v_forward; if(!move_out_of_solid(portal)) diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index f014f1a2b..ecaaad5bb 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -934,7 +934,7 @@ spawnfunc(trigger_race_checkpoint) self.touch = checkpoint_touch; o = (self.absmin + self.absmax) * 0.5; - tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o.z - self.absmin.z), MOVE_NORMAL, self); + tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - self.absmin.z), MOVE_NORMAL, self); waypoint_spawnforitem_force(self, trace_endpos); self.nearestwaypointtimeout = time + 1000000000; @@ -983,7 +983,7 @@ spawnfunc(target_checkpoint) // defrag entity self.touch = checkpoint_touch; o = (self.absmin + self.absmax) * 0.5; - tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o.z - self.absmin.z), MOVE_NORMAL, self); + tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - self.absmin.z), MOVE_NORMAL, self); waypoint_spawnforitem_force(self, trace_endpos); self.nearestwaypointtimeout = time + 1000000000; -- 2.39.2