From: terencehill Date: Sun, 13 Mar 2022 19:08:56 +0000 (+0100) Subject: Add a small Menu game dialog that can be opened with F11 X-Git-Tag: xonotic-v0.8.5~129^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7543e59f1fafaf3e6fcbe64baf58e0a94f0321a7;p=xonotic%2Fxonotic-data.pk3dir.git Add a small Menu game dialog that can be opened with F11 --- diff --git a/binds-xonotic.cfg b/binds-xonotic.cfg index 6dd5fe2cf..77d4147b7 100644 --- a/binds-xonotic.cfg +++ b/binds-xonotic.cfg @@ -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 diff --git a/commands.cfg b/commands.cfg index 68dc610c4..5f71f58af 100644 --- a/commands.cfg +++ b/commands.cfg @@ -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 diff --git a/qcsrc/menu/command/menu_cmd.qc b/qcsrc/menu/command/menu_cmd.qc index c4593e87a..8ba94a786 100644 --- a/qcsrc/menu/command/menu_cmd.qc +++ b/qcsrc/menu/command/menu_cmd.qc @@ -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"); diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index f374b0a10..4030270d3 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -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 { diff --git a/qcsrc/menu/xonotic/_mod.inc b/qcsrc/menu/xonotic/_mod.inc index 1bc511c9e..56d8e00c1 100644 --- a/qcsrc/menu/xonotic/_mod.inc +++ b/qcsrc/menu/xonotic/_mod.inc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/qcsrc/menu/xonotic/_mod.qh b/qcsrc/menu/xonotic/_mod.qh index e3ba15b9d..0b8f5c149 100644 --- a/qcsrc/menu/xonotic/_mod.qh +++ b/qcsrc/menu/xonotic/_mod.qh @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/qcsrc/menu/xonotic/dialog_gamemenu.qc b/qcsrc/menu/xonotic/dialog_gamemenu.qc new file mode 100644 index 000000000..5403c1e5f --- /dev/null +++ b/qcsrc/menu/xonotic/dialog_gamemenu.qc @@ -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 index 000000000..75ded66c5 --- /dev/null +++ b/qcsrc/menu/xonotic/dialog_gamemenu.qh @@ -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) diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_profile.qh b/qcsrc/menu/xonotic/dialog_multiplayer_profile.qh index 2285efcaf..f346aaf66 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_profile.qh +++ b/qcsrc/menu/xonotic/dialog_multiplayer_profile.qh @@ -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(); diff --git a/qcsrc/menu/xonotic/dialog_settings_input.qh b/qcsrc/menu/xonotic/dialog_settings_input.qh index 040908298..13e56afbb 100644 --- a/qcsrc/menu/xonotic/dialog_settings_input.qh +++ b/qcsrc/menu/xonotic/dialog_settings_input.qh @@ -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(); diff --git a/qcsrc/menu/xonotic/keybinder.qc b/qcsrc/menu/xonotic/keybinder.qc index d1bc88c46..e1956b394 100644 --- a/qcsrc/menu/xonotic/keybinder.qc +++ b/qcsrc/menu/xonotic/keybinder.qc @@ -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")); diff --git a/qcsrc/menu/xonotic/mainwindow.qc b/qcsrc/menu/xonotic/mainwindow.qc index 2a100c5b4..17695dc09 100644 --- a/qcsrc/menu/xonotic/mainwindow.qc +++ b/qcsrc/menu/xonotic/mainwindow.qc @@ -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);