]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Hide null and hidden entries from the guide menu
authorMario <mario.mario@y7mail.com>
Fri, 2 Dec 2022 02:19:40 +0000 (12:19 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 2 Dec 2022 02:19:40 +0000 (12:19 +1000)
qcsrc/common/gamemodes/gamemode/nexball/weapon.qh
qcsrc/common/monsters/all.qh
qcsrc/common/mutators/mutator/nades/nades.qh
qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qh
qcsrc/common/turrets/all.qh
qcsrc/common/vehicles/all.qh
qcsrc/common/weapons/all.qh
qcsrc/menu/xonotic/guide/tab.qh

index bde6340798bc057586660158a61df0a01a17f0de..190ecb88ef740a002a40cdfcf0c73a08a318da1a 100644 (file)
@@ -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));
index dfcacdc609b2da10aa47b4b1756be4d4dea6091e..ae3924c0d4677c470cce547ba9a03e38e26ba524 100644 (file)
@@ -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)
index a129c826aae651cd287e956a71dda72b6ab51298..3ae3f18a1d98f6c7c58bffcc242c5bf097f3594b 100644 (file)
@@ -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)
index 3926bbe62bad1d3439e1e7cc522b49ac711688e9..6269db3e4ab649c850b6fa2b5b7705b0daa983de 100644 (file)
@@ -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));
index 5bebc285db77fbcdc8c9fc5c75686601a3911ac0..5e1ac8bd695690709a1cd1f2fd75665d661b3fa9 100644 (file)
@@ -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"
index 2e4a2be5043b9a51d2eef18c92ae3eb090128454..25c988503316fb65e091afabf67fa0234e928ea4 100644 (file)
@@ -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"
index acf4366593e62d3a1b72ba012b30e9121d6777e9..f614f093f2e5f3e1fa2a80751f25607edb3e32f5 100644 (file)
@@ -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))
index 7aeaf7db07b8063f13042394a447f72169ec9319..d2603fa2fb1b725872acb7aabd035eeeba6791b0 100644 (file)
@@ -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"