]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Guide: sort Items by item type terencehill/guide
authorterencehill <piuntn@gmail.com>
Mon, 23 Dec 2024 14:32:27 +0000 (15:32 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 23 Dec 2024 14:32:27 +0000 (15:32 +0100)
qcsrc/menu/xonotic/guide/guide.qh

index de9d085fcaa51d6f2658e2c3001191e7da1a7e9f..40e345939bf4e898aa1ce18715bf2d0e093f8555 100644 (file)
@@ -33,13 +33,21 @@ ENDCLASS(DebugSource)
 
 .bool m_hidden;
 
-#define _REGISTRY_SOURCE(id, arr_name, register_arr, cond) \
+#define _REGISTRY_SOURCE(id, arr_name, register_arr, cond1, cond2, cond3) \
 ArrayList arr_name##_MENU; \
 int arr_name##_MENU_COUNT; \
 STATIC_INIT_LATE(arr_name##_MENU) \
 { \
        AL_NEW(arr_name##_MENU, register_arr##_MAX, NULL, e); \
-       FOREACH(register_arr, !it.m_hidden && (cond), { \
+       FOREACH(register_arr, !it.m_hidden && (cond1), { \
+               AL_sete(arr_name##_MENU, arr_name##_MENU_COUNT, it); \
+               arr_name##_MENU_COUNT++; \
+       }); \
+       FOREACH(register_arr, !it.m_hidden && (cond2), { \
+               AL_sete(arr_name##_MENU, arr_name##_MENU_COUNT, it); \
+               arr_name##_MENU_COUNT++; \
+       }); \
+       FOREACH(register_arr, !it.m_hidden && (cond3), { \
                AL_sete(arr_name##_MENU, arr_name##_MENU_COUNT, it); \
                arr_name##_MENU_COUNT++; \
        }); \
@@ -55,8 +63,10 @@ CLASS(id, DataSource) \
 ENDCLASS(id)
 
 #define REGISTRY_SOURCE(...) EVAL(OVERLOAD(REGISTRY_SOURCE, __VA_ARGS__))
-#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)
+#define REGISTRY_SOURCE_3(id, arr_name, register_arr)                      _REGISTRY_SOURCE(id, arr_name, register_arr, true, false, false)
+#define REGISTRY_SOURCE_4(id, arr_name, register_arr, cond1)               _REGISTRY_SOURCE(id, arr_name, register_arr, cond1, false, false)
+#define REGISTRY_SOURCE_5(id, arr_name, register_arr, cond1, cond2)        _REGISTRY_SOURCE(id, arr_name, register_arr, cond1, cond2, false)
+#define REGISTRY_SOURCE_6(id, arr_name, register_arr, cond1, cond2, cond3) _REGISTRY_SOURCE(id, arr_name, register_arr, cond1, cond2, cond3)
 
 REGISTRY_SOURCE(FreetextSource, Guide, GuidePages)
 
@@ -73,7 +83,10 @@ 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/items/all.qh>
-REGISTRY_SOURCE(ItemSource, Items, Items, !it.instanceOfPowerup)
+REGISTRY_SOURCE(ItemSource, Items, Items,
+       !it.instanceOfPowerup && it.instanceOfAmmo,
+       !it.instanceOfPowerup && it.instanceOfHealth,
+       !it.instanceOfPowerup && it.instanceOfArmor)
 // The descriptions for these are in common/items/item/*.qc and common/mutators/mutator/instagib/items.qc
 
 #include <common/mutators/mutator/nades/nades.qh>