Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
guide.qh
Go to the documentation of this file.
1#pragma once
2
7
8#define TOPICS(X) \
9 X(NEW(IntroductionSource), _("Introduction"), "gametype_tdm") \
10 X(NEW(MovementSource), _("Movement"), "gametype_inv") \
11 X(NEW(GametypeSource), _("Gametypes"), "gametype_dm") \
12 X(NEW(WeaponSource), _("Weapons"), "gametype_duel") \
13 X(NEW(ItemSource), _("Items"), "gametype_kh") \
14 X(NEW(PowerupSource), _("Powerups"), "gametype_dom") \
15 X(NEW(BuffSource), _("Buffs"), "gametype_ka") \
16 X(NEW(NadeSource), _("Nades"), "gametype_ft") \
17 X(NEW(MonsterSource), _("Monsters"), "gametype_lms") \
18 X(NEW(VehicleSource), _("Vehicles"), "gametype_rc") \
19 X(NEW(TurretSource), _("Turrets"), "gametype_as") \
20 X(NEW(MutatorSource), _("Mutators"), "gametype_nb") \
21 X(NEW(ModSource), _("Mods"), "gametype_ons") \
22 /**/
23// XONRELEASE TODO: improve icons, consider just creating new ones from scratch just for the guide
25 METHOD(TopicSource, getEntry, entity(TopicSource this, int i, void(string, string) returns));
26 METHOD(TopicSource, reload, int(TopicSource this, string filter));
28
34
35#define _REGISTRY_SOURCE_FILL(arr_name, register_arr, cond1, cond2, cond3, num_conds, filter_cond) \
36if (num_conds >= 1) \
37 FOREACH(register_arr, !it.m_hidden && (cond1) && (filter_cond), { \
38 AL_sete(arr_name##_MENU, arr_name##_MENU_COUNT, it); \
39 ++arr_name##_MENU_COUNT; \
40 }); \
41if (num_conds >= 2) \
42 FOREACH(register_arr, !it.m_hidden && (cond2) && (filter_cond), { \
43 AL_sete(arr_name##_MENU, arr_name##_MENU_COUNT, it); \
44 ++arr_name##_MENU_COUNT; \
45 }); \
46if (num_conds >= 3) \
47 FOREACH(register_arr, !it.m_hidden && (cond3) && (filter_cond), { \
48 AL_sete(arr_name##_MENU, arr_name##_MENU_COUNT, it); \
49 ++arr_name##_MENU_COUNT; \
50 });
51
52#define _REGISTRY_SOURCE(id, arr_name, register_arr, cond1, cond2, cond3, num_conds) \
53ArrayList arr_name##_MENU; \
54int arr_name##_MENU_COUNT; \
55STATIC_INIT_LATE(arr_name##_MENU) \
56{ \
57 AL_NEW(arr_name##_MENU, REGISTRY_MAX(register_arr), NULL, e); \
58 _REGISTRY_SOURCE_FILL(arr_name, register_arr, cond1, cond2, cond3, num_conds, true); \
59} \
60CLASS(id, DataSource) \
61 METHOD(id, getEntry, entity(id this, int i, void(string, string) returns)) \
62 { \
63 entity e = AL_gete(arr_name##_MENU, i); \
64 if (returns) \
65 e.display(e, returns); \
66 return e; \
67 } \
68 METHOD(id, reload, int(id this, string filter)) \
69 { \
70 arr_name##_MENU_COUNT = 0; \
71 _REGISTRY_SOURCE_FILL(arr_name, register_arr, cond1, cond2, cond3, num_conds, \
72 (filter == "" ? true : (strstrofs(strtolower(it.message ? it.message : it.m_name), strtolower(filter), 0) >= 0))); \
73 return arr_name##_MENU_COUNT; \
74 } \
75ENDCLASS(id)
76
77#define REGISTRY_SOURCE(...) EVAL(OVERLOAD(REGISTRY_SOURCE, __VA_ARGS__))
78#define REGISTRY_SOURCE_3(id, arr_name, register_arr) _REGISTRY_SOURCE(id, arr_name, register_arr, true, false, false, 1)
79#define REGISTRY_SOURCE_4(id, arr_name, register_arr, cond1) _REGISTRY_SOURCE(id, arr_name, register_arr, cond1, false, false, 1)
80#define REGISTRY_SOURCE_5(id, arr_name, register_arr, cond1, cond2) _REGISTRY_SOURCE(id, arr_name, register_arr, cond1, cond2, false, 2)
81#define REGISTRY_SOURCE_6(id, arr_name, register_arr, cond1, cond2, cond3) _REGISTRY_SOURCE(id, arr_name, register_arr, cond1, cond2, cond3, 3)
82
83// The descriptions for these are in menu/xonotic/guide/pages.qc
84REGISTRY_SOURCE(IntroductionSource, Introduction, IntroductionGuidePages)
85REGISTRY_SOURCE(MovementSource, Movement, MovementGuidePages)
86REGISTRY_SOURCE(ModSource, Mods, ModsGuidePages)
87
88#include <common/mapinfo.qh>
89// The descriptions for these are in common/gametypes/gametype/*/*.qc
90REGISTRY_SOURCE(GametypeSource, Gametypes, Gametypes)
91
92#include <common/mutators/mutator/buffs/buffs.qh>
93// The descriptions for these are in common/mutators/mutator/buffs/buff/*.qc
94REGISTRY_SOURCE(BuffSource, Buffs, StatusEffects, it.instanceOfBuff)
95
96#include <common/mutators/mutator/powerups/powerup/_mod.qh>
97// The descriptions for these are in common/mutators/mutator/powerups/powerup/*.qc
98REGISTRY_SOURCE(PowerupSource, Powerups, Items, it.instanceOfPowerup)
99
100#include <common/items/all.qh>
101// The descriptions for these are in common/items/item/*.qc and common/mutators/mutator/instagib/items.qc
102REGISTRY_SOURCE(ItemSource, Items, Items,
103 !it.instanceOfPowerup && it.instanceOfAmmo,
104 !it.instanceOfPowerup && it.instanceOfHealth,
105 !it.instanceOfPowerup && it.instanceOfArmor)
106
107#include <common/mutators/mutator/nades/nades.qh>
108// The descriptions for these are in common/mutators/mutator/nades/nade/*.qc
109REGISTRY_SOURCE(NadeSource, Nades, Nades)
110
111#include <common/weapons/all.qh>
112// The descriptions for these are in common/weapons/weapon/*.qc and common/mutators/mutator/overkill/ok*.qc (weapon files)
114 !startsWith(it.registered_id, "WEP_OVERKILL_"),
115 startsWith(it.registered_id, "WEP_OVERKILL_") && !(it.spawnflags & WEP_FLAG_SUPERWEAPON),
116 startsWith(it.registered_id, "WEP_OVERKILL_") && (it.spawnflags & WEP_FLAG_SUPERWEAPON))
117
118#include <common/monsters/all.qh>
119// The descriptions for these are in common/monsters/monster/*.qc
120REGISTRY_SOURCE(MonsterSource, Monsters, Monsters)
121
122#include <common/vehicles/all.qh>
123// The descriptions for these are in common/vehicles/vehicle/*.qc
124// XONRELEASE TODO: improve icons to make the styling consistent, may need to create new ones from scratch just for the guide
125REGISTRY_SOURCE(VehicleSource, Vehicles, Vehicles)
126
127#include <common/turrets/all.qh>
128// The descriptions for these are in common/turrets/turret/*.qc
129REGISTRY_SOURCE(TurretSource, Turrets, Turrets)
130
131#include <common/mutators/base.qh>
132// The descriptions for these are in common/mutators/mutator/*.qc (not the cl_* or sv_* files)
133REGISTRY_SOURCE(MutatorSource, Mutators, Mutators)
virtual void getEntry()
get entry i passing name and icon through returns if it is not null returns DataSource_false if out o...
Definition guide.qc:3
virtual void reload()
reload all entries matching filter returning how many matches were found
Definition guide.qc:19
entity() spawn
Weapons
Definition guide.qh:113
bool instanceOfAmmo
Definition guide.qh:30
bool instanceOfPowerup
Definition guide.qh:33
#define REGISTRY_SOURCE(...)
Definition guide.qh:77
bool instanceOfHealth
Definition guide.qh:31
bool m_hidden
Definition guide.qh:29
bool instanceOfArmor
Definition guide.qh:32
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define startsWith(haystack, needle)
Definition string.qh:236
const int WEP_FLAG_SUPERWEAPON
Definition weapon.qh:218