]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed problems with playing on QW server caused by the use of _cl_name and similar...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 1 Mar 2007 23:11:26 +0000 (23:11 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 1 Mar 2007 23:11:26 +0000 (23:11 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6929 d7cf8633-e32d-0410-b094-e92efae38249

cvar.c
cvar.h
host_cmd.c

diff --git a/cvar.c b/cvar.c
index d3df0c421ebc71fce219e56cfe59b2c10e525ddd..98892d70c9def548eaed4ecae627831205b169c9 100644 (file)
--- a/cvar.c
+++ b/cvar.c
@@ -250,6 +250,28 @@ void Cvar_SetQuick_Internal (cvar_t *var, const char *value)
 #endif
        if ((var->flags & CVAR_USERINFO) && cls.state != ca_dedicated)
                CL_SetInfo(var->name, var->string, true, false, false, false);
 #endif
        if ((var->flags & CVAR_USERINFO) && cls.state != ca_dedicated)
                CL_SetInfo(var->name, var->string, true, false, false, false);
+       else if ((var->flags & CVAR_NQUSERINFOHACK) && cls.state != ca_dedicated)
+       {
+               // update the cls.userinfo to have proper values for the
+               // silly nq config variables.
+               //
+               // this is done when these variables are changed rather than at
+               // connect time because if the user or code checks the userinfo and it
+               // holds weird values it may cause confusion...
+               if (!strcmp(var->name, "_cl_color"))
+               {
+                       CL_SetInfo("topcolor", va("%i", (var->integer >> 4) & 15), true, false, false, false);
+                       CL_SetInfo("bottomcolor", va("%i", (var->integer) & 15), true, false, false, false);
+               }
+               else if (!strcmp(var->name, "_cl_rate"))
+                       CL_SetInfo("rate", va("%i", var->integer), true, false, false, false);
+               else if (!strcmp(var->name, "_cl_playerskin"))
+                       CL_SetInfo("playerskin", var->string, true, false, false, false);
+               else if (!strcmp(var->name, "_cl_playermodel"))
+                       CL_SetInfo("playermodel", var->string, true, false, false, false);
+               else if (!strcmp(var->name, "_cl_name"))
+                       CL_SetInfo("name", var->string, true, false, false, false);
+       }
 }
 
 void Cvar_SetQuick (cvar_t *var, const char *value)
 }
 
 void Cvar_SetQuick (cvar_t *var, const char *value)
diff --git a/cvar.h b/cvar.h
index 4224653e829fa581f50aae873ec6890db1661b1e..63b1b5e4e1c395295fb34a828231a5e5acd1f01a 100644 (file)
--- a/cvar.h
+++ b/cvar.h
@@ -65,8 +65,10 @@ interface from being ambiguous.
 #define CVAR_USERINFO 16
 // CVAR_PRIVATE means do not $ expand or sendcvar this cvar under any circumstances (rcon_password uses this)
 #define CVAR_PRIVATE 32
 #define CVAR_USERINFO 16
 // CVAR_PRIVATE means do not $ expand or sendcvar this cvar under any circumstances (rcon_password uses this)
 #define CVAR_PRIVATE 32
+// this means that this cvar should update a userinfo key but the name does not correspond directly to the userinfo key to update, and may require additional conversion ("_cl_color" for example should update "topcolor" and "bottomcolor")
+#define CVAR_NQUSERINFOHACK 64
 // used to determine if flags is valid
 // used to determine if flags is valid
-#define CVAR_MAXFLAGSVAL 63
+#define CVAR_MAXFLAGSVAL 127
 // for internal use only!
 #define CVAR_DEFAULTSET (1<<30)
 #define CVAR_ALLOCATED (1<<31)
 // for internal use only!
 #define CVAR_DEFAULTSET (1<<30)
 #define CVAR_ALLOCATED (1<<31)
index 57859b5cf37abc2590cf2b28d44225852d0719a5..2c466d1f24063e146f68bab4c221debcf676c6b8 100644 (file)
@@ -756,7 +756,7 @@ void Host_Loadgame_f (void)
 Host_Name_f
 ======================
 */
 Host_Name_f
 ======================
 */
-cvar_t cl_name = {CVAR_SAVE, "_cl_name", "player", "internal storage cvar for current player name (changed by name command)"};
+cvar_t cl_name = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_name", "player", "internal storage cvar for current player name (changed by name command)"};
 void Host_Name_f (void)
 {
        int i, j;
 void Host_Name_f (void)
 {
        int i, j;
@@ -813,7 +813,7 @@ void Host_Name_f (void)
 Host_Playermodel_f
 ======================
 */
 Host_Playermodel_f
 ======================
 */
-cvar_t cl_playermodel = {CVAR_SAVE, "_cl_playermodel", "", "internal storage cvar for current player model in Nexuiz (changed by playermodel command)"};
+cvar_t cl_playermodel = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playermodel", "", "internal storage cvar for current player model in Nexuiz (changed by playermodel command)"};
 // the old cl_playermodel in cl_main has been renamed to __cl_playermodel
 void Host_Playermodel_f (void)
 {
 // the old cl_playermodel in cl_main has been renamed to __cl_playermodel
 void Host_Playermodel_f (void)
 {
@@ -872,7 +872,7 @@ void Host_Playermodel_f (void)
 Host_Playerskin_f
 ======================
 */
 Host_Playerskin_f
 ======================
 */
-cvar_t cl_playerskin = {CVAR_SAVE, "_cl_playerskin", "", "internal storage cvar for current player skin in Nexuiz (changed by playerskin command)"};
+cvar_t cl_playerskin = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playerskin", "", "internal storage cvar for current player skin in Nexuiz (changed by playerskin command)"};
 void Host_Playerskin_f (void)
 {
        int i, j;
 void Host_Playerskin_f (void)
 {
        int i, j;
@@ -1144,7 +1144,7 @@ void Host_Tell_f(void)
 Host_Color_f
 ==================
 */
 Host_Color_f
 ==================
 */
-cvar_t cl_color = {CVAR_SAVE, "_cl_color", "0", "internal storage cvar for current player colors (changed by color command)"};
+cvar_t cl_color = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_color", "0", "internal storage cvar for current player colors (changed by color command)"};
 void Host_Color(int changetop, int changebottom)
 {
        int top, bottom, playercolor;
 void Host_Color(int changetop, int changebottom)
 {
        int top, bottom, playercolor;
@@ -1256,7 +1256,7 @@ void Host_BottomColor_f(void)
        Host_Color(-1, atoi(Cmd_Argv(1)));
 }
 
        Host_Color(-1, atoi(Cmd_Argv(1)));
 }
 
-cvar_t cl_rate = {CVAR_SAVE, "_cl_rate", "10000", "internal storage cvar for current rate (changed by rate command)"};
+cvar_t cl_rate = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_rate", "10000", "internal storage cvar for current rate (changed by rate command)"};
 void Host_Rate_f(void)
 {
        int rate;
 void Host_Rate_f(void)
 {
        int rate;
@@ -1325,7 +1325,7 @@ LordHavoc: only supported for Nehahra, I personally think this is dumb, but Mind
 LordHavoc: correction, Mindcrime will be removing pmodel in the future, but it's still stuck here for compatibility.
 ======================
 */
 LordHavoc: correction, Mindcrime will be removing pmodel in the future, but it's still stuck here for compatibility.
 ======================
 */
-cvar_t cl_pmodel = {CVAR_SAVE, "_cl_pmodel", "0", "internal storage cvar for current player model number in nehahra (changed by pmodel command)"};
+cvar_t cl_pmodel = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_pmodel", "0", "internal storage cvar for current player model number in nehahra (changed by pmodel command)"};
 static void Host_PModel_f (void)
 {
        int i;
 static void Host_PModel_f (void)
 {
        int i;