#include "xonotic/serverlist.qh"
#include "xonotic/slider_resolution.qh"
-.string cvarName;
+.string controlledCvar;
#include "xonotic/util.qh"
{
it = it.itemFromPoint(it, pos);
if (it.tooltip) best = it;
- else if (menu_tooltips == 2 && (it.cvarName || it.onClickCommand)) best = it;
+ else if (menu_tooltips == 2 && (it.controlledCvar || it.onClickCommand)) best = it;
it = NULL;
}
else if (it.instanceOfModalController)
}
if (!it) break;
if (it.tooltip) best = it;
- else if (menu_tooltips == 2 && (it.cvarName || it.onClickCommand)) best = it;
+ else if (menu_tooltips == 2 && (it.controlledCvar || it.onClickCommand)) best = it;
pos = globalToBox(pos, it.Container_origin, it.Container_size);
}
if (menu_tooltips == 2)
{
string s;
- if (menuTooltipItem.cvarName)
+ if (menuTooltipItem.controlledCvar)
{
string cvar_list = getCvarsMulti(menuTooltipItem);
if (cvar_list)
- cvar_list = strcat(menuTooltipItem.cvarName, " ", cvar_list);
+ cvar_list = strcat(menuTooltipItem.controlledCvar, " ", cvar_list);
else
- cvar_list = menuTooltipItem.cvarName;
- s = strcat("[", cvar_list, " \"", cvar_string(menuTooltipItem.cvarName), "\"]");
+ cvar_list = menuTooltipItem.controlledCvar;
+ s = strcat("[", cvar_list, " \"", cvar_string(menuTooltipItem.controlledCvar), "\"]");
}
else if (menuTooltipItem.onClickCommand)
{
{
// read campaign cvars
strcpy(campaign_name, cvar_string("g_campaign_name"));
- strcpy(me.cvarName, strcat("g_campaign", campaign_name, "_index"));
- registercvar(me.cvarName, "", 0); // saved by server QC anyway
+ strcpy(me.controlledCvar, strcat("g_campaign", campaign_name, "_index"));
+ registercvar(me.controlledCvar, "", 0); // saved by server QC anyway
CampaignFile_Unload();
CampaignFile_Load(0, CAMPAIGN_MAX_ENTRIES);
- me.campaignIndex = bound(0, cvar(me.cvarName), campaign_entries);
- cvar_set(me.cvarName, ftos(me.campaignIndex));
+ me.campaignIndex = bound(0, cvar(me.controlledCvar), campaign_entries);
+ cvar_set(me.controlledCvar, ftos(me.campaignIndex));
if(me.columnNameSize)
rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
me.nItems = min(me.campaignIndex + 2, campaign_entries);
// write campaign cvars
// no reason to do this!
// cvar_set("g_campaign_name", campaign_name);
- // cvar_set(me.cvarName, ftos(me.campaignIndex)); // NOTE: only server QC does that!
+ // cvar_set(me.controlledCvar, ftos(me.campaignIndex)); // NOTE: only server QC does that!
}
void XonoticCampaignList_campaignGo(entity me, float step)
if(me.buttonPrev)
me.buttonPrev.disabled = !me.hasPrevCampaign;
- if(cvar(me.cvarName) != me.campaignIndex || cvar_string("g_campaign_name") != campaign_name)
+ if(cvar(me.controlledCvar) != me.campaignIndex || cvar_string("g_campaign_name") != campaign_name)
me.loadCvars(me);
SUPER(XonoticCampaignList).draw(me);
}
ATTRIB(XonoticCampaignList, emptyLineHeight, float, 0.5);
ATTRIB(XonoticCampaignList, campaignIndex, float, 0);
- ATTRIB(XonoticCampaignList, cvarName, string);
+ ATTRIB(XonoticCampaignList, controlledCvar, string);
METHOD(XonoticCampaignList, loadCvars, void(entity));
METHOD(XonoticCampaignList, saveCvars, void(entity));
ATTRIB(XonoticCampaignList, hasNextCampaign, bool, false);
me.yesValue = theYesValue;
me.noValue = theNoValue;
me.checked = 0;
- me.cvarName = (theCvar) ? theCvar : string_null;
+ me.controlledCvar = (theCvar) ? theCvar : string_null;
me.loadCvars(me);
setZonedTooltip(me, theTooltip, theCvar);
me.configureCheckBox(me, theText, me.fontSize, me.image);
{
float m, d;
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
m = (me.yesValue + me.noValue) * 0.5;
- d = (cvar(me.cvarName) - m) / (me.yesValue - m);
+ d = (cvar(me.controlledCvar) - m) / (me.yesValue - m);
me.checked = (d > 0);
}
void XonoticCheckBox_saveCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
if(me.checked)
- cvar_set(me.cvarName, ftos_mindecimals(me.yesValue));
+ cvar_set(me.controlledCvar, ftos_mindecimals(me.yesValue));
else
- cvar_set(me.cvarName, ftos_mindecimals(me.noValue));
+ cvar_set(me.controlledCvar, ftos_mindecimals(me.noValue));
- CheckSendCvars(me, me.cvarName);
+ CheckSendCvars(me, me.controlledCvar);
}
ATTRIB(XonoticCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F);
ATTRIB(XonoticCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D);
- ATTRIB(XonoticCheckBox, cvarName, string);
+ ATTRIB(XonoticCheckBox, controlledCvar, string);
METHOD(XonoticCheckBox, loadCvars, void(entity));
METHOD(XonoticCheckBox, saveCvars, void(entity));
ATTRIB(XonoticCheckBox, sendCvars, float, 0);
me.savedValue = theControlledSlider.valueMin;
me.controlledSlider = theControlledSlider;
me.configureCheckBox(me, theText, me.fontSize, me.image);
- me.cvarName = theControlledSlider.cvarName; // in case we want to display the cvar in the tooltip
+ me.controlledCvar = theControlledSlider.controlledCvar; // in case we want to display the cvar in the tooltip
me.tooltip = theControlledSlider.tooltip;
}
void XonoticSliderCheckBox_draw(entity me)
me.yesString = theYesValue;
me.noString = theNoValue;
me.checked = 0;
- me.cvarName = (theCvar) ? theCvar : string_null;
+ me.controlledCvar = (theCvar) ? theCvar : string_null;
me.loadCvars(me);
me.configureCheckBox(me, theText, me.fontSize, me.image);
}
}
void XonoticCheckBoxString_loadCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- if(cvar_string(me.cvarName) == me.yesString)
+ if(cvar_string(me.controlledCvar) == me.yesString)
me.checked = 1;
}
void XonoticCheckBoxString_saveCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
if(me.checked)
- cvar_set(me.cvarName, me.yesString);
+ cvar_set(me.controlledCvar, me.yesString);
else
- cvar_set(me.cvarName, me.noString);
+ cvar_set(me.controlledCvar, me.noString);
- CheckSendCvars(me, me.cvarName);
+ CheckSendCvars(me, me.controlledCvar);
}
ATTRIB(XonoticCheckBoxString, colorF, vector, SKINCOLOR_CHECKBOX_F);
ATTRIB(XonoticCheckBoxString, colorD, vector, SKINCOLOR_CHECKBOX_D);
- ATTRIB(XonoticCheckBoxString, cvarName, string);
+ ATTRIB(XonoticCheckBoxString, controlledCvar, string);
METHOD(XonoticCheckBoxString, loadCvars, void(entity));
METHOD(XonoticCheckBoxString, saveCvars, void(entity));
ATTRIB(XonoticCheckBoxString, sendCvars, float, 0);
// no change
break;
}
- me.cvarName = "_cl_color";
+ me.controlledCvar = "_cl_color";
me.cvarValueFloat = theValue;
me.cvarPart = theColor;
me.loadCvars(me);
}
void XonoticColorButton_loadCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- if(cvar_string(me.cvarName) == cvar_defstring(me.cvarName))
- cvar_set(me.cvarName, ftos(16 * floor(random() * 15) + floor(random() * 15)));
+ if(cvar_string(me.controlledCvar) == cvar_defstring(me.controlledCvar))
+ cvar_set(me.controlledCvar, ftos(16 * floor(random() * 15) + floor(random() * 15)));
if(me.cvarPart == 1)
- me.checked = (cvar(me.cvarName) & 240) == me.cvarValueFloat * 16;
+ me.checked = (cvar(me.controlledCvar) & 240) == me.cvarValueFloat * 16;
else
- me.checked = (cvar(me.cvarName) & 15) == me.cvarValueFloat;
+ me.checked = (cvar(me.controlledCvar) & 15) == me.cvarValueFloat;
}
void XonoticColorButton_saveCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
if(me.checked)
{
if(me.cvarPart == 1)
- cvar_set(me.cvarName, ftos((cvar(me.cvarName) & 15) + me.cvarValueFloat * 16));
+ cvar_set(me.controlledCvar, ftos((cvar(me.controlledCvar) & 15) + me.cvarValueFloat * 16));
else
- cvar_set(me.cvarName, ftos((cvar(me.cvarName) & 240) + me.cvarValueFloat));
+ cvar_set(me.controlledCvar, ftos((cvar(me.controlledCvar) & 240) + me.cvarValueFloat));
}
}
void XonoticColorButton_draw(entity me)
ATTRIB(XonoticColorButton, useDownAsChecked, float, 1);
ATTRIB(XonoticColorButton, cvarPart, float, 0);
- ATTRIB(XonoticColorButton, cvarName, string);
+ ATTRIB(XonoticColorButton, controlledCvar, string);
ATTRIB(XonoticColorButton, cvarValueFloat, float, 0);
METHOD(XonoticColorButton, loadCvars, void(entity));
METHOD(XonoticColorButton, saveCvars, void(entity));
void XonoticColorpickerString_configureXonoticColorpickerString(entity me, string theCvar, string theDefaultCvar)
{
me.configureImage(me, me.image);
- me.cvarName = (theCvar) ? theCvar : string_null;
+ me.controlledCvar = (theCvar) ? theCvar : string_null;
me.loadCvars(me);
}
void XonoticColorpickerString_loadCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- if(substring(me.cvarName, -1, 1) == "_")
+ if(substring(me.controlledCvar, -1, 1) == "_")
{
me.prevcoords = color_hslimage(
- eX * cvar(strcat(me.cvarName, "red")) +
- eY * cvar(strcat(me.cvarName, "green")) +
- eZ * cvar(strcat(me.cvarName, "blue")),
+ eX * cvar(strcat(me.controlledCvar, "red")) +
+ eY * cvar(strcat(me.controlledCvar, "green")) +
+ eZ * cvar(strcat(me.controlledCvar, "blue")),
me.imagemargin);
}
else
- me.prevcoords = color_hslimage(stov(cvar_string(me.cvarName)), me.imagemargin);
+ me.prevcoords = color_hslimage(stov(cvar_string(me.controlledCvar)), me.imagemargin);
}
void XonoticColorpickerString_saveCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- if(substring(me.cvarName, -1, 1) == "_")
+ if(substring(me.controlledCvar, -1, 1) == "_")
{
vector v = hslimage_color(me.prevcoords, me.imagemargin);
- cvar_set(strcat(me.cvarName, "red"), ftos(v.x));
- cvar_set(strcat(me.cvarName, "green"), ftos(v.y));
- cvar_set(strcat(me.cvarName, "blue"), ftos(v.z));
+ cvar_set(strcat(me.controlledCvar, "red"), ftos(v.x));
+ cvar_set(strcat(me.controlledCvar, "green"), ftos(v.y));
+ cvar_set(strcat(me.controlledCvar, "blue"), ftos(v.z));
}
else
- cvar_set(me.cvarName, sprintf("%v", hslimage_color(me.prevcoords, me.imagemargin)));
+ cvar_set(me.controlledCvar, sprintf("%v", hslimage_color(me.prevcoords, me.imagemargin)));
}
METHOD(XonoticColorpickerString, mousePress, bool(XonoticColorpickerString this, vector pos))
METHOD(XonoticColorpickerString, mouseRelease, float(entity, vector));
METHOD(XonoticColorpickerString, mouseDrag, float(entity, vector));
- ATTRIB(XonoticColorpickerString, cvarName, string);
+ ATTRIB(XonoticColorpickerString, controlledCvar, string);
METHOD(XonoticColorpickerString, loadCvars, void(entity));
METHOD(XonoticColorpickerString, saveCvars, void(entity));
{
me.configureInputBox(me, "", 0, me.fontSize, me.image);
me.editColorCodes = doEditColorCodes;
- me.cvarName = (theCvar) ? theCvar : string_null;
+ me.controlledCvar = (theCvar) ? theCvar : string_null;
me.loadCvars(me);
setZonedTooltip(me, theTooltip, theCvar);
me.cursorPos = strlen(me.text);
}
void XonoticInputBox_loadCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- SUPER(XonoticInputBox).setText(me, cvar_string(me.cvarName));
+ SUPER(XonoticInputBox).setText(me, cvar_string(me.controlledCvar));
}
void XonoticInputBox_saveCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- cvar_set(me.cvarName, me.text);
- CheckSendCvars(me, me.cvarName);
+ cvar_set(me.controlledCvar, me.text);
+ CheckSendCvars(me, me.controlledCvar);
}
float XonoticInputBox_keyDown(entity me, float key, float ascii, float shift)
{
r = 0;
if(key == K_ENTER || key == K_KP_ENTER)
{
- if(me.cvarName)
+ if(me.controlledCvar)
{
me.saveCvars(me);
r = 1;
ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F);
ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C);
- ATTRIB(XonoticInputBox, cvarName, string);
+ ATTRIB(XonoticInputBox, controlledCvar, string);
METHOD(XonoticInputBox, loadCvars, void(entity));
METHOD(XonoticInputBox, saveCvars, void(entity));
ATTRIB(XonoticInputBox, sendCvars, float, 0);
}
void XonoticRadioButton_configureXonoticRadioButton(entity me, float theGroup, string theCvar, string theValue, string theText, string theTooltip)
{
- me.cvarName = (theCvar) ? theCvar : string_null;
+ me.controlledCvar = (theCvar) ? theCvar : string_null;
me.cvarValue = theValue;
me.loadCvars(me);
setZonedTooltip(me, theTooltip, theCvar);
{
if(me.cvarValue)
{
- if(me.cvarName)
+ if(me.controlledCvar)
{
if(me.cvarValueIsAnotherCvar)
- me.checked = (cvar_string(me.cvarName) == cvar_string(me.cvarValue));
+ me.checked = (cvar_string(me.controlledCvar) == cvar_string(me.cvarValue));
else
- me.checked = (cvar_string(me.cvarName) == me.cvarValue);
+ me.checked = (cvar_string(me.controlledCvar) == me.cvarValue);
}
}
else
{
- if(me.cvarName)
+ if(me.controlledCvar)
{
- me.checked = boolean(cvar(me.cvarName));
+ me.checked = boolean(cvar(me.controlledCvar));
}
else
{
void XonoticRadioButton_draw(entity me)
{
if (!me.cvarValue)
- if (!me.cvarName)
+ if (!me.controlledCvar)
{
// this is the "other" option
// always select this if none other is
{
if(me.cvarValue)
{
- if(me.cvarName)
+ if(me.controlledCvar)
{
if(me.checked)
{
if(me.cvarValueIsAnotherCvar)
- cvar_set(me.cvarName, cvar_string(me.cvarValue));
+ cvar_set(me.controlledCvar, cvar_string(me.cvarValue));
else
- cvar_set(me.cvarName, me.cvarValue);
+ cvar_set(me.controlledCvar, me.cvarValue);
}
else if(me.cvarOffValue)
- cvar_set(me.cvarName, me.cvarOffValue);
+ cvar_set(me.controlledCvar, me.cvarOffValue);
}
}
else
{
- if(me.cvarName)
+ if(me.controlledCvar)
{
- cvar_set(me.cvarName, ftos(me.checked));
+ cvar_set(me.controlledCvar, ftos(me.checked));
}
}
}
ATTRIB(XonoticRadioButton, colorF, vector, SKINCOLOR_RADIOBUTTON_F);
ATTRIB(XonoticRadioButton, colorD, vector, SKINCOLOR_RADIOBUTTON_D);
- ATTRIB(XonoticRadioButton, cvarName, string);
+ ATTRIB(XonoticRadioButton, controlledCvar, string);
ATTRIB(XonoticRadioButton, cvarValue, string);
ATTRIB(XonoticRadioButton, cvarOffValue, string);
ATTRIB(XonoticRadioButton, cvarValueIsAnotherCvar, float, 0);
me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
- me.cvarName = (theCvar) ? theCvar : string_null;
+ me.controlledCvar = (theCvar) ? theCvar : string_null;
if(theCvar)
// Prevent flickering of the slider button by initialising the
// slider out of bounds to hide the button before loading the cvar
}
void XonoticSlider_loadCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- me.setValue_noAnim(me, cvar(me.cvarName));
+ me.setValue_noAnim(me, cvar(me.controlledCvar));
}
void XonoticSlider_saveCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- cvar_set(me.cvarName, ftos_mindecimals(me.value));
+ cvar_set(me.controlledCvar, ftos_mindecimals(me.value));
- CheckSendCvars(me, me.cvarName);
+ CheckSendCvars(me, me.controlledCvar);
}
ATTRIB(XonoticSlider, colorD, vector, SKINCOLOR_SLIDER_D);
ATTRIB(XonoticSlider, color2, vector, SKINCOLOR_SLIDER_S);
- ATTRIB(XonoticSlider, cvarName, string);
+ ATTRIB(XonoticSlider, controlledCvar, string);
METHOD(XonoticSlider, loadCvars, void(entity));
METHOD(XonoticSlider, saveCvars, void(entity));
ATTRIB(XonoticSlider, sendCvars, float, 0);
{
float v;
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- v = cvar(me.cvarName);
+ v = cvar(me.controlledCvar);
// snapping
if(v > fromDecibelOfSquare(me.valueMax - 0.5 * me.valueStep, me.valueMin))
}
void XonoticDecibelsSlider_saveCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
if(me.value > me.valueMax - 0.5 * me.valueStep)
- cvar_set(me.cvarName, ftos(fromDecibelOfSquare(me.valueMax, me.valueMin)));
+ cvar_set(me.controlledCvar, ftos(fromDecibelOfSquare(me.valueMax, me.valueMin)));
else
- cvar_set(me.cvarName, ftos(fromDecibelOfSquare(me.value, me.valueMin)));
+ cvar_set(me.controlledCvar, ftos(fromDecibelOfSquare(me.value, me.valueMin)));
}
float autocvar_menu_snd_sliderscale;
void XonoticTextSlider_configureXonoticTextSlider(entity me, string theCvar, string theTooltip)
{
me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
- me.cvarName = (theCvar) ? theCvar : string_null;
+ me.controlledCvar = (theCvar) ? theCvar : string_null;
// me.loadCvars(me); // don't load it yet
setZonedTooltip(me, theTooltip, theCvar);
}
}
void XonoticTextSlider_loadCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
- float n = tokenize_console(me.cvarName);
+ float n = tokenize_console(me.controlledCvar);
string s = cvar_string(argv(0));
float i;
for(i = 1; i < n; ++i)
}
void XonoticTextSlider_saveCvars(entity me)
{
- if (!me.cvarName)
+ if (!me.controlledCvar)
return;
if(me.value >= 0 && me.value < me.nValues)
{
- float n = tokenize_console(me.cvarName);
+ float n = tokenize_console(me.controlledCvar);
if(n == 1)
{
// this is a special case to allow spaces in the identifiers
else
{
float i;
- float m = tokenize_console(strcat(me.cvarName, " ", me.getIdentifier(me)));
+ float m = tokenize_console(strcat(me.controlledCvar, " ", me.getIdentifier(me)));
if(m == n + 1)
{
for(i = 0; i < n; ++i)
}
}
else
- error("XonoticTextSlider: invalid identifier ", me.getIdentifier(me), " does not match cvar list ", me.cvarName);
+ error("XonoticTextSlider: invalid identifier ", me.getIdentifier(me), " does not match cvar list ", me.controlledCvar);
}
}
}
ATTRIB(XonoticTextSlider, colorD, vector, SKINCOLOR_SLIDER_D);
ATTRIB(XonoticTextSlider, color2, vector, SKINCOLOR_SLIDER_S);
- ATTRIB(XonoticTextSlider, cvarName, string);
+ ATTRIB(XonoticTextSlider, controlledCvar, string);
METHOD(XonoticTextSlider, loadCvars, void(entity));
METHOD(XonoticTextSlider, saveCvars, void(entity));
ATTRIB(XonoticTextSlider, sendCvars, float, 0);
depthfirst(root, parent, firstChild, nextSibling, funcPre, funcPost, pass);
}
-.string cvarName;
+.string controlledCvar;
void SUB_Null_ee(entity e1, entity e2)
{
}
forAllDescendants(root, loadCvarsOf, SUB_Null_ee, NULL);
}
-.string cvarNames_Multi;
+.string controlledCvars_Multi;
.void(entity me) saveCvars_Multi;
string getCvarsMulti(entity me)
{
- if (me.cvarNames_Multi)
- return me.cvarNames_Multi;
+ if (me.controlledCvars_Multi)
+ return me.controlledCvars_Multi;
return string_null;
}
void saveCvarsMulti(entity me)
string s, cvarname;
me.saveCvars_Multi(me);
- s = cvar_string(me.cvarName);
+ s = cvar_string(me.controlledCvar);
- n = tokenize_console(me.cvarNames_Multi);
+ n = tokenize_console(me.controlledCvars_Multi);
for(i = 0; i < n; ++i)
{
// cvars prefixed with ! get saved with the inverted value
}
void makeMulti(entity e, string otherCvars)
{
- e.cvarNames_Multi = otherCvars;
+ e.controlledCvars_Multi = otherCvars;
e.saveCvars_Multi = e.saveCvars;
e.saveCvars = saveCvarsMulti;
}