]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
working on/off switch for panels via a hud dialog
authorFruitieX <rasse@rasse-lappy.localdomain>
Fri, 11 Jun 2010 15:42:42 +0000 (18:42 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Fri, 11 Jun 2010 15:42:42 +0000 (18:42 +0300)
qcsrc/common/constants.qh
qcsrc/common/util.qc
qcsrc/menu/classes.c
qcsrc/menu/gamecommand.qc
qcsrc/menu/menu.qc
qcsrc/menu/menu.qh
qcsrc/menu/xonotic/dialog_hudpanel_options.c
qcsrc/menu/xonotic/util.qc
qcsrc/menu/xonotic/util.qh

index facf3bc9506d2a36da606352e2653413b1f24038..b52931e60ed876f27ca471a770db52a3369b7fb8 100644 (file)
@@ -581,3 +581,5 @@ float HUD_PANEL_MODICONS    = 10;
 float HUD_PANEL_PRESSEDKEYS    = 11;
 float HUD_PANEL_CHAT           = 12;
 float HUD_PANEL_NUM            = 13;
+
+float HUD_MENU_ENABLE          = 0;
index 5329d4e0accc171a4ce02b893f5f265fe122ea1b..b25302c703fc4dce5394039388e66615ad07ba10 100644 (file)
@@ -1969,4 +1969,3 @@ string HUD_Panel_GetName(float id)
                default: return "";
        }
 }
-
index 91313570605ca93e3f6391c8c6d26a6b7038e342..0026f9fc131bd63d1aefbaac0230ee008b63c462 100644 (file)
@@ -41,6 +41,7 @@
 #include "xonotic/slider.c"
 #include "xonotic/slider_resolution.c"
 #include "xonotic/checkbox.c"
+#include "xonotic/checkbox_hudname.c"
 #include "xonotic/radiobutton.c"
 #include "xonotic/nexposee.c"
 #include "xonotic/rootdialog.c"
index 3be1f89e36e610aa8ec79571c3d048007dca5835..94357b2270ed928ac907c7676be41147b03cd5f5 100644 (file)
@@ -66,7 +66,9 @@ void GameCommand(string theCommand)
        {
                // switch to a menu item
                m_goto("HUDOptions");
-               changeXonoticHUDPanel(stof(argv(1)));
+               entity panelvar;
+               panelvar = findstring(NULL, name, "HUDOptions");
+               panelvar.change(panelvar, stof(argv(1)));
                return;
        }
 
index b8fee02a13263a8b9e24a7b43359c150bc1f9dad..e7fc1665a2c85040eda2fb2e8c327a9c77ae557f 100644 (file)
@@ -270,6 +270,9 @@ void draw_Picture_Aligned(vector algn, float scalemode, string img, float a)
 
 void(string img, float a, string algn, float force1) drawBackground =
 {
+       if(main.mainNexposee.ModalController_state == 0)
+               return;
+
        vector v;
        float i, l;
        string c;
index 903700d5d54d5529e174a07feb4fc9a797569c6d..de4224b934b327f20db496198212903dc15817ad 100644 (file)
@@ -40,3 +40,5 @@ void SUB_Null();
 float preMenuInit(); // you have to define this for pre-menu initialization. Return 0 if initialization needs to be retried a frame later, 1 if it succeeded.
 void preMenuDraw(); // this is run before the menu is drawn. You may put some stuff there that has to be done every frame.
 void postMenuDraw(); // this is run just after the menu is drawn (or not). Useful to draw something over everything else.
+
+float highlightedPanel;
index 0536adede63b92e458993d530a2c564a2e6636dd..ee3854fcd40800b8de78fc2043520643f895738c 100644 (file)
@@ -1,6 +1,7 @@
 #ifdef INTERFACE
 CLASS(XonoticHUDOptionsDialog) EXTENDS(XonoticRootDialog)
        METHOD(XonoticHUDOptionsDialog, fill, void(entity))
+       METHOD(XonoticHUDOptionsDialog, change, void(entity, float))
        ATTRIB(XonoticHUDOptionsDialog, title, string, "HUD Setup")
        ATTRIB(XonoticHUDOptionsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
        ATTRIB(XonoticHUDOptionsDialog, intendedWidth, float, 0.4)
@@ -17,11 +18,48 @@ void fillXonoticHUDOptionsDialog(entity me)
        entity e;
        me.TR(me);
        
+       me.TD(me, 1, 1, e = makeXonoticCheckBoxHUDName(0, HUD_MENU_ENABLE, "Enable panel"));
 }
 
-void changeXonoticHUDPanel(float id)
+/* nvm these, i guess they wont be used
+void saveCvarsXonoticHUDOptionsDialog(entity me)
 {
+       cvar_set(strcat("hud_", HUD_Panel_GetName(me.currentPanel)), ftos(me.currentEnabled));
+       if(me.currentPanel == HUD_PANEL_WEAPONICONS)
+               cvar_set(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_number"), ftos(me.currentNumber));
+
+       cvar_set(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg"), ftos(me.currentBg));
+       cvar_set(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_color"), me.currentBgColor);
+       cvar_set(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_color_team"), ftos(me.currentBgColorTeam));
+       cvar_set(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_alpha"), ftos(me.currentBgAlpha));
+       cvar_set(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_border"), ftos(me.currentBgBorder));
+       cvar_set(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_padding"), ftos(me.currentBgPadding));
+}
+
+void loadCvarsXonoticHUDOptionsDialog(entity me)
+{
+       me.currentEnabled = cvar(strcat("hud_", HUD_Panel_GetName(me.currentPanel)));
+       if(me.currentPanel == HUD_PANEL_WEAPONICONS)
+               me.currentNumber = cvar(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_number")); // only weaponicons panel
+
+       me.currentBg = cvar(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg"));
+       me.currentBgColor = cvar_string(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_color"));
+       me.currentBgColorTeam = cvar(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_color_team"));
+       me.currentBgAlpha = cvar(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_alpha"));
+       me.currentBgBorder = cvar(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_border"));
+       me.currentBgPadding = cvar(strcat("hud_", HUD_Panel_GetName(me.currentPanel), "_bg_padding"));
+
+       // wtf?
+       me.go(me, 0); // this will set the other vars for currentSkin and currentModel
+}
+*/
+
+void changeXonoticHUDOptionsDialog(entity me, float id)
+{
+       loadAllCvars(me);
+       highlightedPanel = id;
        print("Yay!", ftos(id), "\n");
 
 }
+
 #endif
index 3571e1ba834c6b47c5c9cb7392f9e071ee9289ec..9a40ba25be82174cce4fe4c25c1f01393aeafe15 100644 (file)
@@ -393,3 +393,11 @@ string resolvemod(string m)
        else
                return m;
 }
+
+string HUD_Panel_GetSettingName(float theSetting)
+{
+       switch(theSetting) {
+               case HUD_MENU_ENABLE: return ""; break;
+               default: return "";
+       }
+}
index 55d994115652b37a4194fe244afc3781d7183057..78eb7c1c43caa7cea3019c50652e7ab4173497db 100644 (file)
@@ -18,3 +18,5 @@ void unloadTooltips();
 string getZonedTooltipForIdentifier(string s);
 
 string resolvemod(string m);
+
+string HUD_Panel_GetSettingName(float setting);