From: Mario Date: Sun, 1 Nov 2015 01:12:23 +0000 (+1000) Subject: Add a function to change the monster model path X-Git-Tag: xonotic-v0.8.2~1749 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a0a3012565d085f987909dd350b75a381e0856ca;p=xonotic%2Fxonotic-data.pk3dir.git Add a function to change the monster model path --- diff --git a/qcsrc/common/monsters/all.qc b/qcsrc/common/monsters/all.qc index f4b2a4bf0..f5c973bd0 100644 --- a/qcsrc/common/monsters/all.qc +++ b/qcsrc/common/monsters/all.qc @@ -1,6 +1,17 @@ #ifndef MONSTERS_ALL_C #define MONSTERS_ALL_C +string M_Model(string m_mdl) +{ + string output = strcat("models/monsters/", m_mdl); +#ifdef SVQC + MUTATOR_CALLHOOK(MonsterModel, m_mdl, output); + return monster_model_output; +#else + return output; +#endif +} + #include "all.qh" #define IMPLEMENTATION diff --git a/qcsrc/common/monsters/all.qh b/qcsrc/common/monsters/all.qh index 72861f9d2..15e775ae7 100644 --- a/qcsrc/common/monsters/all.qh +++ b/qcsrc/common/monsters/all.qh @@ -3,6 +3,8 @@ #include "monster.qh" +string M_Model(string m_mdl); + REGISTRY(Monsters, BITS(4)) REGISTER_REGISTRY(RegisterMonsters) const int MON_FIRST = 1; diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 20bb5c549..36f4a2584 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -2,7 +2,7 @@ #define MAGE_H #ifndef MENUQC -MODEL(MON_MAGE, "models/monsters/mage.dpm"); +MODEL(MON_MAGE, M_Model("mage.dpm")); #endif CLASS(Mage, Monster) diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index 1a1fb450c..767cb9790 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -2,7 +2,7 @@ #define SHAMBLER_H #ifndef MENUQC -MODEL(MON_SHAMBLER, "models/monsters/shambler.mdl"); +MODEL(MON_SHAMBLER, M_Model("shambler.mdl")); #endif CLASS(Shambler, Monster) diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 4167476c8..01a006e13 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -2,7 +2,7 @@ #define SPIDER_H #ifndef MENUQC -MODEL(MON_SPIDER, "models/monsters/spider.dpm"); +MODEL(MON_SPIDER, M_Model("spider.dpm")); #endif CLASS(Spider, Monster) diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 315e8d66e..5cac89829 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -2,7 +2,7 @@ #define WYVERN_H #ifndef MENUQC -MODEL(MON_WYVERN, "models/monsters/wizard.mdl"); +MODEL(MON_WYVERN, M_Model("wizard.mdl")); #endif CLASS(Wyvern, Monster) diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index b4389231c..d63188b0f 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -2,7 +2,7 @@ #define ZOMBIE_H #ifndef MENUQC -MODEL(MON_ZOMBIE, "models/monsters/zombie.dpm"); +MODEL(MON_ZOMBIE, M_Model("zombie.dpm")); #endif CLASS(Zombie, Monster) diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index d5796ea31..7bc65791c 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -823,4 +823,14 @@ MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS); /**/ i(entity, frag_attacker) \ /**/ MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage); + +/** called when a monster model is about to be set, allows custom paths etc. */ +#define EV_MonsterModel(i, o) \ + /**/ i(string, monster_model) \ + /**/ i(string, monster_model_output) \ + /**/ o(string, monster_model_output) \ + /**/ +string monster_model; +string monster_model_output; +MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel); #endif