From ecb96402c38689e2b3abf5a8646aae37e78576c3 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 2 Dec 2015 19:52:08 +1000 Subject: [PATCH] Make the WeaponModel hook common --- qcsrc/common/mutators/events.qh | 10 ++++++++++ qcsrc/common/weapons/all.qc | 8 ++------ qcsrc/server/mutators/events.qh | 10 ---------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/qcsrc/common/mutators/events.qh b/qcsrc/common/mutators/events.qh index ed57753bd..5cb5b4745 100644 --- a/qcsrc/common/mutators/events.qh +++ b/qcsrc/common/mutators/events.qh @@ -90,4 +90,14 @@ MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump); float pm_maxspeed_mod; MUTATOR_HOOKABLE(PM_Physics, EV_PM_Physics); +/** called when a weapon model is about to be set, allows custom paths etc. */ +#define EV_WeaponModel(i, o) \ + /**/ i(string, weapon_model) \ + /**/ i(string, weapon_model_output) \ + /**/ o(string, weapon_model_output) \ + /**/ +string weapon_model; +string weapon_model_output; +MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel); + #endif diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 2ef2d09b9..a12e8556a 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -267,12 +267,8 @@ string W_Sound(string w_snd) string W_Model(string w_mdl) { string output = strcat("models/weapons/", w_mdl); -#ifdef SVQC - MUTATOR_CALLHOOK(WeaponModel, w_mdl, output); - return weapon_model_output; -#else - return output; -#endif + MUTATOR_CALLHOOK(WeaponModel, w_mdl, output); + return weapon_model_output; } #ifndef MENUQC diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index ff9a775cf..75c1872aa 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -73,16 +73,6 @@ string weapon_sound; string weapon_sound_output; MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound); -/** called when a weapon model is about to be set, allows custom paths etc. */ -#define EV_WeaponModel(i, o) \ - /**/ i(string, weapon_model) \ - /**/ i(string, weapon_model_output) \ - /**/ o(string, weapon_model_output) \ - /**/ -string weapon_model; -string weapon_model_output; -MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel); - /** called when an item model is about to be set, allows custom paths etc. */ #define EV_ItemModel(i, o) \ /**/ i(string, item_model) \ -- 2.39.2