From: Mario Date: Mon, 5 Aug 2024 22:27:09 +0000 (+0000) Subject: Add a show all checkbox to the Create menu to list previously hidden gametypes X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3fd2923e2968c41380bfe44e85d4a13bd59881c4;p=xonotic%2Fxonotic-data.pk3dir.git Add a show all checkbox to the Create menu to list previously hidden gametypes Also remove now unused mutator and weapon arena list label --- diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create.qc b/qcsrc/menu/xonotic/dialog_multiplayer_create.qc index a343c546c..2f417db42 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create.qc @@ -7,6 +7,7 @@ #include "maplist.qh" #include +#include "checkbox.qh" #include "image.qh" #include "textslider.qh" #include "textlabel.qh" @@ -77,7 +78,11 @@ void XonoticServerCreateTab_fill(entity me) me.TR(me); me.TD(me, 10.5, 3, e = makeXonoticGametypeList()); - me.gotoRC(me, 12.5, 0); + me.gotoRC(me, 12, 0); + me.TDempty(me, 0.1); + me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "menu_create_show_all", _("Show all"), + _("Show all available gametypes"))); + me.gotoRC(me, 13.5, 0); me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Time limit:"))); me.TD(me, 1, 2, e = makeXonoticTextSlider_T("timelimit_override", _("Timelimit in minutes that when hit, will end the match"))); @@ -107,7 +112,7 @@ void XonoticServerCreateTab_fill(entity me) me.TD(me, 1, 1, me.labelFraglimit = makeXonoticTextLabel(0, _("Frag limit:"))); me.TD(me, 1, 2, e = me.sliderFraglimit = makeXonoticTextSlider("fraglimit_override")); - me.gotoRC(me, 15, 0); + me.gotoRC(me, 16, 0); me.TD(me, 1, 1, me.labelTeams = makeXonoticTextLabel(0, _("Teams:"))); me.TD(me, 1, 2, e = me.sliderTeams = makeXonoticTextSlider(string_null)); e.addValue(e, _("Default"), "0"); @@ -144,13 +149,6 @@ void XonoticServerCreateTab_fill(entity me) e.configureXonoticTextSliderValues(e); setDependentAND(e, "bot_number", 0, -1, "g_campaign", 0, 0); - me.gotoRC(me, me.rows - 3.8, 0); - me.TD(me, 1, 3, e0 = makeXonoticTextLabel(0.5, string_null)); - e0.textEntity = main.mutatorsDialog; - e0.allowCut = 1; - //e0.allowWrap = 1; - setDependent(e0, "g_campaign", 0, 0); - // mapListBox is in the right column but the ref is needed for mutators dialog here me.mapListBox = makeXonoticMapList(); // here we use the following line instead of me.TR(me) for better visual spacing; diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc index 29a5c2f87..20f72863e 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc @@ -15,56 +15,6 @@ void XonoticMutatorsDialog_showNotify(entity me) loadAllCvars(me); } -string weaponarenastring; -string weaponarenastring_cvar; -string WeaponArenaString() -{ - string s; - float n; - s = cvar_string("g_weaponarena"); - if(s == "0" || s == "") return ""; - if(s == "all" || s == "1") return _("All Weapons Arena"); - if(s == "all_available") return _("All Available Weapons Arena"); - if(s == "most") return _("Most Weapons Arena"); - if(s == "most_available") return _("Most Available Weapons Arena"); - if(s == "devall") return "Dev All Weapons Arena"; // development option, do not translate - if(s == "devall_available") return "Dev All Available Weapons Arena"; // development option, do not translate - if(s == weaponarenastring_cvar) - return weaponarenastring; - - strcpy(weaponarenastring_cvar, s); - - n = tokenize_console(s); - s = ""; - for(int j = 0; j < n; ++j) - { - Weapon wep = Weapon_from_name(argv(j)); - if(wep != WEP_Null) - { - s = cons_mid(s, " & ", wep.m_name); - } - } - if (s != "") - s = sprintf(_("%s Arena"), s); - else - s = _("No Weapons Arena"); - - strcpy(weaponarenastring, s); - - return weaponarenastring; -} - -string XonoticMutatorsDialog_toString(entity me) -{ - string s = build_mutator_list(""); - if(cvar_string("g_weaponarena") != "0") - s = cons_mid(s, ", ", WeaponArenaString()); - if(s == "") - return ZCTX(_("MUT^None")); - else - return s; -} - float checkCompatibility_pinata(entity me) { if(cvar("g_instagib")) diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qh b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qh index 48ccc6b48..6722e1eac 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qh +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qh @@ -2,7 +2,6 @@ #include "dialog.qh" CLASS(XonoticMutatorsDialog, XonoticDialog) - METHOD(XonoticMutatorsDialog, toString, string(entity)); METHOD(XonoticMutatorsDialog, fill, void(entity)); METHOD(XonoticMutatorsDialog, showNotify, void(entity)); METHOD(XonoticMutatorsDialog, close, void(entity)); diff --git a/qcsrc/menu/xonotic/gametypelist.qh b/qcsrc/menu/xonotic/gametypelist.qh index bbc50aba4..9d112ae65 100644 --- a/qcsrc/menu/xonotic/gametypelist.qh +++ b/qcsrc/menu/xonotic/gametypelist.qh @@ -22,3 +22,5 @@ CLASS(XonoticGametypeList, XonoticListBox) ATTRIB(XonoticGametypeList, columnNameSize, float, 0); ENDCLASS(XonoticGametypeList) entity makeXonoticGametypeList(); + +bool autocvar_menu_create_show_all; diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index ac3c798a9..e3bb5085c 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -9,6 +9,7 @@ #include #include #include +#include float GL_CheckExtension(string ext) { @@ -696,11 +697,11 @@ Gametype GameType_GetID(int cnt) int GameType_GetCount() { int i = 0; - int dev = cvar("developer"); + bool showall = autocvar_menu_create_show_all; #define GAMETYPE(id) ++i; GAMETYPES #undef GAMETYPE - #define GAMETYPE(it) { if (dev > 0) ++i; } + #define GAMETYPE(it) { if (showall) ++i; } HIDDEN_GAMETYPES #undef GAMETYPE return i; diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 6500e727f..c73731cae 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -491,6 +491,7 @@ seta menu_tooltips 1 "menu tooltips: 0 disabled, 1 enabled, 2 also shows cvar or set menu_picmip_bypass 0 "bypass texture quality enforcement based on system resources, not recommended and may cause crashes!" set menu_showboxes 0 "show item bounding boxes (debug)" set menu_cvarlist_onlymodified 0 "show only modified cvars in the cvar list" +seta menu_create_show_all 0 "show most gametypes in the create menu" set menu_no_music_nor_welcome 0 "don't play the menu music and skip the welcome announcer"