From: Mario Date: Fri, 2 Dec 2022 02:19:40 +0000 (+1000) Subject: Hide null and hidden entries from the guide menu X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dfd057b1b769b0a9e98ffb9fa70acf5ee2636ca4;p=xonotic%2Fxonotic-data.pk3dir.git Hide null and hidden entries from the guide menu --- diff --git a/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh b/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh index bde634079..190ecb88e 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh +++ b/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh @@ -7,5 +7,8 @@ CLASS(BallStealer, PortoLaunch) /* impulse */ ATTRIB(BallStealer, impulse, int, 0); /* refname */ ATTRIB(BallStealer, netname, string, "ballstealer"); /* wepname */ ATTRIB(BallStealer, m_name, string, _("Ball Stealer")); +#ifdef MENUQC +/* hidden */ ATTRIB(BallStealer, m_hidden, bool, true); +#endif ENDCLASS(BallStealer) REGISTER_WEAPON(NEXBALL, NEW(BallStealer)); diff --git a/qcsrc/common/monsters/all.qh b/qcsrc/common/monsters/all.qh index dfcacdc60..ae3924c0d 100644 --- a/qcsrc/common/monsters/all.qh +++ b/qcsrc/common/monsters/all.qh @@ -10,5 +10,8 @@ REGISTRY_CHECK(Monsters) #include "monster.qh" -REGISTER_MONSTER(Null, NEW(Monster)); +CLASS(NullMonster, Monster) + ATTRIB(NullMonster, m_hidden, bool, true); +ENDCLASS(NullMonster) +REGISTER_MONSTER(Null, NEW(NullMonster)); REGISTRY_DEFINE_GET(Monsters, MON_Null) diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index a129c826a..3ae3f18a1 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -106,7 +106,10 @@ CLASS(Nade, Object) } ENDCLASS(Nade) -REGISTER_NADE(Null); +CLASS(NullNade, Nade) + ATTRIB(NullNade, m_hidden, bool, true); +ENDCLASS(NullNade) +REGISTER(Nades, NADE_TYPE, Null, m_id, NEW(NullNade)); REGISTRY_DEFINE_GET(Nades, NADE_TYPE_Null) Nade Nade_FromProjectile(int proj) diff --git a/qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qh b/qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qh index 3926bbe62..6269db3e4 100644 --- a/qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qh +++ b/qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qh @@ -9,5 +9,8 @@ CLASS(Superweapons, StatusEffects) #ifdef GAMEQC ATTRIB(Superweapons, m_sound_rm, Sound, SND_POWEROFF); #endif +#ifdef MENUQC + ATTRIB(Superweapons, m_hidden, bool, true); +#endif ENDCLASS(Superweapons) REGISTER_STATUSEFFECT(Superweapons, NEW(Superweapons)); diff --git a/qcsrc/common/turrets/all.qh b/qcsrc/common/turrets/all.qh index 5bebc285d..5e1ac8bd6 100644 --- a/qcsrc/common/turrets/all.qh +++ b/qcsrc/common/turrets/all.qh @@ -118,7 +118,10 @@ const int TUR_FIRST = 1; #define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst) -REGISTER_TURRET(Null, NEW(Turret)); +CLASS(NullTurret, Turret) + ATTRIB(NullTurret, m_hidden, bool, true); +ENDCLASS(NullTurret) +REGISTER_TURRET(Null, NEW(NullTurret)); REGISTRY_DEFINE_GET(Turrets, TUR_Null) #include "turret/_mod.qh" diff --git a/qcsrc/common/vehicles/all.qh b/qcsrc/common/vehicles/all.qh index 2e4a2be50..25c988503 100644 --- a/qcsrc/common/vehicles/all.qh +++ b/qcsrc/common/vehicles/all.qh @@ -17,7 +17,10 @@ const int VEH_FIRST = 1; #include "cl_vehicles.qh" #endif -REGISTER_VEHICLE(Null, NEW(Vehicle)); +CLASS(NullVehicle, Vehicle) + ATTRIB(NullVehicle, m_hidden, bool, true); +ENDCLASS(NullVehicle) +REGISTER_VEHICLE(Null, NEW(NullVehicle)); REGISTRY_DEFINE_GET(Vehicles, VEH_Null) #include "vehicle/_mod.qh" diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index acf436659..f614f093f 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -128,7 +128,10 @@ STATIC_INIT_LATE(W_PROP_reloader) REGISTER_WEAPON_2(id, inst); \ [[alias("WEP_" #id)]] Weapon _wep_##sname -REGISTER_WEAPON(Null, NEW(Weapon)); +CLASS(NullWeapon, Weapon) + ATTRIB(NullWeapon, m_hidden, bool, true); +ENDCLASS(NullWeapon) +REGISTER_WEAPON(Null, NEW(NullWeapon)); REGISTRY_DEFINE_GET(Weapons, WEP_Null) Weapon Weapon_from_name(string s) @@ -333,6 +336,9 @@ STATIC_INIT(register_weapons_done) #ifdef CSQC FOREACH(Weapons, true, it.wr_init(it)); #endif + #ifdef MENUQC + FOREACH(Weapons, (it.spawnflags & WEP_FLAG_HIDDEN) && (it.spawnflags & WEP_FLAG_SPECIALATTACK), it.m_hidden = true); // TODO: should "hidden" weapons like the tuba actually be hidden? + #endif weaponorder_byid = ""; for (int i = REGISTRY_MAX(Weapons) - 1; i >= 1; --i) if (REGISTRY_GET(Weapons, i)) diff --git a/qcsrc/menu/xonotic/guide/tab.qh b/qcsrc/menu/xonotic/guide/tab.qh index 7aeaf7db0..d2603fa2f 100644 --- a/qcsrc/menu/xonotic/guide/tab.qh +++ b/qcsrc/menu/xonotic/guide/tab.qh @@ -80,13 +80,23 @@ CLASS(DebugSource, DataSource) ENDCLASS(DebugSource) #define REGISTRY_SOURCE(id, arr) \ +ArrayList arr##_MENU; \ +int arr##_MENU_COUNT; \ +STATIC_INIT_LATE(arr##_MENU) \ +{ \ + AL_NEW(arr##_MENU, arr##_MAX, NULL, e); \ + FOREACH(arr, !it.m_hidden, { \ + AL_sete(arr##_MENU, arr##_MENU_COUNT, it); \ + arr##_MENU_COUNT++; \ + }); \ +} \ CLASS(id, DataSource) \ METHOD(id, getEntry, entity(id this, int i, void(string, string) returns)) { \ - entity e = _R_GET(_##arr, i); \ + entity e = AL_gete(arr##_MENU, i); \ if (returns) e.display(e, returns); \ return e; \ } \ - METHOD(id, reload, int(id this, string filter)) { return arr##_COUNT; } \ + METHOD(id, reload, int(id this, string filter)) { return arr##_MENU_COUNT; } \ ENDCLASS(id) #include "pages.qh"