From a16d23d9d677a1c82006037d9b89915dc22b4ecb Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 23 Aug 2019 17:04:05 +0200 Subject: [PATCH] Remove references to sendcvar from cvar descriptions, mark setreport as deprecated. Fix compilation units. --- commands.cfg | 5 +---- qcsrc/client/commands/cl_cmd.qc | 4 ++-- qcsrc/client/defs.qh | 11 ----------- qcsrc/client/view.qc | 4 ---- qcsrc/common/notifications/all.qh | 13 +++++++++++++ qcsrc/lib/replicate.qh | 2 +- xonotic-client.cfg | 8 ++++---- 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/commands.cfg b/commands.cfg index 798104a68..d5da481b9 100644 --- a/commands.cfg +++ b/commands.cfg @@ -134,7 +134,7 @@ alias debugmodel "qc_cmd_cl debugmodel ${* ?}" // Spawn alias hud "qc_cmd_cl hud ${* ?}" // Commands regarding/controlling the HUD system alias localprint "qc_cmd_cl localprint ${* ?}" // Create your own centerprint sent to yourself //alias mv_download "qc_cmd_cl mv_download ${* ?}" // Retrieve mapshot picture from the server -alias sendcvar "qc_cmd_cl sendcvar ${* ?}" // Send a cvar to the server (like weaponpriority) +alias sendcvar "qc_cmd_cl sendcvar ${* ?}" // Send a cvar to the server (like cl_weaponpriority) alias weapon_find "qc_cmd_cl weapon_find ${* ?}" // Show spawn locations of a weapon alias exit "quit" @@ -146,9 +146,6 @@ alias radar "qc_cmd_cl hud radar ${* ?}" alias scoreboard_columns_help "qc_cmd_cl hud scoreboard_columns_help" alias scoreboard_columns_set "qc_cmd_cl hud scoreboard_columns_set ${* ?}" -// changes a cvar and reports it to the server (for the client to notify the server about changes) -alias setreport "set \"$1\" \"$2\" ; sendcvar \"$1\"" - // ======================================================== // cmd (client-to-server command) - server/command/cmd.qc diff --git a/qcsrc/client/commands/cl_cmd.qc b/qcsrc/client/commands/cl_cmd.qc index 567096420..f0c1e789a 100644 --- a/qcsrc/client/commands/cl_cmd.qc +++ b/qcsrc/client/commands/cl_cmd.qc @@ -434,7 +434,7 @@ void LocalCommand_sendcvar(int request, int argc) case CMD_REQUEST_USAGE: { LOG_INFO("Usage:^3 cl_cmd sendcvar "); - LOG_INFO(" Where 'cvar' is the cvar plus arguments to send to the server."); + LOG_INFO(" Where 'cvar' is the cvar to send to the server."); return; } } @@ -477,7 +477,7 @@ CLIENT_COMMAND(handlevote, "System to handle selecting a vote or option") { Loca CLIENT_COMMAND(hud, "Commands regarding/controlling the HUD system") { LocalCommand_hud(request, arguments); } CLIENT_COMMAND(localprint, "Create your own centerprint sent to yourself") { LocalCommand_localprint(request, arguments); } CLIENT_COMMAND(mv_download, "Retrieve mapshot picture from the server") { LocalCommand_mv_download(request, arguments); } -CLIENT_COMMAND(sendcvar, "Send a cvar to the server (like weaponpriority)") { LocalCommand_sendcvar(request, arguments); } +CLIENT_COMMAND(sendcvar, "Send a cvar to the server (like cl_weaponpriority)") { LocalCommand_sendcvar(request, arguments); } void LocalCommand_macro_help() { diff --git a/qcsrc/client/defs.qh b/qcsrc/client/defs.qh index c8ed213c9..7720f071b 100644 --- a/qcsrc/client/defs.qh +++ b/qcsrc/client/defs.qh @@ -172,17 +172,6 @@ REPLICATE(cvar_cl_weaponpriorities[7], string, "cl_weaponpriority7"); REPLICATE(cvar_cl_weaponpriorities[8], string, "cl_weaponpriority8"); REPLICATE(cvar_cl_weaponpriorities[9], string, "cl_weaponpriority9"); -.int cvar_value; -void ReplicateVars(bool would_destroy) -{ - if (!would_destroy) - FOREACH(Notifications, it.nent_type == MSG_CHOICE, { - string cvarname = sprintf("notification_%s", Get_Notif_CvarName(it)); - // NOTE: REPLICATE_SIMPLE can return; - REPLICATE_SIMPLE(it.cvar_value, cvarname); - }); -} - float bgmtime; string weaponorder_byimpulse; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 203fbcc76..7385b4c3a 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1562,10 +1562,6 @@ void CSQC_UpdateView(entity this, float w, float h) lasthud = hud; - // TODO maybe don't send cvar values until the menu is open - // TODO remove CheckSendCvars from menu code (it seems broken anyway) - // TODO remove references to sendcvar from cvar descriptions - ReplicateVars(false); if (ReplicateVars_NOT_SENDING()) ReplicateVars_DELAY(0.8 + random() * 0.4); // no need to check cvars every frame diff --git a/qcsrc/common/notifications/all.qh b/qcsrc/common/notifications/all.qh index dc63a7080..2d775d4f2 100644 --- a/qcsrc/common/notifications/all.qh +++ b/qcsrc/common/notifications/all.qh @@ -856,4 +856,17 @@ REGISTRY_END(Notifications) LOG_SEVERE("Notification initialization failed! Read above and fix the errors!"); } +#ifdef CSQC +.int cvar_value; +void ReplicateVars(bool would_destroy) +{ + if (!would_destroy) + FOREACH(Notifications, it.nent_type == MSG_CHOICE, { + string cvarname = sprintf("notification_%s", Get_Notif_CvarName(it)); + // NOTE: REPLICATE_SIMPLE can return; + REPLICATE_SIMPLE(it.cvar_value, cvarname); + }); +} +#endif + #include "all.inc" diff --git a/qcsrc/lib/replicate.qh b/qcsrc/lib/replicate.qh index 7faa2ec2a..a88bde462 100644 --- a/qcsrc/lib/replicate.qh +++ b/qcsrc/lib/replicate.qh @@ -71,7 +71,7 @@ #define REPLICATE_7(fld, type, var, func, check, update, destroy) \ void ReplicateVars(bool would_destroy) \ { \ - if (would_destroy > 0) { destroy } \ + if (would_destroy) { destroy } \ else if (ReplicateVars_NOT_SENDING() && check) \ { \ localcmd(strcat("cl_cmd sendcvar ", var, "\n")); \ diff --git a/xonotic-client.cfg b/xonotic-client.cfg index c9a49f924..fc57c520f 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -2,8 +2,8 @@ // if you want to reset your client to defaults, it's probably a better idea to delete (parts of) config.cfg and restart -// changes a cvar and reports it to the server (for the menu to notify the -// server about changes) +// changes a cvar and reports it to the server (for the client to notify the server about changes) +// DEPRECATED, cvars can be set in the client code to be sent automatically (using REPLICATE) alias setreport "set \"$1\" \"$2\" ; sendcvar \"$1\"" seta cl_firststart "" "how many times the client has been run" @@ -648,9 +648,9 @@ alias _gl_flashblend_update_01 "gl_flashblend 0" alias _gl_flashblend_update_11 "gl_flashblend 0" alias gl_flashblend_update "_gl_flashblend_update_$r_shadow_realtime_dlight$r_showsurfaces" -set cl_handicap 1 "multiplies damage received and divides damage dealt NOTE: reconnect or use 'sendcvar cl_handicap' to update the choice." +set cl_handicap 1 "multiplies damage received and divides damage dealt" -seta cl_clippedspectating 1 "movement collision for spectators so that you can't pass through walls and such. (client setting) NOTE: reconnect or use sendcvar command to update the choice." +seta cl_clippedspectating 1 "movement collision for spectators so that you can't pass through walls and such" seta cl_autoscreenshot 1 "Take a screenshot upon the end of a match... 0 = Disable completely, 1 = Allow sv_autoscreenshot to take a screenshot when requested, 2 = Always take an autoscreenshot anyway." -- 2.39.2