]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
for new players, set a random color at menuqc startup
authorRudolf Polzer <divverent@xonotic.org>
Wed, 25 Jul 2012 08:18:11 +0000 (10:18 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 25 Jul 2012 08:21:36 +0000 (10:21 +0200)
defaultXonotic.cfg
qcsrc/menu/xonotic/colorbutton.c

index ae952d8a1baca656b277db42af5f9fdbf9c9fced..16510f7805a10b7e69a3cc8ff9370a05b2a21f83 100644 (file)
@@ -57,7 +57,7 @@ bind f6 team_auto
 mod_q3bsp_lightmapmergepower 4
 
 // player defaults
-_cl_color 112
+_cl_color "112.211" // same effect as 112, but menuqc can detect this as the default and not intentionally set
 _cl_name Player
 _cl_playermodel models/player/erebus.iqm
 _cl_playerskin 0
index 4e81a4acc24d2aa7d5ecce525e54d15090e307ce..e0f4c5b2e4c616e02ea7eca35595969d5953618a 100644 (file)
@@ -70,6 +70,9 @@ void XonoticColorButton_loadCvars(entity me)
        if not(me.cvarName)
                return;
 
+       if(cvar_string(me.cvarName) == cvar_defstring(me.cvarName))
+               cvar_set(me.cvarName, ftos(16 * floor(random() * 15) + floor(random() * 15)));
+
        if(me.cvarPart == 1)
                me.checked = (cvar(me.cvarName) & 240) == me.cvarValueFloat * 16;
        else