From: terencehill Date: Mon, 12 Aug 2024 22:59:46 +0000 (+0200) Subject: Simplify REGISTER_WEAPON, now possible thanks to the new WEP_CVAR* macros X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a8d62c4c32bb813b237c58fcede259d023c623a9;p=xonotic%2Fxonotic-data.pk3dir.git Simplify REGISTER_WEAPON, now possible thanks to the new WEP_CVAR* macros --- diff --git a/qcsrc/common/mutators/mutator/overkill/okhmg.qh b/qcsrc/common/mutators/mutator/overkill/okhmg.qh index c4e140234..46dcff450 100644 --- a/qcsrc/common/mutators/mutator/overkill/okhmg.qh +++ b/qcsrc/common/mutators/mutator/overkill/okhmg.qh @@ -59,7 +59,7 @@ CLASS(OverkillHeavyMachineGun, Weapon) #undef X ENDCLASS(OverkillHeavyMachineGun) -REGISTER_WEAPON(OVERKILL_HMG, okhmg, NEW(OverkillHeavyMachineGun)); +REGISTER_WEAPON(OVERKILL_HMG, NEW(OverkillHeavyMachineGun)); //SPAWNFUNC_WEAPON(weapon_okhmg, WEP_OVERKILL_HMG) //SPAWNFUNC_WEAPON(weapon_hmg, WEP_OVERKILL_HMG) diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh index cd1eac827..13d44033c 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh @@ -59,6 +59,6 @@ CLASS(OverkillMachineGun, Weapon) #undef X ENDCLASS(OverkillMachineGun) -REGISTER_WEAPON(OVERKILL_MACHINEGUN, okmachinegun, NEW(OverkillMachineGun)); +REGISTER_WEAPON(OVERKILL_MACHINEGUN, NEW(OverkillMachineGun)); //SPAWNFUNC_WEAPON(weapon_okmachinegun, WEP_OVERKILL_MACHINEGUN) diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qh b/qcsrc/common/mutators/mutator/overkill/oknex.qh index 21bbfaa2f..1890f47fc 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qh +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qh @@ -72,7 +72,7 @@ CLASS(OverkillNex, Weapon) #undef X ENDCLASS(OverkillNex) -REGISTER_WEAPON(OVERKILL_NEX, oknex, NEW(OverkillNex)); +REGISTER_WEAPON(OVERKILL_NEX, NEW(OverkillNex)); //SPAWNFUNC_WEAPON(weapon_oknex, WEP_OVERKILL_NEX) diff --git a/qcsrc/common/mutators/mutator/overkill/okrpc.qh b/qcsrc/common/mutators/mutator/overkill/okrpc.qh index 28b763488..c63db10f7 100644 --- a/qcsrc/common/mutators/mutator/overkill/okrpc.qh +++ b/qcsrc/common/mutators/mutator/overkill/okrpc.qh @@ -64,7 +64,7 @@ CLASS(OverkillRocketPropelledChainsaw, Weapon) #undef X ENDCLASS(OverkillRocketPropelledChainsaw) -REGISTER_WEAPON(OVERKILL_RPC, okrpc, NEW(OverkillRocketPropelledChainsaw)); +REGISTER_WEAPON(OVERKILL_RPC, NEW(OverkillRocketPropelledChainsaw)); //SPAWNFUNC_WEAPON(weapon_okrpc, WEP_OVERKILL_RPC) //SPAWNFUNC_WEAPON(weapon_rpc, WEP_OVERKILL_RPC) diff --git a/qcsrc/common/mutators/mutator/overkill/okshotgun.qh b/qcsrc/common/mutators/mutator/overkill/okshotgun.qh index 91412689b..bf0f8e0f6 100644 --- a/qcsrc/common/mutators/mutator/overkill/okshotgun.qh +++ b/qcsrc/common/mutators/mutator/overkill/okshotgun.qh @@ -60,6 +60,6 @@ CLASS(OverkillShotgun, Weapon) #undef X ENDCLASS(OverkillShotgun) -REGISTER_WEAPON(OVERKILL_SHOTGUN, okshotgun, NEW(OverkillShotgun)); +REGISTER_WEAPON(OVERKILL_SHOTGUN, NEW(OverkillShotgun)); //SPAWNFUNC_WEAPON(weapon_okshotgun, WEP_OVERKILL_SHOTGUN) diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 27a506935..04d658734 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -122,13 +122,7 @@ STATIC_INIT_LATE(W_PROP_reloader) } #endif -#define REGISTER_WEAPON(...) EVAL_REGISTER_WEAPON(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__)) -#define EVAL_REGISTER_WEAPON(...) __VA_ARGS__ -#define REGISTER_WEAPON_2(id, inst) REGISTER(Weapons, WEP, id, m_id, inst) -/** TODO: deprecated - remove */ -#define REGISTER_WEAPON_3(id, sname, inst) \ - REGISTER_WEAPON_2(id, inst); \ - [[alias("WEP_" #id)]] Weapon _wep_##sname +#define REGISTER_WEAPON(id, inst) REGISTER(Weapons, WEP, id, m_id, inst) REGISTER_WEAPON(Null, NEW(Weapon)); REGISTRY_DEFINE_GET(Weapons, WEP_Null) diff --git a/qcsrc/common/weapons/weapon/arc.qh b/qcsrc/common/weapons/weapon/arc.qh index 15a2cb772..a7d289c07 100644 --- a/qcsrc/common/weapons/weapon/arc.qh +++ b/qcsrc/common/weapons/weapon/arc.qh @@ -80,7 +80,7 @@ CLASS(Arc, Weapon) #undef X ENDCLASS(Arc) -REGISTER_WEAPON(ARC, arc, NEW(Arc)); +REGISTER_WEAPON(ARC, NEW(Arc)); SPAWNFUNC_WEAPON(weapon_arc, WEP_ARC) diff --git a/qcsrc/common/weapons/weapon/blaster.qh b/qcsrc/common/weapons/weapon/blaster.qh index 944e86405..23e147478 100644 --- a/qcsrc/common/weapons/weapon/blaster.qh +++ b/qcsrc/common/weapons/weapon/blaster.qh @@ -46,7 +46,7 @@ CLASS(Blaster, Weapon) #undef X ENDCLASS(Blaster) -REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster)); +REGISTER_WEAPON(BLASTER, NEW(Blaster)); SPAWNFUNC_WEAPON(weapon_blaster, WEP_BLASTER) SPAWNFUNC_WEAPON(weapon_laser, WEP_BLASTER) diff --git a/qcsrc/common/weapons/weapon/crylink.qh b/qcsrc/common/weapons/weapon/crylink.qh index 2329c364e..872bbcb1a 100644 --- a/qcsrc/common/weapons/weapon/crylink.qh +++ b/qcsrc/common/weapons/weapon/crylink.qh @@ -60,7 +60,7 @@ CLASS(Crylink, Weapon) #undef X ENDCLASS(Crylink) -REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink)); +REGISTER_WEAPON(CRYLINK, NEW(Crylink)); SPAWNFUNC_WEAPON(weapon_crylink, WEP_CRYLINK) diff --git a/qcsrc/common/weapons/weapon/devastator.qh b/qcsrc/common/weapons/weapon/devastator.qh index 7a10bf62a..39fa37613 100644 --- a/qcsrc/common/weapons/weapon/devastator.qh +++ b/qcsrc/common/weapons/weapon/devastator.qh @@ -65,7 +65,7 @@ CLASS(Devastator, Weapon) #undef X ENDCLASS(Devastator) -REGISTER_WEAPON(DEVASTATOR, devastator, NEW(Devastator)); +REGISTER_WEAPON(DEVASTATOR, NEW(Devastator)); SPAWNFUNC_WEAPON(weapon_devastator, WEP_DEVASTATOR) SPAWNFUNC_WEAPON(weapon_rocketlauncher, WEP_DEVASTATOR) diff --git a/qcsrc/common/weapons/weapon/electro.qh b/qcsrc/common/weapons/weapon/electro.qh index e4263403b..fe9199b8f 100644 --- a/qcsrc/common/weapons/weapon/electro.qh +++ b/qcsrc/common/weapons/weapon/electro.qh @@ -73,7 +73,7 @@ CLASS(Electro, Weapon) #undef X ENDCLASS(Electro) -REGISTER_WEAPON(ELECTRO, electro, NEW(Electro)); +REGISTER_WEAPON(ELECTRO, NEW(Electro)); SPAWNFUNC_WEAPON(weapon_electro, WEP_ELECTRO) diff --git a/qcsrc/common/weapons/weapon/fireball.qh b/qcsrc/common/weapons/weapon/fireball.qh index c3dd73a2e..3ce41d932 100644 --- a/qcsrc/common/weapons/weapon/fireball.qh +++ b/qcsrc/common/weapons/weapon/fireball.qh @@ -54,7 +54,7 @@ CLASS(Fireball, Weapon) #undef X ENDCLASS(Fireball) -REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball)); +REGISTER_WEAPON(FIREBALL, NEW(Fireball)); SPAWNFUNC_WEAPON(weapon_fireball, WEP_FIREBALL) diff --git a/qcsrc/common/weapons/weapon/hagar.qh b/qcsrc/common/weapons/weapon/hagar.qh index 5a43d84ef..1d5ea28d6 100644 --- a/qcsrc/common/weapons/weapon/hagar.qh +++ b/qcsrc/common/weapons/weapon/hagar.qh @@ -58,6 +58,6 @@ CLASS(Hagar, Weapon) #undef X ENDCLASS(Hagar) -REGISTER_WEAPON(HAGAR, hagar, NEW(Hagar)); +REGISTER_WEAPON(HAGAR, NEW(Hagar)); SPAWNFUNC_WEAPON(weapon_hagar, WEP_HAGAR) diff --git a/qcsrc/common/weapons/weapon/hlac.qh b/qcsrc/common/weapons/weapon/hlac.qh index ec07fa35a..2d7e655d6 100644 --- a/qcsrc/common/weapons/weapon/hlac.qh +++ b/qcsrc/common/weapons/weapon/hlac.qh @@ -50,6 +50,6 @@ CLASS(HLAC, Weapon) #undef X ENDCLASS(HLAC) -REGISTER_WEAPON(HLAC, hlac, NEW(HLAC)); +REGISTER_WEAPON(HLAC, NEW(HLAC)); SPAWNFUNC_WEAPON(weapon_hlac, WEP_HLAC) diff --git a/qcsrc/common/weapons/weapon/hook.qh b/qcsrc/common/weapons/weapon/hook.qh index 25b1be507..0bb7b84e1 100644 --- a/qcsrc/common/weapons/weapon/hook.qh +++ b/qcsrc/common/weapons/weapon/hook.qh @@ -50,7 +50,7 @@ CLASS(Hook, Weapon) #undef X ENDCLASS(Hook) -REGISTER_WEAPON(HOOK, hook, NEW(Hook)); +REGISTER_WEAPON(HOOK, NEW(Hook)); SPAWNFUNC_WEAPON(weapon_hook, WEP_HOOK) diff --git a/qcsrc/common/weapons/weapon/machinegun.qh b/qcsrc/common/weapons/weapon/machinegun.qh index 1b77baaee..450a12df9 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qh +++ b/qcsrc/common/weapons/weapon/machinegun.qh @@ -61,7 +61,7 @@ CLASS(MachineGun, Weapon) #undef X ENDCLASS(MachineGun) -REGISTER_WEAPON(MACHINEGUN, machinegun, NEW(MachineGun)); +REGISTER_WEAPON(MACHINEGUN, NEW(MachineGun)); SPAWNFUNC_WEAPON(weapon_machinegun, WEP_MACHINEGUN) SPAWNFUNC_WEAPON(weapon_uzi, WEP_MACHINEGUN) diff --git a/qcsrc/common/weapons/weapon/minelayer.qh b/qcsrc/common/weapons/weapon/minelayer.qh index a574510f5..1f503f7ff 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qh +++ b/qcsrc/common/weapons/weapon/minelayer.qh @@ -54,7 +54,7 @@ CLASS(MineLayer, Weapon) W_PROPS(X, MineLayer, minelayer) #undef X ENDCLASS(MineLayer) -REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer)); +REGISTER_WEAPON(MINE_LAYER, NEW(MineLayer)); SPAWNFUNC_WEAPON(weapon_minelayer, WEP_MINE_LAYER) diff --git a/qcsrc/common/weapons/weapon/mortar.qh b/qcsrc/common/weapons/weapon/mortar.qh index 6d44e7564..ce333250a 100644 --- a/qcsrc/common/weapons/weapon/mortar.qh +++ b/qcsrc/common/weapons/weapon/mortar.qh @@ -55,7 +55,7 @@ CLASS(Mortar, Weapon) W_PROPS(X, Mortar, mortar) #undef X ENDCLASS(Mortar) -REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar)); +REGISTER_WEAPON(MORTAR, NEW(Mortar)); SPAWNFUNC_WEAPON(weapon_mortar, WEP_MORTAR) SPAWNFUNC_WEAPON(weapon_grenadelauncher, WEP_MORTAR) diff --git a/qcsrc/common/weapons/weapon/porto.qh b/qcsrc/common/weapons/weapon/porto.qh index 757386b5c..30d76908b 100644 --- a/qcsrc/common/weapons/weapon/porto.qh +++ b/qcsrc/common/weapons/weapon/porto.qh @@ -34,7 +34,7 @@ CLASS(PortoLaunch, Weapon) W_PROPS(X, PortoLaunch, porto) #undef X ENDCLASS(PortoLaunch) -REGISTER_WEAPON(PORTO, porto, NEW(PortoLaunch)); +REGISTER_WEAPON(PORTO, NEW(PortoLaunch)); SPAWNFUNC_WEAPON(weapon_porto, WEP_PORTO) diff --git a/qcsrc/common/weapons/weapon/rifle.qh b/qcsrc/common/weapons/weapon/rifle.qh index 9b69985a4..56f24b8f0 100644 --- a/qcsrc/common/weapons/weapon/rifle.qh +++ b/qcsrc/common/weapons/weapon/rifle.qh @@ -53,7 +53,7 @@ CLASS(Rifle, Weapon) W_PROPS(X, Rifle, rifle) #undef X ENDCLASS(Rifle) -REGISTER_WEAPON(RIFLE, rifle, NEW(Rifle)); +REGISTER_WEAPON(RIFLE, NEW(Rifle)); SPAWNFUNC_WEAPON(weapon_rifle, WEP_RIFLE) SPAWNFUNC_WEAPON(weapon_campingrifle, WEP_RIFLE) diff --git a/qcsrc/common/weapons/weapon/seeker.qh b/qcsrc/common/weapons/weapon/seeker.qh index d3024a436..e62145ac4 100644 --- a/qcsrc/common/weapons/weapon/seeker.qh +++ b/qcsrc/common/weapons/weapon/seeker.qh @@ -83,7 +83,7 @@ CLASS(Seeker, Weapon) W_PROPS(X, Seeker, seeker) #undef X ENDCLASS(Seeker) -REGISTER_WEAPON(SEEKER, seeker, NEW(Seeker)); +REGISTER_WEAPON(SEEKER, NEW(Seeker)); SPAWNFUNC_WEAPON(weapon_seeker, WEP_SEEKER) diff --git a/qcsrc/common/weapons/weapon/shockwave.qh b/qcsrc/common/weapons/weapon/shockwave.qh index 9fa484b6a..76d3c3ef2 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qh +++ b/qcsrc/common/weapons/weapon/shockwave.qh @@ -73,7 +73,7 @@ CLASS(Shockwave, Weapon) #undef X ENDCLASS(Shockwave) -REGISTER_WEAPON(SHOCKWAVE, shockwave, NEW(Shockwave)); +REGISTER_WEAPON(SHOCKWAVE, NEW(Shockwave)); SPAWNFUNC_WEAPON(weapon_shockwave, WEP_SHOCKWAVE) diff --git a/qcsrc/common/weapons/weapon/shotgun.qh b/qcsrc/common/weapons/weapon/shotgun.qh index 8f78e72b6..13cf944c3 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qh +++ b/qcsrc/common/weapons/weapon/shotgun.qh @@ -60,5 +60,5 @@ CLASS(Shotgun, Weapon) #undef X ENDCLASS(Shotgun) -REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun)); +REGISTER_WEAPON(SHOTGUN, NEW(Shotgun)); diff --git a/qcsrc/common/weapons/weapon/tuba.qh b/qcsrc/common/weapons/weapon/tuba.qh index 8855fc752..f2a1712c5 100644 --- a/qcsrc/common/weapons/weapon/tuba.qh +++ b/qcsrc/common/weapons/weapon/tuba.qh @@ -39,7 +39,7 @@ CLASS(Tuba, Weapon) W_PROPS(X, Tuba, tuba) #undef X ENDCLASS(Tuba) -REGISTER_WEAPON(TUBA, tuba, NEW(Tuba)); +REGISTER_WEAPON(TUBA, NEW(Tuba)); SPAWNFUNC_WEAPON(weapon_tuba, WEP_TUBA) diff --git a/qcsrc/common/weapons/weapon/vaporizer.qh b/qcsrc/common/weapons/weapon/vaporizer.qh index 6d582d45b..2bc58d993 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qh +++ b/qcsrc/common/weapons/weapon/vaporizer.qh @@ -58,7 +58,7 @@ CLASS(Vaporizer, Weapon) #undef X ENDCLASS(Vaporizer) -REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer)); +REGISTER_WEAPON(VAPORIZER, NEW(Vaporizer)); SPAWNFUNC_WEAPON(weapon_vaporizer, WEP_VAPORIZER) SPAWNFUNC_WEAPON(weapon_minstanex, WEP_VAPORIZER) diff --git a/qcsrc/common/weapons/weapon/vortex.qh b/qcsrc/common/weapons/weapon/vortex.qh index ef88c6bd8..b31836e69 100644 --- a/qcsrc/common/weapons/weapon/vortex.qh +++ b/qcsrc/common/weapons/weapon/vortex.qh @@ -63,7 +63,7 @@ CLASS(Vortex, Weapon) #undef X ENDCLASS(Vortex) -REGISTER_WEAPON(VORTEX, vortex, NEW(Vortex)); +REGISTER_WEAPON(VORTEX, NEW(Vortex)); SPAWNFUNC_WEAPON(weapon_vortex, WEP_VORTEX) SPAWNFUNC_WEAPON(weapon_nex, WEP_VORTEX)