]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a wrapper for networked cvars and attach them to the client rather than the clien...
authorMario <zacjardine@y7mail.com>
Sun, 6 Dec 2020 04:06:35 +0000 (14:06 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 6 Dec 2020 04:06:35 +0000 (14:06 +1000)
31 files changed:
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc
qcsrc/common/gamemodes/gamemode/race/sv_race.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/dodging/sv_dodging.qc
qcsrc/common/mutators/mutator/multijump/multijump.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc
qcsrc/common/notifications/all.qc
qcsrc/common/notifications/all.qh
qcsrc/common/physics/player.qc
qcsrc/common/physics/player.qh
qcsrc/common/playerstats.qc
qcsrc/common/state.qc
qcsrc/common/state.qh
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/server/antilag.qc
qcsrc/server/bot/default/bot.qc
qcsrc/server/client.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/getreplies.qc
qcsrc/server/handicap.qc
qcsrc/server/impulse.qc
qcsrc/server/intermission.qc
qcsrc/server/items/items.qc
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/selection.qh
qcsrc/server/weapons/tracing.qc

index 3a6b386429b0cb5e1859991b02d7398cf338631e..d5af50fb3803043cf1f68072850692b78c390dd8 100644 (file)
@@ -27,9 +27,9 @@ void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float ran
        org = casingowner.origin + casingowner.view_ofs + org.x * v_forward - org.y * v_right + org.z * v_up;
 
        FOREACH_CLIENT(true, {
-               if (!(CS(it).cvar_cl_casings))
+               if (!(CS_CVAR(it).cvar_cl_casings))
                        continue;
-               if (it == casingowner && !(CS(it).cvar_r_drawviewmodel))
+               if (it == casingowner && !(CS_CVAR(it).cvar_r_drawviewmodel))
                        continue;
 
                msg_entity = it;
index 3e855c69b253f659235a04eee0840880a3254af2..43a489105f67dccf94a2f9cb089800e9cfded321 100644 (file)
                                                msg_entity = this.pusher;
                                                if (IS_REAL_CLIENT(msg_entity))
                                                {
-                                                       float atten = (CS(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE;
+                                                       float atten = (CS_CVAR(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE;
                                                        if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten, thepitch);
                                                        else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten, thepitch);
                                                        else soundto(MSG_ONE, this, chan, sample, vol, atten, thepitch);
                                {
                                        #define X() \
                                                MACRO_BEGIN \
-                                                       float atten = (CS(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \
+                                                       float atten = (CS_CVAR(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \
                                                        if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten, thepitch); \
                                                        else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten, thepitch); \
                                                        else soundto(MSG_ONE, this, chan, sample, vol, atten, thepitch); \
 
                                        #define X() \
                                                MACRO_BEGIN \
-                                                       if (voicetype != VOICETYPE_AUTOTAUNT || tauntrand < CS(msg_entity).cvar_cl_autotaunt) \
+                                                       if (voicetype != VOICETYPE_AUTOTAUNT || tauntrand < CS_CVAR(msg_entity).cvar_cl_autotaunt) \
                                                        { \
-                                                               float atten = (CS(msg_entity).cvar_cl_voice_directional >= 1) \
-                                                                       ? bound(ATTEN_MIN, CS(msg_entity).cvar_cl_voice_directional_taunt_attenuation, \
+                                                               float atten = (CS_CVAR(msg_entity).cvar_cl_voice_directional >= 1) \
+                                                                       ? bound(ATTEN_MIN, CS_CVAR(msg_entity).cvar_cl_voice_directional_taunt_attenuation, \
                                                                        ATTEN_MAX) \
                                                                        : ATTEN_NONE; \
                                                                if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten, thepitch); \
index 937575752af4f2c1547f11ac55c39e0060314505..83f9d2fb644a056156fe0b3374267d1352639b1b 100644 (file)
@@ -2318,7 +2318,7 @@ MUTATOR_HOOKFUNCTION(ctf, GetPressedKeys)
 
        entity player = M_ARGV(0, entity);
 
-       if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
+       if(CS_CVAR(player).cvar_cl_allow_uidtracking == 1 && CS_CVAR(player).cvar_cl_allow_uid2name == 1)
        {
                if (!player.stored_netname)
                        player.stored_netname = strzone(uid2name(player.crypto_idfp));
index 70bd105ef03466518464c7d8cb0963c3c82441bb..144788917415c2557d8fd5f5da7a81e3d803fb7b 100644 (file)
@@ -282,7 +282,7 @@ MUTATOR_HOOKFUNCTION(cts, GetPressedKeys)
 {
        entity player = M_ARGV(0, entity);
 
-       if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
+       if(CS_CVAR(player).cvar_cl_allow_uidtracking == 1 && CS_CVAR(player).cvar_cl_allow_uid2name == 1)
        {
                if (!player.stored_netname)
                        player.stored_netname = strzone(uid2name(player.crypto_idfp));
index bd5f8b4385dbe8d9aba13074be0d41425487efd5..a69a435227785f7172f65558155049abaddbbc4e 100644 (file)
@@ -328,7 +328,7 @@ MUTATOR_HOOKFUNCTION(rc, GetPressedKeys)
 {
        entity player = M_ARGV(0, entity);
 
-       if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
+       if(CS_CVAR(player).cvar_cl_allow_uidtracking == 1 && CS_CVAR(player).cvar_cl_allow_uid2name == 1)
        {
                if (!player.stored_netname)
                        player.stored_netname = strzone(uid2name(player.crypto_idfp));
index 66cd9007216fc9febac289c4bf115434b57afa52..38345efcf3eb621ceee85f45ffdd0da40069ac02 100644 (file)
@@ -76,7 +76,7 @@ bool buff_Waypoint_visible_for_player(entity this, entity player, entity view)
 
        if (STAT(BUFFS, view))
        {
-               return CS(view).cvar_cl_buffs_autoreplace == false || STAT(BUFFS, view) != STAT(BUFFS, this.owner);
+               return CS_CVAR(view).cvar_cl_buffs_autoreplace == false || STAT(BUFFS, view) != STAT(BUFFS, this.owner);
        }
 
        return WaypointSprite_visible_for_player(this, player, view);
@@ -174,7 +174,7 @@ void buff_Touch(entity this, entity toucher)
 
        if (STAT(BUFFS, toucher))
        {
-               if (CS(toucher).cvar_cl_buffs_autoreplace && STAT(BUFFS, toucher) != STAT(BUFFS, this))
+               if (CS_CVAR(toucher).cvar_cl_buffs_autoreplace && STAT(BUFFS, toucher) != STAT(BUFFS, this))
                {
                        // TODO: lost-gained notification for this case
                        int buffid = buff_FirstFromFlags(STAT(BUFFS, toucher)).m_id;
index 19f8b1046ca9f4acce853f5644012cdec16c2468..1103233e4f8250aa391a29a2b4c2aa06cd3757b4 100644 (file)
@@ -53,9 +53,9 @@
        .float cvar_cl_dodging_timeout;
        .bool cvar_cl_dodging;
        #define PHYS_DODGING_FRAMETIME                          sys_frametime
-       #define PHYS_DODGING_TIMEOUT(s)                         CS(s).cvar_cl_dodging_timeout
+       #define PHYS_DODGING_TIMEOUT(s)                         CS_CVAR(s).cvar_cl_dodging_timeout
        #define PHYS_DODGING_PRESSED_KEYS(s)            CS(s).pressedkeys
-       #define PHYS_DODGING_ENABLED(s)                         CS(s).cvar_cl_dodging
+       #define PHYS_DODGING_ENABLED(s)                         CS_CVAR(s).cvar_cl_dodging
 #endif
 
 #ifdef SVQC
index 40bc9a33e96d57c469a5fa27e1dcef40a30e14d6..9642ab0b38c6bc82ba8495fa87f1df8a2bca0a33 100644 (file)
@@ -32,7 +32,7 @@ int autocvar_cl_multijump = -1;
 #elif defined(SVQC)
 .int cvar_cl_multijump;
 
-       #define PHYS_MULTIJUMP_CLIENT(s)        CS(s).cvar_cl_multijump
+       #define PHYS_MULTIJUMP_CLIENT(s)        CS_CVAR(s).cvar_cl_multijump
 #endif
 
 MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
index 66d9e2d2c327227c69bf508e77e70a5f1ea11b50..a8d9f7936f6548b36f0cd36f63c4e0afbb35fe45 100644 (file)
@@ -1152,8 +1152,8 @@ void nade_prime(entity this)
        }
        else
        {
-               ntype = ((autocvar_g_nades_client_select) ? CS(this).cvar_cl_nade_type : autocvar_g_nades_nade_type);
-               pntype = ((autocvar_g_nades_client_select) ? CS(this).cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
+               ntype = ((autocvar_g_nades_client_select) ? CS_CVAR(this).cvar_cl_nade_type : autocvar_g_nades_nade_type);
+               pntype = ((autocvar_g_nades_client_select) ? CS_CVAR(this).cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
        }
 
        spawn_held_nade(this, this, autocvar_g_nades_nade_lifetime, ntype, pntype);
@@ -1306,8 +1306,8 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
 
                        if(autocvar_g_nades_bonus_client_select)
                        {
-                               STAT(NADE_BONUS_TYPE, player) = CS(player).cvar_cl_nade_type;
-                               player.pokenade_type = CS(player).cvar_cl_pokenade_type;
+                               STAT(NADE_BONUS_TYPE, player) = CS_CVAR(player).cvar_cl_nade_type;
+                               player.pokenade_type = CS_CVAR(player).cvar_cl_pokenade_type;
                        }
                        else
                        {
@@ -1414,7 +1414,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
                player.nade_refire  = time + autocvar_g_nades_nade_refire;
 
        if(autocvar_g_nades_bonus_client_select)
-               STAT(NADE_BONUS_TYPE, player) = CS(player).cvar_cl_nade_type;
+               STAT(NADE_BONUS_TYPE, player) = CS_CVAR(player).cvar_cl_nade_type;
 
        STAT(NADE_TIMER, player) = 0;
 
index 5c7505614e829734f2e074d4371abb824542bb1f..d6afab175160405513e6d6203393669a2aaad76b 100644 (file)
@@ -29,7 +29,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
        entity spawn_spot = M_ARGV(1, entity);
        vector spawn_score = M_ARGV(2, vector);
 
-       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS(player).cvar_cl_spawn_near_teammate))
+       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS_CVAR(player).cvar_cl_spawn_near_teammate))
                return;
 
        spawn_spot.msnt_lookat = NULL;
@@ -79,7 +79,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                return; // at least 1 team has only 1 player, let's not give the bigger team too much of an advantage!
 
        // Note: when entering this, fixangle is already set.
-       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS(player).cvar_cl_spawn_near_teammate))
+       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS_CVAR(player).cvar_cl_spawn_near_teammate))
        {
                if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death)
                        player.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
index 358453e5c52094373ef1625a9bbebcc4338d1018..d6dff6be9a9c6aa67495dd10082e1d61ee39a63c 100644 (file)
@@ -762,12 +762,12 @@ void Create_Notification_Entity_Choice(entity notif,
 
 // used by MSG_CHOICE to build list of choices
 #ifdef SVQC
-void Notification_GetCvars(entity this)
+void Notification_GetCvars(entity this, entity store)
 {
        FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1), {
                GetCvars_handleFloat(
                        this,
-                       CS(this),
+                       store,
                        get_cvars_s,
                        get_cvars_f,
                        msg_choice_choices[it.nent_choice_idx],
index a94ac9ab93bae4d9b8c7f0cad814cf75b7b49e41..72017e3dc8a3efd83a2cebeb521ddd5a3b99ac50 100644 (file)
@@ -310,7 +310,7 @@ float autocvar_notification_lifetime_mapload = 10;
 #endif
 
 #ifdef SVQC
-void Notification_GetCvars(entity this);
+void Notification_GetCvars(entity this, entity store);
 float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes
 #else
 float autocvar_notification_item_centerprinttime = 1.5;
index 69dcf56b0f5dd368c9d0bc5bc6df1c86cbce94ad..1c55d3d14b58e13a02369f0ba49b9f4e9e63d2ec 100644 (file)
@@ -19,9 +19,9 @@ float Physics_ClientOption(entity this, string option, float defaultval)
        if(!autocvar_g_physics_clientselect)
                return defaultval;
 
-       if(IS_REAL_CLIENT(this) && Physics_Valid(CS(this).cvar_cl_physics))
+       if(IS_REAL_CLIENT(this) && Physics_Valid(CS_CVAR(this).cvar_cl_physics))
        {
-               string s = strcat("g_physics_", CS(this).cvar_cl_physics, "_", option);
+               string s = strcat("g_physics_", CS_CVAR(this).cvar_cl_physics, "_", option);
                if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
                        return cvar(s);
        }
@@ -457,7 +457,7 @@ void CheckWaterJump(entity this)
 
 
 #ifdef SVQC
-       #define JETPACK_JUMP(s) CS(s).cvar_cl_jetpack_jump
+       #define JETPACK_JUMP(s) CS_CVAR(s).cvar_cl_jetpack_jump
 #elif defined(CSQC)
        float autocvar_cl_jetpack_jump;
        #define JETPACK_JUMP(s) autocvar_cl_jetpack_jump
index 67c70c4b091d315fa9444cdd5b8fade736c7c63d..9d92581f461a99d35696d5b9624d6b974818e6e7 100644 (file)
@@ -327,7 +327,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
        #define PHYS_JUMPSPEEDCAP_MIN               autocvar_sv_jumpspeedcap_min
        #define PHYS_JUMPSPEEDCAP_MAX               autocvar_sv_jumpspeedcap_max
 
-       #define PHYS_CL_TRACK_CANJUMP(s)            (CS(s).cvar_cl_movement_track_canjump)
+       #define PHYS_CL_TRACK_CANJUMP(s)            (CS_CVAR(s).cvar_cl_movement_track_canjump)
 
 #endif
 
index 2400d4750144916c09109ad4fa1eb55e2a4bdbba..05a6ab7975c9e0b6879c1becf5e34b35b088a0a0 100644 (file)
@@ -136,7 +136,7 @@ void PlayerStats_GameReport_FinalizePlayer(entity p)
 
        db_put(PS_GR_OUT_DB, sprintf("%s:_playerid", p.playerstats_id), ftos(p.playerid));
 
-       if(CS(p).cvar_cl_allow_uid2name == 1 || IS_BOT_CLIENT(p))
+       if(CS_CVAR(p).cvar_cl_allow_uid2name == 1 || IS_BOT_CLIENT(p))
                db_put(PS_GR_OUT_DB, sprintf("%s:_netname", p.playerstats_id), playername(p.netname, p.team, false));
 
        if(teamplay)
@@ -157,7 +157,7 @@ void PlayerStats_GameReport_FinalizePlayer(entity p)
                                PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, latency);
                }
 
-               db_put(PS_GR_OUT_DB, sprintf("%s:_ranked", p.playerstats_id), ftos(CS(p).cvar_cl_allow_uidranking));
+               db_put(PS_GR_OUT_DB, sprintf("%s:_ranked", p.playerstats_id), ftos(CS_CVAR(p).cvar_cl_allow_uidranking));
        }
 
        strfree(p.playerstats_id);
index 7a5979e2bc2c0ba261c11281798bf1d2355fdc1a..651a86f917f5a83ead5c6517070b05bd6be1cd4c 100644 (file)
@@ -68,7 +68,7 @@ void PlayerScore_Detach(entity this);
 
 void ClientState_detach(entity this)
 {
-    GetCvars(this, CS(this), -1);  // free cvars TODO: is this still needed now that it's stored on the clientstate entity?
+    GetCvars(this, CS_CVAR(this), -1);  // free cvars TODO: is this still needed now that it's stored on the clientstate entity?
     accuracy_free(this); // TODO: needs to be before CS() is deleted!
     PlayerScore_Detach(this); // what ^they^ said
     W_HitPlotClose(this);
index 42fc450c4728f97f4e63ca6fe9b196b79f2c0a53..7656d47e66ac566d2f1ae394204ef1716d0db97a 100644 (file)
@@ -47,5 +47,8 @@ ENDCLASS(ClientState)
        ClientState CS(Client this) { TC(Client, this); assert(this._cs); return this._cs; }
 #endif
 
+// NOTE: this exists to ease migration later on - ClientState does not exist early enough for replicated cvars!
+#define CS_CVAR(this) (this)
+
 void ClientState_attach(entity this);
 void ClientState_detach(entity this);
index 01a922bb8e47a7c6a80236062a04d902d7239738..5444980ca89ba2efc129dcfc25141a8503e681aa 100644 (file)
@@ -311,7 +311,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        );
 
        float lag = ((IS_REAL_CLIENT(actor)) ? ANTILAG_LATENCY(actor) : 0);
-       bool noantilag = ((IS_CLIENT(actor)) ? CS(actor).cvar_cl_noantilag : false);
+       bool noantilag = ((IS_CLIENT(actor)) ? CS_CVAR(actor).cvar_cl_noantilag : false);
        if(lag < 0.001)
                lag = 0;
        if(autocvar_g_antilag == 0 || noantilag)
index c3229adfdb5d4bb4c5b7e307f4d294bca69a24bd..b57627963c48c547ddd9b1c6e0e934562a88be6c 100644 (file)
@@ -151,7 +151,7 @@ void antilag_restore_all(entity ignore)
 float antilag_getlag(entity e)
 {
        float lag = ((IS_REAL_CLIENT(e)) ? ANTILAG_LATENCY(e) : 0);
-       bool noantilag = ((IS_CLIENT(e)) ? CS(e).cvar_cl_noantilag : false);
+       bool noantilag = ((IS_CLIENT(e)) ? CS_CVAR(e).cvar_cl_noantilag : false);
        if(autocvar_g_antilag == 0 || noantilag || lag < 0.001)
                lag = 0;
 
@@ -202,14 +202,14 @@ void traceline_antilag_force (entity source, vector v1, vector v2, float nomonst
 }
 void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
-       bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+       bool noantilag = ((IS_CLIENT(source)) ? CS_CVAR(source).cvar_cl_noantilag : false);
        if (autocvar_g_antilag != 2 || noantilag)
                lag = 0;
        traceline_antilag_force(source, v1, v2, nomonst, forent, lag);
 }
 void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
 {
-       bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+       bool noantilag = ((IS_CLIENT(source)) ? CS_CVAR(source).cvar_cl_noantilag : false);
        if (autocvar_g_antilag != 2 || noantilag)
                lag = 0;
        tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, false);
@@ -220,14 +220,14 @@ void WarpZone_traceline_antilag_force (entity source, vector v1, vector v2, floa
 }
 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
-       bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+       bool noantilag = ((IS_CLIENT(source)) ? CS_CVAR(source).cvar_cl_noantilag : false);
        if (autocvar_g_antilag != 2 || noantilag)
                lag = 0;
        WarpZone_traceline_antilag_force(source, v1, v2, nomonst, forent, lag);
 }
 void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
 {
-       bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+       bool noantilag = ((IS_CLIENT(source)) ? CS_CVAR(source).cvar_cl_noantilag : false);
        if (autocvar_g_antilag != 2 || noantilag)
                lag = 0;
        tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, true);
index 7afa5a10c516543ef425e430144471844276a507..9ba2a333b3d57ccfc5b893af9fe59232052211c4 100644 (file)
@@ -35,8 +35,8 @@ STATIC_INIT(bot) { bot_calculate_stepheightvec(); }
 // TODO: remove this function! its only purpose is to update these fields since bot_setnameandstuff is called before ClientState
 void bot_setclientfields(entity this)
 {
-       CS(this).cvar_cl_accuracy_data_share = 1;  // share the bots weapon accuracy data with the world
-       CS(this).cvar_cl_accuracy_data_receive = 0;  // don't receive any weapon accuracy data
+       CS_CVAR(this).cvar_cl_accuracy_data_share = 1;  // share the bots weapon accuracy data with the world
+       CS_CVAR(this).cvar_cl_accuracy_data_receive = 0;  // don't receive any weapon accuracy data
 }
 
 entity bot_spawn()
index 8dd73f66c48938e56750d827c0da29e34f1c046d..6bebfeb3666d33591dfe7c5c865344dba112979b 100644 (file)
@@ -785,7 +785,7 @@ void PutPlayerInServer(entity this)
 
        if (CS(this).impulse) ImpulseCommands(this);
 
-       W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
+       W_ResetGunAlign(this, CS_CVAR(this).cvar_cl_gunalign);
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
                .entity weaponentity = weaponentities[slot];
@@ -1220,7 +1220,7 @@ void ClientDisconnect(entity this)
        MUTATOR_CALLHOOK(ClientDisconnect, this);
 
        strfree(CS(this).netname_previous); // needs to be before the CS entity is removed!
-       strfree(CS(this).weaponorder_byimpulse);
+       strfree(CS_CVAR(this).weaponorder_byimpulse);
        ClientState_detach(this);
 
        Portal_ClearAll(this);
@@ -2260,7 +2260,7 @@ bool PlayerThink(entity this)
        bool dualwielding = W_DualWielding(this);
        if(this.dualwielding_prev != dualwielding)
        {
-               W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
+               W_ResetGunAlign(this, CS_CVAR(this).cvar_cl_gunalign);
                this.dualwielding_prev = dualwielding;
        }
 
@@ -2351,7 +2351,7 @@ void ObserverOrSpectatorThink(entity this)
                        }
                }
                else {
-                       int preferred_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? CS(this).cvar_cl_clippedspectating : !CS(this).cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+                       int preferred_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? CS_CVAR(this).cvar_cl_clippedspectating : !CS_CVAR(this).cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
                        set_movetype(this, preferred_movetype);
                }
        } else {
@@ -2430,8 +2430,8 @@ Called every frame for each client before the physics are run
 .float last_vehiclecheck;
 void PlayerPreThink (entity this)
 {
-       STAT(GUNALIGN, this) = CS(this).cvar_cl_gunalign; // TODO
-       STAT(MOVEVARS_CL_TRACK_CANJUMP, this) = CS(this).cvar_cl_movement_track_canjump;
+       STAT(GUNALIGN, this) = CS_CVAR(this).cvar_cl_gunalign; // TODO
+       STAT(MOVEVARS_CL_TRACK_CANJUMP, this) = CS_CVAR(this).cvar_cl_movement_track_canjump;
 
        WarpZone_PlayerPhysics_FixVAngle(this);
 
@@ -2473,19 +2473,19 @@ void PlayerPreThink (entity this)
        }
 
        // version nagging
-       if (CS(this).version_nagtime && CS(this).cvar_g_xonoticversion && time > CS(this).version_nagtime) {
+       if (CS(this).version_nagtime && CS_CVAR(this).cvar_g_xonoticversion && time > CS(this).version_nagtime) {
         CS(this).version_nagtime = 0;
-        if (strstrofs(CS(this).cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(CS(this).cvar_g_xonoticversion, "autobuild", 0) >= 0) {
+        if (strstrofs(CS_CVAR(this).cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(CS_CVAR(this).cvar_g_xonoticversion, "autobuild", 0) >= 0) {
             // git client
         } else if (strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0) {
             // git server
-            Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
+            Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, CS_CVAR(this).cvar_g_xonoticversion);
         } else {
-            int r = vercmp(CS(this).cvar_g_xonoticversion, autocvar_g_xonoticversion);
+            int r = vercmp(CS_CVAR(this).cvar_g_xonoticversion, autocvar_g_xonoticversion);
             if (r < 0) { // old client
-                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
+                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, CS_CVAR(this).cvar_g_xonoticversion);
             } else if (r > 0) { // old server
-                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
+                Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, CS_CVAR(this).cvar_g_xonoticversion);
             }
         }
     }
@@ -2549,7 +2549,7 @@ void PlayerPreThink (entity this)
                this.last_vehiclecheck = time + 1;
        }
 
-       if(!CS(this).cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+       if(!CS_CVAR(this).cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
        {
                if(PHYS_INPUT_BUTTON_USE(this) && !CS(this).usekeypressed)
                        PlayerUseKey(this);
index ad3685a1f0a549cc03631011531764dfb900cb34..bb227c63c6bd375a1d2d24997368d77c77ea8272 100644 (file)
@@ -73,8 +73,8 @@ void ClientCommand_autoswitch(entity caller, int request, int argc)
                {
                        if (argv(1) != "")
                        {
-                               CS(caller).autoswitch = InterpretBoolean(argv(1));
-                               sprint(caller, strcat("^1autoswitch is currently turned ", (CS(caller).autoswitch ? "on" : "off"), ".\n"));
+                               CS_CVAR(caller).autoswitch = InterpretBoolean(argv(1));
+                               sprint(caller, strcat("^1autoswitch is currently turned ", (CS_CVAR(caller).autoswitch ? "on" : "off"), ".\n"));
                                return;
                        }
                }
@@ -355,7 +355,7 @@ void ClientCommand_physics(entity caller, int request, int argc)
                }
 
                default:
-                       sprint(caller, strcat("Current physics set: ^3", CS(caller).cvar_cl_physics, "\n"));
+                       sprint(caller, strcat("Current physics set: ^3", CS_CVAR(caller).cvar_cl_physics, "\n"));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd physics <physics>\n");
@@ -603,7 +603,7 @@ void ClientCommand_sentcvar(entity caller, int request, int argc, string command
                                        tokenize_console(s);
                                }
 
-                               GetCvars(caller, CS(caller), 1);
+                               GetCvars(caller, CS_CVAR(caller), 1);
 
                                return;
                        }
index d0f882dce312d496ca97d28cd5c041506c78a628..1001bb7d7d9bd1f1602bb4fbb37e6fbb046c80dc 100644 (file)
@@ -379,7 +379,7 @@ void GetCvars_handleFloatOnce(entity this, entity store, string thisname, float
 string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo)
 {
        string o = W_FixWeaponOrder_ForceComplete(wo);
-       strcpy(CS(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
+       strcpy(CS_CVAR(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
        return o;
 }
 
@@ -400,7 +400,7 @@ void GetCvars(entity this, entity store, int f)
        get_cvars_s = s;
        MUTATOR_CALLHOOK(GetCvars);
 
-       Notification_GetCvars(this);
+       Notification_GetCvars(this, store);
 
        ReplicateVars(this, store, s, f);
 
index 6d03725f8f37a1b59bccf96c587c8416fff14099..ce0d6cd0a6c10f3fe0653d33da3ed700b0d95fb2 100644 (file)
@@ -17,7 +17,7 @@ void Handicap_Initialize(entity player)
 
 float Handicap_GetVoluntaryHandicap(entity player)
 {
-       return bound(1.0, CS(player).cvar_cl_handicap, 10.0);
+       return bound(1.0, CS_CVAR(player).cvar_cl_handicap, 10.0);
 }
 
 float Handicap_GetForcedHandicap(entity player)
index e9ebaec8766d8ec740ce48090006779c74692573..3fa3dc6c6fb263ee43874d7ab52a620ec2a7abee 100644 (file)
@@ -97,7 +97,7 @@ void weapon_priority_handle(entity this, int dir, int number, int imp)
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
                .entity weaponentity = weaponentities[slot];
-               W_CycleWeapon(this, CS(this).cvar_cl_weaponpriorities[number], dir, weaponentity);
+               W_CycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriorities[number], dir, weaponentity);
                if(autocvar_g_weaponswitch_debug != 1)
                        break;
        }
index 001692cf9d2b3f40e5a438b23d6d3c11cfb823a8..e1fb6f6070503374db00683ed8e8c0ba6e725086 100644 (file)
@@ -424,8 +424,8 @@ void IntermissionThink(entity this)
 {
        FixIntermissionClient(this);
 
-       float server_screenshot = (autocvar_sv_autoscreenshot && CS(this).cvar_cl_autoscreenshot);
-       float client_screenshot = (CS(this).cvar_cl_autoscreenshot == 2);
+       float server_screenshot = (autocvar_sv_autoscreenshot && CS_CVAR(this).cvar_cl_autoscreenshot);
+       float client_screenshot = (CS_CVAR(this).cvar_cl_autoscreenshot == 2);
 
        if( (server_screenshot || client_screenshot)
                && ((this.autoscreenshot > 0) && (time > this.autoscreenshot)) )
index 36932f0cef3f490a3bbff2f85e09033e49e25e8e..403125eea51b7ef9c41bcbfdea6aa6c654405991 100644 (file)
@@ -481,7 +481,7 @@ bool Item_GiveTo(entity item, entity player)
        // if the player is using their best weapon before items are given, they
        // probably want to switch to an even better weapon after items are given
 
-       if(CS(player).autoswitch)
+       if(CS_CVAR(player).autoswitch)
        {
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
@@ -570,7 +570,7 @@ bool Item_GiveTo(entity item, entity player)
                return false;
 
        // crude hack to enforce switching weapons
-       if(g_cts && item.itemdef.instanceOfWeaponPickup && !CS(player).cvar_cl_cts_noautoswitch)
+       if(g_cts && item.itemdef.instanceOfWeaponPickup && !CS_CVAR(player).cvar_cl_cts_noautoswitch)
        {
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
@@ -1429,7 +1429,7 @@ float GiveItems(entity e, float beginarg, float endarg)
 
        int _switchweapon = 0;
 
-       if(CS(e).autoswitch)
+       if(CS_CVAR(e).autoswitch)
        {
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
index 7b5220e036122e53a2850b5ae5d4740a1b27393e..3eafbc76c7025f0eae0aac9e691b087e5dd77a78 100644 (file)
@@ -27,7 +27,7 @@ bool accuracy_send(entity this, entity to, int sf)
        a = CS(a).accuracy;
 
        if (to != a.owner)
-               if (!autocvar_sv_accuracy_data_share && !CS(a.owner).cvar_cl_accuracy_data_share)
+               if (!autocvar_sv_accuracy_data_share && !CS_CVAR(a.owner).cvar_cl_accuracy_data_share)
                        sf = 0;
        // note: zero sendflags can never be sent... so we can use that to say that we send no accuracy!
        WriteInt24_t(MSG_ENTITY, sf);
index 5dd3073e9f0fe57b800b0ba19376e3a159942e81..09f5e65ca14349aa7da3fc37f7d5b68638779647 100644 (file)
@@ -283,7 +283,7 @@ bool W_SwitchWeapon(entity this, Weapon w, .entity weaponentity)
                        return false;
                }
        }
-       else if(!weaponLocked(this) && CS(this).cvar_cl_weapon_switch_reload)
+       else if(!weaponLocked(this) && CS_CVAR(this).cvar_cl_weapon_switch_reload)
        {
                entity actor = this;
                w.wr_reload(w, actor, weaponentity);
@@ -294,7 +294,7 @@ bool W_SwitchWeapon(entity this, Weapon w, .entity weaponentity)
 
 void W_SwitchWeapon_TryOthers(entity this, Weapon w, .entity weaponentity)
 {
-       if(!W_SwitchWeapon(this, w, weaponentity) && CS(this).cvar_cl_weapon_switch_fallback_to_impulse)
+       if(!W_SwitchWeapon(this, w, weaponentity) && CS_CVAR(this).cvar_cl_weapon_switch_fallback_to_impulse)
                W_NextWeaponOnImpulse(this, w.impulse, weaponentity);
 }
 
@@ -309,7 +309,7 @@ void W_CycleWeapon(entity this, string weaponorder, float dir, .entity weaponent
 void W_NextWeaponOnImpulse(entity this, float imp, .entity weaponentity)
 {
        float w;
-       w = W_GetCycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, imp, 1, (CS(this).cvar_cl_weaponimpulsemode == 0), weaponentity);
+       w = W_GetCycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriority, +1, imp, 1, (CS_CVAR(this).cvar_cl_weaponimpulsemode == 0), weaponentity);
        if(w > 0)
                W_SwitchWeapon(this, REGISTRY_GET(Weapons, w), weaponentity);
 }
@@ -320,9 +320,9 @@ void W_NextWeapon(entity this, int list, .entity weaponentity)
        if(list == 0)
                W_CycleWeapon(this, weaponorder_byid, -1, weaponentity);
        else if(list == 1)
-               W_CycleWeapon(this, CS(this).weaponorder_byimpulse, -1, weaponentity);
+               W_CycleWeapon(this, CS_CVAR(this).weaponorder_byimpulse, -1, weaponentity);
        else if(list == 2)
-               W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, -1, weaponentity);
+               W_CycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriority, -1, weaponentity);
 }
 
 // prev weapon
@@ -331,9 +331,9 @@ void W_PreviousWeapon(entity this, float list, .entity weaponentity)
        if(list == 0)
                W_CycleWeapon(this, weaponorder_byid, +1, weaponentity);
        else if(list == 1)
-               W_CycleWeapon(this, CS(this).weaponorder_byimpulse, +1, weaponentity);
+               W_CycleWeapon(this, CS_CVAR(this).weaponorder_byimpulse, +1, weaponentity);
        else if(list == 2)
-               W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, weaponentity);
+               W_CycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriority, +1, weaponentity);
 }
 
 // previously used if exists and has ammo, (second) best otherwise
index 363b569efdd8f23911a313eb9050cf206d82c691..093d6612b348052416bbf609e26217583914b398 100644 (file)
@@ -20,7 +20,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
 .int weaponcomplainindex;
 float W_GetCycleWeapon(entity this, string weaponorder, float dir, float imp, float complain, float skipmissing, .entity weaponentity);
 
-#define w_getbestweapon(ent,wepent) REGISTRY_GET(Weapons, W_GetCycleWeapon(ent, CS(ent).cvar_cl_weaponpriority, 0, -1, false, true, wepent))
+#define w_getbestweapon(ent,wepent) REGISTRY_GET(Weapons, W_GetCycleWeapon(ent, CS_CVAR(ent).cvar_cl_weaponpriority, 0, -1, false, true, wepent))
 
 void W_SwitchWeapon_Force(Player this, Weapon w, .entity weaponentity);
 
index b345b0984018ec8ccd77df2d03df5396f058630f..686634c7acfdadae38a1a19e29d521643b78ebe5 100644 (file)
@@ -107,7 +107,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect
        //vector prevend = w_shotend;
 
        if (antilag)
-       if (!CS(ent).cvar_cl_noantilag)
+       if (!CS_CVAR(ent).cvar_cl_noantilag)
        {
                if (autocvar_g_antilag == 1) // switch to "ghost" if not hitting original
                {