From: TimePath Date: Mon, 28 Sep 2015 03:56:22 +0000 (+1000) Subject: Monsters: upgrade mage X-Git-Tag: xonotic-v0.8.2~1874^2~81 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=145469ea1e7d218a759f16a7afa9a0ebf5d3e7e6;p=xonotic%2Fxonotic-data.pk3dir.git Monsters: upgrade mage --- diff --git a/qcsrc/common/monsters/all.qc b/qcsrc/common/monsters/all.qc index e17a90a7c..f0c5214fc 100644 --- a/qcsrc/common/monsters/all.qc +++ b/qcsrc/common/monsters/all.qc @@ -2,7 +2,7 @@ #define MONSTERS_ALL_C #include "all.qh" -REGISTER_MONSTER(Null, Monster) { +REGISTER_MONSTER(Null, NEW(Monster)) { this.netname = ""; this.monster_name = "Monster"; this.monster_func = m_null; diff --git a/qcsrc/common/monsters/all.qh b/qcsrc/common/monsters/all.qh index ea1eb5158..50964ecc0 100644 --- a/qcsrc/common/monsters/all.qh +++ b/qcsrc/common/monsters/all.qh @@ -9,10 +9,10 @@ int MON_COUNT; const int MON_FIRST = 1; #define MON_LAST (MON_FIRST + MON_COUNT - 1) /** If you register a new monster, make sure to add it to all.inc */ -#define REGISTER_MONSTER(id, class) REGISTER(RegisterMonsters, MON, monster_info, MON_COUNT, id, monsterid, NEW(class)) +#define REGISTER_MONSTER(id, inst) REGISTER(RegisterMonsters, MON, monster_info, MON_COUNT, id, monsterid, inst) #include "monster.qh" #define REGISTER_MONSTER_SIMPLE(id, monsterflags, min_s, max_s, modelname, shortname, mname) \ - REGISTER_MONSTER(id, Monster) { \ + REGISTER_MONSTER(id, NEW(Monster)) { \ this.netname = shortname; \ this.monster_name = mname; \ this.mdl = modelname; \ diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index d0c6f2e29..b1f5cf1ce 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -1,16 +1,15 @@ +CLASS(Mage, Monster) + ATTRIB(Mage, spawnflags, int, MON_FLAG_MELEE | MON_FLAG_RANGED); + ATTRIB(Mage, mins, vector, '-36 -36 -24'); + ATTRIB(Mage, maxs, vector, '36 36 50'); + ATTRIB(Mage, mdl, string, "mage.dpm"); + ATTRIB(Mage, model, string, strzone(strcat("models/monsters/", this.mdl))); + ATTRIB(Mage, netname, string, "mage"); + ATTRIB(Mage, monster_name, string, _("Mage")); +ENDCLASS(Mage) + +REGISTER_MONSTER(MAGE, NEW(Mage)) { #ifndef MENUQC -bool M_Mage(Monster thismon, int); -#endif -REGISTER_MONSTER_SIMPLE( -/* MON_##id */ MAGE, -/* spawnflags */ MON_FLAG_MELEE | MON_FLAG_RANGED, -/* mins,maxs */ '-36 -36 -24', '36 36 50', -/* model */ "mage.dpm", -/* netname */ "mage", -/* fullname */ _("Mage") -) { -#ifndef MENUQC - this.monster_func = M_Mage; MON_ACTION(this, MR_PRECACHE); #endif } @@ -368,13 +367,10 @@ void spawnfunc_monster_mage() { Monster_Spawn(MON_MAGE.monsterid); } #endif // SVQC -bool M_Mage(Monster thismon, int req) -{SELFPARAM(); - switch(req) - { #ifdef SVQC - case MR_THINK: + METHOD(Mage, mr_think, bool(Monster thismon)) { + SELFPARAM(); entity head; bool need_help = false; @@ -403,19 +399,21 @@ bool M_Mage(Monster thismon, int req) return true; } - case MR_PAIN: + METHOD(Mage, mr_pain, bool(Monster thismon)) { return true; } - case MR_DEATH: + METHOD(Mage, mr_death, bool(Monster thismon)) { + SELFPARAM(); setanim(self, self.anim_die1, false, true, true); return true; } #endif #ifndef MENUQC - case MR_ANIM: + METHOD(Mage, mr_anim, bool(Monster thismon)) { + SELFPARAM(); vector none = '0 0 0'; self.anim_die1 = animfixfps(self, '4 1 0.5', none); // 2 seconds self.anim_walk = animfixfps(self, '1 1 1', none); @@ -428,8 +426,9 @@ bool M_Mage(Monster thismon, int req) } #endif #ifdef SVQC - case MR_SETUP: + METHOD(Mage, mr_setup, bool(Monster thismon)) { + SELFPARAM(); if(!self.health) self.health = (autocvar_g_monster_mage_health); if(!self.speed) { self.speed = (autocvar_g_monster_mage_speed_walk); } if(!self.speed2) { self.speed2 = (autocvar_g_monster_mage_speed_run); } @@ -441,12 +440,8 @@ bool M_Mage(Monster thismon, int req) return true; } - case MR_PRECACHE: + METHOD(Mage, mr_precache, bool(Monster thismon)) { return true; } #endif - } - - return true; -}