]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add confirmation dialog to go to the hud editor when there is no map currently running
authorSamual <samual@xonotic.org>
Sun, 15 Jan 2012 21:42:20 +0000 (16:42 -0500)
committerSamual <samual@xonotic.org>
Sun, 15 Jan 2012 21:42:20 +0000 (16:42 -0500)
qcsrc/menu/classes.c
qcsrc/menu/skin-customizables.inc
qcsrc/menu/xonotic/dialog_multiplayer_playersetup.c
qcsrc/menu/xonotic/dialog_multiplayer_playersetup_hudconfirm.c [new file with mode: 0644]
qcsrc/menu/xonotic/mainwindow.c

index 0be24e5ea16a32750b462d8cd636b3ed62cc6a4d..44141dfcdb5030745cd2fcd7cbde83cb748c8350 100644 (file)
@@ -79,6 +79,7 @@
 #include "xonotic/dialog_singleplayer_winner.c"
 #include "xonotic/dialog_credits.c"
 #include "xonotic/credits.c"
+#include "xonotic/dialog_multiplayer_playersetup_hudconfirm.c"
 #include "xonotic/dialog_multiplayer_playersetup_view.c"
 #include "xonotic/dialog_multiplayer_playersetup_weapons.c"
 #include "xonotic/weaponslist.c"
index c4a004e858b9095915ab9f6b85f2bd1a39d29e99..5449cd916bd7aa09b53e297f09b557cd8ccf0d4f 100644 (file)
@@ -67,6 +67,7 @@ SKINBEGIN
        SKINVECTOR(COLOR_DIALOG_VIEW, '1 0.7 0.7');
        SKINVECTOR(COLOR_DIALOG_SERVERINFO, '0.7 0.7 1');
        SKINVECTOR(COLOR_DIALOG_CVARS, '1 0 0');
+       SKINVECTOR(COLOR_DIALOG_HUDCONFIRM, '1 0 0');
 
        // nexposee positions of windows (they are the scale transformation
        // centers, NOT the actual positions of the windows!)
index fe5739b35abf448a1cd13f07713f083923db8a73..cf9d12874e44b0173f37bb3a5a744bf903fd42f8 100644 (file)
@@ -10,12 +10,21 @@ CLASS(XonoticPlayerSettingsTab) EXTENDS(XonoticTab)
        ATTRIB(XonoticPlayerSettingsTab, playerNameLabelAlpha, float, 0)
 ENDCLASS(XonoticPlayerSettingsTab)
 entity makeXonoticPlayerSettingsTab();
-
-void HUDSetup_Join_Click(entity me, entity btn);
+void HUDSetup_Start(entity me, entity btn);
 #endif
 
 #ifdef IMPLEMENTATION
-
+void HUDSetup_Check_Gamestatus(entity me, entity btn)
+{
+       if not(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)) // we're not in a match, ask the player if they want to start one anyway
+       {
+               DialogOpenButton_Click(btn, main.hudconfirmDialog);
+       }
+       else // already in a match, lets just cut to the point and open up the hud editor directly
+       {
+               HUDSetup_Start(me, btn);
+       }
+}
 entity makeXonoticPlayerSettingsTab()
 {
        entity me;
@@ -140,7 +149,7 @@ void XonoticPlayerSettingsTab_fill(entity me)
        me.TR(me);
                me.TDempty(me, 0.5);
                me.TD(me, 1, 2, e = makeXonoticButton(_("Other crosshair settings"), '0 0 0'));
-                       e.onClick = HUDSetup_Join_Click;
+                       e.onClick = HUDSetup_Start;
                        e.onClickEntity = me;
                setDependent(e, "crosshair_enabled", 1, 2);
                // TODO: show status of crosshair dot and hittest and pickups and such here with text
@@ -148,7 +157,7 @@ void XonoticPlayerSettingsTab_fill(entity me)
        me.TR(me);
                me.TDempty(me, 0.5);
                me.TD(me, 1, 2, e = makeXonoticButton(_("Model settings"), '0 0 0'));
-                       e.onClick = HUDSetup_Join_Click;
+                       e.onClick = HUDSetup_Start;
                        e.onClickEntity = me;
                // TODO: show csqc model settings like forcemyplayer and deglowing/ghosting bodies with text here
        me.TR(me);
@@ -170,24 +179,11 @@ void XonoticPlayerSettingsTab_fill(entity me)
        me.TR(me);
                me.TDempty(me, 0.5);
                me.TD(me, 1, 2, e = makeXonoticButton(_("HUD settings"), '0 0 0'));
-               if not(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))
-               {
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.weaponsDialog;
-               }
-               else
-               {
-                       e.onClick = HUDSetup_Join_Click;
+                       e.onClick = HUDSetup_Check_Gamestatus;
                        e.onClickEntity = me;
-               }
                // TODO: show hud config name with text here 
 
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "color -1 -1;name \"$_cl_name\";cl_cmd sendcvar cl_weaponpriority;sendcvar cl_zoomfactor;sendcvar cl_zoomspeed;sendcvar cl_autoswitch;sendcvar cl_forceplayermodelsfromxonotic;sendcvar cl_forceplayermodels;playermodel $_cl_playermodel;playerskin $_cl_playerskin", COMMANDBUTTON_APPLY));
 }
-void HUDSetup_Join_Click(entity me, entity btn)
-{
-       localcmd("togglemenu 0\n");
-       localcmd("_hud_configure 1", "\n");
-}
 #endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_hudconfirm.c b/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_hudconfirm.c
new file mode 100644 (file)
index 0000000..433c99b
--- /dev/null
@@ -0,0 +1,40 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDConfirmDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticHUDConfirmDialog, fill, void(entity))
+       ATTRIB(XonoticHUDConfirmDialog, title, string, _("Enter HUD editor"))
+       ATTRIB(XonoticHUDConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+       ATTRIB(XonoticHUDConfirmDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticHUDConfirmDialog, rows, float, 4)
+       ATTRIB(XonoticHUDConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticHUDConfirmDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void HUDSetup_Start(entity me, entity btn)
+{
+       if not(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))
+               localcmd("map hudsetup/hudsetup", "\n");
+       else
+               localcmd("togglemenu 0\n");
+               
+       localcmd("_hud_configure 1", "\n");
+}
+
+void XonoticHUDConfirmDialog_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("In order for the HUD editor to show, you must first be in game.")));
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Do you wish to start a local game to set up the HUD?")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Yes"), '1 0 0'));
+                       e.onClick = HUDSetup_Start;
+                       e.onClickEntity = me;
+               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
index 4f762b6188b22721653e308e44215781f9026591..9054bef6a778bf349cfa631cb8a80918bdf6230f 100644 (file)
@@ -12,6 +12,7 @@ CLASS(MainWindow) EXTENDS(ModalController)
        ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
        ATTRIB(MainWindow, cvarsDialog, entity, NULL)
        ATTRIB(MainWindow, viewDialog, entity, NULL)
+       ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
        ATTRIB(MainWindow, mainNexposee, entity, NULL)
        ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
        ATTRIB(MainWindow, dialogToShow, entity, NULL)
@@ -126,6 +127,10 @@ void MainWindow_configureMainWindow(entity me)
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
+       me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
        me.advancedDialog = i = spawnXonoticAdvancedDialog();
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);