From 947f96fc9356f146b315c106d64dd46e95e0b195 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 3 Oct 2015 20:51:18 +1000 Subject: [PATCH] Guide: add a free text section --- qcsrc/menu/classes.inc | 7 ++-- .../description.qc} | 2 +- .../entries.qc} | 4 +-- qcsrc/menu/xonotic/guide/pages.qh | 32 +++++++++++++++++++ .../{dialog_media_guide.qc => guide/tab.qc} | 32 +++++++++++-------- .../topics.qc} | 4 +-- 6 files changed, 59 insertions(+), 22 deletions(-) rename qcsrc/menu/xonotic/{dialog_media_guide_description.qc => guide/description.qc} (98%) rename qcsrc/menu/xonotic/{dialog_media_guide_entries.qc => guide/entries.qc} (99%) create mode 100644 qcsrc/menu/xonotic/guide/pages.qh rename qcsrc/menu/xonotic/{dialog_media_guide.qc => guide/tab.qc} (92%) rename qcsrc/menu/xonotic/{dialog_media_guide_topics.qc => guide/topics.qc} (98%) diff --git a/qcsrc/menu/classes.inc b/qcsrc/menu/classes.inc index 44a15d676a..c5d60b170d 100644 --- a/qcsrc/menu/classes.inc +++ b/qcsrc/menu/classes.inc @@ -62,9 +62,6 @@ #include "xonotic/dialog_hudpanel_vote.qc" #include "xonotic/dialog_hudpanel_weapons.qc" #include "xonotic/dialog_hudsetup_exit.qc" -#include "xonotic/dialog_media_guide.qc" -#include "xonotic/dialog_media_guide_entries.qc" -#include "xonotic/dialog_media_guide_topics.qc" #include "xonotic/dialog_monstertools.qc" #include "xonotic/dialog_multiplayer.qc" #include "xonotic/dialog_multiplayer_create.qc" @@ -105,6 +102,10 @@ #include "xonotic/dialog_singleplayer_winner.qc" #include "xonotic/dialog_teamselect.qc" #include "xonotic/gametypelist.qc" +#include "xonotic/guide/description.qc" +#include "xonotic/guide/entries.qc" +#include "xonotic/guide/tab.qc" +#include "xonotic/guide/topics.qc" #include "xonotic/image.qc" #include "xonotic/inputbox.qc" #include "xonotic/keybinder.qc" diff --git a/qcsrc/menu/xonotic/dialog_media_guide_description.qc b/qcsrc/menu/xonotic/guide/description.qc similarity index 98% rename from qcsrc/menu/xonotic/dialog_media_guide_description.qc rename to qcsrc/menu/xonotic/guide/description.qc index cb94cfa53a..5df9d2e18a 100644 --- a/qcsrc/menu/xonotic/dialog_media_guide_description.qc +++ b/qcsrc/menu/xonotic/guide/description.qc @@ -1,6 +1,6 @@ #ifndef DIALOG_MEDIA_GUIDE_DESCRIPTION_H #define DIALOG_MEDIA_GUIDE_DESCRIPTION_H -#include "credits.qc" +#include "../listbox.qc" CLASS(XonoticGuideDescription, XonoticListBox) ATTRIB(XonoticGuideDescription, rowsPerItem, float, 1) ATTRIB(XonoticGuideDescription, selectionDoesntMatter, bool, true) diff --git a/qcsrc/menu/xonotic/dialog_media_guide_entries.qc b/qcsrc/menu/xonotic/guide/entries.qc similarity index 99% rename from qcsrc/menu/xonotic/dialog_media_guide_entries.qc rename to qcsrc/menu/xonotic/guide/entries.qc index 3a091c4630..f94b56027f 100644 --- a/qcsrc/menu/xonotic/dialog_media_guide_entries.qc +++ b/qcsrc/menu/xonotic/guide/entries.qc @@ -1,7 +1,7 @@ #ifndef DIALOG_MEDIA_GUIDE_ENTRIES_H #define DIALOG_MEDIA_GUIDE_ENTRIES_H -#include "datasource.qc" -#include "listbox.qc" +#include "../datasource.qc" +#include "../listbox.qc" CLASS(XonoticEntryList, XonoticListBox) ATTRIB(XonoticEntryList, alphaBG, float, 0) ATTRIB(XonoticEntryList, itemAbsSize, vector, '0 0 0') diff --git a/qcsrc/menu/xonotic/guide/pages.qh b/qcsrc/menu/xonotic/guide/pages.qh new file mode 100644 index 0000000000..86150af5ff --- /dev/null +++ b/qcsrc/menu/xonotic/guide/pages.qh @@ -0,0 +1,32 @@ +#ifndef GUIDE_PAGES_H +#define GUIDE_PAGES_H + +CLASS(GuidePage, Object); + ATTRIB(GuidePage, m_id, int, 0); + ATTRIB(GuidePage, m_title, string, ""); + ATTRIB(GuidePage, m_description, string, ""); + METHOD(GuidePage, describe, string(GuidePage this)) { + return this.m_description; + } + METHOD(GuidePage, display, void(GuidePage this, void(string name, string icon) returns)) { + returns(this.m_title, "nopreview_map"); + } + CONSTRUCTOR(GuidePage, string _title) { + CONSTRUCT(GuidePage); + this.m_title = _title; + } +ENDCLASS(GuidePage) + +void RegisterGuidePages(); +const int GUIDE_PAGES_MAX = 16; +entity GUIDE_PAGES[GUIDE_PAGES_MAX], GUIDE_PAGES_first, GUIDE_PAGES_last; +int GUIDE_PAGES_COUNT; +#define REGISTER_GUIDE_PAGE(id, title) \ + REGISTER(RegisterGuidePages, GUIDE_PAGE, GUIDE_PAGES, GUIDE_PAGES_COUNT, id, m_id, NEW(GuidePage, title)) +REGISTER_REGISTRY(RegisterGuidePages) + +REGISTER_GUIDE_PAGE(0, _("Intro")) { this.m_description = _( +"Welcome to xonotic" +);} + +#endif diff --git a/qcsrc/menu/xonotic/dialog_media_guide.qc b/qcsrc/menu/xonotic/guide/tab.qc similarity index 92% rename from qcsrc/menu/xonotic/dialog_media_guide.qc rename to qcsrc/menu/xonotic/guide/tab.qc index e4f028e697..209abc80fe 100644 --- a/qcsrc/menu/xonotic/dialog_media_guide.qc +++ b/qcsrc/menu/xonotic/guide/tab.qc @@ -1,8 +1,9 @@ #ifndef DIALOG_MEDIA_GUIDE_H #define DIALOG_MEDIA_GUIDE_H -#include "datasource.qc" +#include "../datasource.qc" #define TOPICS(X) \ + X(NEW(FreetextSource), _("Guide"), "gametype_tdm") \ X(NEW(GametypeSource), _("Gametypes"), "gametype_dm") \ X(NEW(WeaponSource), _("Weapons"), "gametype_ka") \ X(NEW(ItemSource), _("Items"), "gametype_kh") \ @@ -86,31 +87,34 @@ CLASS(id, DataSource) \ METHOD(id, reload, int(id this, string filter)) { return count; } \ ENDCLASS(id) -#include "../../common/mapinfo.qh" +#include "pages.qh" +REGISTRY_SOURCE(FreetextSource, GUIDE_PAGES, GUIDE_PAGES_COUNT) + +#include "../../../common/mapinfo.qh" REGISTRY_SOURCE(GametypeSource, MAPINFO_TYPES, MAPINFO_TYPE_COUNT) -#include "../../common/items/all.qh" +#include "../../../common/items/all.qh" REGISTRY_SOURCE(ItemSource, ITEMS, ITEM_COUNT) -#include "../../common/buffs.qh" +#include "../../../common/buffs.qh" REGISTRY_SOURCE(BuffSource, BUFFS, BUFFS_COUNT) -#include "../../common/nades.qh" +#include "../../../common/nades.qh" REGISTRY_SOURCE(NadeSource, NADES, NADES_COUNT) -#include "../../common/weapons/all.qh" +#include "../../../common/weapons/all.qh" REGISTRY_SOURCE(WeaponSource, weapon_info, WEP_COUNT) -#include "../../common/monsters/all.qh" +#include "../../../common/monsters/all.qh" REGISTRY_SOURCE(MonsterSource, monster_info, MON_COUNT) -#include "../../common/vehicles/all.qh" +#include "../../../common/vehicles/all.qh" REGISTRY_SOURCE(VehicleSource, vehicle_info, VEH_COUNT) -#include "../../common/turrets/all.qh" +#include "../../../common/turrets/all.qh" REGISTRY_SOURCE(TurretSource, turret_info, TUR_COUNT) -#include "../../common/mutators/base.qh" +#include "../../../common/mutators/base.qh" REGISTRY_SOURCE(MutatorSource, MUTATORS, MUTATORS_COUNT) CLASS(MapSource, DataSource) @@ -134,10 +138,10 @@ CLASS(MapSource, DataSource) METHOD(MapSource, destroy, void(MapSource this)) { MapInfo_Shutdown(); } ENDCLASS(MapSource) -#include "dialog_media_guide_topics.qc" -#include "dialog_media_guide_entries.qc" -#include "dialog_media_guide_description.qc" -#include "tab.qc" +#include "topics.qc" +#include "entries.qc" +#include "description.qc" +#include "../tab.qc" CLASS(XonoticGuideTab, XonoticTab) ATTRIB(XonoticGuideTab, rows, float, 21) ATTRIB(XonoticGuideTab, columns, float, 6) diff --git a/qcsrc/menu/xonotic/dialog_media_guide_topics.qc b/qcsrc/menu/xonotic/guide/topics.qc similarity index 98% rename from qcsrc/menu/xonotic/dialog_media_guide_topics.qc rename to qcsrc/menu/xonotic/guide/topics.qc index c5a1044e47..68d7f96fa5 100644 --- a/qcsrc/menu/xonotic/dialog_media_guide_topics.qc +++ b/qcsrc/menu/xonotic/guide/topics.qc @@ -1,7 +1,7 @@ #ifndef DIALOG_MEDIA_GUIDE_TOPICS_H #define DIALOG_MEDIA_GUIDE_TOPICS_H -#include "datasource.qc" -#include "listbox.qc" +#include "../datasource.qc" +#include "../listbox.qc" CLASS(XonoticTopicList, XonoticListBox) ATTRIB(XonoticTopicList, columnIconOrigin, float, 0) ATTRIB(XonoticTopicList, columnIconSize, float, 0) -- 2.39.2