]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/wyvern.qc
Merge branch 'master' into terencehill/hud_fixes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / wyvern.qc
index 02b6a59508980f7ac29015967157f79b39af438e..1adf8f84c85af71053b4d98cbf2e39ceaf7170c1 100644 (file)
@@ -49,10 +49,12 @@ void M_Wyvern_Attack_Fireball_Explode();
 void M_Wyvern_Attack_Fireball_Touch();
 
 SOUND(WyvernAttack_FIRE, W_Sound("electro_fire"));
-METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire)) {
+METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire))
+{
+    TC(WyvernAttack, thiswep);
     if (fire & 1)
     if (time > actor.attack_finished_single[0] || weapon_prepareattack(thiswep, actor, weaponentity, false, 1.2)) {
-        if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, SND(WyvernAttack_FIRE), CH_WEAPON_B, 0);
+        if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, SND_WyvernAttack_FIRE, CH_WEAPON_B, 0);
                if (IS_MONSTER(actor)) {
                        actor.attack_finished_single[0] = time + 1.2;
                        actor.anim_finished = time + 1.2;
@@ -78,7 +80,8 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity
     }
 }
 
-METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack thiswep)) {
+METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack this)) {
+    TC(WyvernAttack, this);
        return true;
 }
 
@@ -101,13 +104,15 @@ void M_Wyvern_Attack_Fireball_Explode()
        SELFPARAM();
        Send_Effect(EFFECT_FIREBALL_EXPLODE, self.origin, '0 0 0', 1);
 
-       entity owner = self.realowner;
+       entity own = self.realowner;
 
-       RadiusDamage(self, owner, 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);
+       RadiusDamage(self, own, 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 (entity e = world; (e = findfloat(e, takedamage, DAMAGE_AIM)); )
-       if (vlen(e.origin - self.origin) <= (autocvar_g_monster_wyvern_attack_fireball_radius))
-               Fire_AddDamage(e, owner, 5 * MONSTER_SKILLMOD(owner), (autocvar_g_monster_wyvern_attack_fireball_damagetime), self.projectiledeathtype);
+       FOREACH_ENTITY_FLOAT(takedamage, DAMAGE_AIM,
+       {
+               if(vdist(it.origin - self.origin, <=, autocvar_g_monster_wyvern_attack_fireball_radius))
+                       Fire_AddDamage(it, own, 5 * MONSTER_SKILLMOD(own), autocvar_g_monster_wyvern_attack_fireball_damagetime, self.projectiledeathtype);
+       });
 
        remove(self);
 }
@@ -140,58 +145,67 @@ bool M_Wyvern_Attack(int attack_type, entity actor, entity targ)
 spawnfunc(monster_wyvern) { Monster_Spawn(this, MON_WYVERN.monsterid); }
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Wyvern, mr_think, bool(Wyvern thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Wyvern, mr_pain, bool(Wyvern thismon, entity actor))
-               {
-                       actor.pain_finished = time + 0.5;
-                       setanim(actor, actor.anim_pain1, true, true, false);
-                       return true;
-               }
-               METHOD(Wyvern, mr_death, bool(Wyvern thismon, entity actor))
-               {
-                       setanim(actor, actor.anim_die1, false, true, true);
-                       actor.velocity_x = -200 + 400 * random();
-                       actor.velocity_y = -200 + 400 * random();
-                       actor.velocity_z = 100 + 100 * random();
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Wyvern, mr_anim, bool(Wyvern thismon, entity actor))
-               {
-                       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_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);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               spawnfunc(item_cells);
-               METHOD(Wyvern, mr_setup, bool(Wyvern thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_wyvern_health);
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_wyvern_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_wyvern_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_wyvern_speed_stop); }
-                       if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_wyvern_damageforcescale); }
+#ifdef SVQC
+METHOD(Wyvern, mr_think, bool(Wyvern this, entity actor))
+{
+    TC(Wyvern, this);
+    return true;
+}
 
-                       actor.monster_loot = spawnfunc_item_cells;
-                       actor.monster_attackfunc = M_Wyvern_Attack;
+METHOD(Wyvern, mr_pain, bool(Wyvern this, entity actor))
+{
+    TC(Wyvern, this);
+    actor.pain_finished = time + 0.5;
+    setanim(actor, actor.anim_pain1, true, true, false);
+    return true;
+}
 
-                       return true;
-               }
-               METHOD(Wyvern, mr_precache, bool(Wyvern thismon))
-               {
-                       return true;
-               }
-               #endif
+METHOD(Wyvern, mr_death, bool(Wyvern this, entity actor))
+{
+    TC(Wyvern, this);
+    setanim(actor, actor.anim_die1, false, true, true);
+    actor.velocity_x = -200 + 400 * random();
+    actor.velocity_y = -200 + 400 * random();
+    actor.velocity_z = 100 + 100 * random();
+    return true;
+}
+#endif
+#ifndef MENUQC
+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_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);
+    return true;
+}
+#endif
+#ifdef SVQC
+spawnfunc(item_cells);
+METHOD(Wyvern, mr_setup, bool(Wyvern this, entity actor))
+{
+    TC(Wyvern, this);
+    if(!actor.health) actor.health = (autocvar_g_monster_wyvern_health);
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_wyvern_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_wyvern_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_wyvern_speed_stop); }
+    if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_wyvern_damageforcescale); }
+
+    actor.monster_loot = spawnfunc_item_cells;
+    actor.monster_attackfunc = M_Wyvern_Attack;
+
+    return true;
+}
+
+METHOD(Wyvern, mr_precache, bool(Wyvern this))
+{
+    TC(Wyvern, this);
+    return true;
+}
+#endif
 
 #endif