From ebc7c790e46e3ca1fc2c4a5b35e5eb834640b274 Mon Sep 17 00:00:00 2001 From: otta8634 Date: Wed, 8 Jan 2025 01:07:11 +0800 Subject: [PATCH] Relocate the guide to Singleplayer Added a button for it alongside the 'Instant action' button. Converted it to a XonoticDialog from a XonoticTab, renamed the class to XonoticGuideDialog. Renamed the Singleplayer menu to Singleplayer / Guide. Slightly changed some Singleplayer menu strings. --- gfx/menu/luma/skinvalues.txt | 1 + gfx/menu/luminos/skinvalues.txt | 1 + gfx/menu/wickedx/skinvalues.txt | 1 + gfx/menu/xaw/skinvalues.txt | 1 + qcsrc/menu/skin-customizables.inc | 1 + .../menu/xonotic/dialog_multiplayer_media.qc | 2 -- .../menu/xonotic/dialog_multiplayer_media.qh | 2 +- .../xonotic/dialog_multiplayer_media_guide.qc | 11 +++---- .../xonotic/dialog_multiplayer_media_guide.qh | 32 +++++++++---------- qcsrc/menu/xonotic/dialog_singleplayer.qc | 8 +++-- qcsrc/menu/xonotic/dialog_singleplayer.qh | 4 +-- qcsrc/menu/xonotic/mainwindow.qc | 7 +++- qcsrc/menu/xonotic/mainwindow.qh | 1 + 13 files changed, 41 insertions(+), 31 deletions(-) diff --git a/gfx/menu/luma/skinvalues.txt b/gfx/menu/luma/skinvalues.txt index 1bf37b98b8..47e20a6c39 100644 --- a/gfx/menu/luma/skinvalues.txt +++ b/gfx/menu/luma/skinvalues.txt @@ -84,6 +84,7 @@ COLOR_DIALOG_QUIT '1 1 1' COLOR_DIALOG_ADVANCED '1 1 1' COLOR_DIALOG_MUTATORS '1 1 1' COLOR_DIALOG_MAPINFO '1 1 1' +COLOR_DIALOG_GUIDE '1 1 1' COLOR_DIALOG_USERBIND '1 1 1' COLOR_DIALOG_SINGLEPLAYER '1 1 1' COLOR_DIALOG_CREDITS '1 1 1' diff --git a/gfx/menu/luminos/skinvalues.txt b/gfx/menu/luminos/skinvalues.txt index d4fdef1cd5..e5928ad706 100755 --- a/gfx/menu/luminos/skinvalues.txt +++ b/gfx/menu/luminos/skinvalues.txt @@ -183,6 +183,7 @@ COLOR_DIALOG_QUIT '1 1 1' COLOR_DIALOG_ADVANCED '1 1 1' COLOR_DIALOG_MUTATORS '1 1 1' COLOR_DIALOG_MAPINFO '1 1 1' +COLOR_DIALOG_GUIDE '1 1 1' COLOR_DIALOG_USERBIND '1 1 1' COLOR_DIALOG_SINGLEPLAYER '1 1 1' COLOR_DIALOG_CREDITS '1 1 1' diff --git a/gfx/menu/wickedx/skinvalues.txt b/gfx/menu/wickedx/skinvalues.txt index ca5e303dac..5441d1300f 100644 --- a/gfx/menu/wickedx/skinvalues.txt +++ b/gfx/menu/wickedx/skinvalues.txt @@ -183,6 +183,7 @@ COLOR_DIALOG_QUIT '1 1 1' COLOR_DIALOG_ADVANCED '1 1 1' COLOR_DIALOG_MUTATORS '1 1 1' COLOR_DIALOG_MAPINFO '1 1 1' +COLOR_DIALOG_GUIDE '1 1 1' COLOR_DIALOG_USERBIND '1 1 1' COLOR_DIALOG_SINGLEPLAYER '1 1 1' COLOR_DIALOG_CREDITS '1 1 1' diff --git a/gfx/menu/xaw/skinvalues.txt b/gfx/menu/xaw/skinvalues.txt index aa4350cc56..bf4f68270e 100644 --- a/gfx/menu/xaw/skinvalues.txt +++ b/gfx/menu/xaw/skinvalues.txt @@ -27,6 +27,7 @@ COLOR_DIALOG_QUIT '1 0 0' COLOR_DIALOG_ADVANCED '1 1 1' COLOR_DIALOG_MUTATORS '1 1 1' COLOR_DIALOG_MAPINFO '1 1 1' +COLOR_DIALOG_GUIDE '1 1 1' COLOR_DIALOG_USERBIND '1 1 1' COLOR_DIALOG_SINGLEPLAYER '1 1 1' COLOR_DIALOG_CREDITS '1 1 1' diff --git a/qcsrc/menu/skin-customizables.inc b/qcsrc/menu/skin-customizables.inc index 15bd5356b8..cbc7e27427 100644 --- a/qcsrc/menu/skin-customizables.inc +++ b/qcsrc/menu/skin-customizables.inc @@ -61,6 +61,7 @@ SKINBEGIN SKINVECTOR(COLOR_DIALOG_ADVANCED, '0.7 0.7 1'); SKINVECTOR(COLOR_DIALOG_MUTATORS, '0.7 0.7 1'); SKINVECTOR(COLOR_DIALOG_MAPINFO, '0.7 0.7 1'); + SKINVECTOR(COLOR_DIALOG_GUIDE, '0.7 0.7 1'); SKINVECTOR(COLOR_DIALOG_USERBIND, '0.7 0.7 1'); SKINVECTOR(COLOR_DIALOG_SINGLEPLAYER, '1 1 0.7'); SKINVECTOR(COLOR_DIALOG_CREDITS, '0.7 0.7 1'); diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media.qc index 3203e3ec59..bc379d3b93 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_media.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_media.qc @@ -1,7 +1,6 @@ #include "dialog_multiplayer_media.qh" #include "demolist.qh" -#include "dialog_multiplayer_media_guide.qh" #include "dialog_multiplayer_media_demo.qh" #include "dialog_multiplayer_media_screenshot.qh" #include "dialog_multiplayer_media_musicplayer.qh" @@ -23,7 +22,6 @@ void XonoticMediaTab_fill(entity me) mc = makeXonoticTabController(me.rows - 2); me.gotoRC(me, 0.5, 0); - me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Guide"), NEW(XonoticGuideTab))); me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Demos"), makeXonoticDemoBrowserTab())); me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Screenshots"), makeXonoticScreenshotBrowserTab())); me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Music Player"), makeXonoticMusicPlayerTab())); diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media.qh index 0c44551110..9713e82c2d 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_media.qh +++ b/qcsrc/menu/xonotic/dialog_multiplayer_media.qh @@ -5,7 +5,7 @@ CLASS(XonoticMediaTab, XonoticTab) METHOD(XonoticMediaTab, fill, void(entity)); ATTRIB(XonoticMediaTab, intendedWidth, float, 0.9); ATTRIB(XonoticMediaTab, rows, float, 23); - ATTRIB(XonoticMediaTab, columns, float, 4); + ATTRIB(XonoticMediaTab, columns, float, 3); ATTRIB(XonoticMediaTab, name, string, "Media"); ENDCLASS(XonoticMediaTab) entity makeXonoticMediaTab(); diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qc index 74f9fe4791..ebf24543fe 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qc @@ -4,7 +4,7 @@ #include "textlabel.qh" #include -void XonoticGuideTab_fill(entity me) +void XonoticGuideDialog_fill(entity me) { entity e; @@ -13,7 +13,7 @@ void XonoticGuideTab_fill(entity me) me.TD(me, 1, width, makeXonoticHeaderLabel(_("Topic"))); me.TR(me); me.TD(me, me.rows - 1, width, e = me.topicList); - e.onChange = XonoticGuideTab_topicChangeNotify; + e.onChange = XonoticGuideDialog_topicChangeNotify; e.onChangeEntity = me; col += width, width = 2; @@ -21,7 +21,7 @@ void XonoticGuideTab_fill(entity me) me.TD(me, 1, width, makeXonoticHeaderLabel(_("Entry"))); me.TR(me); me.TD(me, me.rows - 1 - 1, width, e = me.entryList); - e.onChange = XonoticGuideTab_entryChangeNotify; + e.onChange = XonoticGuideDialog_entryChangeNotify; e.onChangeEntity = me; me.gotoRC(me, me.rows - 1, col); me.entryList.stringFilterBox = makeXonoticInputBox_T(false, string_null, @@ -41,7 +41,7 @@ void XonoticGuideTab_fill(entity me) me.topicChangeNotify(me.topicList, me); } -void XonoticGuideTab_topicChangeNotify(entity, entity me) +void XonoticGuideDialog_topicChangeNotify(entity, entity me) { entity topics = me.topicList; entity entries = me.entryList; @@ -63,8 +63,7 @@ void XonoticGuideTab_topicChangeNotify(entity, entity me) entries.refilter(entries); entries.setSelected(entries, 0); } - -void XonoticGuideTab_entryChangeNotify(entity, entity me) +void XonoticGuideDialog_entryChangeNotify(entity, entity me) { entity desc = me.descriptionPane; entity entries = me.entryList; diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qh index e630e5c8ac..311935c581 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qh +++ b/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qh @@ -2,21 +2,19 @@ #include -#include "tab.qh" -CLASS(XonoticGuideTab, XonoticTab) - ATTRIB(XonoticGuideTab, rows, float, 21); - ATTRIB(XonoticGuideTab, columns, float, 6); - ATTRIB(XonoticGuideTab, intendedWidth, float, 1); - METHOD(XonoticGuideTab, fill, void(entity)); - METHOD(XonoticGuideTab, topicChangeNotify, void(entity, entity)); - METHOD(XonoticGuideTab, entryChangeNotify, void(entity, entity)); +#include "dialog.qh" +CLASS(XonoticGuideDialog, XonoticDialog) + ATTRIB(XonoticGuideDialog, title, string, _("Guide")); + ATTRIB(XonoticGuideDialog, name, string, "guide"); + ATTRIB(XonoticGuideDialog, color, vector, SKINCOLOR_DIALOG_GUIDE); + ATTRIB(XonoticGuideDialog, rows, float, 21); + ATTRIB(XonoticGuideDialog, columns, float, 6); + ATTRIB(XonoticGuideDialog, intendedWidth, float, 0.9); + METHOD(XonoticGuideDialog, fill, void(entity)); + METHOD(XonoticGuideDialog, topicChangeNotify, void(entity, entity)); + METHOD(XonoticGuideDialog, entryChangeNotify, void(entity, entity)); - ATTRIB(XonoticGuideTab, controlledTextbox, entity); - ATTRIB(XonoticGuideTab, topicList, entity, NEW(XonoticTopicList, NEW(TopicSource))); - ATTRIB(XonoticGuideTab, entryList, entity, NEW(XonoticEntryList, NULL)); - ATTRIB(XonoticGuideTab, descriptionPane, entity, NEW(XonoticGuideDescription)); - - INIT(XonoticGuideTab) { - this.configureDialog(this); - } -ENDCLASS(XonoticGuideTab) + ATTRIB(XonoticGuideDialog, topicList, entity, NEW(XonoticTopicList, NEW(TopicSource))); + ATTRIB(XonoticGuideDialog, entryList, entity, NEW(XonoticEntryList, NULL)); + ATTRIB(XonoticGuideDialog, descriptionPane, entity, NEW(XonoticGuideDescription)); +ENDCLASS(XonoticGuideDialog) diff --git a/qcsrc/menu/xonotic/dialog_singleplayer.qc b/qcsrc/menu/xonotic/dialog_singleplayer.qc index ded656605c..69de8c089b 100644 --- a/qcsrc/menu/xonotic/dialog_singleplayer.qc +++ b/qcsrc/menu/xonotic/dialog_singleplayer.qc @@ -6,6 +6,7 @@ #include "leavematchbutton.qh" #include "radiobutton.qh" #include "textlabel.qh" +#include "mainwindow.qh" #include "campaign.qh" void InstantAction_LoadMap(entity btn, entity dummy) @@ -145,10 +146,13 @@ void XonoticSingleplayerDialog_fill(entity me) entity e, btnPrev, btnNext, lblTitle; me.TR(me); - me.TDempty(me, (me.columns - 3) / 2); - me.TD(me, 2, 3, e = makeXonoticBigButton(_("Instant action! (random map with bots)"), '0 0 0')); + me.TDempty(me, (me.columns / 2) - 2); + me.TD(me, 2, 2, e = makeXonoticBigButton(_("Instant action with bots!"), '0 0 0')); e.onClick = InstantAction_LoadMap; e.onClickEntity = NULL; + me.TD(me, 2, 2, e = makeXonoticBigButton(_("Guide"), '0 0 0')); + e.onClick = DialogOpenButton_Click; + e.onClickEntity = main.guideDialog; me.TR(me); me.TR(me); me.TR(me); diff --git a/qcsrc/menu/xonotic/dialog_singleplayer.qh b/qcsrc/menu/xonotic/dialog_singleplayer.qh index c7691fbba4..a7a5bca8a0 100644 --- a/qcsrc/menu/xonotic/dialog_singleplayer.qh +++ b/qcsrc/menu/xonotic/dialog_singleplayer.qh @@ -3,8 +3,8 @@ #include "dialog.qh" CLASS(XonoticSingleplayerDialog, XonoticDialog) METHOD(XonoticSingleplayerDialog, fill, void(entity)); - ATTRIB(XonoticSingleplayerDialog, title, string, _("Singleplayer")); - ATTRIB(XonoticSingleplayerDialog, tooltip, string, _("Play the singleplayer campaign or instant action matches against bots")); + ATTRIB(XonoticSingleplayerDialog, title, string, _("Singleplayer / Guide")); + ATTRIB(XonoticSingleplayerDialog, tooltip, string, _("Play the singleplayer campaign or instant action matches against bots, or read the guide")); ATTRIB(XonoticSingleplayerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER); ATTRIB(XonoticSingleplayerDialog, intendedWidth, float, 0.80); ATTRIB(XonoticSingleplayerDialog, rows, float, 24); diff --git a/qcsrc/menu/xonotic/mainwindow.qc b/qcsrc/menu/xonotic/mainwindow.qc index 039d3452fd..7ebd9d3ebd 100644 --- a/qcsrc/menu/xonotic/mainwindow.qc +++ b/qcsrc/menu/xonotic/mainwindow.qc @@ -37,6 +37,7 @@ #include "dialog_settings_game_hudconfirm.qh" #include "dialog_singleplayer_winner.qh" #include "dialog_multiplayer_join_serverinfo.qh" +#include "dialog_multiplayer_media_guide.qh" #include "dialog_multiplayer_media_demo_startconfirm.qh" #include "dialog_multiplayer_media_demo_timeconfirm.qh" #include "dialog_multiplayer_media_screenshot_viewer.qh" @@ -213,11 +214,15 @@ void MainWindow_configureMainWindow(entity me) me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); - // dialog used by singleplayer + // dialog used by singleplayer / guide me.winnerDialog = i = NEW(XonoticWinnerDialog); i.configureDialog(i); me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + me.guideDialog = i = NEW(XonoticGuideDialog); + i.configureDialog(i); + me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + // dialog used by multiplayer/join me.serverInfoDialog = i = NEW(XonoticServerInfoDialog); diff --git a/qcsrc/menu/xonotic/mainwindow.qh b/qcsrc/menu/xonotic/mainwindow.qh index 24adc37017..7b0b86c2a1 100644 --- a/qcsrc/menu/xonotic/mainwindow.qh +++ b/qcsrc/menu/xonotic/mainwindow.qh @@ -10,6 +10,7 @@ CLASS(MainWindow, ModalController) ATTRIB(MainWindow, advancedDialog, entity); ATTRIB(MainWindow, mutatorsDialog, entity); ATTRIB(MainWindow, mapInfoDialog, entity); + ATTRIB(MainWindow, guideDialog, entity); ATTRIB(MainWindow, userbindEditDialog, entity); ATTRIB(MainWindow, bindingsResetDialog, entity); ATTRIB(MainWindow, winnerDialog, entity); -- 2.39.5