]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/mage.qc
Monsters: upgrade mage
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / mage.qc
index e8e38824b10b8fb14240db49d67830c27055b242..b1f5cf1ce8d68012fcd4f5b862abc9b5beec281a 100644 (file)
@@ -1,29 +1,28 @@
+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(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;
-    this.monster_func(MR_PRECACHE);
+    MON_ACTION(this, MR_PRECACHE);
 #endif
 }
 
+#include "../../weapons/all.qh"
+
 CLASS(MageSpike, PortoLaunch)
 /* flags     */ ATTRIB(MageSpike, spawnflags, int, WEP_TYPE_OTHER);
-/* impulse   */ ATTRIB(MageSpike, impulse, int, 5);
+/* impulse   */ ATTRIB(MageSpike, impulse, int, 9);
 /* refname   */ ATTRIB(MageSpike, netname, string, "magespike");
 /* wepname   */ ATTRIB(MageSpike, message, string, _("Mage spike"));
 ENDCLASS(MageSpike)
-REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike)) {
-       localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", this.netname, 230 + this.m_id - 1));
-}
+REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike));
 
 #ifdef SVQC
 
@@ -116,7 +115,7 @@ void M_Mage_Attack_Spike_Explode()
 {SELFPARAM();
        self.event_damage = func_null;
 
-       sound(self, CH_SHOTS, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM);
+       sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
 
        self.realowner.mage_spike = world;
 
@@ -279,7 +278,7 @@ void M_Mage_Defend_Heal()
 
 void M_Mage_Attack_Push()
 {SELFPARAM();
-       sound(self, CH_SHOTS, W_Sound("tagexp1"), 1, ATTEN_NORM);
+       sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
        RadiusDamage (self, self, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), world, world, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE, self.enemy);
        Send_Effect(EFFECT_TE_EXPLOSION, self.origin, '0 0 0', 1);
 
@@ -368,13 +367,10 @@ void spawnfunc_monster_mage() { Monster_Spawn(MON_MAGE.monsterid); }
 
 #endif // SVQC
 
-bool M_Mage(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(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(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,14 +440,8 @@ bool M_Mage(int req)
 
                        return true;
                }
-               case MR_PRECACHE:
+               METHOD(Mage, mr_precache, bool(Monster thismon))
                {
-                       precache_sound (W_Sound("grenade_impact"));
-                       precache_sound (W_Sound("tagexp1"));
                        return true;
                }
                #endif
-       }
-
-       return true;
-}