]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a "Never ask again" checkbox to the Forfeit dialog
authorterencehill <piuntn@gmail.com>
Mon, 28 Oct 2024 17:01:31 +0000 (18:01 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 28 Oct 2024 17:39:21 +0000 (18:39 +0100)
binds-xonotic.cfg
commands.cfg
qcsrc/client/hud/panel/infomessages.qc
qcsrc/menu/xonotic/dialog_forfeit.qc
qcsrc/menu/xonotic/dialog_forfeit.qh
qcsrc/menu/xonotic/keybinder.qc

index 73fa46d3ec226864e1d69d5c399328bb518ee12d..7c98285150a47c4ed3659ad7bf61d8bdbe8ec6e9 100644 (file)
@@ -55,7 +55,7 @@ bind PAUSE pause
 // function keys
 bind F1 vyes
 bind F2 vno
-bind F3 spec_ask_forfeit
+bind F3 spec_forfeit
 bind F4 ready
 bind F5 team_selection_show
 bind F6 team_auto
index bca8dc0e111b05f93226cfbfce8a865d46fe656c..bae77424fff58f426074aba8f671ae52471fb6ec 100644 (file)
@@ -212,12 +212,16 @@ alias team_yellow "cmd selectteam yellow; cmd join"
 alias team_auto "togglemenu 0; cmd selectteam auto; cmd join"
 
 
-// Xonotic 0.9.0 update: menu will change any spec bind to spec_ask_forfeit (and set this cvar to 1)
+// Xonotic 0.9.0 update: menu will change any spec bind to spec_forfeit (and set this cvar to 1)
 // TODO remove menu code and this cvar in a later Xonotic version
-seta _spec_ask_forfeit_bindupdate 0
+seta _spec_forfeit_bindupdate 0
+
+seta menu_ask_forfeit 1 "ask for forfeit confirmation"
+alias spec_forfeit0 "spectate"
+alias spec_forfeit1 "spectate \"\" ASK_FORFEIT"
+alias spec_forfeit "spec_ask_forfeit${menu_ask_forfeit}"
 
 alias spec "spectate ${* ?}"
-alias spec_ask_forfeit "spectate \"\" ASK_FORFEIT"
 
 // mutator aliases
 alias sandbox "cmd g_sandbox ${* ?}"
index 6c73ddad7db9c0f61f599e84c93b50a96fcc75fe..a5c6e69406bab86fb74cd3d573317bb169b7e929 100644 (file)
@@ -112,7 +112,7 @@ void HUD_InfoMessages()
                                                if(spectatee_status == -1)
                                                        s = sprintf(_("^1Use ^3%s^1 or ^3%s^1 to change the speed"), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev"));
                                                else if(!observe_blocked)
-                                                       s = sprintf(_("^1Press ^3%s^1 to observe, ^3%s^1 to change camera mode"), getcommandkey(_("observe"), "spec"), getcommandkey(_("drop weapon"), "dropweapon"));
+                                                       s = sprintf(_("^1Press ^3%s^1 to observe, ^3%s^1 to change camera mode"), getcommandkey(_("observe / forfeit"), "spec_forfeit"), getcommandkey(_("drop weapon"), "dropweapon"));
                                                else
                                                        s = sprintf(_("^1Press ^3%s^1 to change camera mode"), getcommandkey(_("drop weapon"), "dropweapon"));
                                                break;
index d80784f749b1f212d6cce96bfef4142d9add1318..8b67ed63b461a16410f057d12b75a822fda52eca 100644 (file)
@@ -1,6 +1,7 @@
 #include "dialog_forfeit.qh"
 
 #include "button.qh"
+#include "checkbox.qh"
 #include "commandbutton.qh"
 #include "textlabel.qh"
 
@@ -23,4 +24,7 @@ void XonoticForfeitDialog_fill(entity me)
                me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticCheckBox(1, "menu_ask_forfeit", _("Never ask again")));
 }
index 55acbf6a3919735989f72d145c3d8a671714508a..efd8bb7dafcd7152f475fd1722411c4c5a14742a 100644 (file)
@@ -6,7 +6,7 @@ CLASS(XonoticForfeitDialog, XonoticRootDialog)
        ATTRIB(XonoticForfeitDialog, title, string, _("Forfeit"));
        ATTRIB(XonoticForfeitDialog, name, string, "Forfeit");
        ATTRIB(XonoticForfeitDialog, color, vector, SKINCOLOR_DIALOG_QUIT);
-       ATTRIB(XonoticForfeitDialog, intendedWidth, float, 0.5);
-       ATTRIB(XonoticForfeitDialog, rows, float, 3);
+       ATTRIB(XonoticForfeitDialog, intendedWidth, float, 0.6);
+       ATTRIB(XonoticForfeitDialog, rows, float, 5);
        ATTRIB(XonoticForfeitDialog, columns, float, 2);
 ENDCLASS(XonoticForfeitDialog)
index 1638fbb60c8ba8e70829fd4bb0299043dfb95eca..819b372d64ad4294b86e8309012430519c9db2f0 100644 (file)
@@ -115,7 +115,7 @@ void KeyBinds_BuildList()
        KEYBIND_HEADER(_("Teamplay"));
        KEYBIND_DEF("team_auto"                             , _("auto-join team"));
        KEYBIND_DEF("team_selection_show"                   , _("team selection"));
-       KEYBIND_DEF("spec_ask_forfeit"                      , _("observe"));
+       KEYBIND_DEF("spec_forfeit"                          , _("observe / forfeit"));
        KEYBIND_EMPTY_LINE();
 
        KEYBIND_HEADER(_("Misc"));
@@ -181,10 +181,10 @@ void XonoticKeyBinder_configureXonoticKeyBinder(entity me)
 
        // Xonotic 0.9.0 update
        // TODO remove cvar and this code in a later Xonotic version
-       if (!cvar("_spec_ask_forfeit_bindupdate"))
+       if (!cvar("_spec_forfeit_bindupdate"))
        {
-               replace_bind("spec", "spec_ask_forfeit");
-               cvar_set("_spec_ask_forfeit_bindupdate", "1");
+               replace_bind("spec", "spec_forfeit");
+               cvar_set("_spec_forfeit_bindupdate", "1");
        }
 }
 void XonoticKeyBinder_loadKeyBinds(entity me)