From 78e6119d741b047aaedb9a99591fb142395eebc5 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 25 Jul 2012 10:18:11 +0200 Subject: [PATCH] for new players, set a random color at menuqc startup --- defaultXonotic.cfg | 2 +- qcsrc/menu/xonotic/colorbutton.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index ae952d8a1..16510f780 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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 diff --git a/qcsrc/menu/xonotic/colorbutton.c b/qcsrc/menu/xonotic/colorbutton.c index 4e81a4acc..e0f4c5b2e 100644 --- a/qcsrc/menu/xonotic/colorbutton.c +++ b/qcsrc/menu/xonotic/colorbutton.c @@ -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 -- 2.39.2