From: otta8634 Date: Sun, 22 Dec 2024 17:08:07 +0000 (+0800) Subject: Separate powerups from items in the guide X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1cead207c14aae14211701e2dde9aa16b18fc04b;p=xonotic%2Fxonotic-data.pk3dir.git Separate powerups from items in the guide 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). --- diff --git a/qcsrc/common/items/item/jetpack.qc b/qcsrc/common/items/item/jetpack.qc index 259a7c1e7..75f9f1559 100644 --- a/qcsrc/common/items/item/jetpack.qc +++ b/qcsrc/common/items/item/jetpack.qc @@ -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)); diff --git a/qcsrc/menu/xonotic/guide/guide.qh b/qcsrc/menu/xonotic/guide/guide.qh index 3f45cbaa2..f44bd2c0c 100644 --- a/qcsrc/menu/xonotic/guide/guide.qh +++ b/qcsrc/menu/xonotic/guide/guide.qh @@ -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 -REGISTRY_SOURCE(GametypeSource, Gametypes) +REGISTRY_SOURCE(GametypeSource, Gametypes, Gametypes) // The descriptions for these are in common/gamemodes/gamemode/*/*.qh #include -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 +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 -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 -REGISTRY_SOURCE(NadeSource, Nades) +REGISTRY_SOURCE(NadeSource, Nades, Nades) // The descriptions for these are in common/mutators/mutator/nades/all.inc #include -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 -REGISTRY_SOURCE(MonsterSource, Monsters) +REGISTRY_SOURCE(MonsterSource, Monsters, Monsters) // The descriptions for these are in common/monsters/monster/*.qc #include -REGISTRY_SOURCE(VehicleSource, Vehicles) +REGISTRY_SOURCE(VehicleSource, Vehicles, Vehicles) // The descriptions for these are in common/vehicles/vehicle/*.qc #include -REGISTRY_SOURCE(TurretSource, Turrets) +REGISTRY_SOURCE(TurretSource, Turrets, Turrets) #include -REGISTRY_SOURCE(MutatorSource, Mutators) +REGISTRY_SOURCE(MutatorSource, Mutators, Mutators) CLASS(MapSource, DataSource) METHOD(MapSource, getEntry, entity(MapSource this, int i, void(string, string) returns));