#include "checkbox.qh"
#include "radiobutton.qh"
+#define MENU_CVAR_NAME "_menu_cl_name"
+#define MENU_CVAR_COLOR "_menu_cl_color"
+#define MENU_CVAR_SKIN "_menu_cl_playerskin"
+#define MENU_CVAR_MODEL "_menu_cl_playermodel"
+
entity makeXonoticProfileTab()
{
entity me;
// profile menu specific cvars
string name = cvar_string("_cl_name");
- registercvar("_menu_profile_name", name, 0);
+ registercvar(MENU_CVAR_NAME, name, 0);
string color = cvar_string("_cl_color");
// if color unset, set random color
float randomColor = 16 * floor(random() * COLOR_BUTTONS_COUNT) + floor(random() * COLOR_BUTTONS_COUNT);
cvar_set("_cl_color", ftos(randomColor));
}
- registercvar("_menu_profile_color", color, 0);
+ registercvar(MENU_CVAR_COLOR, color, 0);
string skin = cvar_string("_cl_playerskin");
- registercvar("_menu_profile_skin", skin, 0);
+ registercvar(MENU_CVAR_SKIN, skin, 0);
string model = cvar_string("_cl_playermodel");
- registercvar("_menu_profile_model", model, 0);
+ registercvar(MENU_CVAR_MODEL, model, 0);
return me;
}
if (me.applyButton.disabled)
{
// name field
- string inputName = cvar_string("_menu_profile_name");
+ string inputName = cvar_string(MENU_CVAR_NAME);
if (name != inputName)
{
- cvar_set("_menu_profile_name", name);
+ cvar_set(MENU_CVAR_NAME, name);
me.nameInput.loadCvars(me.nameInput);
}
// color buttons
string color = cvar_string("_cl_color");
- string inputColor = cvar_string("_menu_profile_color");
+ string inputColor = cvar_string(MENU_CVAR_COLOR);
if (color != inputColor)
{
- cvar_set("_menu_profile_color", color);
+ cvar_set(MENU_CVAR_COLOR, color);
for (int i = 0; i < COLOR_BUTTONS_COUNT; i++)
{
me.colorButtonGroup1[i].loadCvars(me.colorButtonGroup1[i]);
// player model
string skin = cvar_string("_cl_playerskin");
- string skinInput = cvar_string("_menu_profile_skin");
+ string skinInput = cvar_string(MENU_CVAR_SKIN);
string model = cvar_string("_cl_playermodel");
- string modelInput = cvar_string("_menu_profile_model");
+ string modelInput = cvar_string(MENU_CVAR_MODEL);
if (skin != skinInput || model != modelInput)
{
- cvar_set("_menu_profile_skin", skin);
- cvar_set("_menu_profile_model", model);
+ cvar_set(MENU_CVAR_SKIN, skin);
+ cvar_set(MENU_CVAR_MODEL, model);
me.playerModelSelector.loadCvars(me.playerModelSelector);
me.playerModelSelector.go(me.playerModelSelector, 0);
}
entity e, label;
float i;
me.applyButton = makeXonoticCommandButton(_("Apply immediately"), '0 0 0',
- "_cl_color \"$_menu_profile_color\""
+ "_cl_color \"$"MENU_CVAR_COLOR"\""
"color -1 -1;" // apply colors contained in _cl_color
- "name \"$_menu_profile_name\";"
- "playermodel $_menu_profile_model;"
- "playerskin $_menu_profile_skin;"
+ "name \"$"MENU_CVAR_NAME"\";"
+ "playermodel $"MENU_CVAR_MODEL";"
+ "playerskin $"MENU_CVAR_SKIN";"
, COMMANDBUTTON_APPLY);
me.applyButton.disableOnClick = true;
label.fontSize = SKINFONTSIZE_TITLE;
me.gotoRC(me, 2.5, 0);
- me.TD(me, 1, 3.0, me.nameInput = makeXonoticInputBox_T(1, "_menu_profile_name",
+ me.TD(me, 1, 3.0, me.nameInput = makeXonoticInputBox_T(1, MENU_CVAR_NAME,
_("Name under which you will appear in the game")));
me.nameInput.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
me.nameInput.maxLength = -127; // negative means encoded length in bytes
me.TR(me);
//me.TDempty(me, 0); // MODEL LEFT, COLOR RIGHT
me.TDempty(me, 1); // MODEL RIGHT, COLOR LEFT
- me.playerModelSelector = makeXonoticPlayerModelSelector("_menu_profile_skin", "_menu_profile_model");
+ me.playerModelSelector = makeXonoticPlayerModelSelector(MENU_CVAR_SKIN, MENU_CVAR_MODEL);
me.TD(me, 1, 0.3, e = makeXonoticButton("<<", '0 0 0'));
e.onClick = PlayerModelSelector_Prev_Click;
e.onClickEntity = me.playerModelSelector;
{
if(mod(i, 5) == 0)
me.TR(me);
- me.TDNoMargin(me, 1, 0.2, me.colorButtonGroup1[i] = makeXonoticColorButton("_menu_profile_color", 1, 0, i), '0 1 0');
+ me.TDNoMargin(me, 1, 0.2, me.colorButtonGroup1[i] = makeXonoticColorButton(MENU_CVAR_COLOR, 1, 0, i), '0 1 0');
me.colorButtonGroup1[i].applyButton = me.applyButton;
}
me.TR(me);
{
if(mod(i, 5) == 0)
me.TR(me);
- me.TDNoMargin(me, 1, 0.2, me.colorButtonGroup2[i] = makeXonoticColorButton("_menu_profile_color", 2, 1, i), '0 1 0');
+ me.TDNoMargin(me, 1, 0.2, me.colorButtonGroup2[i] = makeXonoticColorButton(MENU_CVAR_COLOR, 2, 1, i), '0 1 0');
me.colorButtonGroup2[i].applyButton = me.applyButton;
}