]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Separate powerups from items in the guide
authorotta8634 <k9wolf@pm.me>
Sun, 22 Dec 2024 17:08:07 +0000 (01:08 +0800)
committerotta8634 <k9wolf@pm.me>
Sun, 22 Dec 2024 17:08:07 +0000 (01:08 +0800)
Since both the Powerups and Items sections use the ITEM registry, the REGISTRY_SOURCE macro had to be updated, so some minor refactoring is included.
Choose to use the ka icon for Buffs since it's more circular (like the buffs simpleitems), and dom for Powerups since it's more triangular (like most powerups simpleitems).

qcsrc/common/items/item/jetpack.qc
qcsrc/menu/xonotic/guide/guide.qh

index 259a7c1e723f4e73a4c1e849c4071cb35a6f5eac..75f9f1559d2c4b7e71a874b591296c40fc811026 100644 (file)
@@ -20,7 +20,7 @@ METHOD(JetpackRegen, m_spawnfunc_hookreplace, GameItem(JetpackRegen this, entity
 METHOD(Jetpack, describe, string(Jetpack this))
 {
        TC(Jetpack, this);
-       return sprintf(_("The %s allows you to fly around the map for a short period, "
+       return sprintf(_("The %s powerup allows you to fly around the map for a short period, "
                "providing increased mobility, maneuverability, and the ability to reach higher ground\n\n"
                "It consumes Fuel ammo while operating, so make sure you don't run out when you're high up!"),
        COLORED_NAME(this));
index 3f45cbaa218489a1b15284d23918526fd5fd9cff..f44bd2c0cd58496b69f1f3a4b4decab7a6a5f912 100644 (file)
@@ -10,7 +10,8 @@
        X(NEW(GametypeSource),  _("Gametypes"), "gametype_dm") \
        X(NEW(WeaponSource),    _("Weapons"),   "gametype_duel") \
        X(NEW(ItemSource),      _("Items"),     "gametype_kh") \
-       X(NEW(BuffSource),      _("Buffs"),     "gametype_dom") \
+       X(NEW(PowerupSource),   _("Powerups"),  "gametype_dom") \
+       X(NEW(BuffSource),      _("Buffs"),     "gametype_ka") \
        X(NEW(NadeSource),      _("Nades"),     "gametype_ft") \
        X(NEW(MonsterSource),   _("Monsters"),  "gametype_lms") \
        X(NEW(VehicleSource),   _("Vehicles"),  "gametype_rc") \
@@ -32,66 +33,70 @@ ENDCLASS(DebugSource)
 
 .bool m_hidden;
 
-#define _REGISTRY_SOURCE(id, arr, cond) \
-ArrayList arr##_MENU; \
-int arr##_MENU_COUNT; \
-STATIC_INIT_LATE(arr##_MENU) \
+#define _REGISTRY_SOURCE(id, arr_name, register_arr, cond) \
+ArrayList arr_name##_MENU; \
+int arr_name##_MENU_COUNT; \
+STATIC_INIT_LATE(arr_name##_MENU) \
 { \
-       AL_NEW(arr##_MENU, arr##_MAX, NULL, e); \
-       FOREACH(arr, !it.m_hidden && (cond), { \
-               AL_sete(arr##_MENU, arr##_MENU_COUNT, it); \
-               arr##_MENU_COUNT++; \
+       AL_NEW(arr_name##_MENU, register_arr##_MAX, NULL, e); \
+       FOREACH(register_arr, !it.m_hidden && (cond), { \
+               AL_sete(arr_name##_MENU, arr_name##_MENU_COUNT, it); \
+               arr_name##_MENU_COUNT++; \
        }); \
 } \
 CLASS(id, DataSource) \
        METHOD(id, getEntry, entity(id this, int i, void(string, string) returns)) { \
-               entity e = AL_gete(arr##_MENU, i); \
+               entity e = AL_gete(arr_name##_MENU, i); \
                if (returns) \
                        e.display(e, returns); \
                return e; \
        } \
-       METHOD(id, reload, int(id this, string filter)) { return arr##_MENU_COUNT; } \
+       METHOD(id, reload, int(id this, string filter)) { return arr_name##_MENU_COUNT; } \
 ENDCLASS(id)
 
 #define REGISTRY_SOURCE(...) EVAL(OVERLOAD(REGISTRY_SOURCE, __VA_ARGS__))
-#define REGISTRY_SOURCE_2(id, arr) _REGISTRY_SOURCE(id, arr, true)
-#define REGISTRY_SOURCE_3(id, arr, cond) _REGISTRY_SOURCE(id, arr, cond)
+#define REGISTRY_SOURCE_3(id, arr_name, register_arr)       _REGISTRY_SOURCE(id, arr_name, register_arr, true)
+#define REGISTRY_SOURCE_4(id, arr_name, register_arr, cond) _REGISTRY_SOURCE(id, arr_name, register_arr, cond)
 
-REGISTRY_SOURCE(FreetextSource, GuidePages)
+REGISTRY_SOURCE(FreetextSource, Guide, GuidePages)
 
 #include <common/mapinfo.qh>
-REGISTRY_SOURCE(GametypeSource, Gametypes)
+REGISTRY_SOURCE(GametypeSource, Gametypes, Gametypes)
 // The descriptions for these are in common/gamemodes/gamemode/*/*.qh
 
 #include <common/items/all.qh>
-REGISTRY_SOURCE(ItemSource, Items)
+REGISTRY_SOURCE(ItemSource, Items, Items, !it.instanceOfPowerup)
 // The descriptions for these are in common/items/item/*.qc and common/mutators/mutator/instagib/items.qc
 
+#include <common/mutators/mutator/powerups/powerup/_mod.qh>
+REGISTRY_SOURCE(PowerupSource, Powerups, Items, it.instanceOfPowerup)
+// The descriptions for these are in common/mutators/mutator/powerups/powerup/*.qc and common/items/item/jetpack.qc
+
 #include <common/mutators/mutator/buffs/buffs.qh>
-REGISTRY_SOURCE(BuffSource, StatusEffect, it.instanceOfBuff)
+REGISTRY_SOURCE(BuffSource, Buffs, StatusEffect, it.instanceOfBuff)
 // The descriptions for these are in common/mutators/mutator/buffs/all.inc
 
 #include <common/mutators/mutator/nades/nades.qh>
-REGISTRY_SOURCE(NadeSource, Nades)
+REGISTRY_SOURCE(NadeSource, Nades, Nades)
 // The descriptions for these are in common/mutators/mutator/nades/all.inc
 
 #include <common/weapons/all.qh>
-REGISTRY_SOURCE(WeaponSource, Weapons)
+REGISTRY_SOURCE(WeaponSource, Weapons, Weapons)
 // The descriptions for these are in common/weapons/weapon/*.qc and common/mutators/mutator/overkill/ok*.qc
 
 #include <common/monsters/all.qh>
-REGISTRY_SOURCE(MonsterSource, Monsters)
+REGISTRY_SOURCE(MonsterSource, Monsters, Monsters)
 // The descriptions for these are in common/monsters/monster/*.qc
 
 #include <common/vehicles/all.qh>
-REGISTRY_SOURCE(VehicleSource, Vehicles)
+REGISTRY_SOURCE(VehicleSource, Vehicles, Vehicles)
 // The descriptions for these are in common/vehicles/vehicle/*.qc
 
 #include <common/turrets/all.qh>
-REGISTRY_SOURCE(TurretSource, Turrets)
+REGISTRY_SOURCE(TurretSource, Turrets, Turrets)
 
 #include <common/mutators/base.qh>
-REGISTRY_SOURCE(MutatorSource, Mutators)
+REGISTRY_SOURCE(MutatorSource, Mutators, Mutators)
 
 CLASS(MapSource, DataSource)
        METHOD(MapSource, getEntry, entity(MapSource this, int i, void(string, string) returns));