]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_cmd.c
gl_rmain: Perform lightmap updates only on visible surfaces. Fixes AD perf
[xonotic/darkplaces.git] / cl_cmd.c
index d17c6fda71c1d2224655185dbbb52e9efbe6620c..e8f90268951fdc6f5876493a0ff87f7cf6f27b33 100644 (file)
--- a/cl_cmd.c
+++ b/cl_cmd.c
@@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "image.h"
 #include <time.h>
 
+#include "cl_collision.h"
+
 cvar_t cl_name = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "name", "player", "change your player name"};
 cvar_t cl_rate = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "rate", "20000", "change your connection speed"};
 cvar_t cl_rate_burstsize = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "rate_burstsize", "1024", "internal storage cvar for current rate control burst size (changed by rate_burstsize command)"};
@@ -36,10 +38,9 @@ cvar_t cl_skin = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "skin", "", "QW playe
 cvar_t cl_noaim = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "noaim", "1", "QW option to disable vertical autoaim"};
 cvar_t cl_pmodel = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "pmodel", "0", "current player model number in nehahra"};
 cvar_t r_fixtrans_auto = {CVAR_CLIENT, "r_fixtrans_auto", "0", "automatically fixtrans textures (when set to 2, it also saves the fixed versions to a fixtrans directory)"};
-cvar_t rcon_password = {CVAR_CLIENT | CVAR_SERVER | CVAR_PRIVATE, "rcon_password", "", "password to authenticate rcon commands; NOTE: changing rcon_secure clears rcon_password, so set rcon_secure always before rcon_password; may be set to a string of the form user1:pass1 user2:pass2 user3:pass3 to allow multiple user accounts - the client then has to specify ONE of these combinations"};
-cvar_t rcon_secure = {CVAR_CLIENT | CVAR_SERVER, "rcon_secure", "0", "force secure rcon authentication (1 = time based, 2 = challenge based); NOTE: changing rcon_secure clears rcon_password, so set rcon_secure always before rcon_password"};
-cvar_t rcon_secure_challengetimeout = {CVAR_CLIENT, "rcon_secure_challengetimeout", "5", "challenge-based secure rcon: time out requests if no challenge came within this time interval"};
-cvar_t rcon_address = {CVAR_CLIENT, "rcon_address", "", "server address to send rcon commands to (when not connected to a server)"};
+
+extern cvar_t rcon_secure;
+extern cvar_t rcon_secure_challengetimeout;
 
 /*
 ===================
@@ -171,7 +172,8 @@ void CL_ForwardToServer (const char *s)
 void CL_ForwardToServer_f (cmd_state_t *cmd)
 {
        const char *s;
-       char vabuf[1024];
+       char vabuf[MAX_INPUTLINE];
+       size_t i;
        if (!strcasecmp(Cmd_Argv(cmd, 0), "cmd"))
        {
                // we want to strip off "cmd", so just send the args
@@ -180,7 +182,11 @@ void CL_ForwardToServer_f (cmd_state_t *cmd)
        else
        {
                // we need to keep the command name, so send Cmd_Argv(cmd, 0), a space and then Cmd_Args(cmd)
-               s = va(vabuf, sizeof(vabuf), "%s %s", Cmd_Argv(cmd, 0), Cmd_Argc(cmd) > 1 ? Cmd_Args(cmd) : "");
+               i = dpsnprintf(vabuf, sizeof(vabuf), "%s", Cmd_Argv(cmd, 0));
+               if(Cmd_Argc(cmd) > 1)
+                       // (i + 1) accounts for the added space
+                       dpsnprintf(&vabuf[i], sizeof(vabuf) - (i + 1), " %s", Cmd_Args(cmd));
+               s = vabuf;
        }
        // don't send an empty forward message if the user tries "cmd" by itself
        if (!s || !*s)
@@ -215,7 +221,7 @@ static void CL_SendCvar_f(cmd_state_t *cmd)
 CL_Color_f
 ==================
 */
-cvar_t cl_color = {CVAR_READONLY | CVAR_CLIENT | CVAR_SAVE, "_cl_color", "0", "internal storage cvar for current player colors (changed by color command)"};
+cvar_t cl_color = {CVAR_CLIENT | CVAR_SAVE, "_cl_color", "0", "internal storage cvar for current player colors (changed by color command)"};
 
 // Ignore the callbacks so this two-to-three way synchronization doesn't cause an infinite loop.
 static void CL_Color_c(cvar_t *var)
@@ -510,15 +516,6 @@ static void CL_Rcon_f(cmd_state_t *cmd) // credit: taken from QuakeWorld
        }
 }
 
-static void CL_RCon_ClearPassword_c(cvar_t *var)
-{
-       // whenever rcon_secure is changed to 0, clear rcon_password for
-       // security reasons (prevents a send-rcon-password-as-plaintext
-       // attack based on NQ protocol session takeover and svc_stufftext)
-       if(var->integer <= 0)
-               Cvar_SetQuick(&rcon_password, "");
-}
-
 /*
 ==================
 CL_FullServerinfo_f
@@ -654,11 +651,6 @@ void CL_InitCommands(void)
        Cvar_RegisterCallback(&cl_topcolor, CL_Topcolor_c);
        Cvar_RegisterVariable(&cl_bottomcolor);
        Cvar_RegisterCallback(&cl_bottomcolor, CL_Bottomcolor_c);
-       Cvar_RegisterVariable(&rcon_address);
-       Cvar_RegisterVariable(&rcon_secure);
-       Cvar_RegisterCallback(&rcon_secure, CL_RCon_ClearPassword_c);
-       Cvar_RegisterVariable(&rcon_secure_challengetimeout);
-       Cvar_RegisterVariable(&rcon_password);
        Cvar_RegisterVariable(&r_fixtrans_auto);
        Cvar_RegisterVariable(&cl_team);
        Cvar_RegisterVariable(&cl_skin);