From: terencehill Date: Sat, 8 Jan 2022 21:24:17 +0000 (+0100) Subject: Use REPLICATE_FIELD for the all replicated cvars X-Git-Tag: xonotic-v0.8.5~204^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=971b85b2be5d2e3508036dc7e270e2076150a8b6;p=xonotic%2Fxonotic-data.pk3dir.git Use REPLICATE_FIELD for the all replicated cvars --- diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 10dfa385d..ba83821f7 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -10,13 +10,9 @@ REGISTER_NET_TEMP(casings) -#if defined(SVQC) -.bool cvar_cl_casings; -.int cvar_r_drawviewmodel; -#elif defined(CSQC) -bool cvar_cl_casings; -int cvar_r_drawviewmodel; -#endif + +REPLICATE_FIELD(bool, cvar_cl_casings); +REPLICATE_FIELD(int, cvar_r_drawviewmodel); REPLICATE(cvar_cl_casings, bool, "cl_casings"); REPLICATE(cvar_r_drawviewmodel, int, "r_drawviewmodel"); diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qh b/qcsrc/common/mutators/mutator/buffs/buffs.qh index f4fad84de..44fe0f123 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qh @@ -72,3 +72,8 @@ string Buff_UndeprecateName(string buffname); BUFF_SPAWNFUNCS(random, NULL) #include "all.inc" + +#ifdef GAMEQC +REPLICATE_FIELD(bool, cvar_cl_buffs_autoreplace); +REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace"); +#endif diff --git a/qcsrc/common/mutators/mutator/buffs/cl_buffs.qh b/qcsrc/common/mutators/mutator/buffs/cl_buffs.qh index c9dbe5add..c93902291 100644 --- a/qcsrc/common/mutators/mutator/buffs/cl_buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/cl_buffs.qh @@ -1,6 +1,3 @@ #pragma once #include "buffs.qh" - -float cvar_cl_buffs_autoreplace; -REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace"); diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 7b85e7384..6ce016e56 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -969,8 +969,6 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerRegen) } } -REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace"); - MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsString) { if(autocvar_g_buffs > 0) // only report as a mutator if they're enabled diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh index 7635df6b6..c8b2b363d 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh @@ -77,9 +77,6 @@ float autocvar_g_buffs_luck_damagemultiplier = 3; const vector BUFF_MIN = ('-16 -16 0'); const vector BUFF_MAX = ('16 16 60'); -// client side options -.float cvar_cl_buffs_autoreplace; - float buff_Available(entity buff); void buff_RemoveAll(entity actor, int removal_type); diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index 53effbae2..956b54484 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -42,22 +42,23 @@ #endif #ifdef CSQC - float cvar_cl_dodging_timeout; - bool cvar_cl_dodging; bool autocvar_cl_dodging; #define PHYS_DODGING_FRAMETIME (1 / (frametime <= 0 ? 60 : frametime)) #define PHYS_DODGING_TIMEOUT(s) STAT(DODGING_TIMEOUT) #define PHYS_DODGING_PRESSED_KEYS(s) (s).pressedkeys #define PHYS_DODGING_ENABLED(s) autocvar_cl_dodging #elif defined(SVQC) - .float cvar_cl_dodging_timeout; - .bool cvar_cl_dodging; #define PHYS_DODGING_FRAMETIME sys_frametime #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_CVAR(s).cvar_cl_dodging #endif +REPLICATE_FIELD(bool, cvar_cl_dodging); +REPLICATE_FIELD(float, cvar_cl_dodging_timeout); +REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout"); +REPLICATE(cvar_cl_dodging, bool, "cl_dodging"); + #ifdef SVQC bool autocvar_sv_dodging_sound; @@ -307,9 +308,6 @@ MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics) #ifdef SVQC -REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout"); -REPLICATE(cvar_cl_dodging, bool, "cl_dodging"); - void dodging_ResetPlayer(entity this) { this.last_dodging_time = 0; diff --git a/qcsrc/common/mutators/mutator/multijump/multijump.qc b/qcsrc/common/mutators/mutator/multijump/multijump.qc index 9642ab0b3..5c7838b36 100644 --- a/qcsrc/common/mutators/mutator/multijump/multijump.qc +++ b/qcsrc/common/mutators/mutator/multijump/multijump.qc @@ -25,13 +25,9 @@ REGISTER_MUTATOR(multijump, true); .bool multijump_ready; #ifdef CSQC -int cvar_cl_multijump; int autocvar_cl_multijump = -1; - #define PHYS_MULTIJUMP_CLIENT(s) autocvar_cl_multijump #elif defined(SVQC) -.int cvar_cl_multijump; - #define PHYS_MULTIJUMP_CLIENT(s) CS_CVAR(s).cvar_cl_multijump #endif @@ -118,8 +114,6 @@ MUTATOR_HOOKFUNCTION(multijump, PlayerJump) } } -REPLICATE(cvar_cl_multijump, int, "cl_multijump"); - #ifdef SVQC MUTATOR_HOOKFUNCTION(multijump, BuildMutatorsString) diff --git a/qcsrc/common/mutators/mutator/multijump/multijump.qh b/qcsrc/common/mutators/mutator/multijump/multijump.qh index 6f70f09be..2d2dc015a 100644 --- a/qcsrc/common/mutators/mutator/multijump/multijump.qh +++ b/qcsrc/common/mutators/mutator/multijump/multijump.qh @@ -1 +1,6 @@ #pragma once + +#ifdef GAMEQC +REPLICATE_FIELD(int, cvar_cl_multijump); +REPLICATE(cvar_cl_multijump, bool, "cl_multijump"); +#endif diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 04c61a6d7..a8eb3b5f6 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -11,8 +11,6 @@ float autocvar_g_nades_spread = 0.04; REGISTER_STAT(NADES_SMALL, int, autocvar_g_nades_nade_small) #ifdef GAMEQC -REPLICATE(cvar_cl_nade_type, int, "cl_nade_type"); -REPLICATE(cvar_cl_pokenade_type, string, "cl_pokenade_type"); entity Nade_TrailEffect(int proj, int nade_team) { diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index c07882270..791c18b4b 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -129,6 +129,13 @@ Nade Nade_FromProjectile(int proj) .float orb_lifetime; .float orb_radius; +#ifdef GAMEQC +REPLICATE_FIELD(int, cvar_cl_nade_type); +REPLICATE_FIELD(string, cvar_cl_pokenade_type); +REPLICATE(cvar_cl_nade_type, int, "cl_nade_type"); +REPLICATE(cvar_cl_pokenade_type, string, "cl_pokenade_type"); +#endif + #ifdef SVQC .entity nade; @@ -137,8 +144,6 @@ Nade Nade_FromProjectile(int proj) .float nade_special_time; .string pokenade_type; .entity nade_damage_target; -.float cvar_cl_nade_type; -.string cvar_cl_pokenade_type; .float toss_time; .float nade_show_particles; .float nade_veil_prevalpha; @@ -167,8 +172,6 @@ MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage); #endif #ifdef CSQC -float cvar_cl_nade_type; -string cvar_cl_pokenade_type; bool Projectile_isnade(int proj); // TODO: remove void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time); // TODO: mutator diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/cl_spawn_near_teammate.qh b/qcsrc/common/mutators/mutator/spawn_near_teammate/cl_spawn_near_teammate.qh index 640a7255f..6f70f09be 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/cl_spawn_near_teammate.qh +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/cl_spawn_near_teammate.qh @@ -1,4 +1 @@ #pragma once - -float cvar_cl_spawn_near_teammate; -REPLICATE(cvar_cl_spawn_near_teammate, bool, "cl_spawn_near_teammate"); diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qh b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qh index 3f59c932d..6b08873ba 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qh +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qh @@ -1,2 +1,6 @@ #pragma once +#ifdef GAMEQC +REPLICATE_FIELD(bool, cvar_cl_spawn_near_teammate); +REPLICATE(cvar_cl_spawn_near_teammate, bool, "cl_spawn_near_teammate"); +#endif diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc index 2f0c79431..c2a3250d8 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc @@ -19,8 +19,6 @@ REGISTER_MUTATOR(spawn_near_teammate, expr_evaluate(autocvar_g_spawn_near_teamma .float msnt_timer; -.float cvar_cl_spawn_near_teammate; - MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score) { if (!teamplay) return; @@ -228,5 +226,3 @@ LABEL(skip) */ } } - -REPLICATE(cvar_cl_spawn_near_teammate, bool, "cl_spawn_near_teammate"); diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index cde5d56b3..d2c8c09e8 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -395,9 +395,9 @@ vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn void CL_WeaponEntity_SetModel(entity this, string name, bool _anim); #ifdef CSQC -bool cvar_cl_accuracy_data_share; +REPLICATE_FIELD(bool, cvar_cl_accuracy_data_share); +REPLICATE_FIELD(bool, cvar_cl_accuracy_data_receive); REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share"); -bool cvar_cl_accuracy_data_receive; REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive"); #endif diff --git a/qcsrc/server/weapons/accuracy.qh b/qcsrc/server/weapons/accuracy.qh index 81d2b1763..b1375b5a0 100644 --- a/qcsrc/server/weapons/accuracy.qh +++ b/qcsrc/server/weapons/accuracy.qh @@ -20,9 +20,9 @@ float autocvar_sv_accuracy_data_share = 1; -.bool cvar_cl_accuracy_data_share; +REPLICATE_FIELD(bool, cvar_cl_accuracy_data_share); +REPLICATE_FIELD(bool, cvar_cl_accuracy_data_receive); REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share"); -.bool cvar_cl_accuracy_data_receive; REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive"); .entity accuracy;