]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a small Menu game dialog that can be opened with F11
authorterencehill <piuntn@gmail.com>
Sun, 13 Mar 2022 19:08:56 +0000 (20:08 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 13 Mar 2022 21:47:18 +0000 (22:47 +0100)
12 files changed:
binds-xonotic.cfg
commands.cfg
qcsrc/menu/command/menu_cmd.qc
qcsrc/menu/menu.qc
qcsrc/menu/xonotic/_mod.inc
qcsrc/menu/xonotic/_mod.qh
qcsrc/menu/xonotic/dialog_gamemenu.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_gamemenu.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_profile.qh
qcsrc/menu/xonotic/dialog_settings_input.qh
qcsrc/menu/xonotic/keybinder.qc
qcsrc/menu/xonotic/mainwindow.qc

index 6dd5fe2cfce66b5d0a29fcef27dadaeeb587bdc6..77d4147b754c9cd655629e0ac3022b68393f2d88 100644 (file)
@@ -62,7 +62,7 @@ bind i +show_info
 bind PAUSE pause
 bind F9 "cl_cmd hud minigame"
 bind F10 menu_showquitdialog
-bind F11 menu_showquitdialog
+bind F11 menu_showgamemenudialog
 bind F12 screenshot
 bind F4 ready
 
index 68dc610c43e73feb952d3446372467a7abea2d7f..5f71f58afa805965458e678e8db70918e422071a 100644 (file)
@@ -116,6 +116,7 @@ alias menu_showhudexit "menu_cmd directmenu HUDExit"
 alias menu_showhudoptions "menu_cmd directpanelhudmenu ${* ?}"
 alias menu_showsandboxtools "menu_cmd directmenu SandboxTools"
 alias menu_showquitdialog "menu_cmd directmenu Quit"
+alias menu_showgamemenudialog "menu_cmd directmenu GameMenu"
 alias menu_showmonstertools "menu_cmd directmenu MonsterTools"
 
 // command executed before loading a map by the menu
index c4593e87aa1a90181c8d555513c2bc89af92a8f4..8ba94a7865a4e6fd175d0c86c3693a9e6133494f 100644 (file)
@@ -100,6 +100,18 @@ void GameCommand(string theCommand)
                return;
        }
 
+       if (argv(0) == "nexposee")
+       {
+               m_goto("nexposee");
+               return;
+       }
+
+       if (argv(0) == "profile")
+       {
+               m_goto("profile");
+               return;
+       }
+
        if (argv(0) == "skinselect")
        {
                m_goto("skinselector");
@@ -112,6 +124,12 @@ void GameCommand(string theCommand)
                return;
        }
 
+       if (argv(0) == "inputsettings")
+       {
+               m_goto("inputsettings");
+               return;
+       }
+
        if (argv(0) == "videosettings")
        {
                m_goto("videosettings");
index f374b0a10b2ec780c1252e1afc5ef348c0fe0b35..4030270d321b727222074e2d7fbe7ec1709446ef 100644 (file)
@@ -969,12 +969,16 @@ void m_goto(string itemname)
                if (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))
                {
                        m_hide();
+                       return;
                }
-               else
-               {
-                       m_activate_window(main.mainNexposee);
-                       m_display();
-               }
+               itemname = "nexposee";
+       }
+
+       if (itemname == "nexposee")
+       {
+               // unlike 'togglemenu 1', this closes modal and root dialogs if opened
+               m_activate_window(main.mainNexposee);
+               m_display();
        }
        else
        {
index 1bc511c9e05c34364c59846e4b3ca57124e93863..56d8e00c189ca098cf468c26a81e59ccd3f5f43b 100644 (file)
@@ -20,6 +20,7 @@
 #include <menu/xonotic/dialog.qc>
 #include <menu/xonotic/dialog_credits.qc>
 #include <menu/xonotic/dialog_firstrun.qc>
+#include <menu/xonotic/dialog_gamemenu.qc>
 #include <menu/xonotic/dialog_hudpanel_ammo.qc>
 #include <menu/xonotic/dialog_hudpanel_centerprint.qc>
 #include <menu/xonotic/dialog_hudpanel_chat.qc>
index e3ba15b9d1ae54c5e87520d3bfc27cfd35ad927a..0b8f5c149d116258e2458d722bccf9d60add39d0 100644 (file)
@@ -20,6 +20,7 @@
 #include <menu/xonotic/dialog.qh>
 #include <menu/xonotic/dialog_credits.qh>
 #include <menu/xonotic/dialog_firstrun.qh>
+#include <menu/xonotic/dialog_gamemenu.qh>
 #include <menu/xonotic/dialog_hudpanel_ammo.qh>
 #include <menu/xonotic/dialog_hudpanel_centerprint.qh>
 #include <menu/xonotic/dialog_hudpanel_chat.qh>
diff --git a/qcsrc/menu/xonotic/dialog_gamemenu.qc b/qcsrc/menu/xonotic/dialog_gamemenu.qc
new file mode 100644 (file)
index 0000000..5403c1e
--- /dev/null
@@ -0,0 +1,34 @@
+#include "dialog_gamemenu.qh"
+
+#include "textlabel.qh"
+#include "commandbutton.qh"
+#include "leavematchbutton.qh"
+#include "button.qh"
+
+void XonoticGameMenuDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Main menu"), '0 0 0', "menu_cmd nexposee", 0));
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.8, e = makeXonoticCommandButton(_("Profile"), '0 0 0', "menu_cmd profile", 0));
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.8, e = makeXonoticCommandButton(_("Settings"), '0 0 0', "menu_cmd videosettings", 0));
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.8, e = makeXonoticCommandButton(_("Keys"), '0 0 0', "menu_cmd inputsettings", 0));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Quick menu"), '0 0 0', "quickmenu", COMMANDBUTTON_CLOSE));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Join!"), '0 0 0', "join", COMMANDBUTTON_CLOSE));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Spectate"), '0 0 0', "spec", COMMANDBUTTON_CLOSE));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticLeaveMatchButton('0 0 0', COMMANDBUTTON_CLOSE));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Quit Xonotic"), '1 0 0', "echo ]quit; quit", 0));
+}
diff --git a/qcsrc/menu/xonotic/dialog_gamemenu.qh b/qcsrc/menu/xonotic/dialog_gamemenu.qh
new file mode 100644 (file)
index 0000000..75ded66
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticGameMenuDialog, XonoticRootDialog)
+       METHOD(XonoticGameMenuDialog, fill, void(entity));
+       ATTRIB(XonoticGameMenuDialog, title, string, _("Game menu"));
+       ATTRIB(XonoticGameMenuDialog, color, vector, SKINCOLOR_DIALOG_QUIT);
+       ATTRIB(XonoticGameMenuDialog, intendedWidth, float, 0.3);
+       ATTRIB(XonoticGameMenuDialog, rows, float, 11);
+       ATTRIB(XonoticGameMenuDialog, columns, float, 1);
+       ATTRIB(XonoticGameMenuDialog, name, string, "GameMenu");
+       ATTRIB(XonoticGameMenuDialog, requiresConnection, bool, true);
+ENDCLASS(XonoticGameMenuDialog)
index 2285efcafa370cb6a2da6e8a0cc6c895176b96b6..f346aaf66672c0e26de8537a47dee05be6a63bf7 100644 (file)
@@ -9,5 +9,6 @@ CLASS(XonoticProfileTab, XonoticTab)
        ATTRIB(XonoticProfileTab, columns, float, 6.1);  // added extra .2 for center space
        ATTRIB(XonoticProfileTab, playerNameLabel, entity);
        ATTRIB(XonoticProfileTab, playerNameLabelAlpha, float, SKINALPHA_HEADER);
+       ATTRIB(XonoticProfileTab, name, string, "profile");
 ENDCLASS(XonoticProfileTab)
 entity makeXonoticProfileTab();
index 040908298976dd5784f3b7708ba6af6ae2d9e530..13e56afbb5bf751ce2436e4241d903c4ba0248c3 100644 (file)
@@ -6,5 +6,6 @@ CLASS(XonoticInputSettingsTab, XonoticTab)
        ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9);
        ATTRIB(XonoticInputSettingsTab, rows, float, 15.5);
        ATTRIB(XonoticInputSettingsTab, columns, float, 6.2);  // added extra .2 for center space
+       ATTRIB(XonoticInputSettingsTab, name, string, "inputsettings");
 ENDCLASS(XonoticInputSettingsTab)
 entity makeXonoticInputSettingsTab();
index d1bc88c46a6032d7ef9f80041f38b6972eb7b090..e1956b394636d02c341511c90fcf8e21ae55dd05 100644 (file)
@@ -119,6 +119,7 @@ void KeyBinds_BuildList()
        KEYBIND_DEF("+use"                                  , _("drop key/flag, exit vehicle"));
        KEYBIND_DEF("kill"                                  , _("suicide / respawn"));
        KEYBIND_DEF("quickmenu"                             , _("quick menu"));
+       KEYBIND_DEF("menu_showgamemenudialog"               , _("game menu"));
        KEYBIND_EMPTY_LINE();
 
        KEYBIND_HEADER(_("User defined"));
index 2a100c5b45a5f173c53518e455d74d8c5a2c3954..17695dc09fdd486072caea2e4ed960f0be03b801 100644 (file)
@@ -245,6 +245,10 @@ void MainWindow_configureMainWindow(entity me)
 
 
        // miscellaneous dialogs
+       i = NEW(XonoticGameMenuDialog);
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
        i = NEW(XonoticTeamSelectDialog);
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);