#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)
#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
-#define CVAR_MAXFLAGSVAL 63
+#define CVAR_MAXFLAGSVAL 127
// for internal use only!
#define CVAR_DEFAULTSET (1<<30)
#define CVAR_ALLOCATED (1<<31)
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;
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)
{
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;
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;
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;
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;