]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a function to change the monster model path
authorMario <mario@smbclan.net>
Sun, 1 Nov 2015 01:12:23 +0000 (11:12 +1000)
committerMario <mario@smbclan.net>
Sun, 1 Nov 2015 01:12:23 +0000 (11:12 +1000)
qcsrc/common/monsters/all.qc
qcsrc/common/monsters/all.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/server/mutators/events.qh

index f4b2a4bf0bbb5ac7892ccc1f3ec60497bbbf8503..f5c973bd07bd10bb1aacbb32276dbdefb5f318ff 100644 (file)
@@ -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
index 72861f9d236eea06b46e4a44879e5598f42f5fd3..15e775ae7e5c6ec9b74b6d02c65c7980e2903fe2 100644 (file)
@@ -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;
index 20bb5c549b34d03fdabca52acd2d3f35f0ab5779..36f4a2584e9fe9332e6c1dbb19262348aa5137d7 100644 (file)
@@ -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)
index 1a1fb450ca2268d08ee9090a47ff8303b1ed5056..767cb97904035adbef0500dec457e618baf102f9 100644 (file)
@@ -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)
index 4167476c835df4e8f4f249e77e324396e386ad9c..01a006e13f85c478653006e205cab5bb6b16514e 100644 (file)
@@ -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)
index 315e8d66efde5d671b1db69ccda9194686041491..5cac8982920d5e781c00e67adac8b94f5d0f21ae 100644 (file)
@@ -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)
index b4389231c5137a6ff30828727bef94125d85e574..d63188b0fe9470c9391c91ef432348b8990bcedc 100644 (file)
@@ -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)
index d5796ea31fae7265f75cb99a1dd6895cf9822775..7bc65791ceaf39d1d50a3f77fc64c9a19db2dabe 100644 (file)
@@ -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