]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/wyvern.qc
Merge branch 'master' into Mario/monsters_broken
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / wyvern.qc
index 355d9fa23801ebca0e25f791b82310720de48c08..4dd3fd71f5cc68a78633b866a46149675d7bfd0a 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef MENUQC
-bool m_wyvern(int);
+bool M_Wyvern(int);
 #endif
 REGISTER_MONSTER_SIMPLE(
 /* MON_##id   */ WYVERN,
@@ -10,12 +10,14 @@ REGISTER_MONSTER_SIMPLE(
 /* fullname   */ _("Wyvern")
 ) {
 #ifndef MENUQC
-       this.monster_func = m_wyvern;
+       this.monster_func = M_Wyvern;
+       this.monster_func(MR_PRECACHE);
 #endif
 }
 
 #ifdef SVQC
 float autocvar_g_monster_wyvern_health;
+float autocvar_g_monster_wyvern_damageforcescale = 0.6;
 float autocvar_g_monster_wyvern_attack_fireball_damage;
 float autocvar_g_monster_wyvern_attack_fireball_edgedamage;
 float autocvar_g_monster_wyvern_attack_fireball_damagetime;
@@ -26,13 +28,15 @@ float autocvar_g_monster_wyvern_speed_stop;
 float autocvar_g_monster_wyvern_speed_run;
 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()
+void M_Wyvern_Attack_Fireball_Explode()
 {
        entity e;
        if(self)
@@ -42,20 +46,20 @@ void wyvern_fireball_explode()
                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);
+                       Fire_AddDamage(e, self, 5 * MONSTER_SKILLMOD(self), (autocvar_g_monster_wyvern_attack_fireball_damagetime), self.projectiledeathtype);
 
                remove(self);
        }
 }
 
-void wyvern_fireball_touch()
+void M_Wyvern_Attack_Fireball_Touch()
 {
        PROJECTILE_TOUCH;
 
-       wyvern_fireball_explode();
+       M_Wyvern_Attack_Fireball_Explode();
 }
 
-void wyvern_fireball()
+void M_Wyvern_Attack_Fireball()
 {
        entity missile = spawn();
        vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
@@ -72,13 +76,13 @@ void wyvern_fireball()
        missile.velocity = dir * (autocvar_g_monster_wyvern_attack_fireball_speed);
        missile.avelocity = '300 300 300';
        missile.nextthink = time + 5;
-       missile.think = wyvern_fireball_explode;
+       missile.think = M_Wyvern_Attack_Fireball_Explode;
        missile.enemy = self.enemy;
-       missile.touch = wyvern_fireball_touch;
+       missile.touch = M_Wyvern_Attack_Fireball_Touch;
        CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
 }
 
-float wyvern_attack(float attack_type)
+float M_Wyvern_Attack(float attack_type)
 {
        switch(attack_type)
        {
@@ -86,8 +90,9 @@ float wyvern_attack(float attack_type)
                case MONSTER_ATTACK_RANGED:
                {
                        self.attack_finished_single = time + 1.2;
+                       self.anim_finished = time + 1.2;
 
-                       wyvern_fireball();
+                       M_Wyvern_Attack_Fireball();
 
                        return true;
                }
@@ -96,40 +101,58 @@ float wyvern_attack(float attack_type)
        return false;
 }
 
-void spawnfunc_monster_wyvern()
-{
-       self.classname = "monster_wyvern";
-
-       if(!monster_initialize(MON_WYVERN.monsterid)) { remove(self); return; }
-}
-
-// compatibility with old spawns
-void spawnfunc_monster_wizard() { spawnfunc_monster_wyvern(); }
+void spawnfunc_monster_wyvern() { Monster_Spawn(MON_WYVERN.monsterid); }
+#endif // SVQC
 
-float m_wyvern(float req)
+bool M_Wyvern(int req)
 {
        switch(req)
        {
+               #ifdef SVQC
                case MR_THINK:
                {
-                       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_PAIN:
+               {
+                       self.pain_finished = time + 0.5;
+                       setanim(self, self.anim_pain1, true, true, false);
                        return true;
                }
                case MR_DEATH:
                {
-                       self.frame = wyvern_anim_death;
+                       setanim(self, self.anim_die1, false, true, true);
                        self.velocity_x = -200 + 400 * random();
                        self.velocity_y = -200 + 400 * random();
                        self.velocity_z = 100 + 100 * random();
                        return true;
                }
+               #endif
+               #ifndef MENUQC
+               case MR_ANIM:
+               {
+                       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);
+                       self.anim_idle = animfixfps(self, '0 1 1', none);
+                       self.anim_pain1 = animfixfps(self, '3 1 2', none); // 0.5 seconds
+                       self.anim_shoot = animfixfps(self, '2 1 5', none); // analyze models and set framerate
+                       self.anim_run = animfixfps(self, '1 1 1', none);
+
+                       return true;
+               }
+               #endif
+               #ifdef SVQC
                case MR_SETUP:
                {
                        if(!self.health) self.health = (autocvar_g_monster_wyvern_health);
+                       if(!self.speed) { self.speed = (autocvar_g_monster_wyvern_speed_walk); }
+                       if(!self.speed2) { self.speed2 = (autocvar_g_monster_wyvern_speed_run); }
+                       if(!self.stopspeed) { self.stopspeed = (autocvar_g_monster_wyvern_speed_stop); }
+                       if(!self.damageforcescale) { self.damageforcescale = (autocvar_g_monster_wyvern_damageforcescale); }
 
                        self.monster_loot = spawnfunc_item_cells;
-                       self.monster_attackfunc = wyvern_attack;
-                       self.frame = wyvern_anim_hover;
+                       self.monster_attackfunc = M_Wyvern_Attack;
 
                        return true;
                }
@@ -138,24 +161,8 @@ float m_wyvern(float req)
                        precache_model("models/monsters/wizard.mdl");
                        return true;
                }
+               #endif
        }
 
        return true;
 }
-
-#endif // SVQC
-#ifdef CSQC
-float m_wyvern(float req)
-{
-       switch(req)
-       {
-               case MR_PRECACHE:
-               {
-                       return true;
-               }
-       }
-
-       return true;
-}
-
-#endif // CSQC