From: terencehill Date: Mon, 28 Oct 2024 17:01:31 +0000 (+0100) Subject: Add a "Never ask again" checkbox to the Forfeit dialog X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d66d3b58afba5238c862fdcc63ad816c5a379c2b;p=xonotic%2Fxonotic-data.pk3dir.git Add a "Never ask again" checkbox to the Forfeit dialog --- diff --git a/binds-xonotic.cfg b/binds-xonotic.cfg index 73fa46d3e..7c9828515 100644 --- a/binds-xonotic.cfg +++ b/binds-xonotic.cfg @@ -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 diff --git a/commands.cfg b/commands.cfg index bca8dc0e1..bae77424f 100644 --- a/commands.cfg +++ b/commands.cfg @@ -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 ${* ?}" diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 6c73ddad7..a5c6e6940 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -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; diff --git a/qcsrc/menu/xonotic/dialog_forfeit.qc b/qcsrc/menu/xonotic/dialog_forfeit.qc index d80784f74..8b67ed63b 100644 --- a/qcsrc/menu/xonotic/dialog_forfeit.qc +++ b/qcsrc/menu/xonotic/dialog_forfeit.qc @@ -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"))); } diff --git a/qcsrc/menu/xonotic/dialog_forfeit.qh b/qcsrc/menu/xonotic/dialog_forfeit.qh index 55acbf6a3..efd8bb7da 100644 --- a/qcsrc/menu/xonotic/dialog_forfeit.qh +++ b/qcsrc/menu/xonotic/dialog_forfeit.qh @@ -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) diff --git a/qcsrc/menu/xonotic/keybinder.qc b/qcsrc/menu/xonotic/keybinder.qc index 1638fbb60..819b372d6 100644 --- a/qcsrc/menu/xonotic/keybinder.qc +++ b/qcsrc/menu/xonotic/keybinder.qc @@ -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)