From 12be214bc306349e158805527fc2f9634ff9094b Mon Sep 17 00:00:00 2001 From: otta8634 Date: Tue, 7 Jan 2025 21:43:12 +0800 Subject: [PATCH] Make REGISTER_ITEM call NEW, like most other REGISTER_* macros --- qcsrc/common/items/all.qh | 2 +- qcsrc/common/items/item/ammo.qh | 8 ++++---- qcsrc/common/items/item/armor.qh | 8 ++++---- qcsrc/common/items/item/health.qh | 8 ++++---- qcsrc/common/items/item/jetpack.qh | 6 +++--- qcsrc/common/mutators/mutator/buffs/buffs.qh | 3 +-- qcsrc/common/mutators/mutator/instagib/items.qh | 4 ++-- .../mutators/mutator/powerups/powerup/invisibility.qh | 2 +- qcsrc/common/mutators/mutator/powerups/powerup/shield.qh | 2 +- qcsrc/common/mutators/mutator/powerups/powerup/speed.qh | 2 +- .../common/mutators/mutator/powerups/powerup/strength.qh | 2 +- 11 files changed, 23 insertions(+), 24 deletions(-) diff --git a/qcsrc/common/items/all.qh b/qcsrc/common/items/all.qh index 3d3d62e46..e956d2972 100644 --- a/qcsrc/common/items/all.qh +++ b/qcsrc/common/items/all.qh @@ -10,7 +10,7 @@ REGISTRY(Items, 32) REGISTRY_DEPENDS(Items, Models) #endif REGISTER_REGISTRY(Items) -#define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class)) +#define REGISTER_ITEM(id, inst) REGISTER(Items, ITEM, id, m_id, inst) #ifdef CSQC // Copy Items registry here before it gets sorted alphabetically by REGISTRY_SORT diff --git a/qcsrc/common/items/item/ammo.qh b/qcsrc/common/items/item/ammo.qh index c9688a282..2bd71924d 100644 --- a/qcsrc/common/items/item/ammo.qh +++ b/qcsrc/common/items/item/ammo.qh @@ -46,7 +46,7 @@ void ammo_shells_init(Pickup this, entity item) CLASS(Shells, Ammo) ENDCLASS(Shells) -REGISTER_ITEM(Shells, Shells) { +REGISTER_ITEM(Shells, NEW(Shells)) { this.m_canonical_spawnfunc = "item_shells"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -82,7 +82,7 @@ void ammo_bullets_init(Pickup this, entity item) CLASS(Bullets, Ammo) ENDCLASS(Bullets) -REGISTER_ITEM(Bullets, Bullets) { +REGISTER_ITEM(Bullets, NEW(Bullets)) { this.m_canonical_spawnfunc = "item_bullets"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -114,7 +114,7 @@ void ammo_rockets_init(Pickup this, entity item) SetResourceExplicit(item, RES_ROCKETS, g_pickup_rockets); } #endif -REGISTER_ITEM(Rockets, Ammo) { +REGISTER_ITEM(Rockets, NEW(Ammo)) { this.m_canonical_spawnfunc = "item_rockets"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -146,7 +146,7 @@ void ammo_cells_init(Pickup this, entity item) SetResourceExplicit(item, RES_CELLS, g_pickup_cells); } #endif -REGISTER_ITEM(Cells, Ammo) { +REGISTER_ITEM(Cells, NEW(Ammo)) { this.m_canonical_spawnfunc = "item_cells"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; diff --git a/qcsrc/common/items/item/armor.qh b/qcsrc/common/items/item/armor.qh index b8c3b408f..87452a911 100644 --- a/qcsrc/common/items/item/armor.qh +++ b/qcsrc/common/items/item/armor.qh @@ -29,7 +29,7 @@ void item_armorsmall_init(Pickup this, entity item) } #endif -REGISTER_ITEM(ArmorSmall, Armor) { +REGISTER_ITEM(ArmorSmall, NEW(Armor)) { this.m_canonical_spawnfunc = "item_armor_small"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -73,7 +73,7 @@ void item_armormedium_init(Pickup this, entity item) } #endif -REGISTER_ITEM(ArmorMedium, Armor) { +REGISTER_ITEM(ArmorMedium, NEW(Armor)) { this.m_canonical_spawnfunc = "item_armor_medium"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -117,7 +117,7 @@ void item_armorbig_init(Pickup this, entity item) } #endif -REGISTER_ITEM(ArmorBig, Armor) { +REGISTER_ITEM(ArmorBig, NEW(Armor)) { this.m_canonical_spawnfunc = "item_armor_big"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -161,7 +161,7 @@ void item_armormega_init(Pickup this, entity item) } #endif -REGISTER_ITEM(ArmorMega, Armor) { +REGISTER_ITEM(ArmorMega, NEW(Armor)) { this.m_canonical_spawnfunc = "item_armor_mega"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; diff --git a/qcsrc/common/items/item/health.qh b/qcsrc/common/items/item/health.qh index a028f28c3..c404f388c 100644 --- a/qcsrc/common/items/item/health.qh +++ b/qcsrc/common/items/item/health.qh @@ -29,7 +29,7 @@ void item_healthsmall_init(Pickup this, entity item) } #endif -REGISTER_ITEM(HealthSmall, Health) { +REGISTER_ITEM(HealthSmall, NEW(Health)) { this.m_canonical_spawnfunc = "item_health_small"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -74,7 +74,7 @@ void item_healthmedium_init(Pickup this, entity item) } #endif -REGISTER_ITEM(HealthMedium, Health) { +REGISTER_ITEM(HealthMedium, NEW(Health)) { this.m_canonical_spawnfunc = "item_health_medium"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -118,7 +118,7 @@ void item_healthbig_init(Pickup this, entity item) } #endif -REGISTER_ITEM(HealthBig, Health) { +REGISTER_ITEM(HealthBig, NEW(Health)) { this.m_canonical_spawnfunc = "item_health_big"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -162,7 +162,7 @@ void item_healthmega_init(Pickup this, entity item) } #endif -REGISTER_ITEM(HealthMega, Health) { +REGISTER_ITEM(HealthMega, NEW(Health)) { this.m_canonical_spawnfunc = "item_health_mega"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; diff --git a/qcsrc/common/items/item/jetpack.qh b/qcsrc/common/items/item/jetpack.qh index ca52f5466..41297c898 100644 --- a/qcsrc/common/items/item/jetpack.qh +++ b/qcsrc/common/items/item/jetpack.qh @@ -31,7 +31,7 @@ void powerup_jetpack_init(Pickup def, entity item) CLASS(Jetpack, Powerup) ENDCLASS(Jetpack) -REGISTER_ITEM(Jetpack, Jetpack) { +REGISTER_ITEM(Jetpack, NEW(Jetpack)) { this.m_canonical_spawnfunc = "item_jetpack"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL; @@ -65,7 +65,7 @@ void ammo_fuel_init(Pickup this, entity item) SetResourceExplicit(item, RES_FUEL, g_pickup_fuel); } #endif -REGISTER_ITEM(JetpackFuel, Ammo) { +REGISTER_ITEM(JetpackFuel, NEW(Ammo)) { this.m_canonical_spawnfunc = "item_fuel"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE; @@ -99,7 +99,7 @@ void powerup_fuelregen_init(Pickup def, entity item) CLASS(JetpackRegen, Powerup) ENDCLASS(JetpackRegen) -REGISTER_ITEM(JetpackRegen, JetpackRegen) { +REGISTER_ITEM(JetpackRegen, NEW(JetpackRegen)) { this.m_canonical_spawnfunc = "item_fuel_regen"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_NORMAL; diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qh b/qcsrc/common/mutators/mutator/buffs/buffs.qh index a14ad6bb8..c02625955 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qh @@ -8,8 +8,7 @@ #include #endif -#define REGISTER_BUFF(id, inst) \ - REGISTER(StatusEffect, BUFF_##id, m_id, inst) +#define REGISTER_BUFF(id, inst) REGISTER(StatusEffect, BUFF_##id, m_id, inst) #include CLASS(Buff, StatusEffects) diff --git a/qcsrc/common/mutators/mutator/instagib/items.qh b/qcsrc/common/mutators/mutator/instagib/items.qh index 9be156bb3..39d0378d5 100644 --- a/qcsrc/common/mutators/mutator/instagib/items.qh +++ b/qcsrc/common/mutators/mutator/instagib/items.qh @@ -22,7 +22,7 @@ void ammo_vaporizercells_init(Pickup this, entity item) SetResourceExplicit(item, RES_CELLS, autocvar_g_instagib_ammo_drop); } #endif -REGISTER_ITEM(VaporizerCells, Ammo) { +REGISTER_ITEM(VaporizerCells, NEW(Ammo)) { this.m_canonical_spawnfunc = "item_vaporizer_cells"; #ifdef GAMEQC this.spawnflags = ITEM_FLAG_MUTATORBLOCKED; @@ -49,7 +49,7 @@ MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3")); SOUND(ExtraLife, Item_Sound("megahealth")); #endif -REGISTER_ITEM(ExtraLife, Powerup) { +REGISTER_ITEM(ExtraLife, NEW(Powerup)) { this.m_canonical_spawnfunc = "item_extralife"; #ifdef GAMEQC this.m_model = MDL_ExtraLife_ITEM; diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh index 690abb5ca..df25c8a9c 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh @@ -28,7 +28,7 @@ void powerup_invisibility_init(Pickup def, entity item) item.invisibility_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invisibility_time; } #endif -REGISTER_ITEM(Invisibility, Powerup) { +REGISTER_ITEM(Invisibility, NEW(Powerup)) { this.m_canonical_spawnfunc = "item_invisibility"; #ifdef SVQC this.m_iteminit = powerup_invisibility_init; diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh index de2f5dc29..ac7faaeda 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh @@ -27,7 +27,7 @@ void powerup_shield_init(Pickup def, entity item) item.invincible_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invincible_time; } #endif -REGISTER_ITEM(Shield, Powerup) { +REGISTER_ITEM(Shield, NEW(Powerup)) { this.m_canonical_spawnfunc = "item_shield"; #ifdef SVQC this.m_iteminit = powerup_shield_init; diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh index 38010e480..6b4653546 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh @@ -29,7 +29,7 @@ void powerup_speed_init(Pickup def, entity item) item.speed_finished = (item.count) ? item.count : autocvar_g_balance_powerup_speed_time; } #endif -REGISTER_ITEM(Speed, Powerup) { +REGISTER_ITEM(Speed, NEW(Powerup)) { this.m_canonical_spawnfunc = "item_speed"; #ifdef SVQC this.m_iteminit = powerup_speed_init; diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh index 79ef229f1..3567cb1c3 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh @@ -29,7 +29,7 @@ void powerup_strength_init(Pickup def, entity item) item.strength_finished = (item.count) ? item.count : autocvar_g_balance_powerup_strength_time; } #endif -REGISTER_ITEM(Strength, Powerup) { +REGISTER_ITEM(Strength, NEW(Powerup)) { this.m_canonical_spawnfunc = "item_strength"; #ifdef SVQC this.m_iteminit = powerup_strength_init; -- 2.39.5