REPLICATE_FIELD(bool, cvar_cl_weapon_switch_reload);
REPLICATE_FIELD(bool, cvar_cl_weapon_switch_fallback_to_impulse);
REPLICATE_FIELD(int, cvar_cl_weaponimpulsemode);
-REPLICATE_FIELD(string, cvar_cl_weaponpriority);
-REPLICATE_FIELD(string, cvar_cl_weaponpriorities[10]);
REPLICATE_FIELD(string, cvar_g_xonoticversion);
#endif
REPLICATE(cvar_cl_newusekeysupported, bool, "cl_newusekeysupported");
*/
-REPLICATE(cvar_cl_weaponpriority, string, "cl_weaponpriority");
-
-REPLICATE(cvar_cl_weaponpriorities[0], string, "cl_weaponpriority0");
-REPLICATE(cvar_cl_weaponpriorities[1], string, "cl_weaponpriority1");
-REPLICATE(cvar_cl_weaponpriorities[2], string, "cl_weaponpriority2");
-REPLICATE(cvar_cl_weaponpriorities[3], string, "cl_weaponpriority3");
-REPLICATE(cvar_cl_weaponpriorities[4], string, "cl_weaponpriority4");
-REPLICATE(cvar_cl_weaponpriorities[5], string, "cl_weaponpriority5");
-REPLICATE(cvar_cl_weaponpriorities[6], string, "cl_weaponpriority6");
-REPLICATE(cvar_cl_weaponpriorities[7], string, "cl_weaponpriority7");
-REPLICATE(cvar_cl_weaponpriorities[8], string, "cl_weaponpriority8");
-REPLICATE(cvar_cl_weaponpriorities[9], string, "cl_weaponpriority9");
#endif
#endif
#endif
+
+#ifdef SVQC
+string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo)
+{
+ string o = W_FixWeaponOrder_ForceComplete(wo);
+ strcpy(CS_CVAR(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
+ return o;
+}
+#endif
#ifdef SVQC
void wframe_send(entity actor, entity weaponentity, int wepframe, float attackrate, bool restartanim);
-#endif
-#ifdef SVQC
void W_MuzzleFlash(Weapon thiswep, entity actor, .entity weaponentity, vector shotorg, vector shotdir);
+
+string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo);
+string W_FixWeaponOrder_AllowIncomplete(entity this, string order);
#endif
+
+REPLICATE_FIELD(string, cvar_cl_weaponpriority);
+REPLICATE_FIELD(string, cvar_cl_weaponpriorities[10]);
+REPLICATE(cvar_cl_weaponpriority, string, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
+REPLICATE(cvar_cl_weaponpriorities[0], string, "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[1], string, "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[2], string, "cl_weaponpriority2", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[3], string, "cl_weaponpriority3", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[4], string, "cl_weaponpriority4", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[5], string, "cl_weaponpriority5", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[6], string, "cl_weaponpriority6", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[7], string, "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[8], string, "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[9], string, "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
+
#endif
#pragma once
+#ifdef SVQC
+// copies a string to a tempstring (so one can strunzone it)
+string strcat1(string s) = #115; // FRIK_FILE
+#endif
#if defined(CSQC)
#define REPLICATE_FIELD(type, name) type name
{ strfree(field); }, \
{ \
/* also initialize to the default value of func when requesting cvars */ \
- string s = func(field); \
+ string s = func(this, strcat1(field)); \
if (s != field) \
{ \
strcpy(field, s); \
=============
GetCvars
=============
+Superseded by REPLICATE
Called with:
0: sends the request
>0: receives a cvar from name=argv(f) value=argv(f+1)
stuffcmd(this, strcat("cl_cmd sendcvar ", name, "\n"));
}
}
-string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo)
-{
- string o = W_FixWeaponOrder_ForceComplete(wo);
- strcpy(CS_CVAR(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
- return o;
-}
/**
* @param f -1: cleanup, 0: request, 1: receive
ReplicateVars(this, store, s, f);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[2], "cl_weaponpriority2", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[3], "cl_weaponpriority3", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[4], "cl_weaponpriority4", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[5], "cl_weaponpriority5", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[6], "cl_weaponpriority6", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[7], "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleString_Fixup(this, store, s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
-
// fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early)
if (f > 0)
{
void remove_unsafely(entity e);
-// copies a string to a tempstring (so one can strunzone it)
-string strcat1(string s) = #115; // FRIK_FILE
-
#ifdef PROFILING
float client_cefc_accumulator;
float client_cefc_accumulatortime;
/**/
MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
-/** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
-// NOTE: requesting cvar values (get_cvars_f 0) is deprecated
+/**
+ * is meant to call GetCvars_handle* for cvars this mutator needs from the client, e.g.:
+ MUTATOR_HOOKFUNCTION(mymutator, GetCvars)
+ {
+ GetCvars_handleFloat(this, store, s, f, cvar_mycvar, "mycvar");
+ return false;
+ }
+ * Usually you can just use REPLICATE instead of this hook, e.g.:
+ REPLICATE(cvar_mycvar, int, "mycvar");
+ * NOTE: requesting cvar values (get_cvars_f 0) is deprecated
+ */
#define EV_GetCvars(i, o) \
/**/ i(float, get_cvars_f) \
/**/ i(string, get_cvars_s) \