Remove references to sendcvar from cvar descriptions, mark setreport as deprecated... 694/head
authorterencehill <piuntn@gmail.com>
Fri, 23 Aug 2019 15:04:05 +0000 (17:04 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 23 Aug 2019 15:04:05 +0000 (17:04 +0200)
commands.cfg
qcsrc/client/commands/cl_cmd.qc
qcsrc/client/defs.qh
qcsrc/client/view.qc
qcsrc/common/notifications/all.qh
qcsrc/lib/replicate.qh
xonotic-client.cfg

index 798104a..d5da481 100644 (file)
@@ -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
index 5670964..f0c1e78 100644 (file)
@@ -434,7 +434,7 @@ void LocalCommand_sendcvar(int request, int argc)
                case CMD_REQUEST_USAGE:
                {
                        LOG_INFO("Usage:^3 cl_cmd sendcvar <cvar>");
-                       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()
 {
index c8ed213..7720f07 100644 (file)
@@ -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;
index 203fbcc..7385b4c 100644 (file)
@@ -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
index dc63a70..2d775d4 100644 (file)
@@ -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"
index 7faa2ec..a88bde4 100644 (file)
@@ -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")); \
index c9a49f9..fc57c52 100644 (file)
@@ -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."