From: terencehill Date: Thu, 3 Dec 2020 16:28:48 +0000 (+0100) Subject: Don't show any tooltip with the name of the selected cvar in the cvar list as it... X-Git-Tag: xonotic-v0.8.5~652 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=33e2e50e79eab12dba6bcb0986725331c33034b7;p=xonotic%2Fxonotic-data.pk3dir.git Don't show any tooltip with the name of the selected cvar in the cvar list as it's pointless and looks wrong (this change has been made by renaming cvarName to controlledCvar everywhere in the menu code except in cvarlist.qc/cvarlist.qh); it fixes #2481 --- diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 07486347f..710dca1e6 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -13,7 +13,7 @@ #include "xonotic/serverlist.qh" #include "xonotic/slider_resolution.qh" -.string cvarName; +.string controlledCvar; #include "xonotic/util.qh" @@ -481,7 +481,7 @@ entity m_findtooltipitem(entity root, vector pos) { 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) @@ -494,7 +494,7 @@ entity m_findtooltipitem(entity root, vector pos) } 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); } @@ -505,14 +505,14 @@ string gettooltip() 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) { diff --git a/qcsrc/menu/xonotic/campaign.qc b/qcsrc/menu/xonotic/campaign.qc index 6f1d5111b..b9e9f54db 100644 --- a/qcsrc/menu/xonotic/campaign.qc +++ b/qcsrc/menu/xonotic/campaign.qc @@ -70,12 +70,12 @@ void XonoticCampaignList_loadCvars(entity me) { // 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); @@ -91,7 +91,7 @@ void XonoticCampaignList_saveCvars(entity me) // 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) @@ -155,7 +155,7 @@ void XonoticCampaignList_draw(entity me) 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); } diff --git a/qcsrc/menu/xonotic/campaign.qh b/qcsrc/menu/xonotic/campaign.qh index d6c674e8d..825c6af72 100644 --- a/qcsrc/menu/xonotic/campaign.qh +++ b/qcsrc/menu/xonotic/campaign.qh @@ -33,7 +33,7 @@ CLASS(XonoticCampaignList, XonoticListBox) 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); diff --git a/qcsrc/menu/xonotic/checkbox.qc b/qcsrc/menu/xonotic/checkbox.qc index 949b01c41..1065c5d6d 100644 --- a/qcsrc/menu/xonotic/checkbox.qc +++ b/qcsrc/menu/xonotic/checkbox.qc @@ -47,7 +47,7 @@ void XonoticCheckBox_configureXonoticCheckBox(entity me, float theYesValue, floa 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); @@ -66,22 +66,22 @@ void XonoticCheckBox_loadCvars(entity me) { 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); } diff --git a/qcsrc/menu/xonotic/checkbox.qh b/qcsrc/menu/xonotic/checkbox.qh index e46c9ce4a..811686fe1 100644 --- a/qcsrc/menu/xonotic/checkbox.qh +++ b/qcsrc/menu/xonotic/checkbox.qh @@ -14,7 +14,7 @@ CLASS(XonoticCheckBox, CheckBox) 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); diff --git a/qcsrc/menu/xonotic/checkbox_slider_invalid.qc b/qcsrc/menu/xonotic/checkbox_slider_invalid.qc index 839e66b21..55bab259c 100644 --- a/qcsrc/menu/xonotic/checkbox_slider_invalid.qc +++ b/qcsrc/menu/xonotic/checkbox_slider_invalid.qc @@ -20,7 +20,7 @@ void XonoticSliderCheckBox_configureXonoticSliderCheckBox(entity me, float theOf 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) diff --git a/qcsrc/menu/xonotic/checkbox_string.qc b/qcsrc/menu/xonotic/checkbox_string.qc index 99db16e35..419643472 100644 --- a/qcsrc/menu/xonotic/checkbox_string.qc +++ b/qcsrc/menu/xonotic/checkbox_string.qc @@ -12,7 +12,7 @@ void XonoticCheckBoxString_configureXonoticCheckBoxString(entity me, string theY 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); } @@ -23,21 +23,21 @@ void XonoticCheckBoxString_setChecked(entity me, float foo) } 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); } diff --git a/qcsrc/menu/xonotic/checkbox_string.qh b/qcsrc/menu/xonotic/checkbox_string.qh index e73a7144f..8f014020e 100644 --- a/qcsrc/menu/xonotic/checkbox_string.qh +++ b/qcsrc/menu/xonotic/checkbox_string.qh @@ -14,7 +14,7 @@ CLASS(XonoticCheckBoxString, CheckBox) 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); diff --git a/qcsrc/menu/xonotic/colorbutton.qc b/qcsrc/menu/xonotic/colorbutton.qc index f9db47f99..49bffed25 100644 --- a/qcsrc/menu/xonotic/colorbutton.qc +++ b/qcsrc/menu/xonotic/colorbutton.qc @@ -30,7 +30,7 @@ void XonoticColorButton_configureXonoticColorButton(entity me, float theGroup, f // no change break; } - me.cvarName = "_cl_color"; + me.controlledCvar = "_cl_color"; me.cvarValueFloat = theValue; me.cvarPart = theColor; me.loadCvars(me); @@ -46,28 +46,28 @@ void XonoticColorButton_setChecked(entity me, float val) } 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) diff --git a/qcsrc/menu/xonotic/colorbutton.qh b/qcsrc/menu/xonotic/colorbutton.qh index 9ff9639c5..5c729fcb8 100644 --- a/qcsrc/menu/xonotic/colorbutton.qh +++ b/qcsrc/menu/xonotic/colorbutton.qh @@ -11,7 +11,7 @@ CLASS(XonoticColorButton, RadioButton) 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)); diff --git a/qcsrc/menu/xonotic/colorpicker_string.qc b/qcsrc/menu/xonotic/colorpicker_string.qc index 5a44e5883..7dd4b5698 100644 --- a/qcsrc/menu/xonotic/colorpicker_string.qc +++ b/qcsrc/menu/xonotic/colorpicker_string.qc @@ -13,41 +13,41 @@ entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar) 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)) diff --git a/qcsrc/menu/xonotic/colorpicker_string.qh b/qcsrc/menu/xonotic/colorpicker_string.qh index aa4a10c93..adfe74f3f 100644 --- a/qcsrc/menu/xonotic/colorpicker_string.qh +++ b/qcsrc/menu/xonotic/colorpicker_string.qh @@ -9,7 +9,7 @@ CLASS(XonoticColorpickerString, Image) 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)); diff --git a/qcsrc/menu/xonotic/inputbox.qc b/qcsrc/menu/xonotic/inputbox.qc index 22a7ce717..4a3f90528 100644 --- a/qcsrc/menu/xonotic/inputbox.qc +++ b/qcsrc/menu/xonotic/inputbox.qc @@ -15,7 +15,7 @@ void XonoticInputBox_configureXonoticInputBox(entity me, float doEditColorCodes, { 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); @@ -39,16 +39,16 @@ void XonoticInputBox_setText(entity me, string val) } 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) { @@ -56,7 +56,7 @@ 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; diff --git a/qcsrc/menu/xonotic/inputbox.qh b/qcsrc/menu/xonotic/inputbox.qh index 7be855cd9..95d2a8da5 100644 --- a/qcsrc/menu/xonotic/inputbox.qh +++ b/qcsrc/menu/xonotic/inputbox.qh @@ -26,7 +26,7 @@ CLASS(XonoticInputBox, InputBox) 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); diff --git a/qcsrc/menu/xonotic/radiobutton.qc b/qcsrc/menu/xonotic/radiobutton.qc index 536ea4f15..ab598de0a 100644 --- a/qcsrc/menu/xonotic/radiobutton.qc +++ b/qcsrc/menu/xonotic/radiobutton.qc @@ -13,7 +13,7 @@ entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, s } 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); @@ -31,19 +31,19 @@ void XonoticRadioButton_loadCvars(entity me) { 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 { @@ -58,7 +58,7 @@ void XonoticRadioButton_loadCvars(entity me) 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 @@ -78,24 +78,24 @@ void XonoticRadioButton_saveCvars(entity me) { 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)); } } } diff --git a/qcsrc/menu/xonotic/radiobutton.qh b/qcsrc/menu/xonotic/radiobutton.qh index cd671a338..a0f17fcf7 100644 --- a/qcsrc/menu/xonotic/radiobutton.qh +++ b/qcsrc/menu/xonotic/radiobutton.qh @@ -12,7 +12,7 @@ CLASS(XonoticRadioButton, RadioButton) 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); diff --git a/qcsrc/menu/xonotic/slider.qc b/qcsrc/menu/xonotic/slider.qc index c8e057a64..d0a1cfb75 100644 --- a/qcsrc/menu/xonotic/slider.qc +++ b/qcsrc/menu/xonotic/slider.qc @@ -20,7 +20,7 @@ void XonoticSlider_configureXonoticSlider(entity me, float theValueMin, float th 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 @@ -48,17 +48,17 @@ void XonoticSlider_setValue_noAnim(entity me, float val) } 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); } diff --git a/qcsrc/menu/xonotic/slider.qh b/qcsrc/menu/xonotic/slider.qh index fea357458..de66fb95e 100644 --- a/qcsrc/menu/xonotic/slider.qh +++ b/qcsrc/menu/xonotic/slider.qh @@ -16,7 +16,7 @@ CLASS(XonoticSlider, Slider) 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); diff --git a/qcsrc/menu/xonotic/slider_decibels.qc b/qcsrc/menu/xonotic/slider_decibels.qc index e26076b65..44d042ea3 100644 --- a/qcsrc/menu/xonotic/slider_decibels.qc +++ b/qcsrc/menu/xonotic/slider_decibels.qc @@ -43,10 +43,10 @@ void XonoticDecibelsSlider_loadCvars(entity me) { 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)) @@ -56,13 +56,13 @@ void XonoticDecibelsSlider_loadCvars(entity me) } 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; diff --git a/qcsrc/menu/xonotic/textslider.qc b/qcsrc/menu/xonotic/textslider.qc index 54c7e5fb1..d40d88301 100644 --- a/qcsrc/menu/xonotic/textslider.qc +++ b/qcsrc/menu/xonotic/textslider.qc @@ -14,7 +14,7 @@ entity makeXonoticTextSlider(string theCvar) 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); } @@ -36,10 +36,10 @@ void XonoticTextSlider_setValue_noAnim(entity me, float val) } 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) @@ -58,12 +58,12 @@ void XonoticTextSlider_loadCvars(entity me) } 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 @@ -73,7 +73,7 @@ void XonoticTextSlider_saveCvars(entity me) 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) @@ -91,7 +91,7 @@ void XonoticTextSlider_saveCvars(entity me) } } 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); } } } diff --git a/qcsrc/menu/xonotic/textslider.qh b/qcsrc/menu/xonotic/textslider.qh index 3c588ce55..5b4691e26 100644 --- a/qcsrc/menu/xonotic/textslider.qh +++ b/qcsrc/menu/xonotic/textslider.qh @@ -17,7 +17,7 @@ CLASS(XonoticTextSlider, TextSlider) 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); diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index ac993e622..e77049d20 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -26,7 +26,7 @@ void forAllDescendants(entity root, void(entity, entity) funcPre, void(entity, e depthfirst(root, parent, firstChild, nextSibling, funcPre, funcPost, pass); } -.string cvarName; +.string controlledCvar; void SUB_Null_ee(entity e1, entity e2) { } @@ -53,12 +53,12 @@ void loadAllCvars(entity root) 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) @@ -67,9 +67,9 @@ 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 @@ -89,7 +89,7 @@ void saveCvarsMulti(entity me) } void makeMulti(entity e, string otherCvars) { - e.cvarNames_Multi = otherCvars; + e.controlledCvars_Multi = otherCvars; e.saveCvars_Multi = e.saveCvars; e.saveCvars = saveCvarsMulti; }