]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/wyvern.qc
Merge breaking changes for 0.8.5 into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / wyvern.qc
index 6b1965b542cdd4aad816a88a206f92f3f4be75a9..3b48c67e7d96f8eb41a006e049fd09b2f4b63164 100644 (file)
@@ -1,13 +1,17 @@
 #include "wyvern.qh"
 
 #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;
 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_speed_walk;
 
 void M_Wyvern_Attack_Fireball_Explode(entity this);
 void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher);
@@ -51,20 +55,6 @@ METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack this, entity actor, .entit
        return true;
 }
 
-float autocvar_g_monster_wyvern_health;
-float autocvar_g_monster_wyvern_damageforcescale = 0.6;
-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 M_Wyvern_Attack_Fireball_Explode(entity this)
 {
        Send_Effect(EFFECT_FIREBALL_EXPLODE, this.origin, '0 0 0', 1);
@@ -72,9 +62,9 @@ void M_Wyvern_Attack_Fireball_Explode(entity this)
        entity own = this.realowner;
 
        RadiusDamage(this, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force,
-                                               NULL, NULL, autocvar_g_monster_wyvern_attack_fireball_radius, this.projectiledeathtype, DMG_NOWEP, NULL);
+                                               own, NULL, autocvar_g_monster_wyvern_attack_fireball_radius, this.projectiledeathtype, DMG_NOWEP, NULL);
 
-       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_wyvern_attack_fireball_radius, it.takedamage == DAMAGE_AIM,
+       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_wyvern_attack_fireball_radius, it.takedamage == DAMAGE_AIM && it != own,
        {
                Fire_AddDamage(it, own, 5 * MONSTER_SKILLMOD(own), autocvar_g_monster_wyvern_attack_fireball_damagetime, this.projectiledeathtype);
        });
@@ -89,6 +79,15 @@ void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher)
        M_Wyvern_Attack_Fireball_Explode(this);
 }
 
+void M_Wyvern_Attack_Fireball(entity this)
+{
+       w_shotdir = normalize((this.enemy.origin + '0 0 10') - this.origin);
+       Weapon wep = WEP_WYVERN_ATTACK;
+       // TODO
+       .entity weaponentity = weaponentities[0];
+       wep.wr_think(wep, this, weaponentity, 1);
+}
+
 bool M_Wyvern_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
 {
        switch(attack_type)
@@ -96,9 +95,14 @@ bool M_Wyvern_Attack(int attack_type, entity actor, entity targ, .entity weapone
                case MONSTER_ATTACK_MELEE:
                case MONSTER_ATTACK_RANGED:
                {
-                       w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
-                       Weapon wep = WEP_WYVERN_ATTACK;
-                       wep.wr_think(wep, actor, weaponentity, 1);
+                       Monster_Delay(actor, 0, 1, M_Wyvern_Attack_Fireball);
+                       //actor.anim_finished = time + 1.2;
+                       setanim(actor, actor.anim_shoot, false, true, true);
+                       if(actor.animstate_endtime > time)
+                               actor.anim_finished = actor.animstate_endtime;
+                       else
+                               actor.anim_finished = time + 1.2;
+                       actor.attack_finished_single[0] = actor.anim_finished + 0.2;
                        return true;
                }
        }
@@ -116,6 +120,14 @@ METHOD(Wyvern, mr_think, bool(Wyvern this, entity actor))
     return true;
 }
 
+METHOD(Wyvern, mr_deadthink, bool(Wyvern this, entity actor))
+{
+    TC(Wyvern, this);
+    if(IS_ONGROUND(actor))
+       setanim(actor, actor.anim_die2, true, false, false);
+    return true;
+}
+
 METHOD(Wyvern, mr_pain, float(Wyvern this, entity actor, float damage_take, entity attacker, float deathtype))
 {
     TC(Wyvern, this);
@@ -139,12 +151,15 @@ METHOD(Wyvern, mr_anim, bool(Wyvern this, entity actor))
 {
     TC(Wyvern, this);
     vector none = '0 0 0';
-    actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
-    actor.anim_walk = animfixfps(actor, '1 1 1', none);
     actor.anim_idle = animfixfps(actor, '0 1 1', none);
+    actor.anim_walk = animfixfps(actor, '1 1 1', none);
+    actor.anim_run = animfixfps(actor, '2 1 1', none);
     actor.anim_pain1 = animfixfps(actor, '3 1 2', none); // 0.5 seconds
-    actor.anim_shoot = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
-    actor.anim_run = animfixfps(actor, '1 1 1', none);
+    actor.anim_pain2 = animfixfps(actor, '4 1 2', none); // 0.5 seconds
+    actor.anim_melee = animfixfps(actor, '5 1 5', none); // analyze models and set framerate
+    actor.anim_shoot = animfixfps(actor, '6 1 5', none); // analyze models and set framerate
+    actor.anim_die1 = animfixfps(actor, '7 1 0.5', none); // 2 seconds
+    actor.anim_die2 = animfixfps(actor, '8 1 0.5', none); // 2 seconds
     return true;
 }
 #endif