#include <menu/item/inputcontainer.qc>
#include <menu/item/label.qc>
#include <menu/item/listbox.qc>
+#include <menu/item/mixedslider.qc>
#include <menu/item/modalcontroller.qc>
#include <menu/item/nexposee.qc>
#include <menu/item/radiobutton.qc>
#include <menu/item/inputcontainer.qh>
#include <menu/item/label.qh>
#include <menu/item/listbox.qh>
+#include <menu/item/mixedslider.qh>
#include <menu/item/modalcontroller.qh>
#include <menu/item/nexposee.qh>
#include <menu/item/radiobutton.qh>
--- /dev/null
+#include "mixedslider.qh"
+
+ string MixedSlider_valueToText(entity me, int val)
+ {
+ if (val >= me.nValues || val < 0)
+ return _("Custom");
+ return me.(valueStrings[val]);
+ }
+ float MixedSlider_valueToNumberIdentifier(entity me, int val)
+ {
+ if (val >= me.nValues || val < 0)
+ return -1; // this shouldn't occur
+ return me.(valueNumberIdentifiers[val]);
+ }
+ void MixedSlider_setValueFromNumberIdentifier_allowAnim(entity me, float id, bool allowAnim)
+ {
+ for (int i = 0; i < me.nValues; ++i)
+ if (me.valueToNumberIdentifier(me, i) == id)
+ {
+ SUPER(MixedSlider).setValue_allowAnim(me, i, allowAnim);
+ return;
+ }
+ SUPER(MixedSlider).setValue_allowAnim(me, -1, allowAnim);
+ }
+ void MixedSlider_setValueFromNumberIdentifier_noAnim(entity me, float id)
+ {
+ MixedSlider_setValueFromNumberIdentifier_allowAnim(me, id, false);
+ }
+ void MixedSlider_setValueFromNumberIdentifier(entity me, float id)
+ {
+ MixedSlider_setValueFromNumberIdentifier_allowAnim(me, id, true);
+ }
+ float MixedSlider_getNumberIdentifier(entity me)
+ {
+ return me.valueToNumberIdentifier(me, me.value);
+ }
+ string MixedSlider_rangedIdentifierToText(entity me, float id)
+ {
+ return ftos_decimals(id, me.valueDigits);
+ }
+ void MixedSlider_adjustDigitsForStep(entity me, float valueStep)
+ {
+ float newDigits = 3;
+ if (fabs(floor(valueStep * 100 + 0.5) - (valueStep * 100)) < 0.01) // about a whole number of 100ths
+ newDigits = 2;
+ if (fabs(floor(valueStep * 10 + 0.5) - (valueStep * 10)) < 0.01) // about a whole number of 10ths
+ newDigits = 1;
+ if (fabs(floor(valueStep * 1 + 0.5) - (valueStep * 1)) < 0.01) // about a whole number
+ newDigits = 0;
+ if (newDigits > me.valueDigits)
+ me.valueDigits = newDigits;
+ }
+ void MixedSlider_clearValues(entity me)
+ {
+ me.nValues = 0;
+ }
+ void MixedSlider_addRange(entity me, float theValueMin, float theValueMax, float theValueStep)
+ {
+ me.adjustDigitsForStep(me, theValueStep);
+ for (float id = theValueMin; id <= theValueMax + theValueStep / 2; id += theValueStep)
+ { // plus half to prevent almost all floating point errors
+ string rounded_id_str = me.rangedIdentifierToText(me, id);
+ me.(valueStrings[me.nValues]) = strzone(rounded_id_str);
+ me.(valueNumberIdentifiers[me.nValues]) = stof(rounded_id_str);
+ me.nValues += 1;
+ }
+ }
+ void MixedSlider_addText(entity me, string theString, float theIdentifier)
+ {
+ me.(valueStrings[me.nValues]) = theString;
+ me.(valueNumberIdentifiers[me.nValues]) = theIdentifier;
+ me.nValues += 1;
+ }
+ void MixedSlider_insertRange(entity me, int pos, float theValueMin, float theValueMax, float theValueStep)
+ {
+ me.adjustDigitsForStep(me, theValueStep);
+ // calculate insertedCount first to prevent needing to duplicate valueStrings and valueNumberIdentifiers
+ int insertedCount = ceil((theValueMax - theValueMin) / theValueStep + 0.5);
+ me.nValues += insertedCount;
+
+ for (int i = me.nValues - 1; i > pos; --i)
+ {
+ me.(valueStrings[i]) = me.(valueStrings[i - insertedCount]);
+ me.(valueNumberIdentifiers[i]) = me.(valueNumberIdentifiers[i - insertedCount]);
+ }
+ for (float id = theValueMin; id <= theValueMax + theValueStep / 2; id += theValueStep)
+ {
+ string rounded_id_str = me.rangedIdentifierToText(me, id);
+ me.(valueStrings[pos]) = strzone(rounded_id_str);
+ me.(valueNumberIdentifiers[pos]) = stof(rounded_id_str);
+ pos += 1;
+ }
+ }
+ void MixedSlider_insertText(entity me, int pos, string theString, float theIdentifier)
+ {
+ me.nValues += 1;
+ for (int i = me.nValues - 1; i > pos; --i)
+ {
+ me.(valueStrings[i]) = me.(valueStrings[i - 1]);
+ me.(valueNumberIdentifiers[i]) = me.(valueNumberIdentifiers[i - 1]);
+ }
+ me.(valueStrings[pos]) = theString;
+ me.(valueNumberIdentifiers[pos]) = theIdentifier;
+ }
+ void MixedSlider_configureMixedSliderValues(entity me, float theDefault)
+ {
+ me.configureSliderValues(me, 0, 0, me.nValues - 1, 1, 1, 1);
+ me.setValueFromNumberIdentifier_noAnim(me, theDefault);
+ }
--- /dev/null
+#pragma once
+
+// Note:
+// this is a numeric slider allowing replacement of some numbers with text, hence a "mixed" slider
+// that's why addText takes a string (the text) and a float (the corresponding number)
+// to use this, you FIRST call configureSliderVisuals, then multiple times addRange and/or addText, then configureMixedSlider
+#include "slider.qh"
+CLASS(MixedSlider, Slider)
+ METHOD(MixedSlider, valueToText, string(entity, int));
+ METHOD(MixedSlider, valueToNumberIdentifier, float(entity, int));
+ METHOD(MixedSlider, setValueFromNumberIdentifier_allowAnim, void(entity, float, bool));
+ METHOD(MixedSlider, setValueFromNumberIdentifier_noAnim, void(entity, float));
+ METHOD(MixedSlider, setValueFromNumberIdentifier, void(entity, float));
+ METHOD(MixedSlider, getNumberIdentifier, float(entity));
+ METHOD(MixedSlider, rangedIdentifierToText, string(entity, float));
+ METHOD(MixedSlider, adjustDigitsForStep, void(entity, float));
+ METHOD(MixedSlider, clearValues, void(entity));
+ METHOD(MixedSlider, addRange, void(entity, float, float, float));
+ METHOD(MixedSlider, addText, void(entity, string, float));
+ METHOD(MixedSlider, insertRange, void(entity, int, float, float, float));
+ METHOD(MixedSlider, insertText, void(entity, int, string, float));
+ METHOD(MixedSlider, configureMixedSliderValues, void(entity, float));
+ ATTRIBARRAY(MixedSlider, valueStrings, string, 256);
+ ATTRIBARRAY(MixedSlider, valueNumberIdentifiers, float, 256);
+ /* `value` ranges from 0 to nValues - 1,
+ * for each `value` there is a `valueNumberIdentifiers` and `valueStrings` entry,
+ * representing the value to set the cvar, and what to display, respectively
+ */
+ ATTRIB(MixedSlider, nValues, int, 0);
+ENDCLASS(MixedSlider)
// Note:
// to use this, you FIRST call configureSliderVisuals, then multiple times addValue, then configureTextSlider
+// don't use if all identifiers are numbers, instead use a MixedSlider
#include "slider.qh"
CLASS(TextSlider, Slider)
METHOD(TextSlider, valueToText, string(entity, float));
#include <menu/xonotic/listbox.qc>
#include <menu/xonotic/mainwindow.qc>
#include <menu/xonotic/maplist.qc>
+#include <menu/xonotic/mixedslider.qc>
#include <menu/xonotic/nexposee.qc>
#include <menu/xonotic/picker.qc>
#include <menu/xonotic/playerlist.qc>
#include <menu/xonotic/listbox.qh>
#include <menu/xonotic/mainwindow.qh>
#include <menu/xonotic/maplist.qh>
+#include <menu/xonotic/mixedslider.qh>
#include <menu/xonotic/nexposee.qh>
#include <menu/xonotic/picker.qh>
#include <menu/xonotic/playerlist.qh>
#include "checkbox.qh"
#include "textlabel.qh"
#include "slider.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "radiobutton.qh"
void XonoticHUDCenterprintDialog_fill(entity me)
me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 10, 1, "hud_panel_centerprint_time"));
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Fade time:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_centerprint_fade_out"));
- e.addValue(e, ZCTX(_("FADESPEED^Instant")), "0");
- for(i = 1; i <= 19; ++i)
- e.addValue(e, strzone(ftos_decimals(i / 20, 2)), strzone(ftos_mindecimals(i / 20)));
- e.addValue(e, "1.00", "1");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_centerprint_fade_out"));
+ e.addText(e, ZCTX(_("FADESPEED^Instant")), 0);
+ e.addRange(e, 0.05, 1, 0.05);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Font scale:")));
me.TD(me, 1, 2.6, e = makeXonoticSlider(0.5, 2, 0.1, "hud_panel_centerprint_fontscale"));
#include "textlabel.qh"
#include "checkbox.qh"
#include "slider.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "radiobutton.qh"
void XonoticHUDInfoMessagesDialog_fill(entity me)
me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 10, 1, "hud_panel_infomessages_group_time"));
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Fade time:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_infomessages_group_fadetime"));
- e.addValue(e, ZCTX(_("FADESPEED^Instant")), "0");
- for(i = 1; i <= 19; ++i)
- e.addValue(e, strzone(ftos_decimals(i / 20, 2)), strzone(ftos_mindecimals(i / 20)));
- e.addValue(e, "1.00", "1");
- e.configureXonoticTextSliderValues(e);
-
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_infomessages_group_fadetime"));
+ e.addText(e, ZCTX(_("FADESPEED^Instant")), 0);
+ e.addRange(e, 0.05, 1, 0.05);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Text alignment:")));
me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_infomessages_flip", "0", _("Left")));
#include "dialog_hudpanel_itemstime.qh"
#include "textlabel.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "radiobutton.qh"
#include "checkbox.qh"
#include "slider.qh"
string panelname = "itemstime";
me.TR(me);
- me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_itemstime"));
- e.addValue(e, _("Disable"), "0");
- e.addValue(e, _("Enable spectating"), "1");
- e.addValue(e, _("Enable even playing in warmup"), "2");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 4, e = makeXonoticMixedSlider("hud_panel_itemstime"));
+ e.addText(e, _("Disable"), 0);
+ e.addText(e, _("Enable spectating"), 1);
+ e.addText(e, _("Enable even playing in warmup"), 2);
+ e.configureXonoticMixedSliderValues(e);
dialog_hudpanel_main_settings(me, panelname);
#include "textlabel.qh"
#include "checkbox.qh"
#include "slider.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
void XonoticHUDNotificationDialog_fill(entity me)
{
me.TD(me, 1, 2.6, e = makeXonoticSlider(3, 15, 1, "hud_panel_notify_time"));
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Entry fadetime:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_notify_fadetime"));
- e.addValue(e, ZCTX(_("FADESPEED^Instant")), "0");
- for(i = 1; i <= 10; ++i)
- e.addValue(e, strzone(ftos_decimals(i / 2, 1)), strzone(ftos_mindecimals(i / 2)));
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_notify_fadetime"));
+ e.addText(e, ZCTX(_("FADESPEED^Instant")), 0);
+ e.addRange(e, 0.5, 5, 0.5);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_notify_flip", _("Flip notify order")));
#include "dialog_hudpanel_physics.qh"
#include "textlabel.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "checkbox.qh"
#include "slider.qh"
#include "radiobutton.qh"
string panelname = "physics";
me.TR(me);
- me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_physics"));
- e.addValue(e, _("Disable"), "0");
- e.addValue(e, _("Enable"), "1");
- e.addValue(e, _("Enable even observing"), "2");
- e.addValue(e, _("Enable only in Race/CTS"), "3");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 4, e = makeXonoticMixedSlider("hud_panel_physics"));
+ e.addText(e, _("Disable"), 0);
+ e.addText(e, _("Enable"), 1);
+ e.addText(e, _("Enable even observing"), 2);
+ e.addText(e, _("Enable only in Race/CTS"), 3);
+ e.configureXonoticMixedSliderValues(e);
dialog_hudpanel_main_settings(me, panelname);
me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_physics_flip", _("Flip speed/acceleration positions")));
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Status bar")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_physics_progressbar"));
- e.addValue(e, _("None"), "0");
- e.addValue(e, _("Both"), "1");
- e.addValue(e, _("Speed"), "2");
- e.addValue(e, _("Acceleration"), "3");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_physics_progressbar"));
+ e.addText(e, _("None"), 0);
+ e.addText(e, _("Speed"), 2);
+ e.addText(e, _("Acceleration"), 3);
+ e.addText(e, _("Both"), 1);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 3.8, e = makeXonoticTextLabel(0, _("Status bar alignment:")));
#include "checkbox.qh"
#include "textlabel.qh"
#include "slider.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "radiobutton.qh"
void XonoticHUDPickupDialog_fill(entity me)
me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 5, 1, "hud_panel_pickup_time"));
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Fade time:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_pickup_fade_out"));
- e.addValue(e, ZCTX(_("FADESPEED^Instant")), "0");
- for(i = 1; i <= 19; ++i)
- e.addValue(e, strzone(ftos_decimals(i / 20, 2)), strzone(ftos_mindecimals(i / 20)));
- e.addValue(e, "1.00", "1");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_pickup_fade_out"));
+ e.addText(e, ZCTX(_("FADESPEED^Instant")), 0);
+ e.addRange(e, 0.05, 1, 0.05);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Icon size scale:")));
me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 3, 0.1, "hud_panel_pickup_iconsize"));
#include "dialog_hudpanel_pressedkeys.qh"
#include "checkbox.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "slider.qh"
#include "textlabel.qh"
string panelname = "pressedkeys";
me.TR(me);
- me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_pressedkeys"));
- e.addValue(e, (_("Disable")), "0");
- e.addValue(e, (_("Enable spectating")), "1");
- e.addValue(e, (_("Always enable")), "2");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 4, e = makeXonoticMixedSlider("hud_panel_pressedkeys"));
+ e.addText(e, (_("Disable")), 0);
+ e.addText(e, (_("Enable spectating")), 1);
+ e.addText(e, (_("Always enable")), 2);
+ e.configureXonoticMixedSliderValues(e);
dialog_hudpanel_main_settings(me, panelname);
#include "dialog_hudpanel_radar.qh"
#include "checkbox.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "slider.qh"
#include "textlabel.qh"
string panelname = "radar";
me.TR(me);
- me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_radar"));
- e.addValue(e, _("Disable"), "0");
- e.addValue(e, _("Enable in team games"), "1");
- e.addValue(e, _("Always enable"), "2");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 4, e = makeXonoticMixedSlider("hud_panel_radar"));
+ e.addText(e, _("Disable"), 0);
+ e.addText(e, _("Enable in team games"), 1);
+ e.addText(e, _("Always enable"), 2);
+ e.configureXonoticMixedSliderValues(e);
dialog_hudpanel_main_settings(me, panelname);
me.TD(me, 1, 2.6, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_radar_foreground_alpha"));
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Rotation:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_radar_rotation"));
- e.addValue(e, _("Forward"), "0");
- e.addValue(e, _("West"), "1");
- e.addValue(e, _("South"), "2");
- e.addValue(e, _("East"), "3");
- e.addValue(e, _("North"), "4");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_radar_rotation"));
+ e.addText(e, _("Forward"), 0);
+ e.addText(e, _("West"), 1);
+ e.addText(e, _("South"), 2);
+ e.addText(e, _("East"), 3);
+ e.addText(e, _("North"), 4);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Scale:")));
me.TD(me, 1, 2.6, e = makeXonoticSlider(1024, 8192, 512, "hud_panel_radar_scale"));
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Zoom mode:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_radar_zoommode"));
- e.addValue(e, _("Zoomed in"), "0");
- e.addValue(e, _("Zoomed out"), "1");
- e.addValue(e, _("Always zoomed"), "2");
- e.addValue(e, _("Never zoomed"), "3");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_radar_zoommode"));
+ e.addText(e, _("Zoomed in"), 0);
+ e.addText(e, _("Zoomed out"), 1);
+ e.addText(e, _("Always zoomed"), 2);
+ e.addText(e, _("Never zoomed"), 3);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Maximized radar:")));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Rotation:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_radar_maximized_rotation"));
- e.addValue(e, _("Forward"), "0");
- e.addValue(e, _("West"), "1");
- e.addValue(e, _("South"), "2");
- e.addValue(e, _("East"), "3");
- e.addValue(e, _("North"), "4");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_radar_maximized_rotation"));
+ e.addText(e, _("Forward"), 0);
+ e.addText(e, _("West"), 1);
+ e.addText(e, _("South"), 2);
+ e.addText(e, _("East"), 3);
+ e.addText(e, _("North"), 4);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Scale:")));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Zoom mode:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_radar_maximized_zoommode"));
- e.addValue(e, _("Zoomed in"), "0");
- e.addValue(e, _("Zoomed out"), "1");
- e.addValue(e, _("Always zoomed"), "2");
- e.addValue(e, _("Never zoomed"), "3");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_radar_maximized_zoommode"));
+ e.addText(e, _("Zoomed in"), 0);
+ e.addText(e, _("Zoomed out"), 1);
+ e.addText(e, _("Always zoomed"), 2);
+ e.addText(e, _("Never zoomed"), 3);
+ e.configureXonoticMixedSliderValues(e);
}
#include "button.qh"
#include "slider.qh"
#include "textlabel.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "radiobutton.qh"
void StrafeHUD_ColorReset(entity btn, entity me)
int i;
me.TR(me);
- me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_strafehud"));
- e.addValue(e, _("Disable"), "0");
- e.addValue(e, _("Enable"), "1");
- e.addValue(e, _("Enable even observing"), "2");
- e.addValue(e, _("Enable only in Race/CTS"), "3");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 4, e = makeXonoticMixedSlider("hud_panel_strafehud"));
+ e.addText(e, _("Disable"), 0);
+ e.addText(e, _("Enable"), 1);
+ e.addText(e, _("Enable even observing"), 2);
+ e.addText(e, _("Enable only in Race/CTS"), 3);
+ e.configureXonoticMixedSliderValues(e);
dialog_hudpanel_main_settings(me, panelname);
me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(3, "hud_panel_strafehud_style", "2", _("Gradient")));
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Range:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_strafehud_range"));
- e.addValue(e, _("Dynamic"), "0");
- for(i = 10; i <= 360; i += 10)
- {
- string i_str = strzone(itos(i));
- e.addValue(e, i_str, i_str);
- }
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_strafehud_range"));
+ e.addText(e, _("Dynamic"), 0);
+ e.addRange(e, 10, 360, 10);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1.9, e = makeXonoticTextLabel(0, _("Strafe bar:")));
#include "checkbox.qh"
#include "textlabel.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "slider.qh"
#include "radiobutton.qh"
#include "colorpicker_string.qh"
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Fade out after:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_timeout"))));
- e.addValue(e, _("Never"), "0");
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider(strzone(strcat("hud_panel_", panelname, "_timeout"))));
+ e.addText(e, _("Never"), 0);
for(i = 1; i <= 10; ++i)
- e.addValue(e, strzone(sprintf(_("%ds"), i)), strzone(ftos(i)));
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, strzone(sprintf(_("%ds"), i)), i);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Fade effect:")));
setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_timeout_effect"))));
- e.addValue(e, ZCTX(_("EF^None")), "0");
- e.addValue(e, _("Alpha"), "1");
- e.addValue(e, _("Slide"), "2");
- e.addValue(e, ZCTX(_("EF^Both")), "3");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider(strzone(strcat("hud_panel_", panelname, "_timeout_effect"))));
+ e.addText(e, ZCTX(_("EF^None")), 0);
+ e.addText(e, _("Alpha"), 1);
+ e.addText(e, _("Slide"), 2);
+ e.addText(e, ZCTX(_("EF^Both")), 3);
+ e.configureXonoticMixedSliderValues(e);
setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
me.TR(me);
#include "textlabel.qh"
#include "button.qh"
+#include "slider.qh"
#include "textslider.qh"
+#include "mixedslider.qh"
#include "inputbox.qh"
#include "hudskinlist.qh"
#include "colorpicker_string.qh"
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Border size:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_border"));
- e.addValue(e, _("Disable"), "0");
- for(i = 1; i <= 10; ++i)
- e.addValue(e, strzone(ftos_decimals(i * 2, 0)), strzone(ftos(i * 2)));
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_bg_border"));
+ e.addText(e, _("Disable"), 0);
+ e.addRange(e, 2, 20, 2);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_alpha"));
- for(i = 1; i <= 10; ++i)
- e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_bg_alpha"));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team color:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_color_team"));
- e.addValue(e, _("Disable"), "0");
- for(i = 1; i <= 10; ++i)
- e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_panel_bg_color_team"));
+ e.addText(e, _("Disable"), 0);
+ e.addRange(e, 0.1, 1, 0.1);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TDempty(me, 0.4);
me.TD(me, 1, 3.6, e = makeXonoticCheckBox(0, "hud_configure_teamcolorforced", _("Test team color in configure mode")));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Padding:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_padding"));
- for(i = 0; i <= 10; ++i)
- e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5)));
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticSlider(-5, 5, 1, "hud_panel_bg_padding"));
me.TR(me);
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("HUD Dock:")));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_dock_alpha"));
- for(i = 1; i <= 10; ++i)
- e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticSlider(0.1, 1, 0.1, "hud_dock_alpha"));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team color:")));
- me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_dock_color_team"));
- e.addValue(e, _("Disable"), "0");
- for(i = 1; i <= 10; ++i)
- e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2.6, e = makeXonoticMixedSlider("hud_dock_color_team"));
+ e.addText(e, _("Disable"), 0);
+ e.addRange(e, 0.1, 1, 0.1);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1.4, makeXonoticTextLabel(0, _("Grid settings:")));
me.TD(me, 1, 2.6, e = makeXonoticCheckBox(0, "hud_configure_grid", _("Snap panels to grid")));
setDependent(e, "hud_configure_grid", 1, 1);
me.TD(me, 1, 0.2, e = makeXonoticTextLabel(0, _("X:")));
setDependent(e, "hud_configure_grid", 1, 1);
- me.TD(me, 1, 1.1, e = makeXonoticTextSlider("hud_configure_grid_xsize"));
+ me.TD(me, 1, 1.1, e = makeXonoticMixedSlider("hud_configure_grid_xsize"));
for(i = 1; i <= 14; ++i)
- e.addValue(e, strzone(sprintf("%.1f%%", i/2)), strzone(ftos(i/200)));
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, strzone(sprintf("%.1f%%", i/2)), i/200);
+ e.configureXonoticMixedSliderValues(e);
setDependent(e, "hud_configure_grid", 1, 1);
me.TD(me, 1, 0.2, e = makeXonoticTextLabel(0, _("Y:")));
setDependent(e, "hud_configure_grid", 1, 1);
- me.TD(me, 1, 1.1, e = makeXonoticTextSlider("hud_configure_grid_ysize"));
+ me.TD(me, 1, 1.1, e = makeXonoticMixedSlider("hud_configure_grid_ysize"));
for(i = 1; i <= 14; ++i)
- e.addValue(e, strzone(sprintf("%.1f%%", i/2)), strzone(ftos(i/200)));
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, strzone(sprintf("%.1f%%", i/2)), i/200);
+ e.configureXonoticMixedSliderValues(e);
setDependent(e, "hud_configure_grid", 1, 1);
me.TR(me);
me.TDempty(me, 0.2);
#include "checkbox.qh"
#include "image.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "textlabel.qh"
#include "slider.qh"
#include "mainwindow.qh"
int i;
entity e = me.sliderFraglimit;
entity l = me.labelFraglimit;
- e.configureXonoticTextSlider(e, pCvar, pTooltip);
+ e.configureXonoticMixedSlider(e, pCvar, pTooltip);
e.disabled = l.disabled = !pCvar;
l.setText(l, pLabel);
// clear old values
for(i = 0; i < e.nValues; ++i);
- {
strfree(e.(valueStrings[i]));
- strfree(e.(valueIdentifiers[i]));
- }
e.clearValues(e);
if(pCvar != "")
{
// set new values
- e.addValue(e, strzone(_("Default")), strzone("-1"));
- for(i = pMin; i <= pMax; i += pStep) { e.addValue(e, strzone(ftos(i)), strzone(ftos(i))); }
- e.addValue(e, strzone(_("Unlimited")), strzone("0"));
+ e.addText(e, strzone(_("Default")), -1);
+ for(i = pMin; i <= pMax; i += pStep)
+ e.addText(e, strzone(ftos(i)), i);
+ e.addText(e, strzone(_("Unlimited")), 0);
}
- e.configureXonoticTextSliderValues(e);
+ e.configureXonoticMixedSliderValues(e);
entity t = me.sliderTeams;
entity tl = me.labelTeams;
- t.configureXonoticTextSlider(t, tCvar, string_null);
+ t.configureXonoticMixedSlider(t, tCvar, string_null);
tl.disabled = t.disabled = !tCvar;
t.nValues = (tCvar == "") ? 0 : 4; // instead of clearing / readding the very same values
- t.configureXonoticTextSliderValues(t);
+ t.configureXonoticMixedSliderValues(t);
}
void GameType_ConfigureSliders_for_CurrentGametype(entity me)
_("Show all available gametypes")));
me.gotoRC(me, 13.5, 0);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Time limit:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("timelimit_override",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("timelimit_override",
_("Timelimit in minutes that when hit, will end the match")));
- #define ADDVALUE_MINUTES(i) e.addValue(e, strzone(sprintf(_("%d minutes"), i)), #i)
- e.addValue(e, ZCTX(_("TIMLIM^Default")), "-1");
- e.addValue(e, _("1 minute"), "1");
+ #define ADDVALUE_MINUTES(i) e.addText(e, strzone(sprintf(_("%d minutes"), i)), i)
+ e.addText(e, ZCTX(_("TIMLIM^Default")), -1);
+ e.addText(e, _("1 minute"), 1);
ADDVALUE_MINUTES(2);
ADDVALUE_MINUTES(3);
ADDVALUE_MINUTES(4);
ADDVALUE_MINUTES(40);
ADDVALUE_MINUTES(50);
ADDVALUE_MINUTES(60);
- e.addValue(e, ZCTX(_("TIMLIM^Infinite")), "0");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, ZCTX(_("TIMLIM^Infinite")), 0);
+ e.configureXonoticMixedSliderValues(e);
#undef ADDVALUE_MINUTES
me.TR(me);
me.TD(me, 1, 1, me.labelFraglimit = makeXonoticTextLabel(0, _("Frag limit:")));
- me.TD(me, 1, 2, e = me.sliderFraglimit = makeXonoticTextSlider("fraglimit_override"));
+ me.TD(me, 1, 2, e = me.sliderFraglimit = makeXonoticMixedSlider("fraglimit_override"));
me.gotoRC(me, 16, 0);
me.TD(me, 1, 1, me.labelTeams = makeXonoticTextLabel(0, _("Teams:")));
- me.TD(me, 1, 2, e = me.sliderTeams = makeXonoticTextSlider(string_null));
- e.addValue(e, _("Default"), "0");
- e.addValue(e, _("2 teams"), "2");
- e.addValue(e, _("3 teams"), "3");
- e.addValue(e, _("4 teams"), "4");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = me.sliderTeams = makeXonoticMixedSlider(string_null));
+ e.addText(e, _("Default"), 0);
+ e.addText(e, _("2 teams"), 2);
+ e.addText(e, _("3 teams"), 3);
+ e.addText(e, _("4 teams"), 4);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player slots:")));
me.TD(me, 1, 2, e = makeXonoticSlider_T(1, 32, 1, "menu_maxplayers",
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bot skill:")));
setDependentAND(e, "bot_number", 0, -1, "g_campaign", 0, 0);
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("skill",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("skill",
_("Specify how experienced the bots will be")));
- e.addValue(e, _("Botlike"), "0");
- e.addValue(e, _("Beginner"), "1");
- e.addValue(e, _("You will win"), "2");
- e.addValue(e, _("You can win"), "3");
- e.addValue(e, _("You might win"), "4");
- e.addValue(e, _("Advanced"), "5");
- e.addValue(e, _("Expert"), "6");
- e.addValue(e, _("Pro"), "7");
- e.addValue(e, _("Assassin"), "8");
- e.addValue(e, _("Unhuman"), "9");
- e.addValue(e, _("Godlike"), "10");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, _("Botlike"), 0);
+ e.addText(e, _("Beginner"), 1);
+ e.addText(e, _("You will win"), 2);
+ e.addText(e, _("You can win"), 3);
+ e.addText(e, _("You might win"), 4);
+ e.addText(e, _("Advanced"), 5);
+ e.addText(e, _("Expert"), 6);
+ e.addText(e, _("Pro"), 7);
+ e.addText(e, _("Assassin"), 8);
+ e.addText(e, _("Unhuman"), 9);
+ e.addText(e, _("Godlike"), 10);
+ e.configureXonoticMixedSliderValues(e);
setDependentAND(e, "bot_number", 0, -1, "g_campaign", 0, 0);
// mapListBox is in the right column but the ref is needed for mutators dialog here
#include "textlabel.qh"
#include "checkbox.qh"
#include "radiobutton.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "checkbox_slider_invalid.qh"
entity makeXonoticAudioSettingsTab()
me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Frequency:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("snd_speed",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("snd_speed",
_("Sound output frequency")));
- e.addValue(e, _("8 kHz"), "8000");
- e.addValue(e, _("11.025 kHz"), "11025");
- e.addValue(e, _("16 kHz"), "16000");
- e.addValue(e, _("22.05 kHz"), "22050");
- e.addValue(e, _("24 kHz"), "24000");
- e.addValue(e, _("32 kHz"), "32000");
- e.addValue(e, _("44.1 kHz"), "44100");
- e.addValue(e, _("48 kHz"), "48000");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, _("8 kHz"), 8000);
+ e.addText(e, _("11.025 kHz"), 11025);
+ e.addText(e, _("16 kHz"), 16000);
+ e.addText(e, _("22.05 kHz"), 22050);
+ e.addText(e, _("24 kHz"), 24000);
+ e.addText(e, _("32 kHz"), 32000);
+ e.addText(e, _("44.1 kHz"), 44100);
+ e.addText(e, _("48 kHz"), 48000);
+ e.configureXonoticMixedSliderValues(e);
e.applyButton = audioApplyButton;
me.TR(me);
me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Channels:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("snd_channels",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("snd_channels",
_("Number of channels for the sound output")));
- e.addValue(e, _("Mono"), "1");
- e.addValue(e, _("Stereo"), "2");
- e.addValue(e, _("2.1"), "3");
- e.addValue(e, _("4"), "4");
- e.addValue(e, _("5"), "5");
- e.addValue(e, _("5.1"), "6");
- e.addValue(e, _("6.1"), "7");
- e.addValue(e, _("7.1"), "8");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, _("Mono"), 1);
+ e.addText(e, _("Stereo"), 2);
+ e.addText(e, _("2.1"), 3);
+ e.addText(e, _("4"), 4);
+ e.addText(e, _("5"), 5);
+ e.addText(e, _("5.1"), 6);
+ e.addText(e, _("6.1"), 7);
+ e.addText(e, _("7.1"), 8);
+ e.configureXonoticMixedSliderValues(e);
e.applyButton = audioApplyButton;
me.TR(me);
me.TR(me);
me.TR(me);
me.TR(me);
me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Time announcer:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_announcer_maptime"));
- e.addValue(e, ZCTX(_("WRN^Disabled")), "0");
- e.addValue(e, _("1 minute"), "1");
- e.addValue(e, _("5 minutes"), "2");
- e.addValue(e, ZCTX(_("WRN^Both")), "3");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_announcer_maptime"));
+ e.addText(e, ZCTX(_("WRN^Disabled")), 0);
+ e.addText(e, _("1 minute"), 1);
+ e.addText(e, _("5 minutes"), 2);
+ e.addText(e, ZCTX(_("WRN^Both")), 3);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Automatic taunts:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("cl_autotaunt",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("cl_autotaunt",
_("Automatically taunt enemies after fragging them")));
- e.addValue(e, _("Never"), "0");
- e.addValue(e, _("Sometimes"), "0.35");
- e.addValue(e, _("Often"), "0.65");
- e.addValue(e, _("Always"), "1");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, _("Never"), 0);
+ e.addText(e, _("Sometimes"), 0.35);
+ e.addText(e, _("Often"), 0.65);
+ e.addText(e, _("Always"), 1);
+ e.configureXonoticMixedSliderValues(e);
e.sendCvars = true;
me.gotoRC(me, me.rows - 1, 0);
#include "textlabel.qh"
#include "checkbox.qh"
#include "textslider.qh"
+#include "mixedslider.qh"
#include "slider.qh"
#include "radiobutton.qh"
#include "checkbox_slider_invalid.qh"
me.gotoRC(me, 1.25, 0);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Geometry detail:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("r_subdivisions_tolerance",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("r_subdivisions_tolerance",
_("Change the smoothness of the curves on the map")));
- e.addValue(e, ZCTX(_("DET^Lowest")), "16");
- e.addValue(e, ZCTX(_("DET^Low")), "8");
- e.addValue(e, ZCTX(_("DET^Normal")), "4");
- e.addValue(e, ZCTX(_("DET^Good")), "3");
- e.addValue(e, ZCTX(_("DET^Best")), "2");
- e.addValue(e, ZCTX(_("DET^Insane")), "1");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, ZCTX(_("DET^Lowest")), 16);
+ e.addText(e, ZCTX(_("DET^Low")), 8);
+ e.addText(e, ZCTX(_("DET^Normal")), 4);
+ e.addText(e, ZCTX(_("DET^Good")), 3);
+ e.addText(e, ZCTX(_("DET^Best")), 2);
+ e.addText(e, ZCTX(_("DET^Insane")), 1);
+ e.configureXonoticMixedSliderValues(e);
e.applyButton = effectsApplyButton;
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player detail:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_playerdetailreduction"));
- e.addValue(e, ZCTX(_("PDET^Low")), "4");
- e.addValue(e, ZCTX(_("PDET^Medium")), "3");
- e.addValue(e, ZCTX(_("PDET^Normal")), "2");
- e.addValue(e, ZCTX(_("PDET^Good")), "1");
- e.addValue(e, ZCTX(_("PDET^Best")), "0");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_playerdetailreduction"));
+ e.addText(e, ZCTX(_("PDET^Low")), 4);
+ e.addText(e, ZCTX(_("PDET^Medium")), 3);
+ e.addText(e, ZCTX(_("PDET^Normal")), 2);
+ e.addText(e, ZCTX(_("PDET^Good")), 1);
+ e.addText(e, ZCTX(_("PDET^Best")), 0);
+ e.configureXonoticMixedSliderValues(e);
e.applyButton = effectsApplyButton;
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Texture resolution:")));
setDependent(e, "r_showsurfaces", 0, 0);
me.TD(me, 1, 2, e = makeXonoticPicmipSlider());
- e.addValue(e, ZCTX(_("RES^Lowest")), "1337");
- e.addValue(e, ZCTX(_("RES^Very low")), "2");
- e.addValue(e, ZCTX(_("RES^Low")), "1");
- e.addValue(e, ZCTX(_("RES^Normal")), "0");
- e.addValue(e, ZCTX(_("RES^Good")), "-1");
- e.addValue(e, ZCTX(_("RES^Best")), "-2");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, ZCTX(_("RES^Lowest")), 1337);
+ e.addText(e, ZCTX(_("RES^Very low")), 2);
+ e.addText(e, ZCTX(_("RES^Low")), 1);
+ e.addText(e, ZCTX(_("RES^Normal")), 0);
+ e.addText(e, ZCTX(_("RES^Good")), -1);
+ e.addText(e, ZCTX(_("RES^Best")), -2);
+ e.configureXonoticMixedSliderValues(e);
setDependent(e, "r_showsurfaces", 0, 0);
e.applyButton = effectsApplyButton;
me.TR(me);
_("Reflection and refraction quality, has a huge impact on performance on maps with reflecting surfaces")));
if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
setDependent(e, "vid_gl20", 1, 1);
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("r_water_resolutionmultiplier",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("r_water_resolutionmultiplier",
_("Resolution of reflections/refractions")));
- e.addValue(e, _("Blurred"), "0.25");
- e.addValue(e, ZCTX(_("REFL^Good")), "0.5");
- e.addValue(e, _("Sharp"), "1");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, _("Blurred"), 0.25);
+ e.addText(e, ZCTX(_("REFL^Good")), 0.5);
+ e.addText(e, _("Sharp"), 1);
+ e.configureXonoticMixedSliderValues(e);
if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
setDependentAND(e, "vid_gl20", 1, 1, "r_water", 1, 1);
else
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Damage effects:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_damageeffect"));
- e.addValue(e, ZCTX(_("DMGFX^Disabled")), "0");
- e.addValue(e, _("Skeletal"), "1");
- e.addValue(e, ZCTX(_("DMGFX^All")), "2");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_damageeffect"));
+ e.addText(e, ZCTX(_("DMGFX^Disabled")), 0);
+ e.addText(e, _("Skeletal"), 1);
+ e.addText(e, ZCTX(_("DMGFX^All")), 2);
+ e.configureXonoticMixedSliderValues(e);
me.gotoRC(me, 1.25, 3.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 2, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_dlight", _("Realtime dynamic lights"),
#include "slider.qh"
#include "colorpicker_string.qh"
#include "checkbox.qh"
-#include "textslider.qh"
void XonoticGameCrosshairSettingsTab_showNotify(entity me)
{
#include "textlabel.qh"
#include "slider.qh"
#include "slider_sbfadetime.qh"
+#include "mixedslider.qh"
#include "checkbox.qh"
#include "button.qh"
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_scoreboard_accuracy", _("Show accuracy underneath scoreboard")));
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Show team sizes:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("hud_panel_scoreboard_team_size_position", _("Team size position: Off=do not show; Left=on the left side of the scoreboard and move team scores to the right; Right=on the right of the scoreboard")));
- e.addValue(e, _("Left"), "1");
- e.addValue(e, _("Off"), "0");
- e.addValue(e, _("Right"), "2");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("hud_panel_scoreboard_team_size_position", _("Team size position: Off=do not show; Left=on the left side of the scoreboard and move team scores to the right; Right=on the right of the scoreboard")));
+ e.addText(e, _("Left"), 1);
+ e.addText(e, _("Off"), 0);
+ e.addText(e, _("Right"), 2);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Decolorize:")));
setDependent(e, "hud_shownames", 1, 1);
- me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_shownames_decolorize"));
- e.addValue(e, _("Never"), "0");
- e.addValue(e, _("Teamplay"), "1");
- e.addValue(e, _("Always"), "2");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("hud_shownames_decolorize"));
+ e.addText(e, _("Never"), 0);
+ e.addText(e, _("Teamplay"), 1);
+ e.addText(e, _("Always"), 2);
+ e.configureXonoticMixedSliderValues(e);
setDependent(e, "hud_shownames", 1, 1);
me.TR(me);
me.TR(me);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Speed unit:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_speed_unit"));
- e.addValue(e, _("qu/s") , "1");
- e.addValue(e, _("m/s") , "2");
- e.addValue(e, _("km/h") , "3");
- e.addValue(e, _("mph") , "4");
- e.addValue(e, _("knots"), "5");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("hud_speed_unit"));
+ e.addText(e, _("qu/s"), 1);
+ e.addText(e, _("m/s"), 2);
+ e.addText(e, _("km/h"), 3);
+ e.addText(e, _("mph"), 4);
+ e.addText(e, _("knots"), 5);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Damage overlay:")));
me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "hud_damage"));
#include "textlabel.qh"
#include "checkbox.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
void XonoticGameMessageSettingsTab_showNotify(entity me)
{
me.TDempty(me, 0.1);
me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Sprees in info messages:")));
setDependent(e, "notification_show_sprees", 1, 1);
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("notification_show_sprees_info", "-"));
- e.addValue(e, ZCTX(_("SPREES^Disabled")), "0");
- e.addValue(e, _("Target"), "1");
- e.addValue(e, _("Attacker"), "2");
- e.addValue(e, ZCTX(_("SPREES^Both")), "3");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("notification_show_sprees_info", "-"));
+ e.addText(e, ZCTX(_("SPREES^Disabled")), 0);
+ e.addText(e, _("Target"), 1);
+ e.addText(e, _("Attacker"), 2);
+ e.addText(e, ZCTX(_("SPREES^Both")), 3);
+ e.configureXonoticMixedSliderValues(e);
setDependent(e, "notification_show_sprees", 1, 1);
#endif
me.TR(me);
#include "textlabel.qh"
#include "checkbox.qh"
#include "textslider.qh"
+#include "mixedslider.qh"
#include "slider.qh"
void XonoticGameModelSettingsTab_showNotify(entity me)
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_forceplayermodels", _("Force player models to mine")));
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Force player colors to mine")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("cl_forceplayercolors",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("cl_forceplayercolors",
_("Warning: if enabled in team games your team's color may be the same as the enemy team")));
- e.addValue(e, _("Never"), "0");
- e.addValue(e, _("Except in team games"), "1");
- e.addValue(e, _("Only in Duel"), "3");
- e.addValue(e, _("Only in team games"), "4");
- e.addValue(e, _("In team games and Duel"), "5");
- e.addValue(e, _("Always"), "2");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, _("Never"), 0);
+ e.addText(e, _("Except in team games"), 1);
+ e.addText(e, _("Only in Duel"), 3);
+ e.addText(e, _("Only in team games"), 4);
+ e.addText(e, _("In team games and Duel"), 5);
+ e.addText(e, _("Always"), 2);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Body fading:")));
me.TD(me, 1, 2, e = makeXonoticSlider(0, 2, 0.2, "cl_deathglow"));
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Gibs:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_nogibs"));
- e.addValue(e, ZCTX(_("GIBS^None")), "1");
- e.addValue(e, ZCTX(_("GIBS^Few")), "0.75");
- e.addValue(e, ZCTX(_("GIBS^Many")), "0.5");
- e.addValue(e, ZCTX(_("GIBS^Lots")), "0");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_nogibs"));
+ e.addText(e, ZCTX(_("GIBS^None")), 1);
+ e.addText(e, ZCTX(_("GIBS^Few")), 0.75);
+ e.addText(e, ZCTX(_("GIBS^Many")), 0.5);
+ e.addText(e, ZCTX(_("GIBS^Lots")), 0);
+ e.configureXonoticMixedSliderValues(e);
setDependent(e, "cl_gentle", 0, 0);
}
#include "textlabel.qh"
#include "checkbox.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "slider.qh"
#include "radiobutton.qh"
me.TR(me);
//me.TDempty(me, 0.2);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("ZOOM^Zoom speed:"))));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("cl_zoomspeed",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("cl_zoomspeed",
_("How fast the view will be zoomed, disable to zoom instantly")));
- e.addValue(e, "1", "1"); // Samual: for() loop doesn't work here, even though it would make sense.
- e.addValue(e, "2", "2");
- e.addValue(e, "3", "3");
- e.addValue(e, "4", "4");
- e.addValue(e, "5", "5");
- e.addValue(e, "6", "6");
- e.addValue(e, "7", "7");
- e.addValue(e, "8", "8");
- e.addValue(e, ZCTX(_("ZOOM^Instant")), "-1");
- e.configureXonoticTextSliderValues(e);
+ e.addRange(e, 1, 8, 1);
+ e.addText(e, ZCTX(_("ZOOM^Instant")), -1);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
//me.TDempty(me, 0.2);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("ZOOM^Zoom sensitivity:"))));
me.TDempty(me, 0.2);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Speed:")));
setDependent(e, "cl_zoomscroll", 1, 1);
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_zoomscroll_speed"));
- e.addValue(e, "2", "2"); // Samual: for() loop doesn't work here, even though it would make sense.
- e.addValue(e, "4", "4");
- e.addValue(e, "6", "6");
- e.addValue(e, "8", "8");
- e.addValue(e, "10", "10");
- e.addValue(e, "12", "12");
- e.addValue(e, "14", "14");
- e.addValue(e, "16", "16");
- e.addValue(e, ZCTX(_("ZOOM^Instant")), "-1");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_zoomscroll_speed"));
+ e.addRange(e, 2, 16, 2);
+ e.addText(e, ZCTX(_("ZOOM^Instant")), -1);
+ e.configureXonoticMixedSliderValues(e);
setDependent(e, "cl_zoomscroll", 1, 1);
me.TR(me);
me.TR(me);
#include "weaponslist.qh"
#include "commandbutton.qh"
#include "textlabel.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "checkbox.qh"
#include "button.qh"
#include "radiobutton.qh"
e.sendCvars = true;
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Auto switch in CTS:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_autoswitch_cts"));
- e.addValue(e, _("Default"), "-1");
- e.addValue(e, _("Always"), "1");
- e.addValue(e, _("Never"), "0");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_autoswitch_cts"));
+ e.addText(e, _("Never"), 0);
+ e.addText(e, _("Default"), -1);
+ e.addText(e, _("Always"), 1);
+ e.configureXonoticMixedSliderValues(e);
e.sendCvars = true;
me.TR(me);
me.TR(me);
_("Position of the weapon model; requires reconnect")));
setDependent(e, "r_drawviewmodel", 1, 1);
me.TR(me);
- me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Weapon model opacity:")));
- setDependent(e, "r_drawviewmodel", 1, 1);
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_viewmodel_alpha"));
- setDependent(e, "r_drawviewmodel", 1, 1);
- e.addValue(e, "15%", "0.15");
- e.addValue(e, "25%", "0.25");
- e.addValue(e, "50%", "0.5");
- e.addValue(e, "75%", "0.75");
- e.addValue(e, "100%", "1");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Weapon model opacity:")));
+ setDependent(e, "r_drawviewmodel", 1, 1);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_viewmodel_alpha"));
+ setDependent(e, "r_drawviewmodel", 1, 1);
+ e.addText(e, "15%", 0.15);
+ e.addText(e, "25%", 0.25);
+ e.addText(e, "50%", 0.5);
+ e.addText(e, "75%", 0.75);
+ e.addText(e, "100%", 1);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TR(me);
me.TDempty(me, 0.2);
#include "textlabel.qh"
#include "button.qh"
#include "slider.qh"
+#include "mixedslider.qh"
#include "checkbox.qh"
#include "inputbox.qh"
e.sendCvars = true;
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Jetpack on jump:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_jetpack_jump"));
- e.addValue(e, ZCTX(_("JPJUMP^Disabled")), "0");
- e.addValue(e, _("Air only"), "1");
- e.addValue(e, ZCTX(_("JPJUMP^All")), "2");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_jetpack_jump"));
+ e.addText(e, ZCTX(_("JPJUMP^Disabled")), 0);
+ e.addText(e, _("Air only"), 1);
+ e.addText(e, ZCTX(_("JPJUMP^All")), 2);
+ e.configureXonoticMixedSliderValues(e);
e.sendCvars = true;
me.TR(me);
if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
#include "textlabel.qh"
#include "inputbox.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "slider.qh"
#include "checkbox.qh"
#include "button.qh"
#include "mainwindow.qh"
#include "commandbutton.qh"
-#define ADDVALUE_FPS(i) e.addValue(e, strzone(sprintf(_("%d fps"), i)), #i)
-#define ADDVALUE_SPEED_KB(i) e.addValue(e, strzone(sprintf(_("%d KiB/s"), i)), #i)
-#define ADDVALUE_SPEED_MB(i, j) e.addValue(e, strzone(sprintf(_("%d MiB/s"), i)), #j)
+#define ADDVALUE_FPS(i) e.addText(e, strzone(sprintf(_("%d fps"), i)), i)
+#define ADDVALUE_SPEED_KB(i) e.addText(e, strzone(sprintf(_("%d KiB/s"), i)), i)
+#define ADDVALUE_SPEED_MB(i, j) e.addText(e, strzone(sprintf(_("%d MiB/s"), i)), j)
entity makeXonoticMiscSettingsTab()
{
entity me;
_("Maximum number of concurrent HTTP downloads")));
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bandwidth limit:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_curl_maxspeed"));
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_curl_maxspeed"));
ADDVALUE_SPEED_KB(64);
ADDVALUE_SPEED_KB(128);
ADDVALUE_SPEED_KB(256);
ADDVALUE_SPEED_MB(2, 2048);
ADDVALUE_SPEED_MB(4, 4096);
ADDVALUE_SPEED_MB(8, 8192);
- e.addValue(e, strzone(_("Unlimited")), "0");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, strzone(_("Unlimited")), 0);
+ e.configureXonoticMixedSliderValues(e);
me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Framerate")));
_("Show your rendered frames per second")));
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Maximum:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_maxfps"));
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_maxfps"));
ADDVALUE_FPS(128);
ADDVALUE_FPS(256);
ADDVALUE_FPS(512);
ADDVALUE_FPS(1024);
ADDVALUE_FPS(2048);
- e.addValue(e, ZCTX(_("MAXFPS^Unlimited")), "0");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, ZCTX(_("MAXFPS^Unlimited")), 0);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Target:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_minfps"));
- e.addValue(e, ZCTX(_("TRGT^Disabled")), "0");
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_minfps"));
+ e.addText(e, ZCTX(_("TRGT^Disabled")), 0);
ADDVALUE_FPS(40);
ADDVALUE_FPS(60);
ADDVALUE_FPS(100);
ADDVALUE_FPS(200);
ADDVALUE_FPS(250);
ADDVALUE_FPS(400);
- e.configureXonoticTextSliderValues(e);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Idle limit:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_maxidlefps"));
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("cl_maxidlefps"));
ADDVALUE_FPS(16);
ADDVALUE_FPS(32);
ADDVALUE_FPS(64);
ADDVALUE_FPS(128);
- e.addValue(e, ZCTX(_("IDLFPS^Unlimited")), "0");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, ZCTX(_("IDLFPS^Unlimited")), 0);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Other")));
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Menu tooltips:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("menu_tooltips",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("menu_tooltips",
_("Menu tooltips: disabled, standard or advanced (also shows cvar or console command bound to the menu item)")));
- e.addValue(e, ZCTX(_("TLTIP^Disabled")), "0");
- e.addValue(e, ZCTX(_("TLTIP^Standard")), "1");
- e.addValue(e, ZCTX(_("TLTIP^Advanced")), "2");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, ZCTX(_("TLTIP^Disabled")), 0);
+ e.addText(e, ZCTX(_("TLTIP^Standard")), 1);
+ e.addText(e, ZCTX(_("TLTIP^Advanced")), 2);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "showtime", _("Show current date and time"),
_("Show current date and time of day, useful on screenshots")));
#include "commandbutton.qh"
#include "textlabel.qh"
-#include "textslider.qh"
+#include "mixedslider.qh"
#include "checkbox.qh"
#include "slider.qh"
#include "slider_resolution.qh"
e.applyButton = videoApplyButton;
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Font/UI size:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider("menu_vid_scale"));
- e.addValue(e, ZCTX(_("SZ^Unreadable")), "-1");
- e.addValue(e, ZCTX(_("SZ^Tiny")), "-0.75");
- e.addValue(e, ZCTX(_("SZ^Little")), "-0.5");
- e.addValue(e, ZCTX(_("SZ^Small")), "-0.25");
- e.addValue(e, ZCTX(_("SZ^Medium")), "0");
- e.addValue(e, ZCTX(_("SZ^Large")), "0.25");
- e.addValue(e, ZCTX(_("SZ^Huge")), "0.5");
- e.addValue(e, ZCTX(_("SZ^Gigantic")), "0.75");
- e.addValue(e, ZCTX(_("SZ^Colossal")), "1");
- e.configureXonoticTextSliderValues(e);
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider("menu_vid_scale"));
+ e.addText(e, ZCTX(_("SZ^Unreadable")), -1);
+ e.addText(e, ZCTX(_("SZ^Tiny")), -0.75);
+ e.addText(e, ZCTX(_("SZ^Little")), -0.5);
+ e.addText(e, ZCTX(_("SZ^Small")), -0.25);
+ e.addText(e, ZCTX(_("SZ^Medium")), 0);
+ e.addText(e, ZCTX(_("SZ^Large")), 0.25);
+ e.addText(e, ZCTX(_("SZ^Huge")), 0.5);
+ e.addText(e, ZCTX(_("SZ^Gigantic")), 0.75);
+ e.addText(e, ZCTX(_("SZ^Colossal")), 1);
+ e.configureXonoticMixedSliderValues(e);
e.applyButton = videoApplyButton;
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Color depth:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("vid_bitsperpixel",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("vid_bitsperpixel",
_("How many bits per pixel (BPP) to render at, 32 is recommended")));
- e.addValue(e, _("16bit"), "16");
- e.addValue(e, _("32bit"), "32");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, _("16bit"), 16);
+ e.addText(e, _("32bit"), 32);
+ e.configureXonoticMixedSliderValues(e);
e.applyButton = videoApplyButton;
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "vid_fullscreen", _("Full screen")));
{
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Antialiasing:")));
setDependent(e, "r_viewfbo", 0, 0);
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("vid_samples",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("vid_samples",
_("Enable antialiasing, which smooths the edges of 3D geometry. Note that it might decrease performance by quite a lot")));
- e.addValue(e, ZCTX(_("AA^Disabled")), "1");
- e.addValue(e, _("2x"), "2");
- e.addValue(e, _("4x"), "4");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, ZCTX(_("AA^Disabled")), 1);
+ e.addText(e, _("2x"), 2);
+ e.addText(e, _("4x"), 4);
+ e.configureXonoticMixedSliderValues(e);
setDependent(e, "r_viewfbo", 0, 0);
e.applyButton = videoApplyButton;
}
}
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Anisotropy:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("gl_texture_anisotropy",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("gl_texture_anisotropy",
_("Anisotropic filtering quality")));
- e.addValue(e, ZCTX(_("ANISO^Disabled")), "1");
- e.addValue(e, _("2x"), "2");
- e.addValue(e, _("4x"), "4");
- e.addValue(e, _("8x"), "8");
- e.addValue(e, _("16x"), "16");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, ZCTX(_("ANISO^Disabled")), 1);
+ e.addText(e, _("2x"), 2);
+ e.addText(e, _("4x"), 4);
+ e.addText(e, _("8x"), 8);
+ e.addText(e, _("16x"), 16);
+ e.configureXonoticMixedSliderValues(e);
me.TR(me);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Depth first:")));
- me.TD(me, 1, 2, e = makeXonoticTextSlider_T("r_depthfirst",
+ me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("r_depthfirst",
_("Eliminate overdraw by rendering a depth-only version of the scene before the normal rendering starts")));
- e.addValue(e, ZCTX(_("DF^Disabled")), "0");
- e.addValue(e, ZCTX(_("DF^World")), "1");
- e.addValue(e, ZCTX(_("DF^All")), "2");
- e.configureXonoticTextSliderValues(e);
+ e.addText(e, ZCTX(_("DF^Disabled")), 0);
+ e.addText(e, ZCTX(_("DF^World")), 1);
+ e.addText(e, ZCTX(_("DF^All")), 2);
+ e.configureXonoticMixedSliderValues(e);
me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Brightness:")));
--- /dev/null
+#include "mixedslider.qh"
+
+entity makeXonoticMixedSlider_T(string theCvar, string theTooltip)
+{
+ entity me;
+ me = NEW(XonoticMixedSlider);
+ me.configureXonoticMixedSlider(me, theCvar, theTooltip);
+ return me;
+}
+entity makeXonoticMixedSlider(string theCvar)
+{
+ return makeXonoticMixedSlider_T(theCvar, string_null);
+}
+void XonoticMixedSlider_configureXonoticMixedSlider(entity me, string theCvar, string theTooltip)
+{
+ me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
+ me.controlledCvar = (theCvar) ? theCvar : string_null;
+ // me.loadCvars(me); // don't load it yet
+ setZonedTooltip(me, theTooltip, theCvar);
+}
+void XonoticMixedSlider_setValue(entity me, float val)
+{
+ if (val != me.value)
+ {
+ SUPER(XonoticMixedSlider).setValue(me, val);
+ me.saveCvars(me);
+ }
+}
+void XonoticMixedSlider_setValue_noAnim(entity me, float val)
+{
+ if (val != me.value)
+ {
+ SUPER(XonoticMixedSlider).setValue_noAnim(me, val);
+ me.saveCvars(me);
+ }
+}
+void XonoticMixedSlider_loadCvars(entity me)
+{
+ if (!me.controlledCvar)
+ return;
+
+ // don't call setValue_noAnim or else it will call saveCvars
+ me.setValueFromNumberIdentifier_noAnim(me, cvar(me.controlledCvar));
+}
+void XonoticMixedSlider_saveCvars(entity me)
+{
+ if (!me.controlledCvar)
+ return;
+
+ cvar_set(me.controlledCvar, ftos_mindecimals(me.getNumberIdentifier(me)));
+
+ CheckSendCvars(me, me.controlledCvar);
+}
+void XonoticMixedSlider_configureXonoticMixedSliderValues(entity me)
+{
+ me.configureMixedSliderValues(me, 0);
+ me.loadCvars(me);
+}
--- /dev/null
+#pragma once
+
+#include "../item/mixedslider.qh"
+CLASS(XonoticMixedSlider, MixedSlider)
+ METHOD(XonoticMixedSlider, configureXonoticMixedSlider, void(entity, string, string));
+ METHOD(XonoticMixedSlider, setValue, void(entity, float));
+ METHOD(XonoticMixedSlider, setValue_noAnim, void(entity, float));
+ METHOD(XonoticMixedSlider, configureXonoticMixedSliderValues, void(entity));
+ ATTRIB(XonoticMixedSlider, fontSize, float, SKINFONTSIZE_NORMAL);
+ ATTRIB(XonoticMixedSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT);
+ ATTRIB(XonoticMixedSlider, image, string, SKINGFX_SLIDER);
+ ATTRIB(XonoticMixedSlider, tolerance, vector, '0.2 2 0');
+ ATTRIB(XonoticMixedSlider, align, float, 0.5);
+ ATTRIB(XonoticMixedSlider, color, vector, SKINCOLOR_SLIDER_N);
+ ATTRIB(XonoticMixedSlider, colorC, vector, SKINCOLOR_SLIDER_C);
+ ATTRIB(XonoticMixedSlider, colorF, vector, SKINCOLOR_SLIDER_F);
+ ATTRIB(XonoticMixedSlider, colorD, vector, SKINCOLOR_SLIDER_D);
+ ATTRIB(XonoticMixedSlider, color2, vector, SKINCOLOR_SLIDER_S);
+
+ ATTRIB(XonoticMixedSlider, controlledCvar, string);
+ METHOD(XonoticMixedSlider, loadCvars, void(entity));
+ METHOD(XonoticMixedSlider, saveCvars, void(entity));
+ ATTRIB(XonoticMixedSlider, sendCvars, float, 0);
+
+ ATTRIB(XonoticMixedSlider, alpha, float, SKINALPHA_TEXT);
+ ATTRIB(XonoticMixedSlider, disabledAlpha, float, SKINALPHA_DISABLED);
+ENDCLASS(XonoticMixedSlider)
+entity makeXonoticMixedSlider_T(string, string theTooltip);
+entity makeXonoticMixedSlider(string); // note: you still need to call addRange, addText, and configureXonoticMixedSliderValues!
}
void XonoticPicmipSlider_configureXonoticPicmipSlider(entity me)
{
- me.configureXonoticTextSlider(me, "gl_picmip",
+ me.configureXonoticMixedSlider(me, "gl_picmip",
_("Change the sharpness of the textures. Lowering it will effectively reduce texture memory usage, but make the textures appear very blurry."));
me.autofix(me);
me.have_s3tc = GL_Have_TextureCompression();
#pragma once
-#include "textslider.qh"
-CLASS(XonoticPicmipSlider, XonoticTextSlider)
+#include "mixedslider.qh"
+CLASS(XonoticPicmipSlider, XonoticMixedSlider)
METHOD(XonoticPicmipSlider, configureXonoticPicmipSlider, void(entity));
METHOD(XonoticPicmipSlider, draw, void(entity));
METHOD(XonoticPicmipSlider, autofix, void(entity));
ATTRIB(XonoticPicmipSlider, have_s3tc, float, 0);
ENDCLASS(XonoticPicmipSlider)
-entity makeXonoticPicmipSlider(); // note: you still need to call addValue and configureXonoticTextSliderValues!
+entity makeXonoticPicmipSlider(); // note: you still need to call addRange, addText, and configureXonoticMixedSliderValues!