]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/wyvern.qc
Merge branch 'master' into Mario/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / wyvern.qc
index 1d184ce55ca6400becac27d8464aa0c834c7d333..a44f6d9c7ab2fe089dea4c821a8857fa3e98c0c0 100644 (file)
@@ -2,6 +2,7 @@
 REGISTER_MONSTER(
 /* MON_##id   */ WYVERN,
 /* function   */ m_wyvern,
+/* spawnflags */ MONSTER_TYPE_FLY | MONSTER_SIZE_BROKEN | MON_FLAG_RANGED,
 /* mins,maxs  */ '-20 -20 -58', '20 20 20',
 /* model      */ "wizard.mdl",
 /* netname    */ "wyvern",
@@ -10,22 +11,22 @@ REGISTER_MONSTER(
 
 #else
 #ifdef SVQC
-float autocvar_g_monster_wyvern;
 float autocvar_g_monster_wyvern_health;
-float autocvar_g_monster_wyvern_speed_walk;
+float autocvar_g_monster_wyvern_attack_fireball_damage;
+float autocvar_g_monster_wyvern_attack_fireball_edgedamage;
+float autocvar_g_monster_wyvern_attack_fireball_damagetime;
+float autocvar_g_monster_wyvern_attack_fireball_force;
+float autocvar_g_monster_wyvern_attack_fireball_radius;
+float autocvar_g_monster_wyvern_attack_fireball_speed;
+float autocvar_g_monster_wyvern_speed_stop;
 float autocvar_g_monster_wyvern_speed_run;
-float autocvar_g_monster_wyvern_fireball_damage;
-float autocvar_g_monster_wyvern_fireball_force;
-float autocvar_g_monster_wyvern_fireball_radius;
-float autocvar_g_monster_wyvern_fireball_edgedamage;
-float autocvar_g_monster_wyvern_fireball_damagetime;
-float autocvar_g_monster_wyvern_fireball_speed;
-
-const float wyvern_anim_hover  = 0;
-const float wyvern_anim_fly    = 1;
-const float wyvern_anim_magic  = 2;
-const float wyvern_anim_pain   = 3;
-const float wyvern_anim_death  = 4;
+float autocvar_g_monster_wyvern_speed_walk;
+
+const float wyvern_anim_hover  = 0;
+const float wyvern_anim_fly            = 1;
+const float wyvern_anim_magic  = 2;
+const float wyvern_anim_pain   = 3;
+const float wyvern_anim_death  = 4;
 
 void wyvern_fireball_explode()
 {
@@ -33,12 +34,12 @@ void wyvern_fireball_explode()
        if(self)
        {
                pointparticles(particleeffectnum("fireball_explode"), self.origin, '0 0 0', 1);
-               
-               RadiusDamage(self, self.realowner, autocvar_g_monster_wyvern_fireball_damage, autocvar_g_monster_wyvern_fireball_edgedamage, autocvar_g_monster_wyvern_fireball_force, world, autocvar_g_monster_wyvern_fireball_radius, self.projectiledeathtype, world);
-               
-               for(e = world; (e = findfloat(e, takedamage, DAMAGE_AIM)); ) if(vlen(e.origin - self.origin) <= autocvar_g_monster_wyvern_fireball_radius)
-                       Fire_AddDamage(e, self, 5 * monster_skill, autocvar_g_monster_wyvern_fireball_damagetime, self.projectiledeathtype);
-               
+
+               RadiusDamage(self, self.realowner, (autocvar_g_monster_wyvern_attack_fireball_damage), (autocvar_g_monster_wyvern_attack_fireball_edgedamage), (autocvar_g_monster_wyvern_attack_fireball_force), world, world, (autocvar_g_monster_wyvern_attack_fireball_radius), self.projectiledeathtype, world);
+
+               for(e = world; (e = findfloat(e, takedamage, DAMAGE_AIM)); ) if(vlen(e.origin - self.origin) <= (autocvar_g_monster_wyvern_attack_fireball_radius))
+                       Fire_AddDamage(e, self, 5 * Monster_SkillModifier(), (autocvar_g_monster_wyvern_attack_fireball_damagetime), self.projectiledeathtype);
+
                remove(self);
        }
 }
@@ -46,7 +47,7 @@ void wyvern_fireball_explode()
 void wyvern_fireball_touch()
 {
        PROJECTILE_TOUCH;
-       
+
        wyvern_fireball_explode();
 }
 
@@ -54,17 +55,17 @@ void wyvern_fireball()
 {
        entity missile = spawn();
        vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
-       
+
        monster_makevectors(self.enemy);
 
        missile.owner = missile.realowner = self;
        missile.solid = SOLID_TRIGGER;
        missile.movetype = MOVETYPE_FLYMISSILE;
        missile.projectiledeathtype = DEATH_MONSTER_WYVERN;
-       setsize(missile, '-6 -6 -6', '6 6 6');          
+       setsize(missile, '-6 -6 -6', '6 6 6');
        setorigin(missile, self.origin + self.view_ofs + v_forward * 14);
        missile.flags = FL_PROJECTILE;
-       missile.velocity = dir * autocvar_g_monster_wyvern_fireball_speed;
+       missile.velocity = dir * (autocvar_g_monster_wyvern_attack_fireball_speed);
        missile.avelocity = '300 300 300';
        missile.nextthink = time + 5;
        missile.think = wyvern_fireball_explode;
@@ -81,28 +82,21 @@ float wyvern_attack(float attack_type)
                case MONSTER_ATTACK_RANGED:
                {
                        self.attack_finished_single = time + 1.2;
-                       
+
                        wyvern_fireball();
-                       
+
                        return TRUE;
                }
        }
-       
+
        return FALSE;
 }
 
 void spawnfunc_monster_wyvern()
 {
-       if not(autocvar_g_monster_wyvern) { remove(self); return; }
-       
        self.classname = "monster_wyvern";
-       
-       self.monster_spawnfunc = spawnfunc_monster_wyvern;
-       
-       if(Monster_CheckAppearFlags(self))
-               return;
-       
-       if not(monster_initialize(MON_WYVERN, TRUE, MONSTER_TYPE_FLY | MONSTER_SIZE_BROKEN)) { remove(self); return; }
+
+       if(!monster_initialize(MON_WYVERN)) { remove(self); return; }
 }
 
 // compatibility with old spawns
@@ -114,12 +108,12 @@ float m_wyvern(float req)
        {
                case MR_THINK:
                {
-                       monster_move(autocvar_g_monster_wyvern_speed_run, autocvar_g_monster_wyvern_speed_walk, 300, wyvern_anim_fly, wyvern_anim_hover, wyvern_anim_hover);
+                       monster_move((autocvar_g_monster_wyvern_speed_run), (autocvar_g_monster_wyvern_speed_walk), (autocvar_g_monster_wyvern_speed_stop), wyvern_anim_fly, wyvern_anim_hover, wyvern_anim_hover);
                        return TRUE;
                }
                case MR_DEATH:
                {
-                       monsters_setframe(wyvern_anim_death);
+                       self.frame = wyvern_anim_death;
                        self.velocity_x = -200 + 400 * random();
                        self.velocity_y = -200 + 400 * random();
                        self.velocity_z = 100 + 100 * random();
@@ -127,20 +121,21 @@ float m_wyvern(float req)
                }
                case MR_SETUP:
                {
-                       if not(self.health) self.health = autocvar_g_monster_wyvern_health;
-                               
+                       if(!self.health) self.health = (autocvar_g_monster_wyvern_health);
+
+                       self.monster_loot = spawnfunc_item_cells;
                        self.monster_attackfunc = wyvern_attack;
-                       monsters_setframe(wyvern_anim_hover);
-                       
+                       self.frame = wyvern_anim_hover;
+
                        return TRUE;
                }
-               case MR_INIT:
+               case MR_PRECACHE:
                {
-                       // nothing
+                       precache_model("models/monsters/wizard.mdl");
                        return TRUE;
                }
        }
-       
+
        return TRUE;
 }
 
@@ -150,18 +145,12 @@ float m_wyvern(float req)
 {
        switch(req)
        {
-               case MR_DEATH:
+               case MR_PRECACHE:
                {
-                       // nothing
-                       return TRUE;
-               }
-               case MR_INIT:
-               {
-                       precache_model ("models/monsters/wizard.mdl");
                        return TRUE;
                }
        }
-       
+
        return TRUE;
 }