float HUD_PANEL_NUM = 13;
float HUD_MENU_ENABLE = 0;
+float HUD_MENU_ALPHA = 1;
+float HUD_MENU_BORDER = 2;
+float HUD_MENU_PADDING = 3;
+float HUD_MENU_COLOR = 4;
+float HUD_MENU_COLORTEAM = 5;
+float HUD_MENU_FLIP = 6;
+float HUD_MENU_MIRROR = 7;
+float HUD_MENU_PRINT = 8;
+float HUD_MENU_TIME = 9;
+float HUD_MENU_FADETIME = 10;
#include "xonotic/tabcontroller.c"
#include "xonotic/textlabel.c"
#include "xonotic/slider.c"
+#include "xonotic/slider_hudname.c"
#include "xonotic/slider_resolution.c"
#include "xonotic/checkbox.c"
#include "xonotic/checkbox_hudname.c"
#include "xonotic/playermodel.c"
#include "xonotic/dialog_news.c"
#include "xonotic/checkbox_slider_invalid.c"
+#include "xonotic/checkbox_slider_invalid_off_string.c"
#include "xonotic/charmap.c"
#include "xonotic/keybinder.c"
#include "xonotic/dialog_settings_input.c"
--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticCheckBoxHUDName) EXTENDS(CheckBox)
+ METHOD(XonoticCheckBoxHUDName, configureXonoticCheckBoxHUDName, void(entity, float, float, float, string))
+ METHOD(XonoticCheckBoxHUDName, setChecked, void(entity, float))
+ ATTRIB(XonoticCheckBoxHUDName, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticCheckBoxHUDName, image, string, SKINGFX_CHECKBOX)
+ ATTRIB(XonoticCheckBoxHUDName, yesValue, float, 1)
+ ATTRIB(XonoticCheckBoxHUDName, noValue, float, 0)
+
+ ATTRIB(XonoticCheckBoxHUDName, color, vector, SKINCOLOR_CHECKBOX_N)
+ ATTRIB(XonoticCheckBoxHUDName, colorC, vector, SKINCOLOR_CHECKBOX_C)
+ ATTRIB(XonoticCheckBoxHUDName, colorF, vector, SKINCOLOR_CHECKBOX_F)
+ ATTRIB(XonoticCheckBoxHUDName, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+ ATTRIB(XonoticCheckBoxHUDName, setting, float, 0)
+ METHOD(XonoticCheckBoxHUDName, loadCvars, void(entity))
+ METHOD(XonoticCheckBoxHUDName, saveCvars, void(entity))
+
+ ATTRIB(XonoticCheckBoxHUDName, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticCheckBoxHUDName, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCheckBoxHUDName)
+entity makeXonoticCheckBoxHUDName(float, float, string);
+entity makeXonoticCheckBoxHUDNameEx(float, float, float, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticCheckBoxHUDName(float isInverted, float theSetting, string theText)
+{
+ float y, n;
+ if(isInverted > 1)
+ {
+ n = isInverted - 1;
+ y = -n;
+ }
+ else if(isInverted < -1)
+ {
+ n = isInverted + 1;
+ y = -n;
+ }
+ else if(isInverted == 1)
+ {
+ n = 1;
+ y = 0;
+ }
+ else
+ {
+ n = 0;
+ y = 1;
+ }
+ return makeXonoticCheckBoxHUDNameEx(y, n, theSetting, theText);
+}
+entity makeXonoticCheckBoxHUDNameEx(float theYesValue, float theNoValue, float theSetting, string theText)
+{
+ entity me;
+ me = spawnXonoticCheckBoxHUDName();
+ me.configureXonoticCheckBoxHUDName(me, theYesValue, theNoValue, theSetting, theText);
+ return me;
+}
+void configureXonoticCheckBoxHUDNameXonoticCheckBoxHUDName(entity me, float theYesValue, float theNoValue, float theSetting, string theText)
+{
+ me.yesValue = theYesValue;
+ me.noValue = theNoValue;
+ me.checked = 0;
+
+ me.setting = theSetting;
+ //me.tooltip = getZonedTooltipForIdentifier(theSetting);
+ me.loadCvars(me);
+
+ me.configureCheckBox(me, theText, me.fontSize, me.image);
+}
+void setCheckedXonoticCheckBoxHUDName(entity me, float val)
+{
+ if(val != me.checked)
+ {
+ me.checked = val;
+ me.saveCvars(me);
+ }
+}
+void loadCvarsXonoticCheckBoxHUDName(entity me)
+{
+ float m, d;
+
+ m = (me.yesValue + me.noValue) * 0.5;
+ d = (cvar(strcat("hud_", HUD_Panel_GetName(highlightedPanel), HUD_Panel_GetSettingName(me.setting))) - m) / (me.yesValue - m);
+ me.checked = (d > 0);
+}
+void saveCvarsXonoticCheckBoxHUDName(entity me)
+{
+ if(me.checked)
+ cvar_set(strcat("hud_", HUD_Panel_GetName(highlightedPanel), HUD_Panel_GetSettingName(me.setting)), ftos(me.yesValue));
+ else
+ cvar_set(strcat("hud_", HUD_Panel_GetName(highlightedPanel), HUD_Panel_GetSettingName(me.setting)), ftos(me.noValue));
+}
+#endif
--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticSliderCheckBoxNull) EXTENDS(CheckBox)
+ METHOD(XonoticSliderCheckBoxNull, configureXonoticSliderCheckBoxNull, void(entity, float, entity, string, float))
+ METHOD(XonoticSliderCheckBoxNull, setChecked, void(entity, float))
+ METHOD(XonoticSliderCheckBoxNull, draw, void(entity))
+ ATTRIB(XonoticSliderCheckBoxNull, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticSliderCheckBoxNull, image, string, SKINGFX_CHECKBOX)
+
+ ATTRIB(XonoticSliderCheckBoxNull, color, vector, SKINCOLOR_CHECKBOX_N)
+ ATTRIB(XonoticSliderCheckBoxNull, colorC, vector, SKINCOLOR_CHECKBOX_C)
+ ATTRIB(XonoticSliderCheckBoxNull, colorF, vector, SKINCOLOR_CHECKBOX_F)
+ ATTRIB(XonoticSliderCheckBoxNull, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+ ATTRIB(XonoticSliderCheckBoxNull, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticSliderCheckBoxNull, disabledAlpha, float, SKINALPHA_DISABLED)
+
+ ATTRIB(XonoticSliderCheckBoxNull, setting, float, 0)
+ METHOD(XonoticSliderCheckBoxNull, loadCvars, void(entity))
+ METHOD(XonoticSliderCheckBoxNull, saveCvars, void(entity))
+ ATTRIB(XonoticSliderCheckBoxNull, value_s, string, string_null)
+
+ ATTRIB(XonoticSliderCheckBoxNull, controlledSlider, entity, NULL)
+ ATTRIB(XonoticSliderCheckBoxNull, inverted, float, 0)
+ ATTRIB(XonoticSliderCheckBoxNull, savedValue, float, -1)
+ENDCLASS(XonoticSliderCheckBoxNull)
+entity makeXonoticSliderCheckBoxNull(float, entity, string, float);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticSliderCheckBoxNull(float isInverted, entity theControlledSlider, string theText, float theSetting)
+{
+ entity me;
+ me = spawnXonoticSliderCheckBoxNull();
+ me.configureXonoticSliderCheckBoxNull(me, isInverted, theControlledSlider, theText, theSetting);
+ return me;
+}
+void configureXonoticSliderCheckBoxNullXonoticSliderCheckBoxNull(entity me, float isInverted, entity theControlledSlider, string theText, float theSetting)
+{
+ me.setting = theSetting;
+ me.loadCvars(me);
+ me.inverted = isInverted;
+ me.checked = (me.value_s == "");
+ if(theControlledSlider.value == median(theControlledSlider.valueMin, theControlledSlider.value, theControlledSlider.valueMax))
+ me.savedValue = theControlledSlider.value;
+ else
+ me.savedValue = theControlledSlider.valueMin;
+ me.controlledSlider = theControlledSlider;
+ me.configureCheckBox(me, theText, me.fontSize, me.image);
+ me.tooltip = theControlledSlider.tooltip;
+}
+void drawXonoticSliderCheckBoxNull(entity me)
+{
+ me.checked = ((me.value_s == "") != me.inverted);
+ if(me.controlledSlider.value == median(me.controlledSlider.valueMin, me.controlledSlider.value, me.controlledSlider.valueMax))
+ me.savedValue = me.controlledSlider.value;
+ drawCheckBox(me);
+}
+void setCheckedXonoticSliderCheckBoxNull(entity me, float val)
+{
+ if(me.checked == val)
+ return;
+ me.checked = val;
+ if(val == me.inverted)
+ me.controlledSlider.setValue(me.controlledSlider, median(me.controlledSlider.valueMin, me.savedValue, me.controlledSlider.valueMax));
+ else
+ me.controlledSlider.setValue(me.controlledSlider, 9000);
+}
+void loadCvarsXonoticSliderCheckBoxNull(entity me)
+{
+ me.value_s = strzone(cvar_string(strcat("hud_", HUD_Panel_GetName(highlightedPanel), HUD_Panel_GetSettingName(me.setting))));
+}
+void saveCvarsXonoticSliderCheckBoxNull(entity me)
+{
+ cvar_set(strcat("hud_", HUD_Panel_GetName(highlightedPanel), HUD_Panel_GetSettingName(me.setting)), me.value_s);
+}
+#endif
#ifdef IMPLEMENTATION
void fillXonoticHUDOptionsDialog(entity me)
{
- entity e;
+ entity e, s;
me.TR(me);
-
- me.TD(me, 1, 1, e = makeXonoticCheckBoxHUDName(0, HUD_MENU_ENABLE, "Enable panel"));
+ me.TD(me, 1, 1, e = makeXonoticCheckBoxHUDName(0, HUD_MENU_ENABLE, "Enable panel"));
+
+ me.TR(me);
+ //me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Alpha"));
+ s = makeXonoticSliderHUDName(0.25, 1.0, 0.01, HUD_MENU_ALPHA);
+ me.TD(me, 1, 2, e = makeXonoticSliderCheckBoxNull(0, s, "Alpha", HUD_MENU_ALPHA));
}
/* nvm these, i guess they wont be used
void changeXonoticHUDOptionsDialog(entity me, float id)
{
- loadAllCvars(me);
highlightedPanel = id;
- print("Yay!", ftos(id), "\n");
-
+ loadAllCvars(main);
}
#endif
--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticSliderHUDName) EXTENDS(Slider)
+ METHOD(XonoticSliderHUDName, configureXonoticSliderHUDName, void(entity, float, float, float, float))
+ METHOD(XonoticSliderHUDName, setValue, void(entity, float))
+ ATTRIB(XonoticSliderHUDName, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticSliderHUDName, valueSpace, float, SKINWIDTH_SLIDERTEXT)
+ ATTRIB(XonoticSliderHUDName, image, string, SKINGFX_SLIDER)
+ ATTRIB(XonoticSliderHUDName, tolerance, vector, SKINTOLERANCE_SLIDER)
+ ATTRIB(XonoticSliderHUDName, align, float, 0.5)
+ ATTRIB(XonoticSliderHUDName, color, vector, SKINCOLOR_SLIDER_N)
+ ATTRIB(XonoticSliderHUDName, colorC, vector, SKINCOLOR_SLIDER_C)
+ ATTRIB(XonoticSliderHUDName, colorF, vector, SKINCOLOR_SLIDER_F)
+ ATTRIB(XonoticSliderHUDName, colorD, vector, SKINCOLOR_SLIDER_D)
+ ATTRIB(XonoticSliderHUDName, color2, vector, SKINCOLOR_SLIDER_S)
+
+ ATTRIB(XonoticSliderHUDName, setting, float, 0)
+ METHOD(XonoticSliderHUDName, loadCvars, void(entity))
+ METHOD(XonoticSliderHUDName, saveCvars, void(entity))
+
+ ATTRIB(XonoticSliderHUDName, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticSliderHUDName, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticSliderHUDName)
+entity makeXonoticSliderHUDName(float, float, float, float);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticSliderHUDName(float theValueMin, float theValueMax, float theValueStep, float theSetting)
+{
+ entity me;
+ me = spawnXonoticSliderHUDName();
+ me.configureXonoticSliderHUDName(me, theValueMin, theValueMax, theValueStep, theSetting);
+ return me;
+}
+void configureXonoticSliderHUDNameXonoticSliderHUDName(entity me, float theValueMin, float theValueMax, float theValueStep, float theSetting)
+{
+ float v, vk, vp;
+ v = theValueMin;
+ vk = theValueStep;
+ vp = theValueStep * 10;
+ while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
+ vp *= 10;
+ me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
+ me.configureSliderValues(me, theValueMin, v, theValueMax, theValueStep, vk, vp);
+
+ me.setting = theSetting;
+ me.loadCvars(me);
+ // TODO: Tooltips.
+ //if(tooltipdb >= 0)
+ // me.tooltip = getZonedTooltipForIdentifier(theCvar);
+}
+void setValueXonoticSliderHUDName(entity me, float val)
+{
+ if(val != me.value)
+ {
+ setValueSlider( me, val );
+ me.saveCvars(me);
+ }
+}
+void loadCvarsXonoticSliderHUDName(entity me)
+{
+ me.setValue(me, cvar(strcat("hud_", HUD_Panel_GetName(highlightedPanel), HUD_Panel_GetSettingName(me.setting))));
+}
+void saveCvarsXonoticSliderHUDName(entity me)
+{
+ cvar_set(strcat("hud_", HUD_Panel_GetName(highlightedPanel), HUD_Panel_GetSettingName(me.setting)), ftos(me.value));
+}
+#endif
{
switch(theSetting) {
case HUD_MENU_ENABLE: return ""; break;
+ case HUD_MENU_ALPHA: return "_bg_alpha"; break;
default: return "";
}
}