]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix indentation
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 9 Mar 2016 10:15:49 +0000 (21:15 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 9 Mar 2016 10:15:49 +0000 (21:15 +1100)
33 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc

index d1ac1b40ab54be7af3b62ff6bee1b6cecf686734..df062641a6126088cd15e84d732a9748d5448f6c 100644 (file)
@@ -852,48 +852,51 @@ float ball_customize()
        return true;
 }
 
-       METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
-       {
-               if(fire & 1)
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
-                               if(autocvar_g_nexball_basketball_meter)
-                               {
-                                       if(self.ballcarried && !self.metertime)
-                                               self.metertime = time;
-                                       else
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
-                               }
-                               else
-                               {
-                                       W_Nexball_Attack(-1);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
-                               }
-               if(fire & 2)
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
-                       {
-                               W_Nexball_Attack2();
-                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
-                       }
+METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(fire & 1)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
+            if(autocvar_g_nexball_basketball_meter)
+            {
+                if(self.ballcarried && !self.metertime)
+                    self.metertime = time;
+                else
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+            }
+            else
+            {
+                W_Nexball_Attack(-1);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+            }
+    if(fire & 2)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
+        {
+            W_Nexball_Attack2();
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
+        }
+
+    if(!(fire & 1) && self.metertime && self.ballcarried)
+    {
+        W_Nexball_Attack(time - self.metertime);
+        // DropBall or stealing will set metertime back to 0
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+    }
+}
 
-               if(!(fire & 1) && self.metertime && self.ballcarried)
-               {
-                       W_Nexball_Attack(time - self.metertime);
-                       // DropBall or stealing will set metertime back to 0
-                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
-               }
-       }
-       METHOD(BallStealer, wr_setup, void(BallStealer thiswep))
-       {
-               //weapon_setup(WEP_PORTO.m_id);
-       }
-       METHOD(BallStealer, wr_checkammo1, bool(BallStealer thiswep))
-       {
-               return true;
-       }
-       METHOD(BallStealer, wr_checkammo2, bool(BallStealer thiswep))
-       {
-               return true;
-       }
+METHOD(BallStealer, wr_setup, void(BallStealer thiswep))
+{
+    //weapon_setup(WEP_PORTO.m_id);
+}
+
+METHOD(BallStealer, wr_checkammo1, bool(BallStealer thiswep))
+{
+    return true;
+}
+
+METHOD(BallStealer, wr_checkammo2, bool(BallStealer thiswep))
+{
+    return true;
+}
 
 void nb_DropBall(entity player)
 {
index 37c6301fbdbf8fcd5bd8f97620821f88c7f0914c..c71e8c911ccfa1dde53e7aa85c926437fba453b8 100644 (file)
@@ -408,81 +408,85 @@ spawnfunc(monster_mage) { Monster_Spawn(this, MON_MAGE.monsterid); }
 
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
-               {
-                       bool need_help = false;
+#ifdef SVQC
+METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
+{
+    bool need_help = false;
 
-                       FOREACH_ENTITY_FLOAT(iscreature, true,
-                       {
-                               if(it != actor)
-                               if(vdist(it.origin - actor.origin, <=, autocvar_g_monster_mage_heal_range))
-                               if(M_Mage_Defend_Heal_Check(actor, it))
-                               {
-                                       need_help = true;
-                                       break;
-                               }
-                       });
+    FOREACH_ENTITY_FLOAT(iscreature, true,
+    {
+        if(it != actor)
+        if(vdist(it.origin - actor.origin, <=, autocvar_g_monster_mage_heal_range))
+        if(M_Mage_Defend_Heal_Check(actor, it))
+        {
+            need_help = true;
+            break;
+        }
+    });
+
+    if(actor.health < (autocvar_g_monster_mage_heal_minhealth) || need_help)
+    if(time >= actor.attack_finished_single[0])
+    if(random() < 0.5)
+        M_Mage_Defend_Heal(actor);
+
+    if(time >= actor.mage_shield_time && actor.armorvalue)
+        M_Mage_Defend_Shield_Remove(actor);
+
+    if(actor.enemy)
+    if(actor.health < actor.max_health)
+    if(time >= actor.mage_shield_delay)
+    if(random() < 0.5)
+        M_Mage_Defend_Shield(actor);
+
+    return true;
+}
 
-                       if(actor.health < (autocvar_g_monster_mage_heal_minhealth) || need_help)
-                       if(time >= actor.attack_finished_single[0])
-                       if(random() < 0.5)
-                               M_Mage_Defend_Heal(actor);
+METHOD(Mage, mr_pain, bool(Mage thismon, entity actor))
+{
+    return true;
+}
 
-                       if(time >= actor.mage_shield_time && actor.armorvalue)
-                               M_Mage_Defend_Shield_Remove(actor);
+METHOD(Mage, mr_death, bool(Mage thismon, entity actor))
+{
+    setanim(actor, actor.anim_die1, false, true, true);
+    return true;
+}
 
-                       if(actor.enemy)
-                       if(actor.health < actor.max_health)
-                       if(time >= actor.mage_shield_delay)
-                       if(random() < 0.5)
-                               M_Mage_Defend_Shield(actor);
+#endif
+#ifndef MENUQC
+METHOD(Mage, mr_anim, bool(Mage 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, '5 1 1', none);
+    return true;
+}
+#endif
+#ifdef SVQC
+.float speed;
+spawnfunc(item_health_large);
+METHOD(Mage, mr_setup, bool(Mage thismon, entity actor))
+{
+    if(!actor.health) actor.health = (autocvar_g_monster_mage_health);
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_mage_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_mage_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_mage_speed_stop); }
+    if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_mage_damageforcescale); }
 
-                       return true;
-               }
-               METHOD(Mage, mr_pain, bool(Mage thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Mage, mr_death, bool(Mage thismon, entity actor))
-               {
-                       setanim(actor, actor.anim_die1, false, true, true);
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Mage, mr_anim, bool(Mage 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, '5 1 1', none);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               .float speed;
-               spawnfunc(item_health_large);
-               METHOD(Mage, mr_setup, bool(Mage thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_mage_health);
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_mage_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_mage_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_mage_speed_stop); }
-                       if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_mage_damageforcescale); }
+    actor.monster_loot = spawnfunc_item_health_large;
+    actor.monster_attackfunc = M_Mage_Attack;
 
-                       actor.monster_loot = spawnfunc_item_health_large;
-                       actor.monster_attackfunc = M_Mage_Attack;
+    return true;
+}
 
-                       return true;
-               }
-               METHOD(Mage, mr_precache, bool(Mage thismon))
-               {
-                       return true;
-               }
-               #endif
+METHOD(Mage, mr_precache, bool(Mage thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index 0ffa60f8cc44c2311af878cadd017029b6b060c5..b091712791b9c5001aeed10841458cbd92872fe1 100644 (file)
@@ -224,65 +224,68 @@ bool M_Shambler_Attack(int attack_type, entity actor, entity targ)
 spawnfunc(monster_shambler) { Monster_Spawn(this, MON_SHAMBLER.monsterid); }
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Shambler, mr_think, bool(Shambler thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Shambler, mr_pain, bool(Shambler thismon, entity actor))
-               {
-                       actor.pain_finished = time + 0.5;
-                       setanim(actor, actor.anim_pain1, true, true, false);
-                       return true;
-               }
-               METHOD(Shambler, mr_death, bool(Shambler thismon, entity actor))
-               {
-                       setanim(actor, actor.anim_die1, false, true, true);
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Shambler, mr_anim, bool(Shambler thismon, entity actor))
-               {
-                       vector none = '0 0 0';
-                       actor.anim_die1 = animfixfps(actor, '8 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, '7 1 2', none); // 0.5 seconds
-                       actor.anim_melee1 = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
-                       actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
-                       actor.anim_melee3 = 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_run = animfixfps(actor, '2 1 1', none);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               spawnfunc(item_health_mega);
-               .float animstate_endtime;
-               METHOD(Shambler, mr_setup, bool(Shambler thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_shambler_health);
-                       if(!actor.attack_range) actor.attack_range = 150;
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_shambler_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_shambler_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_shambler_speed_stop); }
-                       if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_shambler_damageforcescale); }
+#ifdef SVQC
+METHOD(Shambler, mr_think, bool(Shambler thismon, entity actor))
+{
+    return true;
+}
 
-                       actor.monster_loot = spawnfunc_item_health_mega;
-                       actor.weapon = WEP_ELECTRO.m_id; // matches attacks better than WEP_VORTEX
+METHOD(Shambler, mr_pain, bool(Shambler thismon, entity actor))
+{
+    actor.pain_finished = time + 0.5;
+    setanim(actor, actor.anim_pain1, true, true, false);
+    return true;
+}
 
-                       setanim(actor, actor.anim_shoot, false, true, true);
-                       actor.spawn_time = actor.animstate_endtime;
-                       actor.spawnshieldtime = actor.spawn_time;
-                       actor.monster_attackfunc = M_Shambler_Attack;
+METHOD(Shambler, mr_death, bool(Shambler thismon, entity actor))
+{
+    setanim(actor, actor.anim_die1, false, true, true);
+    return true;
+}
+#endif
+#ifndef MENUQC
+METHOD(Shambler, mr_anim, bool(Shambler thismon, entity actor))
+{
+    vector none = '0 0 0';
+    actor.anim_die1 = animfixfps(actor, '8 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, '7 1 2', none); // 0.5 seconds
+    actor.anim_melee1 = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
+    actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
+    actor.anim_melee3 = 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_run = animfixfps(actor, '2 1 1', none);
+    return true;
+}
+#endif
+#ifdef SVQC
+spawnfunc(item_health_mega);
+.float animstate_endtime;
+METHOD(Shambler, mr_setup, bool(Shambler thismon, entity actor))
+{
+    if(!actor.health) actor.health = (autocvar_g_monster_shambler_health);
+    if(!actor.attack_range) actor.attack_range = 150;
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_shambler_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_shambler_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_shambler_speed_stop); }
+    if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_shambler_damageforcescale); }
+
+    actor.monster_loot = spawnfunc_item_health_mega;
+    actor.weapon = WEP_ELECTRO.m_id; // matches attacks better than WEP_VORTEX
+
+    setanim(actor, actor.anim_shoot, false, true, true);
+    actor.spawn_time = actor.animstate_endtime;
+    actor.spawnshieldtime = actor.spawn_time;
+    actor.monster_attackfunc = M_Shambler_Attack;
+
+    return true;
+}
 
-                       return true;
-               }
-               METHOD(Shambler, mr_precache, bool(Shambler thismon))
-               {
-                       return true;
-               }
-               #endif
+METHOD(Shambler, mr_precache, bool(Shambler thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index 89239941ee1d3dfc4c25d60e2f1cb93b21245415..512422d33b9c8227420106035d5b9e41991c3c9e 100644 (file)
@@ -214,53 +214,56 @@ bool M_Spider_Attack(int attack_type, entity actor, entity targ)
 spawnfunc(monster_spider) { Monster_Spawn(this, MON_SPIDER.monsterid); }
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Spider, mr_think, bool(Spider thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Spider, mr_pain, bool(Spider thismon, entity actor))
-               {
-                       return true;
-               }
-               METHOD(Spider, mr_death, bool(Spider thismon, entity actor))
-               {
-                       setanim(actor, actor.anim_melee, false, true, true);
-                       actor.angles_x = 180;
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Spider, mr_anim, bool(Spider thismon, entity actor))
-               {
-                       vector none = '0 0 0';
-                       actor.anim_walk = animfixfps(actor, '1 1 1', none);
-                       actor.anim_idle = animfixfps(actor, '0 1 1', none);
-                       actor.anim_melee = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
-                       actor.anim_shoot = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
-                       actor.anim_run = animfixfps(actor, '1 1 1', none);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               spawnfunc(item_health_medium);
-               METHOD(Spider, mr_setup, bool(Spider thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_spider_health);
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_spider_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_spider_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_spider_speed_stop); }
-                       if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_spider_damageforcescale); }
+#ifdef SVQC
+METHOD(Spider, mr_think, bool(Spider thismon, entity actor))
+{
+    return true;
+}
 
-                       actor.monster_loot = spawnfunc_item_health_medium;
-                       actor.monster_attackfunc = M_Spider_Attack;
+METHOD(Spider, mr_pain, bool(Spider thismon, entity actor))
+{
+    return true;
+}
 
-                       return true;
-               }
-               METHOD(Spider, mr_precache, bool(Spider thismon))
-               {
-                       return true;
-               }
-               #endif
+METHOD(Spider, mr_death, bool(Spider thismon, entity actor))
+{
+    setanim(actor, actor.anim_melee, false, true, true);
+    actor.angles_x = 180;
+    return true;
+}
+#endif
+#ifndef MENUQC
+METHOD(Spider, mr_anim, bool(Spider thismon, entity actor))
+{
+    vector none = '0 0 0';
+    actor.anim_walk = animfixfps(actor, '1 1 1', none);
+    actor.anim_idle = animfixfps(actor, '0 1 1', none);
+    actor.anim_melee = animfixfps(actor, '2 1 5', none); // analyze models and set framerate
+    actor.anim_shoot = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
+    actor.anim_run = animfixfps(actor, '1 1 1', none);
+    return true;
+}
+#endif
+#ifdef SVQC
+spawnfunc(item_health_medium);
+METHOD(Spider, mr_setup, bool(Spider thismon, entity actor))
+{
+    if(!actor.health) actor.health = (autocvar_g_monster_spider_health);
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_spider_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_spider_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_spider_speed_stop); }
+    if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_spider_damageforcescale); }
+
+    actor.monster_loot = spawnfunc_item_health_medium;
+    actor.monster_attackfunc = M_Spider_Attack;
+
+    return true;
+}
+
+METHOD(Spider, mr_precache, bool(Spider thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index b7d398da6dbdf1874bec30623f4751009a299ee9..fc13de40ffc314aa268794e00068ff9281c622fc 100644 (file)
@@ -142,58 +142,61 @@ 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 thismon, entity actor))
+{
+    return true;
+}
 
-                       actor.monster_loot = spawnfunc_item_cells;
-                       actor.monster_attackfunc = M_Wyvern_Attack;
+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;
+}
 
-                       return true;
-               }
-               METHOD(Wyvern, mr_precache, bool(Wyvern thismon))
-               {
-                       return true;
-               }
-               #endif
+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); }
+
+    actor.monster_loot = spawnfunc_item_cells;
+    actor.monster_attackfunc = M_Wyvern_Attack;
+
+    return true;
+}
+
+METHOD(Wyvern, mr_precache, bool(Wyvern thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index b522a9647e1f6ca6109b9f82731bb74ddae17301..9163aaf071e5f9dea4f2d6f920abf43584d2a51e 100644 (file)
@@ -154,76 +154,79 @@ bool M_Zombie_Attack(int attack_type, entity actor, entity targ)
 spawnfunc(monster_zombie) { Monster_Spawn(this, MON_ZOMBIE.monsterid); }
 #endif // SVQC
 
-               #ifdef SVQC
-               METHOD(Zombie, mr_think, bool(Zombie thismon, entity actor))
-               {
-                       if(time >= actor.spawn_time)
-                               actor.damageforcescale = autocvar_g_monster_zombie_damageforcescale;
-                       return true;
-               }
-               METHOD(Zombie, mr_pain, bool(Zombie thismon, entity actor))
-               {
-                       actor.pain_finished = time + 0.34;
-                       setanim(actor, ((random() > 0.5) ? actor.anim_pain1 : actor.anim_pain2), true, true, false);
-                       return true;
-               }
-               METHOD(Zombie, mr_death, bool(Zombie thismon, entity actor))
-               {
-                       actor.armorvalue = autocvar_g_monsters_armor_blockpercent;
+#ifdef SVQC
+METHOD(Zombie, mr_think, bool(Zombie thismon, entity actor))
+{
+    if(time >= actor.spawn_time)
+        actor.damageforcescale = autocvar_g_monster_zombie_damageforcescale;
+    return true;
+}
 
-                       setanim(actor, ((random() > 0.5) ? actor.anim_die1 : actor.anim_die2), false, true, true);
-                       return true;
-               }
-               #endif
-               #ifndef MENUQC
-               METHOD(Zombie, mr_anim, bool(Zombie thismon, entity actor))
-               {
-                       vector none = '0 0 0';
-                       actor.anim_die1 = animfixfps(actor, '9 1 0.5', none); // 2 seconds
-                       actor.anim_die2 = animfixfps(actor, '12 1 0.5', none); // 2 seconds
-                       actor.anim_spawn = animfixfps(actor, '30 1 3', none);
-                       actor.anim_walk = animfixfps(actor, '27 1 1', none);
-                       actor.anim_idle = animfixfps(actor, '19 1 1', none);
-                       actor.anim_pain1 = animfixfps(actor, '20 1 2', none); // 0.5 seconds
-                       actor.anim_pain2 = animfixfps(actor, '22 1 2', none); // 0.5 seconds
-                       actor.anim_melee1 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
-                       actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
-                       actor.anim_melee3 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
-                       actor.anim_shoot = animfixfps(actor, '0 1 5', none); // analyze models and set framerate
-                       actor.anim_run = animfixfps(actor, '27 1 1', none);
-                       actor.anim_blockstart = animfixfps(actor, '8 1 1', none);
-                       actor.anim_blockend = animfixfps(actor, '7 1 1', none);
-                       return true;
-               }
-               #endif
-               #ifdef SVQC
-               METHOD(Zombie, mr_setup, bool(Zombie thismon, entity actor))
-               {
-                       if(!actor.health) actor.health = (autocvar_g_monster_zombie_health);
-                       if(!actor.speed) { actor.speed = (autocvar_g_monster_zombie_speed_walk); }
-                       if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_zombie_speed_run); }
-                       if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_zombie_speed_stop); }
+METHOD(Zombie, mr_pain, bool(Zombie thismon, entity actor))
+{
+    actor.pain_finished = time + 0.34;
+    setanim(actor, ((random() > 0.5) ? actor.anim_pain1 : actor.anim_pain2), true, true, false);
+    return true;
+}
 
-                       if(actor.spawnflags & MONSTERFLAG_NORESPAWN)
-                               actor.spawnflags &= ~MONSTERFLAG_NORESPAWN; // zombies always respawn
+METHOD(Zombie, mr_death, bool(Zombie thismon, entity actor))
+{
+    actor.armorvalue = autocvar_g_monsters_armor_blockpercent;
 
-                       actor.spawnflags |= MONSTER_RESPAWN_DEATHPOINT;
+    setanim(actor, ((random() > 0.5) ? actor.anim_die1 : actor.anim_die2), false, true, true);
+    return true;
+}
+#endif
+#ifndef MENUQC
+METHOD(Zombie, mr_anim, bool(Zombie thismon, entity actor))
+{
+    vector none = '0 0 0';
+    actor.anim_die1 = animfixfps(actor, '9 1 0.5', none); // 2 seconds
+    actor.anim_die2 = animfixfps(actor, '12 1 0.5', none); // 2 seconds
+    actor.anim_spawn = animfixfps(actor, '30 1 3', none);
+    actor.anim_walk = animfixfps(actor, '27 1 1', none);
+    actor.anim_idle = animfixfps(actor, '19 1 1', none);
+    actor.anim_pain1 = animfixfps(actor, '20 1 2', none); // 0.5 seconds
+    actor.anim_pain2 = animfixfps(actor, '22 1 2', none); // 0.5 seconds
+    actor.anim_melee1 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
+    actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
+    actor.anim_melee3 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
+    actor.anim_shoot = animfixfps(actor, '0 1 5', none); // analyze models and set framerate
+    actor.anim_run = animfixfps(actor, '27 1 1', none);
+    actor.anim_blockstart = animfixfps(actor, '8 1 1', none);
+    actor.anim_blockend = animfixfps(actor, '7 1 1', none);
+    return true;
+}
+#endif
+#ifdef SVQC
+METHOD(Zombie, mr_setup, bool(Zombie thismon, entity actor))
+{
+    if(!actor.health) actor.health = (autocvar_g_monster_zombie_health);
+    if(!actor.speed) { actor.speed = (autocvar_g_monster_zombie_speed_walk); }
+    if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_zombie_speed_run); }
+    if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_zombie_speed_stop); }
 
-                       actor.monster_loot = spawnfunc_item_health_medium;
-                       actor.monster_attackfunc = M_Zombie_Attack;
-                       actor.spawnshieldtime = actor.spawn_time;
-                       actor.respawntime = 0.2;
-                       actor.damageforcescale = 0.0001; // no push while spawning
+    if(actor.spawnflags & MONSTERFLAG_NORESPAWN)
+        actor.spawnflags &= ~MONSTERFLAG_NORESPAWN; // zombies always respawn
 
-                       setanim(actor, actor.anim_spawn, false, true, true);
-                       actor.spawn_time = actor.animstate_endtime;
+    actor.spawnflags |= MONSTER_RESPAWN_DEATHPOINT;
 
-                       return true;
-               }
-               METHOD(Zombie, mr_precache, bool(Zombie thismon))
-               {
-                       return true;
-               }
-               #endif
+    actor.monster_loot = spawnfunc_item_health_medium;
+    actor.monster_attackfunc = M_Zombie_Attack;
+    actor.spawnshieldtime = actor.spawn_time;
+    actor.respawntime = 0.2;
+    actor.damageforcescale = 0.0001; // no push while spawning
+
+    setanim(actor, actor.anim_spawn, false, true, true);
+    actor.spawn_time = actor.animstate_endtime;
+
+    return true;
+}
+
+METHOD(Zombie, mr_precache, bool(Zombie thismon))
+{
+    return true;
+}
+#endif
 
 #endif
index fb1a496331c5a1c42bae9afd6f2c21ff6d163c61..c656c35a5f0816a7104839ed43316229209efe0e 100644 (file)
@@ -98,72 +98,78 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
 }
 
-               METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
-               {
-                       if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
-                       else
-                               PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
-               }
-               METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       {
-                               if (fire & 1)
-                               if (weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
-                               {
-                                       actor.misc_bulletcounter = 0;
-                                       W_HeavyMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
-                               }
-                       }
-               }
-               METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
-
-                       if(autocvar_g_balance_hmg_reload_ammo)
-                               ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
-
-                       return ammo_amount;
-               }
-               METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
-
-                       if(autocvar_g_balance_hmg_reload_ammo)
-                               ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
-
-                       return ammo_amount;
-               }
-               METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
-               }
-               METHOD(HeavyMachineGun, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(HeavyMachineGun, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_HMG_MURDER_SNIPE;
-                       else
-                               return WEAPON_HMG_MURDER_SPRAY;
-               }
+METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
+{
+    if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+    else
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+}
+
+METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    {
+        if (fire & 1)
+        if (weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+        {
+            actor.misc_bulletcounter = 0;
+            W_HeavyMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
+        }
+    }
+}
+
+METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
+
+    if(autocvar_g_balance_hmg_reload_ammo)
+        ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
+
+    return ammo_amount;
+}
+
+METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
+
+    if(autocvar_g_balance_hmg_reload_ammo)
+        ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
+
+    return ammo_amount;
+}
+
+METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
+}
+
+METHOD(HeavyMachineGun, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+
+METHOD(HeavyMachineGun, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_HMG_MURDER_SNIPE;
+    else
+        return WEAPON_HMG_MURDER_SPRAY;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
-               }
+METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+}
 
 #endif
 #endif
index 5b108c7923d7a93969a26f886ee21ae98321a352..ced3ca0b2515e37b090a5ed68d280ffc3668bf21 100644 (file)
@@ -150,74 +150,80 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-               METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
-               {
-                       PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
-               }
-               METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       {
-                               if (fire & 1)
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(rpc, refire)))
-                                       {
-                                               W_RocketPropelledChainsaw_Attack(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
-                                       }
-                               }
-
-                               if (fire & 2)
-                               {
-                                       // to-do
-                               }
-                       }
-               }
-               METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
-                       ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
-                       return ammo_amount;
-               }
-               METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep))
-               {
-                       return false;
-               }
-               METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
-               }
-               METHOD(RocketPropelledChainsaw, wr_suicidemessage, int(entity thiswep))
-               {
-                       if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
-                               return WEAPON_RPC_SUICIDE_SPLASH;
-                       else
-                               return WEAPON_RPC_SUICIDE_DIRECT;
-               }
-               METHOD(RocketPropelledChainsaw, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_BLASTER_MURDER;
-                       else if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
-                               return WEAPON_RPC_MURDER_SPLASH;
-                       else
-                               return WEAPON_RPC_MURDER_DIRECT;
-               }
+METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
+}
+
+METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    {
+        if (fire & 1)
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(rpc, refire)))
+            {
+                W_RocketPropelledChainsaw_Attack(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
+            }
+        }
+
+        if (fire & 2)
+        {
+            // to-do
+        }
+    }
+}
+
+METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
+    ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
+    return ammo_amount;
+}
+
+METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep))
+{
+    return false;
+}
+
+METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
+}
+
+METHOD(RocketPropelledChainsaw, wr_suicidemessage, int(entity thiswep))
+{
+    if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+        return WEAPON_RPC_SUICIDE_SPLASH;
+    else
+        return WEAPON_RPC_SUICIDE_DIRECT;
+}
+
+METHOD(RocketPropelledChainsaw, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_BLASTER_MURDER;
+    else if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+        return WEAPON_RPC_MURDER_SPLASH;
+    else
+        return WEAPON_RPC_MURDER_DIRECT;
+}
 
 #endif
 
 #ifdef CSQC
 
-               METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 12;
-                       pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-               }
+METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 12;
+    pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+}
 
 #endif
 #endif
index dc3b460e94291277593f33e14d67f6093b56e768..2a537d4e98fdc889f94ebb10ad1b2c1873637925 100644 (file)
@@ -137,102 +137,104 @@ void ewheel_move_idle()
 
 spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL)) remove(self); }
 
-        METHOD(EWheel, tr_think, void(EWheel thistur, entity it))
-        {
-            SELFPARAM();
-            float vz;
-            vector wish_angle, real_angle;
+METHOD(EWheel, tr_think, void(EWheel thistur, entity it))
+{
+    SELFPARAM();
+    float vz;
+    vector wish_angle, real_angle;
 
-            vz = self.velocity_z;
+    vz = self.velocity_z;
 
-            self.angles_x = anglemods(self.angles_x);
-            self.angles_y = anglemods(self.angles_y);
+    self.angles_x = anglemods(self.angles_x);
+    self.angles_y = anglemods(self.angles_y);
 
-            fixedmakevectors(self.angles);
+    fixedmakevectors(self.angles);
 
-            wish_angle = normalize(self.steerto);
-            wish_angle = vectoangles(wish_angle);
-            real_angle = wish_angle - self.angles;
-            real_angle = shortangle_vxy(real_angle, self.tur_head.angles);
+    wish_angle = normalize(self.steerto);
+    wish_angle = vectoangles(wish_angle);
+    real_angle = wish_angle - self.angles;
+    real_angle = shortangle_vxy(real_angle, self.tur_head.angles);
 
-            self.tur_head.spawnshieldtime = fabs(real_angle_y);
-            real_angle_y  = bound(-self.tur_head.aim_speed, real_angle_y, self.tur_head.aim_speed);
-            self.angles_y = (self.angles_y + real_angle_y);
+    self.tur_head.spawnshieldtime = fabs(real_angle_y);
+    real_angle_y  = bound(-self.tur_head.aim_speed, real_angle_y, self.tur_head.aim_speed);
+    self.angles_y = (self.angles_y + real_angle_y);
 
-            if(self.enemy)
-                ewheel_move_enemy();
-            else if(self.pathcurrent)
-                ewheel_move_path();
-            else
-                ewheel_move_idle();
+    if(self.enemy)
+        ewheel_move_enemy();
+    else if(self.pathcurrent)
+        ewheel_move_path();
+    else
+        ewheel_move_idle();
 
-            self.velocity_z = vz;
+    self.velocity_z = vz;
 
-            if(self.velocity)
-                self.SendFlags |= TNSF_MOVE;
-        }
-        METHOD(EWheel, tr_death, void(EWheel this, entity it))
-        {
-            it.velocity = '0 0 0';
+    if(self.velocity)
+        self.SendFlags |= TNSF_MOVE;
+}
+
+METHOD(EWheel, tr_death, void(EWheel this, entity it))
+{
+    it.velocity = '0 0 0';
 
 #ifdef EWHEEL_FANCYPATH
-            if (self.pathcurrent)
-                pathlib_deletepath(it.pathcurrent.owner);
+    if (self.pathcurrent)
+        pathlib_deletepath(it.pathcurrent.owner);
 #endif
-            it.pathcurrent = NULL;
-        }
-        METHOD(EWheel, tr_setup, void(EWheel this, entity it))
-        {
-            entity e;
+    it.pathcurrent = NULL;
+}
 
-            if(it.movetype == MOVETYPE_WALK)
-            {
-                it.velocity = '0 0 0';
-                it.enemy = world;
+METHOD(EWheel, tr_setup, void(EWheel this, entity it))
+{
+    entity e;
+
+    if(it.movetype == MOVETYPE_WALK)
+    {
+        it.velocity = '0 0 0';
+        it.enemy = world;
 
-                setorigin(it, it.pos1);
+        setorigin(it, it.pos1);
 
-                if (it.target != "")
-                {
-                    e = find(world, targetname, it.target);
-                    if (!e)
-                    {
-                        LOG_TRACE("Initital waypoint for ewheel does NOT exsist, fix your map!\n");
-                        it.target = "";
-                    }
-
-                    if (e.classname != "turret_checkpoint")
-                        LOG_TRACE("Warning: not a turrret path\n");
-                    else
-                    {
+        if (it.target != "")
+        {
+            e = find(world, targetname, it.target);
+            if (!e)
+            {
+                LOG_TRACE("Initital waypoint for ewheel does NOT exsist, fix your map!\n");
+                it.target = "";
+            }
+
+            if (e.classname != "turret_checkpoint")
+                LOG_TRACE("Warning: not a turrret path\n");
+            else
+            {
 
 #ifdef EWHEEL_FANCYPATH
-                        it.pathcurrent = WALKER_PATH(it.origin,e.origin);
-                        it.pathgoal = e;
+                it.pathcurrent = WALKER_PATH(it.origin,e.origin);
+                it.pathgoal = e;
 #else
-                        it.pathcurrent  = e;
+                it.pathcurrent  = e;
 #endif
-                    }
-                }
             }
-
-            it.iscreature                              = true;
-            it.teleportable                    = TELEPORT_NORMAL;
-            it.damagedbycontents               = true;
-            it.movetype                                = MOVETYPE_WALK;
-            it.solid                                   = SOLID_SLIDEBOX;
-            it.takedamage                              = DAMAGE_AIM;
-            it.idle_aim                                = '0 0 0';
-            it.pos1                                    = it.origin;
-            it.target_select_flags     = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-            it.target_validate_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-            it.frame                                   = it.tur_head.frame = 1;
-            it.ammo_flags                              = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
-
-            // Convert from dgr / sec to dgr / tic
-            it.tur_head.aim_speed = (autocvar_g_turrets_unit_ewheel_turnrate);
-            it.tur_head.aim_speed = it.tur_head.aim_speed / (1 / it.ticrate);
         }
+    }
+
+    it.iscreature                              = true;
+    it.teleportable                    = TELEPORT_NORMAL;
+    it.damagedbycontents               = true;
+    it.movetype                                = MOVETYPE_WALK;
+    it.solid                                   = SOLID_SLIDEBOX;
+    it.takedamage                              = DAMAGE_AIM;
+    it.idle_aim                                = '0 0 0';
+    it.pos1                                    = it.origin;
+    it.target_select_flags     = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
+    it.target_validate_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
+    it.frame                                   = it.tur_head.frame = 1;
+    it.ammo_flags                              = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
+
+    // Convert from dgr / sec to dgr / tic
+    it.tur_head.aim_speed = (autocvar_g_turrets_unit_ewheel_turnrate);
+    it.tur_head.aim_speed = it.tur_head.aim_speed / (1 / it.ticrate);
+}
 
 #endif // SVQC
 #ifdef CSQC
index 599e00c29d4e4d82cbc06c52c4087b7d847ca646..bf68e85fd207459861fec6e164e5b7abb0b217a6 100644 (file)
@@ -348,284 +348,284 @@ void walker_move_path()
 
 spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(self); }
 
-        METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it))
-        {
-            fixedmakevectors(self.angles);
+METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it))
+{
+    fixedmakevectors(self.angles);
 
-            if (self.spawnflags & TSF_NO_PATHBREAK && self.pathcurrent)
-                walker_move_path();
-            else if (self.enemy == world)
+    if (self.spawnflags & TSF_NO_PATHBREAK && self.pathcurrent)
+        walker_move_path();
+    else if (self.enemy == world)
+    {
+        if(self.pathcurrent)
+            walker_move_path();
+        else
+        {
+            if(self.enemy_last_time != 0)
             {
-                if(self.pathcurrent)
-                    walker_move_path();
+                if(vdist(self.origin - self.enemy_last_loc, <, 128) || time - self.enemy_last_time > 10)
+                    self.enemy_last_time = 0;
                 else
-                {
-                    if(self.enemy_last_time != 0)
-                    {
-                        if(vdist(self.origin - self.enemy_last_loc, <, 128) || time - self.enemy_last_time > 10)
-                            self.enemy_last_time = 0;
-                        else
-                            walker_move_to(self.enemy_last_loc, 0);
-                    }
-                    else
-                    {
-                        if(self.animflag != ANIM_NO)
-                        {
-                            traceline(self.origin + '0 0 64', self.origin + '0 0 64' + v_forward * 128, MOVE_NORMAL, self);
-
-                            if(trace_fraction != 1.0)
-                                self.tur_head.idletime = -1337;
-                            else
-                            {
-                                traceline(trace_endpos, trace_endpos - '0 0 256', MOVE_NORMAL, self);
-                                if(trace_fraction == 1.0)
-                                    self.tur_head.idletime = -1337;
-                            }
-
-                            if(self.tur_head.idletime == -1337)
-                            {
-                                self.moveto = self.origin + randomvec() * 256;
-                                self.tur_head.idletime = 0;
-                            }
-
-                            self.moveto = self.moveto * 0.9 + ((self.origin + v_forward * 500) + randomvec() * 400) * 0.1;
-                            self.moveto_z = self.origin_z + 64;
-                            walker_move_to(self.moveto, 0);
-                        }
-
-                        if(self.idletime < time)
-                        {
-                            if(random() < 0.5 || !(self.spawnflags & TSL_ROAM))
-                            {
-                                self.idletime = time + 1 + random() * 5;
-                                self.moveto = self.origin;
-                                self.animflag = ANIM_NO;
-                            }
-                            else
-                            {
-                                self.animflag = ANIM_WALK;
-                                self.idletime = time + 4 + random() * 2;
-                                self.moveto = self.origin + randomvec() * 256;
-                                self.tur_head.moveto = self.moveto;
-                                self.tur_head.idletime = 0;
-                            }
-                        }
-                    }
-                }
+                    walker_move_to(self.enemy_last_loc, 0);
             }
             else
             {
-                if (self.tur_dist_enemy < (autocvar_g_turrets_unit_walker_melee_range) && self.animflag != ANIM_MELEE)
+                if(self.animflag != ANIM_NO)
                 {
-                    vector wish_angle;
+                    traceline(self.origin + '0 0 64', self.origin + '0 0 64' + v_forward * 128, MOVE_NORMAL, self);
+
+                    if(trace_fraction != 1.0)
+                        self.tur_head.idletime = -1337;
+                    else
+                    {
+                        traceline(trace_endpos, trace_endpos - '0 0 256', MOVE_NORMAL, self);
+                        if(trace_fraction == 1.0)
+                            self.tur_head.idletime = -1337;
+                    }
 
-                    wish_angle = angleofs(self, self.enemy);
-                    if (self.animflag != ANIM_SWIM)
-                    if (fabs(wish_angle_y) < 15)
+                    if(self.tur_head.idletime == -1337)
                     {
-                        self.moveto   = self.enemy.origin;
-                        self.steerto  = steerlib_attract2(self, self.moveto, 0.5, 500, 0.95);
-                        self.animflag = ANIM_MELEE;
+                        self.moveto = self.origin + randomvec() * 256;
+                        self.tur_head.idletime = 0;
                     }
+
+                    self.moveto = self.moveto * 0.9 + ((self.origin + v_forward * 500) + randomvec() * 400) * 0.1;
+                    self.moveto_z = self.origin_z + 64;
+                    walker_move_to(self.moveto, 0);
                 }
-                else if (self.tur_head.attack_finished_single[0] < time)
+
+                if(self.idletime < time)
                 {
-                    if(self.tur_head.shot_volly)
+                    if(random() < 0.5 || !(self.spawnflags & TSL_ROAM))
                     {
+                        self.idletime = time + 1 + random() * 5;
+                        self.moveto = self.origin;
                         self.animflag = ANIM_NO;
-
-                        self.tur_head.shot_volly = self.tur_head.shot_volly -1;
-                        if(self.tur_head.shot_volly == 0)
-                            self.tur_head.attack_finished_single[0] = time + (autocvar_g_turrets_unit_walker_rocket_refire);
-                        else
-                            self.tur_head.attack_finished_single[0] = time + 0.2;
-
-                        if(self.tur_head.shot_volly > 1)
-                            walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket01")));
-                        else
-                            walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket02")));
                     }
                     else
                     {
-                        if (self.tur_dist_enemy > (autocvar_g_turrets_unit_walker_rocket_range_min))
-                        if (self.tur_dist_enemy < (autocvar_g_turrets_unit_walker_rocket_range))
-                            self.tur_head.shot_volly = 4;
+                        self.animflag = ANIM_WALK;
+                        self.idletime = time + 4 + random() * 2;
+                        self.moveto = self.origin + randomvec() * 256;
+                        self.tur_head.moveto = self.moveto;
+                        self.tur_head.idletime = 0;
                     }
                 }
-                else
-                {
-                    if (self.animflag != ANIM_MELEE)
-                        walker_move_to(self.enemy.origin, self.tur_dist_enemy);
-                }
             }
+        }
+    }
+    else
+    {
+        if (self.tur_dist_enemy < (autocvar_g_turrets_unit_walker_melee_range) && self.animflag != ANIM_MELEE)
+        {
+            vector wish_angle;
 
+            wish_angle = angleofs(self, self.enemy);
+            if (self.animflag != ANIM_SWIM)
+            if (fabs(wish_angle_y) < 15)
             {
-                vector real_angle;
-                float turny = 0, turnx = 0;
-                float vz;
+                self.moveto   = self.enemy.origin;
+                self.steerto  = steerlib_attract2(self, self.moveto, 0.5, 500, 0.95);
+                self.animflag = ANIM_MELEE;
+            }
+        }
+        else if (self.tur_head.attack_finished_single[0] < time)
+        {
+            if(self.tur_head.shot_volly)
+            {
+                self.animflag = ANIM_NO;
 
-                real_angle = vectoangles(self.steerto) - self.angles;
-                vz = self.velocity_z;
+                self.tur_head.shot_volly = self.tur_head.shot_volly -1;
+                if(self.tur_head.shot_volly == 0)
+                    self.tur_head.attack_finished_single[0] = time + (autocvar_g_turrets_unit_walker_rocket_refire);
+                else
+                    self.tur_head.attack_finished_single[0] = time + 0.2;
 
-                switch (self.animflag)
-                {
-                    case ANIM_NO:
-                        movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
-                        break;
-
-                    case ANIM_TURN:
-                        turny = (autocvar_g_turrets_unit_walker_turn);
-                        movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
-                        break;
-
-                    case ANIM_WALK:
-                        turny = (autocvar_g_turrets_unit_walker_turn_walk);
-                        movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_walk), 0.6);
-                        break;
-
-                    case ANIM_RUN:
-                        turny = (autocvar_g_turrets_unit_walker_turn_run);
-                        movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_run), 0.6);
-                        break;
-
-                    case ANIM_STRAFE_L:
-                        turny = (autocvar_g_turrets_unit_walker_turn_strafe);
-                        movelib_move_simple(self, v_right * -1, (autocvar_g_turrets_unit_walker_speed_walk), 0.8);
-                        break;
-
-                    case ANIM_STRAFE_R:
-                        turny = (autocvar_g_turrets_unit_walker_turn_strafe);
-                        movelib_move_simple(self, v_right, (autocvar_g_turrets_unit_walker_speed_walk), 0.8);
-                        break;
-
-                    case ANIM_JUMP:
-                        self.velocity += '0 0 1' * (autocvar_g_turrets_unit_walker_speed_jump);
-                        break;
-
-                    case ANIM_LAND:
-                        break;
-
-                    case ANIM_PAIN:
-                        if(self.frame != ANIM_PAIN)
-                            defer(self, 0.25, walker_setnoanim);
-
-                        break;
-
-                    case ANIM_MELEE:
-                        if(self.frame != ANIM_MELEE)
-                        {
-                            defer(self, 0.41, walker_setnoanim);
-                            defer(self, 0.21, walker_melee_do_dmg);
-                        }
-
-                        movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
-                        break;
-
-                    case ANIM_SWIM:
-                        turny = (autocvar_g_turrets_unit_walker_turn_swim);
-                        turnx = (autocvar_g_turrets_unit_walker_turn_swim);
-
-                        self.angles_x += bound(-10, shortangle_f(real_angle_x, self.angles_x), 10);
-                        movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_swim), 0.3);
-                        vz = self.velocity_z + sin(time * 4) * 8;
-                        break;
-
-                    case ANIM_ROAM:
-                        turny = (autocvar_g_turrets_unit_walker_turn_walk);
-                        movelib_move_simple(self, v_forward ,(autocvar_g_turrets_unit_walker_speed_roam), 0.5);
-                        break;
-                }
+                if(self.tur_head.shot_volly > 1)
+                    walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket01")));
+                else
+                    walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket02")));
+            }
+            else
+            {
+                if (self.tur_dist_enemy > (autocvar_g_turrets_unit_walker_rocket_range_min))
+                if (self.tur_dist_enemy < (autocvar_g_turrets_unit_walker_rocket_range))
+                    self.tur_head.shot_volly = 4;
+            }
+        }
+        else
+        {
+            if (self.animflag != ANIM_MELEE)
+                walker_move_to(self.enemy.origin, self.tur_dist_enemy);
+        }
+    }
 
-                if(turny)
-                {
-                    turny = bound( turny * -1, shortangle_f(real_angle_y, self.angles_y), turny );
-                    self.angles_y += turny;
-                }
+    {
+        vector real_angle;
+        float turny = 0, turnx = 0;
+        float vz;
 
-                if(turnx)
+        real_angle = vectoangles(self.steerto) - self.angles;
+        vz = self.velocity_z;
+
+        switch (self.animflag)
+        {
+            case ANIM_NO:
+                movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
+                break;
+
+            case ANIM_TURN:
+                turny = (autocvar_g_turrets_unit_walker_turn);
+                movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
+                break;
+
+            case ANIM_WALK:
+                turny = (autocvar_g_turrets_unit_walker_turn_walk);
+                movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_walk), 0.6);
+                break;
+
+            case ANIM_RUN:
+                turny = (autocvar_g_turrets_unit_walker_turn_run);
+                movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_run), 0.6);
+                break;
+
+            case ANIM_STRAFE_L:
+                turny = (autocvar_g_turrets_unit_walker_turn_strafe);
+                movelib_move_simple(self, v_right * -1, (autocvar_g_turrets_unit_walker_speed_walk), 0.8);
+                break;
+
+            case ANIM_STRAFE_R:
+                turny = (autocvar_g_turrets_unit_walker_turn_strafe);
+                movelib_move_simple(self, v_right, (autocvar_g_turrets_unit_walker_speed_walk), 0.8);
+                break;
+
+            case ANIM_JUMP:
+                self.velocity += '0 0 1' * (autocvar_g_turrets_unit_walker_speed_jump);
+                break;
+
+            case ANIM_LAND:
+                break;
+
+            case ANIM_PAIN:
+                if(self.frame != ANIM_PAIN)
+                    defer(self, 0.25, walker_setnoanim);
+
+                break;
+
+            case ANIM_MELEE:
+                if(self.frame != ANIM_MELEE)
                 {
-                    turnx = bound( turnx * -1, shortangle_f(real_angle_x, self.angles_x), turnx );
-                    self.angles_x += turnx;
+                    defer(self, 0.41, walker_setnoanim);
+                    defer(self, 0.21, walker_melee_do_dmg);
                 }
 
-                self.velocity_z = vz;
-            }
+                movelib_brake_simple(self, (autocvar_g_turrets_unit_walker_speed_stop));
+                break;
 
+            case ANIM_SWIM:
+                turny = (autocvar_g_turrets_unit_walker_turn_swim);
+                turnx = (autocvar_g_turrets_unit_walker_turn_swim);
 
-            if(self.origin != self.oldorigin)
-                self.SendFlags |= TNSF_MOVE;
+                self.angles_x += bound(-10, shortangle_f(real_angle_x, self.angles_x), 10);
+                movelib_move_simple(self, v_forward, (autocvar_g_turrets_unit_walker_speed_swim), 0.3);
+                vz = self.velocity_z + sin(time * 4) * 8;
+                break;
 
-            self.oldorigin = self.origin;
-            turrets_setframe(self.animflag, false);
+            case ANIM_ROAM:
+                turny = (autocvar_g_turrets_unit_walker_turn_walk);
+                movelib_move_simple(self, v_forward ,(autocvar_g_turrets_unit_walker_speed_roam), 0.5);
+                break;
         }
-        METHOD(WalkerTurret, tr_death, void(WalkerTurret this, entity it))
+
+        if(turny)
         {
-#ifdef WALKER_FANCYPATHING
-            if (it.pathcurrent)
-                pathlib_deletepath(it.pathcurrent.owner);
-#endif
-            it.pathcurrent = NULL;
+            turny = bound( turny * -1, shortangle_f(real_angle_y, self.angles_y), turny );
+            self.angles_y += turny;
         }
-        METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it))
+
+        if(turnx)
         {
-            it.ticrate = 0.05;
+            turnx = bound( turnx * -1, shortangle_f(real_angle_x, self.angles_x), turnx );
+            self.angles_x += turnx;
+        }
 
-            entity e;
+        self.velocity_z = vz;
+    }
 
-            // Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
-            if(it.movetype == MOVETYPE_WALK)
-            {
-                if(it.pos1)
-                    setorigin(it, it.pos1);
-                if(it.pos2)
-                    it.angles = it.pos2;
-            }
 
-            it.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
-            it.aim_flags = TFL_AIM_LEAD;
-            it.turret_flags |= TUR_FLAG_HITSCAN;
-
-            it.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-            it.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-            it.iscreature = true;
-            it.teleportable = TELEPORT_NORMAL;
-            it.damagedbycontents = true;
-            it.solid = SOLID_SLIDEBOX;
-            it.takedamage = DAMAGE_AIM;
-            if(it.movetype != MOVETYPE_WALK)
-            {
-                setorigin(it, it.origin);
-                tracebox(it.origin + '0 0 128', it.mins, it.maxs, it.origin - '0 0 10000', MOVE_NORMAL, it);
-                setorigin(it, trace_endpos + '0 0 4');
-                it.pos1 = it.origin;
-                it.pos2 = it.angles;
-            }
-            it.movetype = MOVETYPE_WALK;
-            it.idle_aim = '0 0 0';
-            it.turret_firecheckfunc = walker_firecheck;
+    if(self.origin != self.oldorigin)
+        self.SendFlags |= TNSF_MOVE;
 
-            if (it.target != "")
-            {
-                e = find(world, targetname, it.target);
-                if (!e)
-                {
-                    LOG_TRACE("Initital waypoint for walker does NOT exsist, fix your map!\n");
-                    it.target = "";
-                }
+    self.oldorigin = self.origin;
+    turrets_setframe(self.animflag, false);
+}
+METHOD(WalkerTurret, tr_death, void(WalkerTurret this, entity it))
+{
+#ifdef WALKER_FANCYPATHING
+    if (it.pathcurrent)
+        pathlib_deletepath(it.pathcurrent.owner);
+#endif
+    it.pathcurrent = NULL;
+}
+METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it))
+{
+    it.ticrate = 0.05;
 
-                if (e.classname != "turret_checkpoint")
-                    LOG_TRACE("Warning: not a turrret path\n");
-                else
-                {
+    entity e;
+
+    // Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
+    if(it.movetype == MOVETYPE_WALK)
+    {
+        if(it.pos1)
+            setorigin(it, it.pos1);
+        if(it.pos2)
+            it.angles = it.pos2;
+    }
+
+    it.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
+    it.aim_flags = TFL_AIM_LEAD;
+    it.turret_flags |= TUR_FLAG_HITSCAN;
+
+    it.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
+    it.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
+    it.iscreature = true;
+    it.teleportable = TELEPORT_NORMAL;
+    it.damagedbycontents = true;
+    it.solid = SOLID_SLIDEBOX;
+    it.takedamage = DAMAGE_AIM;
+    if(it.movetype != MOVETYPE_WALK)
+    {
+        setorigin(it, it.origin);
+        tracebox(it.origin + '0 0 128', it.mins, it.maxs, it.origin - '0 0 10000', MOVE_NORMAL, it);
+        setorigin(it, trace_endpos + '0 0 4');
+        it.pos1 = it.origin;
+        it.pos2 = it.angles;
+    }
+    it.movetype = MOVETYPE_WALK;
+    it.idle_aim = '0 0 0';
+    it.turret_firecheckfunc = walker_firecheck;
+
+    if (it.target != "")
+    {
+        e = find(world, targetname, it.target);
+        if (!e)
+        {
+            LOG_TRACE("Initital waypoint for walker does NOT exsist, fix your map!\n");
+            it.target = "";
+        }
+
+        if (e.classname != "turret_checkpoint")
+            LOG_TRACE("Warning: not a turrret path\n");
+        else
+        {
 #ifdef WALKER_FANCYPATHING
-                    it.pathcurrent = WALKER_PATH(it.origin, e.origin);
-                    it.pathgoal = e;
+            it.pathcurrent = WALKER_PATH(it.origin, e.origin);
+            it.pathgoal = e;
 #else
-                    it.pathcurrent = e;
+            it.pathcurrent = e;
 #endif
-                }
-            }
         }
+    }
+}
 
 #endif // SVQC
 #ifdef CSQC
index 194ff13654600486edbabdc0f57acfd944ef6239..323e485dc5ee737dac65d12062cf5252dcf7a7df 100644 (file)
@@ -736,222 +736,222 @@ spawnfunc(vehicle_bumblebee)
        if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
 }
 
-               METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_bumblebee_bouncepain)
-                               vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
-               }
-               METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
-               {
-                       SELFPARAM();
-                       self.touch = bumblebee_touch;
-                       self.nextthink = 0;
-                       self.movetype = MOVETYPE_BOUNCEMISSILE;
-               }
-               METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
-               {
-                       SELFPARAM();
-                       self.angles_z *= 0.8;
-                       self.angles_x *= 0.8;
-
-                       self.nextthink = time;
-
-                       if(!self.owner)
-                       {
-                               entity oldself = self;
-                               if(self.gunner1)
-                               {
-                                       setself(self.gunner1);
-                                       oldself.gun1.vehicle_exit(VHEF_EJECT);
-                                       entity oldother = other;
-                                       other = self;
-                                       setself(oldself);
-                                       self.phase = 0;
-                                       self.touch();
-                                       other = oldother;
-                                       return;
-                               }
-
-                               if(self.gunner2)
-                               {
-                                       setself(self.gunner2);
-                                       oldself.gun2.vehicle_exit(VHEF_EJECT);
-                                       entity oldother = other;
-                                       other = self;
-                                       setself(oldself);
-                                       self.phase = 0;
-                                       self.touch();
-                                       other = oldother;
-                                       return;
-                               }
-                       }
-               }
-               METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
-               {
-                       entity oldself = self;
-                       setself(instance);
-
-                       CSQCModel_UnlinkEntity(self);
-
-                       // Hide beam
-                       if(self.gun3.enemy || !wasfreed(self.gun3.enemy))
-                               self.gun3.enemy.effects |= EF_NODRAW;
-
-                       if(self.gunner1)
-                       {
-                               setself(self.gunner1);
-                               oldself.gun1.vehicle_exit(VHEF_EJECT);
-                               setself(oldself);
-                       }
-
-                       if(self.gunner2)
-                       {
-                               setself(self.gunner2);
-                               oldself.gun2.vehicle_exit(VHEF_EJECT);
-                               setself(oldself);
-                       }
-
-                       self.vehicle_exit(VHEF_EJECT);
-
-                       fixedmakevectors(self.angles);
-                       vehicle_tossgib(self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
-                       vehicle_tossgib(self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
-                       vehicle_tossgib(self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
-
-                       entity _body = vehicle_tossgib(self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
-
-                       if(random() > 0.5)
-                               _body.touch = bumblebee_blowup;
-                       else
-                               _body.touch = func_null;
-
-                       _body.think = bumblebee_diethink;
-                       _body.nextthink = time;
-                       _body.wait = time + 2 + (random() * 8);
-                       _body.owner = self;
-                       _body.enemy = self.enemy;
-                       _body.scale = 1.5;
-                       _body.angles = self.angles;
-
-                       Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation(self.origin, 16), '0 0 0', 1);
-
-                       self.health                     = 0;
-                       self.event_damage       = func_null;
-                       self.solid                      = SOLID_NOT;
-                       self.takedamage         = DAMAGE_NO;
-                       self.deadflag           = DEAD_DYING;
-                       self.movetype           = MOVETYPE_NONE;
-                       self.effects            = EF_NODRAW;
-                       self.colormod           = '0 0 0';
-                       self.avelocity          = '0 0 0';
-                       self.velocity           = '0 0 0';
-                       self.touch                      = func_null;
-                       self.nextthink          = 0;
-
-                       setorigin(self, self.pos1);
-
-                       setself(oldself);
-               }
-               METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
-               {
-                       SELFPARAM();
-                       if(!self.gun1)
-                       {
-                               // for some reason, autosizing of the shield entity refuses to work for this one so set it up in advance.
-                               self.vehicle_shieldent = spawn();
-                               self.vehicle_shieldent.effects = EF_LOWPRECISION;
-                               setmodel(self.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD);
-                               setattachment(self.vehicle_shieldent, self, "");
-                               setorigin(self.vehicle_shieldent, real_origin(self) - self.origin);
-                               self.vehicle_shieldent.scale       = 512 / vlen(self.maxs - self.mins);
-                               self.vehicle_shieldent.think       = shieldhit_think;
-                               self.vehicle_shieldent.alpha = -1;
-                               self.vehicle_shieldent.effects = EF_LOWPRECISION | EF_NODRAW;
-
-                               self.gun1 = new(vehicle_playerslot);
-                               self.gun2 = new(vehicle_playerslot);
-                               self.gun3 = new(bumblebee_raygun);
-
-                               self.vehicle_flags |= VHF_MULTISLOT;
-
-                               self.gun1.owner = self;
-                               self.gun2.owner = self;
-                               self.gun3.owner = self;
-
-                               setmodel(self.gun1, MDL_VEH_BUMBLEBEE_CANNON_RIGHT);
-                               setmodel(self.gun2, MDL_VEH_BUMBLEBEE_CANNON_LEFT);
-                               setmodel(self.gun3, MDL_VEH_BUMBLEBEE_CANNON_CENTER);
-
-                               setattachment(self.gun1, self, "cannon_right");
-                               setattachment(self.gun2, self, "cannon_left");
-
-                               // Angled bones are no fun, messes up gun-aim; so work arround it.
-                               self.gun3.pos1 = self.angles;
-                               self.angles = '0 0 0';
-                               vector ofs = gettaginfo(self, gettagindex(self, "raygun"));
-                               ofs -= self.origin;
-                               setattachment(self.gun3, self, "");
-                               setorigin(self.gun3, ofs);
-                               self.angles = self.gun3.pos1;
-
-                               vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
-                               vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
-
-                               setorigin(self.vehicle_hudmodel, '50 0 -5');    // Move cockpit forward - down.
-                               setorigin(self.vehicle_viewport, '5 0 2');    // Move camera forward up
-
-                               //fixme-model-bones
-                               setorigin(self.gun1.vehicle_hudmodel, '90 -27 -23');
-                               setorigin(self.gun1.vehicle_viewport, '-85 0 50');
-                               //fixme-model-bones
-                               setorigin(self.gun2.vehicle_hudmodel, '90 27 -23');
-                               setorigin(self.gun2.vehicle_viewport, '-85 0 50');
-
-                               self.scale = 1.5;
-
-                               // Raygun beam
-                               if(self.gun3.enemy == world)
-                               {
-                                       self.gun3.enemy = spawn();
-                                       Net_LinkEntity(self.gun3.enemy, true, 0, bumble_raygun_send);
-                                       self.gun3.enemy.SendFlags = BRG_SETUP;
-                                       self.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
-                                       self.gun3.enemy.effects = EF_NODRAW | EF_LOWPRECISION;
-                               }
-                       }
-
-                       self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
-                       self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
-                       self.solid = SOLID_BBOX;
-                       self.movetype = MOVETYPE_TOSS;
-                       self.damageforcescale = 0.025;
-
-                       self.PlayerPhysplug = bumblebee_pilot_frame;
-
-                       setorigin(self, self.origin + '0 0 25');
-               }
-               METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
-               {
-                       SELFPARAM();
-                       if(autocvar_g_vehicle_bumblebee_energy)
-                       if(autocvar_g_vehicle_bumblebee_energy_regen)
-                               self.vehicle_flags |= VHF_ENERGYREGEN;
+METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_bumblebee_bouncepain)
+        vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
+}
+METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
+{
+    SELFPARAM();
+    self.touch = bumblebee_touch;
+    self.nextthink = 0;
+    self.movetype = MOVETYPE_BOUNCEMISSILE;
+}
+METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
+{
+    SELFPARAM();
+    self.angles_z *= 0.8;
+    self.angles_x *= 0.8;
+
+    self.nextthink = time;
+
+    if(!self.owner)
+    {
+        entity oldself = self;
+        if(self.gunner1)
+        {
+            setself(self.gunner1);
+            oldself.gun1.vehicle_exit(VHEF_EJECT);
+            entity oldother = other;
+            other = self;
+            setself(oldself);
+            self.phase = 0;
+            self.touch();
+            other = oldother;
+            return;
+        }
+
+        if(self.gunner2)
+        {
+            setself(self.gunner2);
+            oldself.gun2.vehicle_exit(VHEF_EJECT);
+            entity oldother = other;
+            other = self;
+            setself(oldself);
+            self.phase = 0;
+            self.touch();
+            other = oldother;
+            return;
+        }
+    }
+}
+METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
+{
+    entity oldself = self;
+    setself(instance);
+
+    CSQCModel_UnlinkEntity(self);
+
+    // Hide beam
+    if(self.gun3.enemy || !wasfreed(self.gun3.enemy))
+        self.gun3.enemy.effects |= EF_NODRAW;
+
+    if(self.gunner1)
+    {
+        setself(self.gunner1);
+        oldself.gun1.vehicle_exit(VHEF_EJECT);
+        setself(oldself);
+    }
+
+    if(self.gunner2)
+    {
+        setself(self.gunner2);
+        oldself.gun2.vehicle_exit(VHEF_EJECT);
+        setself(oldself);
+    }
+
+    self.vehicle_exit(VHEF_EJECT);
+
+    fixedmakevectors(self.angles);
+    vehicle_tossgib(self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
+    vehicle_tossgib(self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
+    vehicle_tossgib(self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
+
+    entity _body = vehicle_tossgib(self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
+
+    if(random() > 0.5)
+        _body.touch = bumblebee_blowup;
+    else
+        _body.touch = func_null;
+
+    _body.think = bumblebee_diethink;
+    _body.nextthink = time;
+    _body.wait = time + 2 + (random() * 8);
+    _body.owner = self;
+    _body.enemy = self.enemy;
+    _body.scale = 1.5;
+    _body.angles = self.angles;
+
+    Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation(self.origin, 16), '0 0 0', 1);
+
+    self.health                        = 0;
+    self.event_damage  = func_null;
+    self.solid                 = SOLID_NOT;
+    self.takedamage            = DAMAGE_NO;
+    self.deadflag              = DEAD_DYING;
+    self.movetype              = MOVETYPE_NONE;
+    self.effects               = EF_NODRAW;
+    self.colormod              = '0 0 0';
+    self.avelocity             = '0 0 0';
+    self.velocity              = '0 0 0';
+    self.touch                         = func_null;
+    self.nextthink             = 0;
+
+    setorigin(self, self.pos1);
+
+    setself(oldself);
+}
+METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
+{
+    SELFPARAM();
+    if(!self.gun1)
+    {
+        // for some reason, autosizing of the shield entity refuses to work for this one so set it up in advance.
+        self.vehicle_shieldent = spawn();
+        self.vehicle_shieldent.effects = EF_LOWPRECISION;
+        setmodel(self.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD);
+        setattachment(self.vehicle_shieldent, self, "");
+        setorigin(self.vehicle_shieldent, real_origin(self) - self.origin);
+        self.vehicle_shieldent.scale       = 512 / vlen(self.maxs - self.mins);
+        self.vehicle_shieldent.think       = shieldhit_think;
+        self.vehicle_shieldent.alpha = -1;
+        self.vehicle_shieldent.effects = EF_LOWPRECISION | EF_NODRAW;
+
+        self.gun1 = new(vehicle_playerslot);
+        self.gun2 = new(vehicle_playerslot);
+        self.gun3 = new(bumblebee_raygun);
+
+        self.vehicle_flags |= VHF_MULTISLOT;
+
+        self.gun1.owner = self;
+        self.gun2.owner = self;
+        self.gun3.owner = self;
+
+        setmodel(self.gun1, MDL_VEH_BUMBLEBEE_CANNON_RIGHT);
+        setmodel(self.gun2, MDL_VEH_BUMBLEBEE_CANNON_LEFT);
+        setmodel(self.gun3, MDL_VEH_BUMBLEBEE_CANNON_CENTER);
+
+        setattachment(self.gun1, self, "cannon_right");
+        setattachment(self.gun2, self, "cannon_left");
+
+        // Angled bones are no fun, messes up gun-aim; so work arround it.
+        self.gun3.pos1 = self.angles;
+        self.angles = '0 0 0';
+        vector ofs = gettaginfo(self, gettagindex(self, "raygun"));
+        ofs -= self.origin;
+        setattachment(self.gun3, self, "");
+        setorigin(self.gun3, ofs);
+        self.angles = self.gun3.pos1;
+
+        vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+        vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+
+        setorigin(self.vehicle_hudmodel, '50 0 -5');    // Move cockpit forward - down.
+        setorigin(self.vehicle_viewport, '5 0 2');    // Move camera forward up
+
+        //fixme-model-bones
+        setorigin(self.gun1.vehicle_hudmodel, '90 -27 -23');
+        setorigin(self.gun1.vehicle_viewport, '-85 0 50');
+        //fixme-model-bones
+        setorigin(self.gun2.vehicle_hudmodel, '90 27 -23');
+        setorigin(self.gun2.vehicle_viewport, '-85 0 50');
+
+        self.scale = 1.5;
+
+        // Raygun beam
+        if(self.gun3.enemy == world)
+        {
+            self.gun3.enemy = spawn();
+            Net_LinkEntity(self.gun3.enemy, true, 0, bumble_raygun_send);
+            self.gun3.enemy.SendFlags = BRG_SETUP;
+            self.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
+            self.gun3.enemy.effects = EF_NODRAW | EF_LOWPRECISION;
+        }
+    }
+
+    self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
+    self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
+    self.solid = SOLID_BBOX;
+    self.movetype = MOVETYPE_TOSS;
+    self.damageforcescale = 0.025;
+
+    self.PlayerPhysplug = bumblebee_pilot_frame;
+
+    setorigin(self, self.origin + '0 0 25');
+}
+METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
+{
+    SELFPARAM();
+    if(autocvar_g_vehicle_bumblebee_energy)
+    if(autocvar_g_vehicle_bumblebee_energy_regen)
+        self.vehicle_flags |= VHF_ENERGYREGEN;
 
-                       if(autocvar_g_vehicle_bumblebee_shield)
-                               self.vehicle_flags |= VHF_HASSHIELD;
+    if(autocvar_g_vehicle_bumblebee_shield)
+        self.vehicle_flags |= VHF_HASSHIELD;
 
-                       if(autocvar_g_vehicle_bumblebee_shield_regen)
-                               self.vehicle_flags |= VHF_SHIELDREGEN;
+    if(autocvar_g_vehicle_bumblebee_shield_regen)
+        self.vehicle_flags |= VHF_SHIELDREGEN;
 
-                       if(autocvar_g_vehicle_bumblebee_health_regen)
-                               self.vehicle_flags |= VHF_HEALTHREGEN;
+    if(autocvar_g_vehicle_bumblebee_health_regen)
+        self.vehicle_flags |= VHF_HEALTHREGEN;
 
-                       self.vehicle_exit = bumblebee_exit;
-                       self.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
-                       self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
-                       self.max_health = self.vehicle_health;
-                       self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
-               }
+    self.vehicle_exit = bumblebee_exit;
+    self.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
+    self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
+    self.max_health = self.vehicle_health;
+    self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
+}
 
 #endif // SVQC
 #ifdef CSQC
@@ -963,40 +963,40 @@ void CSQC_BUMBLE_GUN_HUD()
                                         string_null, '0 0 0');
 }
 
-               METHOD(Bumblebee, vr_hud, void(Bumblebee thisveh))
-               {
-                       Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon, "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color);
-
-                       float hudAlpha = autocvar_hud_panel_fg_alpha;
-                       float blinkValue = 0.55 + sin(time * 7) * 0.45;
-                       vector tmpPos  = '0 0 0';
-                       vector tmpSize = '1 1 1' * hud_fontsize;
-                       tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (520/768);
-
-                       if(!AuxiliaryXhair[1].draw2d)
-                       {
-                               tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (96/256) - tmpSize.y;
-                               drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
-                       }
-
-                       if(!AuxiliaryXhair[2].draw2d)
-                       {
-                               tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (160/256);
-                               drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
-                       }
-               }
-               METHOD(Bumblebee, vr_crosshair, void(Bumblebee thisveh))
-               {
-                       Vehicles_drawCrosshair(vCROSS_HEAL);
-               }
-               METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
-               {
-                       AuxiliaryXhair[0].axh_image = vCROSS_LOCK;  // Raygun-locked
-                       AuxiliaryXhair[1].axh_image = vCROSS_BURST; // Gunner1
-                       AuxiliaryXhair[2].axh_image = vCROSS_BURST; // Gunner2
-               }
+METHOD(Bumblebee, vr_hud, void(Bumblebee thisveh))
+{
+    Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon, "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color);
+
+    float hudAlpha = autocvar_hud_panel_fg_alpha;
+    float blinkValue = 0.55 + sin(time * 7) * 0.45;
+    vector tmpPos  = '0 0 0';
+    vector tmpSize = '1 1 1' * hud_fontsize;
+    tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (520/768);
+
+    if(!AuxiliaryXhair[1].draw2d)
+    {
+        tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (96/256) - tmpSize.y;
+        drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
+    }
+
+    if(!AuxiliaryXhair[2].draw2d)
+    {
+        tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (160/256);
+        drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
+    }
+}
+METHOD(Bumblebee, vr_crosshair, void(Bumblebee thisveh))
+{
+    Vehicles_drawCrosshair(vCROSS_HEAL);
+}
+METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
+{
+    AuxiliaryXhair[0].axh_image = vCROSS_LOCK;  // Raygun-locked
+    AuxiliaryXhair[1].axh_image = vCROSS_BURST; // Gunner1
+    AuxiliaryXhair[2].axh_image = vCROSS_BURST; // Gunner2
+}
 
 #endif
 #endif
index 74ed19e69f170a41854c04bcf27d767668331ee5..b9a1a71744b4ac487dc68e0cd4bf80de8f79620d 100644 (file)
@@ -560,140 +560,140 @@ void racer_draw()
 #endif
 #endif
 
-               METHOD(Racer, vr_impact, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       if(autocvar_g_vehicle_racer_bouncepain)
-                               vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
-               #endif
-               }
+METHOD(Racer, vr_impact, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    if(autocvar_g_vehicle_racer_bouncepain)
+        vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+#endif
+}
 
-               METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       self.movetype = MOVETYPE_BOUNCE;
-                       self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health)  * 100;
-                       self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield)  * 100;
+METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    self.movetype = MOVETYPE_BOUNCE;
+    self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health)  * 100;
+    self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield)  * 100;
 
-                       if(self.owner.flagcarried)
-                          setorigin(self.owner.flagcarried, '-190 0 96');
-               #elif defined(CSQC)
+    if(self.owner.flagcarried)
+       setorigin(self.owner.flagcarried, '-190 0 96');
+#elif defined(CSQC)
 
-                       self.move_movetype = MOVETYPE_BOUNCE;
-               #endif
-               }
+    self.move_movetype = MOVETYPE_BOUNCE;
+#endif
+}
 
-               METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       if(self.scale != 0.5)
-                       {
-                               if(autocvar_g_vehicle_racer_hovertype != 0)
-                                       racer_force_from_tag = vehicles_force_fromtag_maglev;
-                               else
-                                       racer_force_from_tag = vehicles_force_fromtag_hover;
-
-                               // FIXME: this be hakkz, fix the models insted (scale body, add tag_viewport to the hudmodel).
-                               self.scale = 0.5;
-                               setattachment(self.vehicle_hudmodel, self, "");
-                               setattachment(self.vehicle_viewport, self, "tag_viewport");
-
-                               self.mass                          = 900;
-                       }
-
-                       self.think                = racer_think;
-                       self.nextthink    = time;
-                       self.vehicle_health = autocvar_g_vehicle_racer_health;
-                       self.vehicle_shield = autocvar_g_vehicle_racer_shield;
-
-                       self.movetype     = MOVETYPE_TOSS;
-                       self.solid                = SOLID_SLIDEBOX;
-                       self.delay                = time;
-                       self.scale                = 0.5;
-
-                       self.PlayerPhysplug = racer_frame;
-
-                       self.bouncefactor = autocvar_g_vehicle_racer_bouncefactor;
-                       self.bouncestop = autocvar_g_vehicle_racer_bouncestop;
-                       self.damageforcescale = 0.5;
-                       self.vehicle_health = autocvar_g_vehicle_racer_health;
-                       self.vehicle_shield = autocvar_g_vehicle_racer_shield;
-               #endif
-               }
+METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    if(self.scale != 0.5)
+    {
+        if(autocvar_g_vehicle_racer_hovertype != 0)
+            racer_force_from_tag = vehicles_force_fromtag_maglev;
+        else
+            racer_force_from_tag = vehicles_force_fromtag_hover;
+
+        // FIXME: this be hakkz, fix the models insted (scale body, add tag_viewport to the hudmodel).
+        self.scale = 0.5;
+        setattachment(self.vehicle_hudmodel, self, "");
+        setattachment(self.vehicle_viewport, self, "tag_viewport");
+
+        self.mass                         = 900;
+    }
+
+    self.think           = racer_think;
+    self.nextthink       = time;
+    self.vehicle_health = autocvar_g_vehicle_racer_health;
+    self.vehicle_shield = autocvar_g_vehicle_racer_shield;
+
+    self.movetype        = MOVETYPE_TOSS;
+    self.solid           = SOLID_SLIDEBOX;
+    self.delay           = time;
+    self.scale           = 0.5;
+
+    self.PlayerPhysplug = racer_frame;
+
+    self.bouncefactor = autocvar_g_vehicle_racer_bouncefactor;
+    self.bouncestop = autocvar_g_vehicle_racer_bouncestop;
+    self.damageforcescale = 0.5;
+    self.vehicle_health = autocvar_g_vehicle_racer_health;
+    self.vehicle_shield = autocvar_g_vehicle_racer_shield;
+#endif
+}
 
-               METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       instance.SendEntity             = func_null; // stop networking this racer (for now)
-                       instance.health                 = 0;
-                       instance.event_damage   = func_null;
-                       instance.solid                  = SOLID_CORPSE;
-                       instance.takedamage             = DAMAGE_NO;
-                       instance.deadflag               = DEAD_DYING;
-                       instance.movetype               = MOVETYPE_BOUNCE;
-                       instance.wait                   = time;
-                       instance.delay                  = 2 + time + random() * 3;
-                       instance.cnt                    = 1 + random() * 2;
-                       instance.touch                  = racer_deadtouch;
-
-                       Send_Effect(EFFECT_EXPLOSION_MEDIUM, instance.origin, '0 0 0', 1);
-
-                       if(random() < 0.5)
-                               instance.avelocity_z = 32;
-                       else
-                               instance.avelocity_z = -32;
-
-                       instance.avelocity_x = -vlen(instance.velocity) * 0.2;
-                       instance.velocity += '0 0 700';
-                       instance.colormod = '-0.5 -0.5 -0.5';
-
-                       instance.think = racer_blowup_think;
-                       instance.nextthink = time;
-               #endif
-               }
+METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    instance.SendEntity                = func_null; // stop networking this racer (for now)
+    instance.health                    = 0;
+    instance.event_damage      = func_null;
+    instance.solid                     = SOLID_CORPSE;
+    instance.takedamage                = DAMAGE_NO;
+    instance.deadflag          = DEAD_DYING;
+    instance.movetype          = MOVETYPE_BOUNCE;
+    instance.wait                      = time;
+    instance.delay                     = 2 + time + random() * 3;
+    instance.cnt                       = 1 + random() * 2;
+    instance.touch                     = racer_deadtouch;
+
+    Send_Effect(EFFECT_EXPLOSION_MEDIUM, instance.origin, '0 0 0', 1);
+
+    if(random() < 0.5)
+        instance.avelocity_z = 32;
+    else
+        instance.avelocity_z = -32;
+
+    instance.avelocity_x = -vlen(instance.velocity) * 0.2;
+    instance.velocity += '0 0 700';
+    instance.colormod = '-0.5 -0.5 -0.5';
+
+    instance.think = racer_blowup_think;
+    instance.nextthink = time;
+#endif
+}
 
 #ifdef CSQC
-               METHOD(Racer, vr_hud, void(Racer thisveh))
-               {
-                       Vehicles_drawHUD(VEH_RACER.m_icon, "vehicle_racer_weapon1", "vehicle_racer_weapon2",
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
-                                                        "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
-               }
-               METHOD(Racer, vr_crosshair, void(Racer thisveh))
-               {
-                       Vehicles_drawCrosshair(vCROSS_GUIDE);
-               }
+METHOD(Racer, vr_hud, void(Racer thisveh))
+{
+    Vehicles_drawHUD(VEH_RACER.m_icon, "vehicle_racer_weapon1", "vehicle_racer_weapon2",
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+                     "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+}
+METHOD(Racer, vr_crosshair, void(Racer thisveh))
+{
+    Vehicles_drawCrosshair(vCROSS_GUIDE);
+}
 #endif
-               METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
-               {
-               #ifdef SVQC
-                       self.vehicle_exit = racer_exit;
-               #endif
-
-               #ifdef SVQC
-                       // we have no need to network energy
-                       if(autocvar_g_vehicle_racer_energy)
-                       if(autocvar_g_vehicle_racer_energy_regen)
-                               self.vehicle_flags |= VHF_ENERGYREGEN;
-
-                       if(autocvar_g_vehicle_racer_shield)
-                               self.vehicle_flags |= VHF_HASSHIELD;
-
-                       if(autocvar_g_vehicle_racer_shield_regen)
-                               self.vehicle_flags |= VHF_SHIELDREGEN;
-
-                       if(autocvar_g_vehicle_racer_health_regen)
-                               self.vehicle_flags |= VHF_HEALTHREGEN;
-
-                       self.respawntime = autocvar_g_vehicle_racer_respawntime;
-                       self.vehicle_health = autocvar_g_vehicle_racer_health;
-                       self.vehicle_shield = autocvar_g_vehicle_racer_shield;
-                       self.max_health = self.vehicle_health;
-               #endif
-
-               #ifdef CSQC
-                       AuxiliaryXhair[0].axh_image = vCROSS_LOCK; // Rocket
-               #endif
-               }
+METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
+{
+#ifdef SVQC
+    self.vehicle_exit = racer_exit;
+#endif
+
+#ifdef SVQC
+    // we have no need to network energy
+    if(autocvar_g_vehicle_racer_energy)
+    if(autocvar_g_vehicle_racer_energy_regen)
+        self.vehicle_flags |= VHF_ENERGYREGEN;
+
+    if(autocvar_g_vehicle_racer_shield)
+        self.vehicle_flags |= VHF_HASSHIELD;
+
+    if(autocvar_g_vehicle_racer_shield_regen)
+        self.vehicle_flags |= VHF_SHIELDREGEN;
+
+    if(autocvar_g_vehicle_racer_health_regen)
+        self.vehicle_flags |= VHF_HEALTHREGEN;
+
+    self.respawntime = autocvar_g_vehicle_racer_respawntime;
+    self.vehicle_health = autocvar_g_vehicle_racer_health;
+    self.vehicle_shield = autocvar_g_vehicle_racer_shield;
+    self.max_health = self.vehicle_health;
+#endif
+
+#ifdef CSQC
+    AuxiliaryXhair[0].axh_image = vCROSS_LOCK; // Rocket
+#endif
+}
 
 #endif
index caf253aee00c41b76b563d8bc8f57264c8931c3d..8f8f3cf72f70ea4ccad7b1a799e0ac034505f749 100644 (file)
@@ -617,243 +617,243 @@ spawnfunc(vehicle_raptor)
        if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
 }
 
-               METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_raptor_bouncepain)
-                               vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
-               }
-               METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
-               {
-                       self.vehicle_weapon2mode = RSM_BOMB;
-                       self.owner.PlayerPhysplug = raptor_takeoff;
-                       self.movetype      = MOVETYPE_BOUNCEMISSILE;
-                       self.solid                = SOLID_SLIDEBOX;
-                       self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
-                       self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
-                       self.velocity_z = 1; // Nudge upwards to takeoff sequense can work.
-                       self.tur_head.exteriormodeltoclient = self.owner;
-
-                       self.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
-                       self.lip   = time;
-
-                       if(self.owner.flagcarried)
-                          setorigin(self.owner.flagcarried, '-20 0 96');
-
-                       CSQCVehicleSetup(self.owner, 0);
-               }
-               METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
-               {
-                       instance.health                         = 0;
-                       instance.event_damage           = func_null;
-                       instance.solid                          = SOLID_CORPSE;
-                       instance.takedamage                     = DAMAGE_NO;
-                       instance.deadflag                       = DEAD_DYING;
-                       instance.movetype                       = MOVETYPE_BOUNCE;
-                       instance.think                          = raptor_diethink;
-                       instance.nextthink                      = time;
-                       instance.wait                           = time + 5 + (random() * 5);
-
-                       Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
-
-                       instance.velocity_z += 600;
-
-                       instance.avelocity = '0 0.5 1' * (random() * 400);
-                       instance.avelocity -= '0 0.5 1' * (random() * 400);
-
-                       instance.colormod = '-0.5 -0.5 -0.5';
-                       instance.touch = raptor_blowup;
-               }
-               METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
-               {
-                       if(!self.gun1)
-                       {
-                               entity spinner;
-                               vector ofs;
-
-                               //FIXME: Camera is in a bad place in HUD model.
-                               //setorigin(self.vehicle_viewport, '25 0 5');
-
-                               self.vehicles_impulse   = raptor_impulse;
-
-                               self.frame = 0;
-
-                               self.bomb1 = new(raptor_bomb);
-                               self.bomb2 = new(raptor_bomb);
-                               self.gun1  = new(raptor_gun);
-                               self.gun2  = new(raptor_gun);
-
-                               setmodel(self.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
-                               setmodel(self.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
-                               setmodel(self.gun1, MDL_VEH_RAPTOR_GUN);
-                               setmodel(self.gun2, MDL_VEH_RAPTOR_GUN);
-                               setmodel(self.tur_head, MDL_VEH_RAPTOR_TAIL);
-
-                               setattachment(self.bomb1, self, "bombmount_left");
-                               setattachment(self.bomb2, self, "bombmount_right");
-                               setattachment(self.tur_head, self,"root");
-
-                               // FIXMODEL Guns mounts to angled bones
-                               self.bomb1.angles = self.angles;
-                               self.angles = '0 0 0';
-                               // This messes up gun-aim, so work arround it.
-                               //setattachment(self.gun1, self, "gunmount_left");
-                               ofs = gettaginfo(self, gettagindex(self, "gunmount_left"));
-                               ofs -= self.origin;
-                               setattachment(self.gun1, self, "");
-                               setorigin(self.gun1, ofs);
-
-                               //setattachment(self.gun2, self, "gunmount_right");
-                               ofs = gettaginfo(self, gettagindex(self, "gunmount_right"));
-                               ofs -= self.origin;
-                               setattachment(self.gun2, self, "");
-                               setorigin(self.gun2, ofs);
-
-                               self.angles = self.bomb1.angles;
-                               self.bomb1.angles = '0 0 0';
-
-                               spinner = new(raptor_spinner);
-                               spinner.owner = self;
-                               setmodel(spinner, MDL_VEH_RAPTOR_PROP);
-                               setattachment(spinner, self, "engine_left");
-                               spinner.movetype = MOVETYPE_NOCLIP;
-                               spinner.avelocity = '0 90 0';
-                               self.bomb1.gun1 = spinner;
-
-                               spinner = new(raptor_spinner);
-                               spinner.owner = self;
-                               setmodel(spinner, MDL_VEH_RAPTOR_PROP);
-                               setattachment(spinner, self, "engine_right");
-                               spinner.movetype = MOVETYPE_NOCLIP;
-                               spinner.avelocity = '0 -90 0';
-                               self.bomb1.gun2 = spinner;
-
-                               // Sigh.
-                               self.bomb1.think = raptor_rotor_anglefix;
-                               self.bomb1.nextthink = time;
-
-                               self.mass                          = 1 ;
-                       }
-
-                       self.frame                = 0;
-                       self.vehicle_health = autocvar_g_vehicle_raptor_health;
-                       self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-                       self.movetype      = MOVETYPE_TOSS;
-                       self.solid                = SOLID_SLIDEBOX;
-                       self.vehicle_energy = 1;
+METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_raptor_bouncepain)
+        vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+}
+METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
+{
+    self.vehicle_weapon2mode = RSM_BOMB;
+    self.owner.PlayerPhysplug = raptor_takeoff;
+    self.movetype         = MOVETYPE_BOUNCEMISSILE;
+    self.solid           = SOLID_SLIDEBOX;
+    self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
+    self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
+    self.velocity_z = 1; // Nudge upwards to takeoff sequense can work.
+    self.tur_head.exteriormodeltoclient = self.owner;
+
+    self.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
+    self.lip   = time;
+
+    if(self.owner.flagcarried)
+       setorigin(self.owner.flagcarried, '-20 0 96');
+
+    CSQCVehicleSetup(self.owner, 0);
+}
+METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
+{
+    instance.health                            = 0;
+    instance.event_damage              = func_null;
+    instance.solid                             = SOLID_CORPSE;
+    instance.takedamage                        = DAMAGE_NO;
+    instance.deadflag                  = DEAD_DYING;
+    instance.movetype                  = MOVETYPE_BOUNCE;
+    instance.think                             = raptor_diethink;
+    instance.nextthink                 = time;
+    instance.wait                              = time + 5 + (random() * 5);
 
-                       self.PlayerPhysplug = raptor_frame;
+    Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
 
-                       self.bomb1.gun1.avelocity_y = 90;
-                       self.bomb1.gun2.avelocity_y = -90;
+    instance.velocity_z += 600;
 
-                       self.delay = time;
+    instance.avelocity = '0 0.5 1' * (random() * 400);
+    instance.avelocity -= '0 0.5 1' * (random() * 400);
 
-                       self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
-                       self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
-                       self.damageforcescale = 0.25;
-                       self.vehicle_health = autocvar_g_vehicle_raptor_health;
-                       self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-               }
-               METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_raptor_shield)
-                               self.vehicle_flags |= VHF_HASSHIELD;
+    instance.colormod = '-0.5 -0.5 -0.5';
+    instance.touch = raptor_blowup;
+}
+METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
+{
+    if(!self.gun1)
+    {
+        entity spinner;
+        vector ofs;
+
+        //FIXME: Camera is in a bad place in HUD model.
+        //setorigin(self.vehicle_viewport, '25 0 5');
+
+        self.vehicles_impulse   = raptor_impulse;
+
+        self.frame = 0;
+
+        self.bomb1 = new(raptor_bomb);
+        self.bomb2 = new(raptor_bomb);
+        self.gun1  = new(raptor_gun);
+        self.gun2  = new(raptor_gun);
+
+        setmodel(self.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
+        setmodel(self.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
+        setmodel(self.gun1, MDL_VEH_RAPTOR_GUN);
+        setmodel(self.gun2, MDL_VEH_RAPTOR_GUN);
+        setmodel(self.tur_head, MDL_VEH_RAPTOR_TAIL);
+
+        setattachment(self.bomb1, self, "bombmount_left");
+        setattachment(self.bomb2, self, "bombmount_right");
+        setattachment(self.tur_head, self,"root");
+
+        // FIXMODEL Guns mounts to angled bones
+        self.bomb1.angles = self.angles;
+        self.angles = '0 0 0';
+        // This messes up gun-aim, so work arround it.
+        //setattachment(self.gun1, self, "gunmount_left");
+        ofs = gettaginfo(self, gettagindex(self, "gunmount_left"));
+        ofs -= self.origin;
+        setattachment(self.gun1, self, "");
+        setorigin(self.gun1, ofs);
+
+        //setattachment(self.gun2, self, "gunmount_right");
+        ofs = gettaginfo(self, gettagindex(self, "gunmount_right"));
+        ofs -= self.origin;
+        setattachment(self.gun2, self, "");
+        setorigin(self.gun2, ofs);
+
+        self.angles = self.bomb1.angles;
+        self.bomb1.angles = '0 0 0';
+
+        spinner = new(raptor_spinner);
+        spinner.owner = self;
+        setmodel(spinner, MDL_VEH_RAPTOR_PROP);
+        setattachment(spinner, self, "engine_left");
+        spinner.movetype = MOVETYPE_NOCLIP;
+        spinner.avelocity = '0 90 0';
+        self.bomb1.gun1 = spinner;
+
+        spinner = new(raptor_spinner);
+        spinner.owner = self;
+        setmodel(spinner, MDL_VEH_RAPTOR_PROP);
+        setattachment(spinner, self, "engine_right");
+        spinner.movetype = MOVETYPE_NOCLIP;
+        spinner.avelocity = '0 -90 0';
+        self.bomb1.gun2 = spinner;
+
+        // Sigh.
+        self.bomb1.think = raptor_rotor_anglefix;
+        self.bomb1.nextthink = time;
+
+        self.mass                         = 1 ;
+    }
+
+    self.frame           = 0;
+    self.vehicle_health = autocvar_g_vehicle_raptor_health;
+    self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+    self.movetype         = MOVETYPE_TOSS;
+    self.solid           = SOLID_SLIDEBOX;
+    self.vehicle_energy = 1;
+
+    self.PlayerPhysplug = raptor_frame;
+
+    self.bomb1.gun1.avelocity_y = 90;
+    self.bomb1.gun2.avelocity_y = -90;
+
+    self.delay = time;
+
+    self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
+    self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
+    self.damageforcescale = 0.25;
+    self.vehicle_health = autocvar_g_vehicle_raptor_health;
+    self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+}
+METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_raptor_shield)
+        self.vehicle_flags |= VHF_HASSHIELD;
 
-                       if(autocvar_g_vehicle_raptor_shield_regen)
-                               self.vehicle_flags |= VHF_SHIELDREGEN;
+    if(autocvar_g_vehicle_raptor_shield_regen)
+        self.vehicle_flags |= VHF_SHIELDREGEN;
 
-                       if(autocvar_g_vehicle_raptor_health_regen)
-                               self.vehicle_flags |= VHF_HEALTHREGEN;
+    if(autocvar_g_vehicle_raptor_health_regen)
+        self.vehicle_flags |= VHF_HEALTHREGEN;
 
-                       if(autocvar_g_vehicle_raptor_energy_regen)
-                               self.vehicle_flags |= VHF_ENERGYREGEN;
+    if(autocvar_g_vehicle_raptor_energy_regen)
+        self.vehicle_flags |= VHF_ENERGYREGEN;
 
-                       self.vehicle_exit = raptor_exit;
-                       self.respawntime = autocvar_g_vehicle_raptor_respawntime;
-                       self.vehicle_health = autocvar_g_vehicle_raptor_health;
-                       self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-                       self.max_health = self.vehicle_health;
-               }
+    self.vehicle_exit = raptor_exit;
+    self.respawntime = autocvar_g_vehicle_raptor_respawntime;
+    self.vehicle_health = autocvar_g_vehicle_raptor_health;
+    self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+    self.max_health = self.vehicle_health;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Raptor, vr_hud, void(Raptor thisveh))
-               {
-                       Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
-                                                        "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
-               }
-               METHOD(Raptor, vr_crosshair, void(Raptor thisveh))
-               {
-                       string crosshair;
-
-                       switch(weapon2mode)
-                       {
-                               case RSM_FLARE: crosshair = vCROSS_RAIN;  break;
-                               case RSM_BOMB:  crosshair = vCROSS_BURST; break;
-                               default:        crosshair = vCROSS_BURST;
-                       }
-
-                       vector tmpSize = '0 0 0';
-                       if(weapon2mode != RSM_FLARE)
-                       {
-                               vector where;
-
-                               if(!dropmark)
-                               {
-                                       dropmark = spawn();
-                                       dropmark.owner = self;
-                                       dropmark.gravity = 1;
-                               }
-
-                               float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
-                               if(reload2 == 1)
-                               {
-                                       setorigin(dropmark, pmove_org);
-                                       dropmark.velocity = pmove_vel;
-                                       tracetoss(dropmark, self);
-
-                                       where = project_3d_to_2d(trace_endpos);
-
-                                       setorigin(dropmark, trace_endpos);
-                                       tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
-
-                                       if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
-                                       {
-                                               where.x -= tmpSize.x * 0.5;
-                                               where.y -= tmpSize.y * 0.5;
-                                               where.z = 0;
-                                               drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
-                                               drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
-                                       }
-                                       dropmark.cnt = time + 5;
-                               }
-                               else
-                               {
-                                       if(dropmark.cnt > time)
-                                       {
-                                               where = project_3d_to_2d(dropmark.origin);
-                                               tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
-
-                                               if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
-                                               {
-                                                       where.x -= tmpSize.x * 0.5;
-                                                       where.y -= tmpSize.y * 0.5;
-                                                       where.z = 0;
-                                                       drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
-                                                       drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
-                                               }
-                                       }
-                               }
-                       }
-
-                       Vehicles_drawCrosshair(crosshair);
-               }
-               METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
-               {
-                       AuxiliaryXhair[1].axh_image = vCROSS_LOCK;
-               }
+METHOD(Raptor, vr_hud, void(Raptor thisveh))
+{
+    Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+                     "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+}
+METHOD(Raptor, vr_crosshair, void(Raptor thisveh))
+{
+    string crosshair;
+
+    switch(weapon2mode)
+    {
+        case RSM_FLARE: crosshair = vCROSS_RAIN;  break;
+        case RSM_BOMB:  crosshair = vCROSS_BURST; break;
+        default:        crosshair = vCROSS_BURST;
+    }
+
+    vector tmpSize = '0 0 0';
+    if(weapon2mode != RSM_FLARE)
+    {
+        vector where;
+
+        if(!dropmark)
+        {
+            dropmark = spawn();
+            dropmark.owner = self;
+            dropmark.gravity = 1;
+        }
+
+        float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
+        if(reload2 == 1)
+        {
+            setorigin(dropmark, pmove_org);
+            dropmark.velocity = pmove_vel;
+            tracetoss(dropmark, self);
+
+            where = project_3d_to_2d(trace_endpos);
+
+            setorigin(dropmark, trace_endpos);
+            tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
+
+            if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
+            {
+                where.x -= tmpSize.x * 0.5;
+                where.y -= tmpSize.y * 0.5;
+                where.z = 0;
+                drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
+                drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
+            }
+            dropmark.cnt = time + 5;
+        }
+        else
+        {
+            if(dropmark.cnt > time)
+            {
+                where = project_3d_to_2d(dropmark.origin);
+                tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
+
+                if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
+                {
+                    where.x -= tmpSize.x * 0.5;
+                    where.y -= tmpSize.y * 0.5;
+                    where.z = 0;
+                    drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
+                    drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
+                }
+            }
+        }
+    }
+
+    Vehicles_drawCrosshair(crosshair);
+}
+METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
+{
+    AuxiliaryXhair[1].axh_image = vCROSS_LOCK;
+}
 
 #endif
 #endif
index 41d67a78f1c900474ce65ab5ab543d87601dbd0d..589f6ff9e83635b160f535a8f86056654220e352 100644 (file)
@@ -554,127 +554,127 @@ spawnfunc(vehicle_spiderbot)
        if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
 }
 
-               METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_spiderbot_bouncepain)
-                               vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
-               }
-               METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
-               {
-                       self.vehicle_weapon2mode = SBRM_GUIDE;
-                       self.movetype = MOVETYPE_WALK;
-                       CSQCVehicleSetup(self.owner, 0);
-                       self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
-                       self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
-
-                       if(self.owner.flagcarried)
-                       {
-                               setattachment(self.owner.flagcarried, self.tur_head, "");
-                               setorigin(self.owner.flagcarried, '-20 0 120');
-                       }
-               }
-               METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
-               {
-                       if(IS_ONGROUND(self))
-                               movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
-               }
-               METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
-               {
-                       instance.health                         = 0;
-                       instance.event_damage           = func_null;
-                       instance.takedamage                     = DAMAGE_NO;
-                       instance.touch                          = func_null;
-                       instance.cnt                            = 3.4 + time + random() * 2;
-                       instance.think                          = spiderbot_blowup;
-                       instance.nextthink                      = time;
-                       instance.deadflag                       = DEAD_DYING;
-                       instance.frame                          = 5;
-                       instance.tur_head.effects  |= EF_FLAME;
-                       instance.colormod                       = instance.tur_head.colormod = '-1 -1 -1';
-                       instance.frame                          = 10;
-                       instance.movetype                       = MOVETYPE_TOSS;
-
-                       CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
-               }
-               METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
-               {
-                       if(!self.gun1)
-                       {
-                               self.vehicles_impulse = spiderbot_impulse;
-                               self.gun1 = spawn();
-                               self.gun2 = spawn();
-                               setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN);
-                               setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN);
-                               setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
-                               setattachment(self.gun2, self.tur_head, "tag_hardpoint02");
-                               self.gravity = 2;
-                               self.mass = 5000;
-                       }
-
-                       self.frame = 5;
-                       self.tur_head.frame = 1;
-                       self.movetype = MOVETYPE_WALK;
-                       self.solid = SOLID_SLIDEBOX;
-                       self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
-                       self.tur_head.angles = '0 0 0';
-                       self.vehicle_exit = spiderbot_exit;
-
-                       setorigin(self, self.pos1 + '0 0 128');
-                       self.angles = self.pos2;
-                       self.damageforcescale = 0.03;
-                       self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
-                       self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
-
-                       self.PlayerPhysplug = spiderbot_frame;
-               }
-               METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
-               {
-                       if(autocvar_g_vehicle_spiderbot_shield)
-                               self.vehicle_flags |= VHF_HASSHIELD;
+METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_spiderbot_bouncepain)
+        vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+}
+METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
+{
+    self.vehicle_weapon2mode = SBRM_GUIDE;
+    self.movetype = MOVETYPE_WALK;
+    CSQCVehicleSetup(self.owner, 0);
+    self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
+    self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
+
+    if(self.owner.flagcarried)
+    {
+        setattachment(self.owner.flagcarried, self.tur_head, "");
+        setorigin(self.owner.flagcarried, '-20 0 120');
+    }
+}
+METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
+{
+    if(IS_ONGROUND(self))
+        movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
+}
+METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
+{
+    instance.health                            = 0;
+    instance.event_damage              = func_null;
+    instance.takedamage                        = DAMAGE_NO;
+    instance.touch                             = func_null;
+    instance.cnt                               = 3.4 + time + random() * 2;
+    instance.think                             = spiderbot_blowup;
+    instance.nextthink                 = time;
+    instance.deadflag                  = DEAD_DYING;
+    instance.frame                             = 5;
+    instance.tur_head.effects  |= EF_FLAME;
+    instance.colormod                  = instance.tur_head.colormod = '-1 -1 -1';
+    instance.frame                             = 10;
+    instance.movetype                  = MOVETYPE_TOSS;
+
+    CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
+}
+METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
+{
+    if(!self.gun1)
+    {
+        self.vehicles_impulse = spiderbot_impulse;
+        self.gun1 = spawn();
+        self.gun2 = spawn();
+        setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN);
+        setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN);
+        setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
+        setattachment(self.gun2, self.tur_head, "tag_hardpoint02");
+        self.gravity = 2;
+        self.mass = 5000;
+    }
+
+    self.frame = 5;
+    self.tur_head.frame = 1;
+    self.movetype = MOVETYPE_WALK;
+    self.solid = SOLID_SLIDEBOX;
+    self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
+    self.tur_head.angles = '0 0 0';
+    self.vehicle_exit = spiderbot_exit;
+
+    setorigin(self, self.pos1 + '0 0 128');
+    self.angles = self.pos2;
+    self.damageforcescale = 0.03;
+    self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
+    self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
+
+    self.PlayerPhysplug = spiderbot_frame;
+}
+METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
+{
+    if(autocvar_g_vehicle_spiderbot_shield)
+        self.vehicle_flags |= VHF_HASSHIELD;
 
-                       if(autocvar_g_vehicle_spiderbot_shield_regen)
-                               self.vehicle_flags |= VHF_SHIELDREGEN;
+    if(autocvar_g_vehicle_spiderbot_shield_regen)
+        self.vehicle_flags |= VHF_SHIELDREGEN;
 
-                       if(autocvar_g_vehicle_spiderbot_health_regen)
-                               self.vehicle_flags |= VHF_HEALTHREGEN;
+    if(autocvar_g_vehicle_spiderbot_health_regen)
+        self.vehicle_flags |= VHF_HEALTHREGEN;
 
-                       self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
-                       self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
-                       self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
-                       self.max_health = self.vehicle_health;
-                       self.pushable = true; // spiderbot can use jumppads
-               }
+    self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
+    self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
+    self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
+    self.max_health = self.vehicle_health;
+    self.pushable = true; // spiderbot can use jumppads
+}
 
 #endif // SVQC
 #ifdef CSQC
 float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
 float autocvar_cl_vehicle_spiderbot_cross_size = 1;
 
-               METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
-               {
-                       Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
-                                                        "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
-               }
-               METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
-               {
-                       string crosshair;
+METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
+{
+    Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
+                     "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+                     "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+}
+METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
+{
+    string crosshair;
 
-                       switch(weapon2mode)
-                       {
-                               case SBRM_VOLLY:     crosshair = vCROSS_BURST; break;
-                               case SBRM_GUIDE:     crosshair = vCROSS_GUIDE; break;
-                               case SBRM_ARTILLERY: crosshair = vCROSS_RAIN;  break;
-                               default:             crosshair = vCROSS_BURST;
-                       }
+    switch(weapon2mode)
+    {
+        case SBRM_VOLLY:     crosshair = vCROSS_BURST; break;
+        case SBRM_GUIDE:     crosshair = vCROSS_GUIDE; break;
+        case SBRM_ARTILLERY: crosshair = vCROSS_RAIN;  break;
+        default:             crosshair = vCROSS_BURST;
+    }
 
-                       Vehicles_drawCrosshair(crosshair);
-               }
-               METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
-               {
-                       AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
-                       AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2
-               }
+    Vehicles_drawCrosshair(crosshair);
+}
+METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
+{
+    AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
+    AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2
+}
 
 #endif
 #endif
index c35ab3ede27b1403d3411c55b1d7d89deb5d7ae5..247548b12aaf79923de8b633cba389bec3dfdf47 100644 (file)
@@ -726,159 +726,159 @@ void Arc_Smoke()
        }
 }
 
-               METHOD(Arc, wr_aim, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       if(WEP_CVAR(arc, beam_botaimspeed))
-                       {
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
-                                       WEP_CVAR(arc, beam_botaimspeed),
-                                       0,
-                                       WEP_CVAR(arc, beam_botaimlifetime),
-                                       false
-                               );
-                       }
-                       else
-                       {
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
-                                       1000000,
-                                       0,
-                                       0.001,
-                                       false
-                               );
-                       }
-               }
-               METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       Arc_Player_SetHeat(actor);
-                       Arc_Smoke();
-
-                       bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
-
-                       if (time >= actor.arc_overheat)
-                       if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
-                       {
-
-                               if(actor.arc_BUTTON_ATCK_prev)
-                               {
-                                       #if 0
-                                       if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
-                                               weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
-                                       else
-                                       #endif
-                                               weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
-                               }
-
-                               if((!actor.arc_beam) || wasfreed(actor.arc_beam))
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
-                                       {
-                                               W_Arc_Beam(boolean(beam_fire2));
-
-                                               if(!actor.arc_BUTTON_ATCK_prev)
-                                               {
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
-                                                       actor.arc_BUTTON_ATCK_prev = true;
-                                               }
-                                       }
-                               }
-
-                               return;
-                       }
-                       else if(fire & 2)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
-                               {
-                                       W_Arc_Attack_Bolt(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
-                               }
-                       }
-
-                       if(actor.arc_BUTTON_ATCK_prev)
-                       {
-                               sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
-                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
-                               int slot = weaponslot(weaponentity);
-                               ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
-                       }
-                       actor.arc_BUTTON_ATCK_prev = false;
-
-                       #if 0
-                       if(fire & 2)
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
-                       {
-                               W_Arc_Attack2();
-                               actor.arc_count = autocvar_g_balance_arc_secondary_count;
-                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
-                               actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
-                       }
-                       #endif
-               }
-               METHOD(Arc, wr_init, void(entity thiswep))
-               {
-                       if(!arc_shotorigin[0])
-                       {
-                               arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
-                               arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
-                               arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
-                               arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
-                       }
-               }
-               METHOD(Arc, wr_checkammo1, bool(entity thiswep))
-               {
-                       SELFPARAM();
-                       return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
-               }
-               METHOD(Arc, wr_checkammo2, bool(entity thiswep))
-               {
-                       SELFPARAM();
-                       if(WEP_CVAR(arc, bolt))
-                       {
-                               float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
-                               ammo_amount += self.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
-                               return ammo_amount;
-                       }
-                       else
-                               return WEP_CVAR(arc, overheat_max) > 0 &&
-                                       ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
-               }
-               METHOD(Arc, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_ARC_MURDER_SPRAY;
-                       else
-                               return WEAPON_ARC_MURDER;
-               }
-               METHOD(Arc, wr_drop, void(entity thiswep))
-               {
-                       weapon_dropevent_item.arc_overheat = self.arc_overheat;
-                       weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
-                       self.arc_overheat = 0;
-                       self.arc_cooldown = 0;
-               }
-               METHOD(Arc, wr_pickup, void(entity thiswep))
-               {
-                       if ( !client_hasweapon(self, thiswep, false, false) &&
-                               weapon_dropevent_item.arc_overheat > time )
-                       {
-                               self.arc_overheat = weapon_dropevent_item.arc_overheat;
-                               self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
-                       }
-               }
+METHOD(Arc, wr_aim, void(entity thiswep))
+{
+    SELFPARAM();
+    if(WEP_CVAR(arc, beam_botaimspeed))
+    {
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+            WEP_CVAR(arc, beam_botaimspeed),
+            0,
+            WEP_CVAR(arc, beam_botaimlifetime),
+            false
+        );
+    }
+    else
+    {
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+            1000000,
+            0,
+            0.001,
+            false
+        );
+    }
+}
+METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    Arc_Player_SetHeat(actor);
+    Arc_Smoke();
+
+    bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
+
+    if (time >= actor.arc_overheat)
+    if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
+    {
+
+        if(actor.arc_BUTTON_ATCK_prev)
+        {
+            #if 0
+            if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
+                weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
+            else
+            #endif
+                weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
+        }
+
+        if((!actor.arc_beam) || wasfreed(actor.arc_beam))
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
+            {
+                W_Arc_Beam(boolean(beam_fire2));
+
+                if(!actor.arc_BUTTON_ATCK_prev)
+                {
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+                    actor.arc_BUTTON_ATCK_prev = true;
+                }
+            }
+        }
+
+        return;
+    }
+    else if(fire & 2)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
+        {
+            W_Arc_Attack_Bolt(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
+        }
+    }
+
+    if(actor.arc_BUTTON_ATCK_prev)
+    {
+        sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+        int slot = weaponslot(weaponentity);
+        ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
+    }
+    actor.arc_BUTTON_ATCK_prev = false;
+
+    #if 0
+    if(fire & 2)
+    if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
+    {
+        W_Arc_Attack2();
+        actor.arc_count = autocvar_g_balance_arc_secondary_count;
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
+        actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
+    }
+    #endif
+}
+METHOD(Arc, wr_init, void(entity thiswep))
+{
+    if(!arc_shotorigin[0])
+    {
+        arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
+        arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
+        arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
+        arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
+    }
+}
+METHOD(Arc, wr_checkammo1, bool(entity thiswep))
+{
+    SELFPARAM();
+    return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
+}
+METHOD(Arc, wr_checkammo2, bool(entity thiswep))
+{
+    SELFPARAM();
+    if(WEP_CVAR(arc, bolt))
+    {
+        float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
+        ammo_amount += self.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
+        return ammo_amount;
+    }
+    else
+        return WEP_CVAR(arc, overheat_max) > 0 &&
+            ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
+}
+METHOD(Arc, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_ARC_MURDER_SPRAY;
+    else
+        return WEAPON_ARC_MURDER;
+}
+METHOD(Arc, wr_drop, void(entity thiswep))
+{
+    weapon_dropevent_item.arc_overheat = self.arc_overheat;
+    weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
+    self.arc_overheat = 0;
+    self.arc_cooldown = 0;
+}
+METHOD(Arc, wr_pickup, void(entity thiswep))
+{
+    if ( !client_hasweapon(self, thiswep, false, false) &&
+        weapon_dropevent_item.arc_overheat > time )
+    {
+        self.arc_overheat = weapon_dropevent_item.arc_overheat;
+        self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
+    }
+}
 #endif
 #ifdef CSQC
 bool autocvar_cl_arcbeam_teamcolor = true;
 
-               METHOD(Arc, wr_impacteffect, void(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               vector org2;
-                               org2 = w_org + w_backoff * 6;
-                               pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
-                               if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
-                       }
-               }
+METHOD(Arc, wr_impacteffect, void(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        vector org2;
+        org2 = w_org + w_backoff * 6;
+        pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
+        if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+    }
+}
 
 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
 {
index 69d9298b8755211a617ca232656a8a66ada1e515..83740c43d59529da61754ee2feeec4ff60648471 100644 (file)
@@ -150,113 +150,113 @@ void W_Blaster_Attack(
        }
 }
 
-               METHOD(Blaster, wr_aim, void(entity thiswep))
-               {
-                       if(WEP_CVAR(blaster, secondary))
-                       {
-                               if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
-                                       { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
-                               else
-                                       { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
-                       }
-                       else
-                               { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
-               }
+METHOD(Blaster, wr_aim, void(entity thiswep))
+{
+    if(WEP_CVAR(blaster, secondary))
+    {
+        if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
+            { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
+        else
+            { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+    }
+    else
+        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+}
 
-               METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(blaster, refire)))
-                               {
-                                       W_Blaster_Attack(
-                                               actor,
-                                               WEP_BLASTER.m_id,
-                                               WEP_CVAR_PRI(blaster, shotangle),
-                                               WEP_CVAR_PRI(blaster, damage),
-                                               WEP_CVAR_PRI(blaster, edgedamage),
-                                               WEP_CVAR_PRI(blaster, radius),
-                                               WEP_CVAR_PRI(blaster, force),
-                                               WEP_CVAR_PRI(blaster, speed),
-                                               WEP_CVAR_PRI(blaster, spread),
-                                               WEP_CVAR_PRI(blaster, delay),
-                                               WEP_CVAR_PRI(blaster, lifetime)
-                                       );
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               switch(WEP_CVAR(blaster, secondary))
-                               {
-                                       case 0: // switch to last used weapon
-                                       {
-                                               if(PS(actor).m_switchweapon == WEP_BLASTER) // don't do this if already switching
-                                                       W_LastWeapon(actor);
-                                               break;
-                                       }
+METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(blaster, refire)))
+        {
+            W_Blaster_Attack(
+                actor,
+                WEP_BLASTER.m_id,
+                WEP_CVAR_PRI(blaster, shotangle),
+                WEP_CVAR_PRI(blaster, damage),
+                WEP_CVAR_PRI(blaster, edgedamage),
+                WEP_CVAR_PRI(blaster, radius),
+                WEP_CVAR_PRI(blaster, force),
+                WEP_CVAR_PRI(blaster, speed),
+                WEP_CVAR_PRI(blaster, spread),
+                WEP_CVAR_PRI(blaster, delay),
+                WEP_CVAR_PRI(blaster, lifetime)
+            );
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
+        }
+    }
+    else if(fire & 2)
+    {
+        switch(WEP_CVAR(blaster, secondary))
+        {
+            case 0: // switch to last used weapon
+            {
+                if(PS(actor).m_switchweapon == WEP_BLASTER) // don't do this if already switching
+                    W_LastWeapon(actor);
+                break;
+            }
 
-                                       case 1: // normal projectile secondary
-                                       {
-                                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire)))
-                                               {
-                                                       W_Blaster_Attack(
-                                                               actor,
-                                                               WEP_BLASTER.m_id | HITTYPE_SECONDARY,
-                                                               WEP_CVAR_SEC(blaster, shotangle),
-                                                               WEP_CVAR_SEC(blaster, damage),
-                                                               WEP_CVAR_SEC(blaster, edgedamage),
-                                                               WEP_CVAR_SEC(blaster, radius),
-                                                               WEP_CVAR_SEC(blaster, force),
-                                                               WEP_CVAR_SEC(blaster, speed),
-                                                               WEP_CVAR_SEC(blaster, spread),
-                                                               WEP_CVAR_SEC(blaster, delay),
-                                                               WEP_CVAR_SEC(blaster, lifetime)
-                                                       );
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
-                                               }
+            case 1: // normal projectile secondary
+            {
+                if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire)))
+                {
+                    W_Blaster_Attack(
+                        actor,
+                        WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+                        WEP_CVAR_SEC(blaster, shotangle),
+                        WEP_CVAR_SEC(blaster, damage),
+                        WEP_CVAR_SEC(blaster, edgedamage),
+                        WEP_CVAR_SEC(blaster, radius),
+                        WEP_CVAR_SEC(blaster, force),
+                        WEP_CVAR_SEC(blaster, speed),
+                        WEP_CVAR_SEC(blaster, spread),
+                        WEP_CVAR_SEC(blaster, delay),
+                        WEP_CVAR_SEC(blaster, lifetime)
+                    );
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
+                }
 
-                                               break;
-                                       }
-                               }
-                       }
-               }
+                break;
+            }
+        }
+    }
+}
 
-               METHOD(Blaster, wr_setup, void(entity thiswep))
-               {
-                       self.ammo_field = ammo_none;
-               }
+METHOD(Blaster, wr_setup, void(entity thiswep))
+{
+    self.ammo_field = ammo_none;
+}
 
-               METHOD(Blaster, wr_checkammo1, bool(entity thiswep))
-               {
-                       return true; // infinite ammo
-               }
+METHOD(Blaster, wr_checkammo1, bool(entity thiswep))
+{
+    return true; // infinite ammo
+}
 
-               METHOD(Blaster, wr_checkammo2, bool(entity thiswep))
-               {
-                       return true; // blaster has infinite ammo
-               }
+METHOD(Blaster, wr_checkammo2, bool(entity thiswep))
+{
+    return true; // blaster has infinite ammo
+}
 
-               METHOD(Blaster, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_BLASTER_SUICIDE;
-               }
+METHOD(Blaster, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_BLASTER_SUICIDE;
+}
 
-               METHOD(Blaster, wr_killmessage, int(entity thiswep))
-               {
-                       return WEAPON_BLASTER_MURDER;
-               }
+METHOD(Blaster, wr_killmessage, int(entity thiswep))
+{
+    return WEAPON_BLASTER_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Blaster, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
-               }
+METHOD(Blaster, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+}
 
 #endif
 #endif
index 2348a33b9e680d27aa087375db0ce14fe1a4edb7..ca786835845f78f6caced91209315c362bd6e2d8 100644 (file)
@@ -567,123 +567,123 @@ void W_Crylink_Attack2(Weapon thiswep)
        }
 }
 
-               METHOD(Crylink, wr_aim, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       if(random() < 0.10)
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
-                       else
-                               PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
-               }
-               METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       }
-
-                       if(fire & 1)
-                       {
-                               if(actor.crylink_waitrelease != 1)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire)))
-                               {
-                                       W_Crylink_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
-                               }
-                       }
-
-                       if((fire & 2) && autocvar_g_balance_crylink_secondary)
-                       {
-                               if(actor.crylink_waitrelease != 2)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire)))
-                               {
-                                       W_Crylink_Attack2(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
-                               }
-                       }
-
-                       if((actor.crylink_waitrelease == 1 && !(fire & 1)) || (actor.crylink_waitrelease == 2 && !(fire & 2)))
-                       {
-                               if(!actor.crylink_lastgroup || time > actor.crylink_lastgroup.teleport_time)
-                               {
-                                       // fired and released now!
-                                       if(actor.crylink_lastgroup)
-                                       {
-                                               vector pos;
-                                               entity linkjoineffect;
-                                               float isprimary = (actor.crylink_waitrelease == 1);
-
-                                               pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
-
-                                               linkjoineffect = new(linkjoineffect);
-                                               linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
-                                               linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
-                                               linkjoineffect.owner = actor;
-                                               setorigin(linkjoineffect, pos);
-                                       }
-                                       actor.crylink_waitrelease = 0;
-                                       if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
-                                       if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                       {
-                                               // ran out of ammo!
-                                               actor.cnt = WEP_CRYLINK.m_id;
-                                               PS(actor).m_switchweapon = w_getbestweapon(actor);
-                                       }
-                               }
-                       }
-               }
-               METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
-               {
-                       SELFPARAM();
-                       // don't "run out of ammo" and switch weapons while waiting for release
-                       if(self.crylink_lastgroup && self.crylink_waitrelease)
-                               return true;
-
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
-                       ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Crylink, wr_checkammo2, bool(entity thiswep))
-               {
-                       SELFPARAM();
-                       // don't "run out of ammo" and switch weapons while waiting for release
-                       if(self.crylink_lastgroup && self.crylink_waitrelease)
-                               return true;
-
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
-                       ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
-               }
-               METHOD(Crylink, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_CRYLINK_SUICIDE;
-               }
-               METHOD(Crylink, wr_killmessage, int(entity thiswep))
-               {
-                       return WEAPON_CRYLINK_MURDER;
-               }
+METHOD(Crylink, wr_aim, void(entity thiswep))
+{
+    SELFPARAM();
+    if(random() < 0.10)
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
+    else
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
+}
+METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    }
+
+    if(fire & 1)
+    {
+        if(actor.crylink_waitrelease != 1)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire)))
+        {
+            W_Crylink_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
+        }
+    }
+
+    if((fire & 2) && autocvar_g_balance_crylink_secondary)
+    {
+        if(actor.crylink_waitrelease != 2)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire)))
+        {
+            W_Crylink_Attack2(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
+        }
+    }
+
+    if((actor.crylink_waitrelease == 1 && !(fire & 1)) || (actor.crylink_waitrelease == 2 && !(fire & 2)))
+    {
+        if(!actor.crylink_lastgroup || time > actor.crylink_lastgroup.teleport_time)
+        {
+            // fired and released now!
+            if(actor.crylink_lastgroup)
+            {
+                vector pos;
+                entity linkjoineffect;
+                float isprimary = (actor.crylink_waitrelease == 1);
+
+                pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
+
+                linkjoineffect = new(linkjoineffect);
+                linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
+                linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
+                linkjoineffect.owner = actor;
+                setorigin(linkjoineffect, pos);
+            }
+            actor.crylink_waitrelease = 0;
+            if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
+            if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+            {
+                // ran out of ammo!
+                actor.cnt = WEP_CRYLINK.m_id;
+                PS(actor).m_switchweapon = w_getbestweapon(actor);
+            }
+        }
+    }
+}
+METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
+{
+    SELFPARAM();
+    // don't "run out of ammo" and switch weapons while waiting for release
+    if(self.crylink_lastgroup && self.crylink_waitrelease)
+        return true;
+
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
+    ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
+    return ammo_amount;
+}
+METHOD(Crylink, wr_checkammo2, bool(entity thiswep))
+{
+    SELFPARAM();
+    // don't "run out of ammo" and switch weapons while waiting for release
+    if(self.crylink_lastgroup && self.crylink_waitrelease)
+        return true;
+
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
+    ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
+    return ammo_amount;
+}
+METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
+}
+METHOD(Crylink, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_CRYLINK_SUICIDE;
+}
+METHOD(Crylink, wr_killmessage, int(entity thiswep))
+{
+    return WEAPON_CRYLINK_MURDER;
+}
 #endif
 #ifdef CSQC
-               METHOD(Crylink, wr_impacteffect, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               pointparticles(EFFECT_CRYLINK_IMPACT2, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CH_SHOTS, SND_CRYLINK_IMPACT2, VOL_BASE, ATTN_NORM);
-                       }
-                       else
-                       {
-                               pointparticles(EFFECT_CRYLINK_IMPACT, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM);
-                       }
-               }
+METHOD(Crylink, wr_impacteffect, void(entity thiswep))
+{
+    SELFPARAM();
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        pointparticles(EFFECT_CRYLINK_IMPACT2, org2, '0 0 0', 1);
+        if(!w_issilent)
+            sound(self, CH_SHOTS, SND_CRYLINK_IMPACT2, VOL_BASE, ATTN_NORM);
+    }
+    else
+    {
+        pointparticles(EFFECT_CRYLINK_IMPACT, org2, '0 0 0', 1);
+        if(!w_issilent)
+            sound(self, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM);
+    }
+}
 #endif
 #endif
index 3d89299e194df7f0e82630a0b9696fa659c82b6a..f63f3f54d7accb31fe139b320570c3ec21a3c2a5 100644 (file)
@@ -404,233 +404,233 @@ void W_Devastator_Attack(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-               #if 0
-               METHOD(Devastator, wr_aim, void(entity thiswep))
-               {
-                       // aim and decide to fire if appropriate
-                       PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
-                       if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
-                       {
-                               // decide whether to detonate rockets
-                               entity missile, targetlist, targ;
-                               targetlist = findchainfloat(bot_attack, true);
-                               for(missile = world; (missile = find(missile, classname, "rocket")); ) if(missile.realowner == self)
-                               {
-                                       targ = targetlist;
-                                       while(targ)
-                                       {
-                                               if(targ != missile.realowner && vlen(targ.origin - missile.origin) < WEP_CVAR(devastator, radius))
-                                               {
-                                                       PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                                       break;
-                                               }
-                                               targ = targ.chain;
-                                       }
-                               }
-
-                               if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
-                       }
-               }
-               #else
-               METHOD(Devastator, wr_aim, void(entity thiswep))
-               {
-                       // aim and decide to fire if appropriate
-                       PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
-                       if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
-                       {
-                               // decide whether to detonate rockets
-                               entity targetlist, targ;
-                               float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
-                               float selfdamage, teamdamage, enemydamage;
-                               edgedamage = WEP_CVAR(devastator, edgedamage);
-                               coredamage = WEP_CVAR(devastator, damage);
-                               edgeradius = WEP_CVAR(devastator, radius);
-                               recipricoledgeradius = 1 / edgeradius;
-                               selfdamage = 0;
-                               teamdamage = 0;
-                               enemydamage = 0;
-                               targetlist = findchainfloat(bot_attack, true);
-                               FOREACH_ENTITY_ENT(realowner, self,
-                               {
-                                       if(it.classname != "rocket") continue;
-
-                                       targ = targetlist;
-                                       while(targ)
-                                       {
-                                               d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - it.origin);
-                                               d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
-                                               // count potential damage according to type of target
-                                               if(targ == self)
-                                                       selfdamage = selfdamage + d;
-                                               else if(targ.team == self.team && teamplay)
-                                                       teamdamage = teamdamage + d;
-                                               else if(bot_shouldattack(targ))
-                                                       enemydamage = enemydamage + d;
-                                               targ = targ.chain;
-                                       }
-                               });
-                               float desirabledamage;
-                               desirabledamage = enemydamage;
-                               if(time > self.invincible_finished && time > self.spawnshieldtime)
-                                       desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
-                               if(teamplay && self.team)
-                                       desirabledamage = desirabledamage - teamdamage;
-
-                               FOREACH_ENTITY_ENT(realowner, self,
-                               {
-                                       if(it.classname != "rocket") continue;
-
-                                       makevectors(it.v_angle);
-                                       targ = targetlist;
-                                       if(skill > 9) // normal players only do this for the target they are tracking
-                                       {
-                                               targ = targetlist;
-                                               while(targ)
-                                               {
-                                                       if(
-                                                               (v_forward * normalize(it.origin - targ.origin)< 0.1)
-                                                               && desirabledamage > 0.1*coredamage
-                                                       ) PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                                       targ = targ.chain;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
-                                               //As the distance gets larger, a correct detonation gets near imposible
-                                               //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
-                                               if(v_forward * normalize(it.origin - self.enemy.origin)< 0.1)
-                                                       if(IS_PLAYER(self.enemy))
-                                                               if(desirabledamage >= 0.1*coredamage)
-                                                                       if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
-                                                                               PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                       //      dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
-                                       }
-                               });
-                               // if we would be doing at X percent of the core damage, detonate it
-                               // but don't fire a new shot at the same time!
-                               if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                               if((skill > 6.5) && (selfdamage > self.health))
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-                               //if(PHYS_INPUT_BUTTON_ATCK2(self) == true)
-                               //      dprint(ftos(desirabledamage),"\n");
-                               if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
-                       }
-               }
-               #endif
-               METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else {
-                               if(fire & 1)
-                               {
-                                       if(actor.rl_release || WEP_CVAR(devastator, guidestop))
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
-                                       {
-                                               W_Devastator_Attack(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
-                                               actor.rl_release = 0;
-                                       }
-                               }
-                               else
-                                       actor.rl_release = 1;
-
-                               if(fire & 2)
-                               if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
-                               {
-                                       entity rock;
-                                       bool rockfound = false;
-                                       for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == actor)
-                                       {
-                                               if(!rock.rl_detonate_later)
-                                               {
-                                                       rock.rl_detonate_later = true;
-                                                       rockfound = true;
-                                               }
-                                       }
-                                       if(rockfound)
-                                               sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
-                               }
-                       }
-               }
-               METHOD(Devastator, wr_setup, void(entity thiswep))
-               {
-                       self.rl_release = 1;
-               }
-               METHOD(Devastator, wr_checkammo1, bool(entity thiswep))
-               {
-                       #if 0
-                       // don't switch while guiding a missile
-                       if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
-                       {
-                               ammo_amount = false;
-                               if(WEP_CVAR(devastator, reload_ammo))
-                               {
-                                       if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
-                                               ammo_amount = true;
-                               }
-                               else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
-                                       ammo_amount = true;
-                               return !ammo_amount;
-                       }
-                       #endif
-                       #if 0
-                       if(self.rl_release == 0)
-                       {
-                               LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
-                               return true;
-                       }
-                       else
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
-                               ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
-                               LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
-                               return ammo_amount;
-                       }
-                       #else
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
-                       ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
-                       return ammo_amount;
-                       #endif
-               }
-               METHOD(Devastator, wr_checkammo2, bool(entity thiswep))
-               {
-                       return false;
-               }
-               METHOD(Devastator, wr_resetplayer, void(entity thiswep))
-               {
-                       self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
-                       self.rl_release = 0;
-               }
-               METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
-               }
-               METHOD(Devastator, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_DEVASTATOR_SUICIDE;
-               }
-               METHOD(Devastator, wr_killmessage, int(entity thiswep))
-               {
-                       if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
-                               return WEAPON_DEVASTATOR_MURDER_SPLASH;
-                       else
-                               return WEAPON_DEVASTATOR_MURDER_DIRECT;
-               }
+#if 0
+METHOD(Devastator, wr_aim, void(entity thiswep))
+{
+    // aim and decide to fire if appropriate
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+    if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
+    {
+        // decide whether to detonate rockets
+        entity missile, targetlist, targ;
+        targetlist = findchainfloat(bot_attack, true);
+        for(missile = world; (missile = find(missile, classname, "rocket")); ) if(missile.realowner == self)
+        {
+            targ = targetlist;
+            while(targ)
+            {
+                if(targ != missile.realowner && vlen(targ.origin - missile.origin) < WEP_CVAR(devastator, radius))
+                {
+                    PHYS_INPUT_BUTTON_ATCK2(self) = true;
+                    break;
+                }
+                targ = targ.chain;
+            }
+        }
+
+        if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
+    }
+}
+#else
+METHOD(Devastator, wr_aim, void(entity thiswep))
+{
+    // aim and decide to fire if appropriate
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+    if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
+    {
+        // decide whether to detonate rockets
+        entity targetlist, targ;
+        float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
+        float selfdamage, teamdamage, enemydamage;
+        edgedamage = WEP_CVAR(devastator, edgedamage);
+        coredamage = WEP_CVAR(devastator, damage);
+        edgeradius = WEP_CVAR(devastator, radius);
+        recipricoledgeradius = 1 / edgeradius;
+        selfdamage = 0;
+        teamdamage = 0;
+        enemydamage = 0;
+        targetlist = findchainfloat(bot_attack, true);
+        FOREACH_ENTITY_ENT(realowner, self,
+        {
+            if(it.classname != "rocket") continue;
+
+            targ = targetlist;
+            while(targ)
+            {
+                d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - it.origin);
+                d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
+                // count potential damage according to type of target
+                if(targ == self)
+                    selfdamage = selfdamage + d;
+                else if(targ.team == self.team && teamplay)
+                    teamdamage = teamdamage + d;
+                else if(bot_shouldattack(targ))
+                    enemydamage = enemydamage + d;
+                targ = targ.chain;
+            }
+        });
+        float desirabledamage;
+        desirabledamage = enemydamage;
+        if(time > self.invincible_finished && time > self.spawnshieldtime)
+            desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
+        if(teamplay && self.team)
+            desirabledamage = desirabledamage - teamdamage;
+
+        FOREACH_ENTITY_ENT(realowner, self,
+        {
+            if(it.classname != "rocket") continue;
+
+            makevectors(it.v_angle);
+            targ = targetlist;
+            if(skill > 9) // normal players only do this for the target they are tracking
+            {
+                targ = targetlist;
+                while(targ)
+                {
+                    if(
+                        (v_forward * normalize(it.origin - targ.origin)< 0.1)
+                        && desirabledamage > 0.1*coredamage
+                    ) PHYS_INPUT_BUTTON_ATCK2(self) = true;
+                    targ = targ.chain;
+                }
+            }
+            else
+            {
+                float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
+                //As the distance gets larger, a correct detonation gets near imposible
+                //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
+                if(v_forward * normalize(it.origin - self.enemy.origin)< 0.1)
+                    if(IS_PLAYER(self.enemy))
+                        if(desirabledamage >= 0.1*coredamage)
+                            if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
+                                PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+            }
+        });
+        // if we would be doing at X percent of the core damage, detonate it
+        // but don't fire a new shot at the same time!
+        if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+        if((skill > 6.5) && (selfdamage > self.health))
+            PHYS_INPUT_BUTTON_ATCK2(self) = false;
+        //if(PHYS_INPUT_BUTTON_ATCK2(self) == true)
+        //     dprint(ftos(desirabledamage),"\n");
+        if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
+    }
+}
+#endif
+METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else {
+        if(fire & 1)
+        {
+            if(actor.rl_release || WEP_CVAR(devastator, guidestop))
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
+            {
+                W_Devastator_Attack(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
+                actor.rl_release = 0;
+            }
+        }
+        else
+            actor.rl_release = 1;
+
+        if(fire & 2)
+        if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
+        {
+            entity rock;
+            bool rockfound = false;
+            for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == actor)
+            {
+                if(!rock.rl_detonate_later)
+                {
+                    rock.rl_detonate_later = true;
+                    rockfound = true;
+                }
+            }
+            if(rockfound)
+                sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
+        }
+    }
+}
+METHOD(Devastator, wr_setup, void(entity thiswep))
+{
+    self.rl_release = 1;
+}
+METHOD(Devastator, wr_checkammo1, bool(entity thiswep))
+{
+    #if 0
+    // don't switch while guiding a missile
+    if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
+    {
+        ammo_amount = false;
+        if(WEP_CVAR(devastator, reload_ammo))
+        {
+            if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
+                ammo_amount = true;
+        }
+        else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
+            ammo_amount = true;
+        return !ammo_amount;
+    }
+    #endif
+    #if 0
+    if(self.rl_release == 0)
+    {
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
+        return true;
+    }
+    else
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+        ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+        return ammo_amount;
+    }
+    #else
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+    ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+    return ammo_amount;
+    #endif
+}
+METHOD(Devastator, wr_checkammo2, bool(entity thiswep))
+{
+    return false;
+}
+METHOD(Devastator, wr_resetplayer, void(entity thiswep))
+{
+    self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
+    self.rl_release = 0;
+}
+METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
+}
+METHOD(Devastator, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_DEVASTATOR_SUICIDE;
+}
+METHOD(Devastator, wr_killmessage, int(entity thiswep))
+{
+    if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+        return WEAPON_DEVASTATOR_MURDER_SPLASH;
+    else
+        return WEAPON_DEVASTATOR_MURDER_DIRECT;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Devastator, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 12;
-                       pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM);
-               }
+METHOD(Devastator, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 12;
+    pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index 55266f8420082e308fe9e6c66698a375badf014c..78632fa0b5300584df81c2e95fcdff9355e34d71 100644 (file)
@@ -425,152 +425,152 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
 
 .float bot_secondary_electromooth;
 
-               METHOD(Electro, wr_aim, void(entity thiswep))
-               {
-                       PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false;
-                       if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
-                       if(self.bot_secondary_electromooth == 0)
-                       {
-                               float shoot;
-
-                               if(WEP_CVAR_PRI(electro, speed))
-                                       shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
-                               else
-                                       shoot = bot_aim(1000000, 0, 0.001, false);
-
-                               if(shoot)
-                               {
-                                       PHYS_INPUT_BUTTON_ATCK(self) = true;
-                                       if(random() < 0.01) self.bot_secondary_electromooth = 1;
-                               }
-                       }
-                       else
-                       {
-                               if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
-                               {
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                       if(random() < 0.03) self.bot_secondary_electromooth = 0;
-                               }
-                       }
-               }
-               METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
-                       {
-                               float ammo_amount = 0;
-                               if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
-                                       ammo_amount = 1;
-                               if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
-                                       ammo_amount += 1;
-
-                               if(!ammo_amount)
-                               {
-                                       thiswep.wr_reload(thiswep, actor, weaponentity);
-                                       return;
-                               }
-                       }
-
-                       if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
-                               {
-                                               W_Electro_Attack_Bolt(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               if(time >= actor.electro_secondarytime)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
-                               {
-                                       W_Electro_Attack_Orb(thiswep);
-                                       actor.electro_count = WEP_CVAR_SEC(electro, count);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
-                                       actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
-                               }
-                       }
-               }
-               METHOD(Electro, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
-                       ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Electro, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
-                               ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
-                       }
-                       else
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
-                               ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(Electro, wr_resetplayer, void(entity thiswep))
-               {
-                       self.electro_secondarytime = time;
-               }
-               METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
-               }
-               METHOD(Electro, wr_suicidemessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_ELECTRO_SUICIDE_ORBS;
-                       else
-                               return WEAPON_ELECTRO_SUICIDE_BOLT;
-               }
-               METHOD(Electro, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               return WEAPON_ELECTRO_MURDER_ORBS;
-                       }
-                       else
-                       {
-                               if(w_deathtype & HITTYPE_BOUNCE)
-                                       return WEAPON_ELECTRO_MURDER_COMBO;
-                               else
-                                       return WEAPON_ELECTRO_MURDER_BOLT;
-                       }
-               }
+METHOD(Electro, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
+    if(self.bot_secondary_electromooth == 0)
+    {
+        float shoot;
+
+        if(WEP_CVAR_PRI(electro, speed))
+            shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
+        else
+            shoot = bot_aim(1000000, 0, 0.001, false);
+
+        if(shoot)
+        {
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+            if(random() < 0.01) self.bot_secondary_electromooth = 1;
+        }
+    }
+    else
+    {
+        if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
+        {
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            if(random() < 0.03) self.bot_secondary_electromooth = 0;
+        }
+    }
+}
+METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
+    {
+        float ammo_amount = 0;
+        if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
+            ammo_amount = 1;
+        if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
+            ammo_amount += 1;
+
+        if(!ammo_amount)
+        {
+            thiswep.wr_reload(thiswep, actor, weaponentity);
+            return;
+        }
+    }
+
+    if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
+        {
+                W_Electro_Attack_Bolt(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+        }
+    }
+    else if(fire & 2)
+    {
+        if(time >= actor.electro_secondarytime)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
+        {
+            W_Electro_Attack_Orb(thiswep);
+            actor.electro_count = WEP_CVAR_SEC(electro, count);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
+            actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
+        }
+    }
+}
+METHOD(Electro, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
+    ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
+    return ammo_amount;
+}
+METHOD(Electro, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+        ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+    }
+    else
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
+        ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
+    }
+    return ammo_amount;
+}
+METHOD(Electro, wr_resetplayer, void(entity thiswep))
+{
+    self.electro_secondarytime = time;
+}
+METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
+}
+METHOD(Electro, wr_suicidemessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_ELECTRO_SUICIDE_ORBS;
+    else
+        return WEAPON_ELECTRO_SUICIDE_BOLT;
+}
+METHOD(Electro, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        return WEAPON_ELECTRO_MURDER_ORBS;
+    }
+    else
+    {
+        if(w_deathtype & HITTYPE_BOUNCE)
+            return WEAPON_ELECTRO_MURDER_COMBO;
+        else
+            return WEAPON_ELECTRO_MURDER_BOLT;
+    }
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Electro, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               pointparticles(EFFECT_ELECTRO_BALLEXPLODE, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
-                       }
-                       else
-                       {
-                               if(w_deathtype & HITTYPE_BOUNCE)
-                               {
-                                       // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
-                                       pointparticles(EFFECT_ELECTRO_COMBO, org2, '0 0 0', 1);
-                                       if(!w_issilent)
-                                               sound(self, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM);
-                               }
-                               else
-                               {
-                                       pointparticles(EFFECT_ELECTRO_IMPACT, org2, '0 0 0', 1);
-                                       if(!w_issilent)
-                                               sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
-                               }
-                       }
-               }
+METHOD(Electro, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        pointparticles(EFFECT_ELECTRO_BALLEXPLODE, org2, '0 0 0', 1);
+        if(!w_issilent)
+            sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
+    }
+    else
+    {
+        if(w_deathtype & HITTYPE_BOUNCE)
+        {
+            // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
+            pointparticles(EFFECT_ELECTRO_COMBO, org2, '0 0 0', 1);
+            if(!w_issilent)
+                sound(self, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM);
+        }
+        else
+        {
+            pointparticles(EFFECT_ELECTRO_IMPACT, org2, '0 0 0', 1);
+            if(!w_issilent)
+                sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
+        }
+    }
+}
 
 #endif
 #endif
index ce17e8f395d889543dd633755b96330ac8af86e6..53520c60b78ec59b1968d407ae6b72c819a5103b 100644 (file)
@@ -351,96 +351,96 @@ void W_Fireball_Attack2()
        MUTATOR_CALLHOOK(EditProjectile, self, proj);
 }
 
-               METHOD(Fireball, wr_aim, void(entity thiswep))
-               {
-                       PHYS_INPUT_BUTTON_ATCK(self) = false;
-                       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-                       if(self.bot_primary_fireballmooth == 0)
-                       {
-                               if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
-                               {
-                                       PHYS_INPUT_BUTTON_ATCK(self) = true;
-                                       if(random() < 0.02) self.bot_primary_fireballmooth = 0;
-                               }
-                       }
-                       else
-                       {
-                               if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
-                               {
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                       if(random() < 0.01) self.bot_primary_fireballmooth = 1;
-                               }
-                       }
-               }
-               METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(fire & 1)
-                       {
-                               if(time >= actor.fireball_primarytime)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(fireball, refire)))
-                               {
-                                       W_Fireball_Attack1_Frame0(thiswep, actor, weaponentity, fire);
-                                       actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire)))
-                               {
-                                       W_Fireball_Attack2();
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
-                               }
-                       }
-               }
-               METHOD(Fireball, wr_setup, void(entity thiswep))
-               {
-                       self.ammo_field = ammo_none;
-               }
-               METHOD(Fireball, wr_checkammo1, bool(entity thiswep))
-               {
-                       return true; // infinite ammo
-               }
-               METHOD(Fireball, wr_checkammo2, bool(entity thiswep))
-               {
-                       return true; // fireball has infinite ammo
-               }
-               METHOD(Fireball, wr_resetplayer, void(entity thiswep))
-               {
-                       self.fireball_primarytime = time;
-               }
-               METHOD(Fireball, wr_suicidemessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_FIREBALL_SUICIDE_FIREMINE;
-                       else
-                               return WEAPON_FIREBALL_SUICIDE_BLAST;
-               }
-               METHOD(Fireball, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_FIREBALL_MURDER_FIREMINE;
-                       else
-                               return WEAPON_FIREBALL_MURDER_BLAST;
-               }
+METHOD(Fireball, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = false;
+    PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(self.bot_primary_fireballmooth == 0)
+    {
+        if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
+        {
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+            if(random() < 0.02) self.bot_primary_fireballmooth = 0;
+        }
+    }
+    else
+    {
+        if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
+        {
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            if(random() < 0.01) self.bot_primary_fireballmooth = 1;
+        }
+    }
+}
+METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(fire & 1)
+    {
+        if(time >= actor.fireball_primarytime)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(fireball, refire)))
+        {
+            W_Fireball_Attack1_Frame0(thiswep, actor, weaponentity, fire);
+            actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
+        }
+    }
+    else if(fire & 2)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire)))
+        {
+            W_Fireball_Attack2();
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
+        }
+    }
+}
+METHOD(Fireball, wr_setup, void(entity thiswep))
+{
+    self.ammo_field = ammo_none;
+}
+METHOD(Fireball, wr_checkammo1, bool(entity thiswep))
+{
+    return true; // infinite ammo
+}
+METHOD(Fireball, wr_checkammo2, bool(entity thiswep))
+{
+    return true; // fireball has infinite ammo
+}
+METHOD(Fireball, wr_resetplayer, void(entity thiswep))
+{
+    self.fireball_primarytime = time;
+}
+METHOD(Fireball, wr_suicidemessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_FIREBALL_SUICIDE_FIREMINE;
+    else
+        return WEAPON_FIREBALL_SUICIDE_BLAST;
+}
+METHOD(Fireball, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_FIREBALL_MURDER_FIREMINE;
+    else
+        return WEAPON_FIREBALL_MURDER_BLAST;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Fireball, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               // firemine goes out silently
-                       }
-                       else
-                       {
-                               org2 = w_org + w_backoff * 16;
-                               pointparticles(EFFECT_FIREBALL_EXPLODE, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                                       sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom
-                       }
-               }
+METHOD(Fireball, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        // firemine goes out silently
+    }
+    else
+    {
+        org2 = w_org + w_backoff * 16;
+        pointparticles(EFFECT_FIREBALL_EXPLODE, org2, '0 0 0', 1);
+        if(!w_issilent)
+            sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom
+    }
+}
 
 #endif
 #endif
index 9b4bbd418655163253f7f23572a4c9e81e7969ad..3aafb816da351cd1e9a781c216071012a945c086 100644 (file)
@@ -397,117 +397,117 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
        }
 }
 
-               METHOD(Hagar, wr_aim, void(entity thiswep))
-               {
-                       if(random()>0.15)
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
-                       else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
-                               PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
-               }
-               METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       float loadable_secondary;
-                       loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
-
-                       if(loadable_secondary)
-                               W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
-                       if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
-                               {
-                                       W_Hagar_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
-                               }
-                       }
-                       else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
-                               {
-                                       W_Hagar_Attack2(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
-                               }
-                       }
-               }
-               METHOD(Hagar, wr_gonethink, void(entity thiswep))
-               {
-                       // we lost the weapon and want to prepare switching away
-                       if(self.hagar_load)
-                       {
-                               .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-                               self.(weaponentity).state = WS_READY;
-                               W_Hagar_Attack2_Load_Release(weaponentity);
-                       }
-               }
-               METHOD(Hagar, wr_setup, void(entity thiswep))
-               {
-                       self.hagar_loadblock = false;
+METHOD(Hagar, wr_aim, void(entity thiswep))
+{
+    if(random()>0.15)
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+    else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+}
+METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    float loadable_secondary;
+    loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
+
+    if(loadable_secondary)
+        W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
+    if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
+        {
+            W_Hagar_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
+        }
+    }
+    else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
+        {
+            W_Hagar_Attack2(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
+        }
+    }
+}
+METHOD(Hagar, wr_gonethink, void(entity thiswep))
+{
+    // we lost the weapon and want to prepare switching away
+    if(self.hagar_load)
+    {
+        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+        self.(weaponentity).state = WS_READY;
+        W_Hagar_Attack2_Load_Release(weaponentity);
+    }
+}
+METHOD(Hagar, wr_setup, void(entity thiswep))
+{
+    self.hagar_loadblock = false;
 
-                       if(self.hagar_load)
-                       {
-                               W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
-                               self.hagar_load = 0;
-                       }
-               }
-               METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
-                       ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
-                       ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Hagar, wr_resetplayer, void(entity thiswep))
-               {
-                       self.hagar_load = 0;
-               }
-               METHOD(Hagar, wr_playerdeath, void(entity thiswep))
-               {
-                       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-                       // if we have any rockets loaded when we die, release them
-                       if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
-                               W_Hagar_Attack2_Load_Release(weaponentity);
-               }
-               METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       if(!self.hagar_load) // require releasing loaded rockets first
-                               W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
-               }
-               METHOD(Hagar, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_HAGAR_SUICIDE;
-               }
-               METHOD(Hagar, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_HAGAR_MURDER_BURST;
-                       else
-                               return WEAPON_HAGAR_MURDER_SPRAY;
-               }
+    if(self.hagar_load)
+    {
+        W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
+        self.hagar_load = 0;
+    }
+}
+METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
+    ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
+    return ammo_amount;
+}
+METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
+    ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
+    return ammo_amount;
+}
+METHOD(Hagar, wr_resetplayer, void(entity thiswep))
+{
+    self.hagar_load = 0;
+}
+METHOD(Hagar, wr_playerdeath, void(entity thiswep))
+{
+    .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+    // if we have any rockets loaded when we die, release them
+    if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
+        W_Hagar_Attack2_Load_Release(weaponentity);
+}
+METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    if(!self.hagar_load) // require releasing loaded rockets first
+        W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
+}
+METHOD(Hagar, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_HAGAR_SUICIDE;
+}
+METHOD(Hagar, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_HAGAR_MURDER_BURST;
+    else
+        return WEAPON_HAGAR_MURDER_SPRAY;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Hagar, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                       {
-                               if(w_random<0.15)
-                                       sound(self, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM);
-                               else if(w_random<0.7)
-                                       sound(self, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM);
-                               else
-                                       sound(self, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM);
-                       }
-               }
+METHOD(Hagar, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+    {
+        if(w_random<0.15)
+            sound(self, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM);
+        else if(w_random<0.7)
+            sound(self, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM);
+        else
+            sound(self, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM);
+    }
+}
 
 #endif
 #endif
index deae8b11ca1da8207b86ff2dbd691d1edf03147f..b2f3264d668d9d5e59db6f4755f1e741cc0068f0 100644 (file)
@@ -207,69 +207,69 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
        }
 }
 
-               METHOD(HLAC, wr_aim, void(entity thiswep))
-               {
-                       PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
-               }
-               METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
-                               {
-                                       actor.misc_bulletcounter = 0;
-                                       W_HLAC_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
-                               }
-                       }
-
-                       else if((fire & 2) && WEP_CVAR(hlac, secondary))
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire)))
-                               {
-                                       W_HLAC_Attack2_Frame(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
-                               }
-                       }
-               }
-               METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
-                       ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
-                       return ammo_amount;
-               }
-               METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
-                       ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
-                       return ammo_amount;
-               }
-               METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
-               }
-               METHOD(HLAC, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_HLAC_SUICIDE;
-               }
-               METHOD(HLAC, wr_killmessage, int(entity thiswep))
-               {
-                       return WEAPON_HLAC_MURDER;
-               }
+METHOD(HLAC, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
+}
+METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
+        {
+            actor.misc_bulletcounter = 0;
+            W_HLAC_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
+        }
+    }
+
+    else if((fire & 2) && WEP_CVAR(hlac, secondary))
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire)))
+        {
+            W_HLAC_Attack2_Frame(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
+        }
+    }
+}
+METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
+    ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
+    return ammo_amount;
+}
+METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
+    ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
+    return ammo_amount;
+}
+METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
+}
+METHOD(HLAC, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_HLAC_SUICIDE;
+}
+METHOD(HLAC, wr_killmessage, int(entity thiswep))
+{
+    return WEAPON_HLAC_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(HLAC, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM);
-               }
+METHOD(HLAC, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index 0b679e098cfc9b04eaf8d05422132998b4578092..79ef90009af72e877055be5db31734313d0afa7a 100644 (file)
@@ -180,141 +180,141 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
        MUTATOR_CALLHOOK(EditProjectile, actor, gren);
 }
 
-               METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if (fire & 1) {
-                               if(!actor.hook)
-                               if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
-                               if(time > actor.hook_refire)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1))
-                               {
-                                       W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo));
-                                       actor.hook_state |= HOOK_FIRING;
-                                       actor.hook_state |= HOOK_WAITING_FOR_RELEASE;
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
-                               }
-                       } else {
-                               actor.hook_state |= HOOK_REMOVING;
-                               actor.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
-                       }
+METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if (fire & 1) {
+        if(!actor.hook)
+        if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
+        if(time > actor.hook_refire)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1))
+        {
+            W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo));
+            actor.hook_state |= HOOK_FIRING;
+            actor.hook_state |= HOOK_WAITING_FOR_RELEASE;
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
+        }
+    } else {
+        actor.hook_state |= HOOK_REMOVING;
+        actor.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
+    }
 
-                       if(fire & 2)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire)))
-                               {
-                                       W_Hook_Attack2(thiswep, actor);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
-                               }
-                       }
+    if(fire & 2)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire)))
+        {
+            W_Hook_Attack2(thiswep, actor);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
+        }
+    }
 
-                       if(actor.hook)
-                       {
-                               // if hooked, no bombs, and increase the timer
-                               actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor());
+    if(actor.hook)
+    {
+        // if hooked, no bombs, and increase the timer
+        actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor());
 
-                               // hook also inhibits health regeneration, but only for 1 second
-                               if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                       actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
-                       }
+        // hook also inhibits health regeneration, but only for 1 second
+        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+            actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
+    }
 
-                       if(actor.hook && actor.hook.state == 1)
-                       {
-                               float hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);
-                               if(hooked_time_max > 0)
-                               {
-                                       if( time > actor.hook_time_hooked + hooked_time_max )
-                                               actor.hook_state |= HOOK_REMOVING;
-                               }
-
-                               float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(hook, hooked_ammo);
-                               if(hooked_fuel > 0)
-                               {
-                                       if( time > actor.hook_time_fueldecrease )
-                                       {
-                                               if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                               {
-                                                       if( actor.ammo_fuel >= (time - actor.hook_time_fueldecrease) * hooked_fuel )
-                                                       {
-                                                               W_DecreaseAmmo(thiswep, actor, (time - actor.hook_time_fueldecrease) * hooked_fuel);
-                                                               actor.hook_time_fueldecrease = time;
-                                                               // decrease next frame again
-                                                       }
-                                                       else
-                                                       {
-                                                               actor.ammo_fuel = 0;
-                                                               actor.hook_state |= HOOK_REMOVING;
-                                                               W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               actor.hook_time_hooked = time;
-                               actor.hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
-                       }
+    if(actor.hook && actor.hook.state == 1)
+    {
+        float hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);
+        if(hooked_time_max > 0)
+        {
+            if( time > actor.hook_time_hooked + hooked_time_max )
+                actor.hook_state |= HOOK_REMOVING;
+        }
+
+        float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(hook, hooked_ammo);
+        if(hooked_fuel > 0)
+        {
+            if( time > actor.hook_time_fueldecrease )
+            {
+                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+                {
+                    if( actor.ammo_fuel >= (time - actor.hook_time_fueldecrease) * hooked_fuel )
+                    {
+                        W_DecreaseAmmo(thiswep, actor, (time - actor.hook_time_fueldecrease) * hooked_fuel);
+                        actor.hook_time_fueldecrease = time;
+                        // decrease next frame again
+                    }
+                    else
+                    {
+                        actor.ammo_fuel = 0;
+                        actor.hook_state |= HOOK_REMOVING;
+                        W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+                    }
+                }
+            }
+        }
+    }
+    else
+    {
+        actor.hook_time_hooked = time;
+        actor.hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
+    }
 
-                       actor.hook_state = BITSET(actor.hook_state, HOOK_PULLING, (!PHYS_INPUT_BUTTON_CROUCH(actor) || !autocvar_g_balance_grapplehook_crouchslide));
+    actor.hook_state = BITSET(actor.hook_state, HOOK_PULLING, (!PHYS_INPUT_BUTTON_CROUCH(actor) || !autocvar_g_balance_grapplehook_crouchslide));
 
-                       if (actor.hook_state & HOOK_FIRING)
-                       {
-                               if (actor.hook)
-                                       RemoveGrapplingHook(actor);
-                               WITH(entity, self, actor, FireGrapplingHook());
-                               actor.hook_state &= ~HOOK_FIRING;
-                               actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
-                       }
-                       else if (actor.hook_state & HOOK_REMOVING)
-                       {
-                               if (actor.hook)
-                                       RemoveGrapplingHook(actor);
-                               actor.hook_state &= ~HOOK_REMOVING;
-                       }
-               }
-               METHOD(Hook, wr_setup, void(entity thiswep))
-               {
-                       self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
-               }
-               METHOD(Hook, wr_checkammo1, bool(Hook thiswep))
-               {
-                       if (!thiswep.ammo_factor) return true;
-                       if(self.hook)
-                               return self.ammo_fuel > 0;
-                       else
-                               return self.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
-               }
-               METHOD(Hook, wr_checkammo2, bool(Hook thiswep))
-               {
-                       // infinite ammo for now
-                       return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
-               }
-               METHOD(Hook, wr_resetplayer, void(entity thiswep))
-               {
-                       RemoveGrapplingHook(self);
-                       self.hook_time = 0;
-                       self.hook_refire = time;
-               }
-               METHOD(Hook, wr_suicidemessage, int(entity thiswep))
-               {
-                       return false;
-               }
-               METHOD(Hook, wr_killmessage, int(entity thiswep))
-               {
-                       return WEAPON_HOOK_MURDER;
-               }
+    if (actor.hook_state & HOOK_FIRING)
+    {
+        if (actor.hook)
+            RemoveGrapplingHook(actor);
+        WITH(entity, self, actor, FireGrapplingHook());
+        actor.hook_state &= ~HOOK_FIRING;
+        actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
+    }
+    else if (actor.hook_state & HOOK_REMOVING)
+    {
+        if (actor.hook)
+            RemoveGrapplingHook(actor);
+        actor.hook_state &= ~HOOK_REMOVING;
+    }
+}
+METHOD(Hook, wr_setup, void(entity thiswep))
+{
+    self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
+}
+METHOD(Hook, wr_checkammo1, bool(Hook thiswep))
+{
+    if (!thiswep.ammo_factor) return true;
+    if(self.hook)
+        return self.ammo_fuel > 0;
+    else
+        return self.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
+}
+METHOD(Hook, wr_checkammo2, bool(Hook thiswep))
+{
+    // infinite ammo for now
+    return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
+}
+METHOD(Hook, wr_resetplayer, void(entity thiswep))
+{
+    RemoveGrapplingHook(self);
+    self.hook_time = 0;
+    self.hook_refire = time;
+}
+METHOD(Hook, wr_suicidemessage, int(entity thiswep))
+{
+    return false;
+}
+METHOD(Hook, wr_killmessage, int(entity thiswep))
+{
+    return WEAPON_HOOK_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Hook, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM);
-               }
+METHOD(Hook, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 
index daace731259f44ced26b50470b5d1f6e187fdaf9..448195a98a3f046b948bf2b3eab92a0e05e260c8 100644 (file)
@@ -242,125 +242,125 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
 
 }
 
-               METHOD(MachineGun, wr_aim, void(entity thiswep))
-               {
-                       if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
-                       else
-                               PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
-               }
-               METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(machinegun, reload_ammo) && actor.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       if(WEP_CVAR(machinegun, mode) == 1)
-                       {
-                               if(fire & 1)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
-                               {
-                                       actor.misc_bulletcounter = 0;
-                                       W_MachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
-                               }
-
-                               if(fire & 2)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
-                               {
-                                       if(!thiswep.wr_checkammo2(thiswep))
-                                       if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                       {
-                                               W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                                               w_ready(thiswep, actor, weaponentity, fire);
-                                               return;
-                                       }
-
-                                       W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo));
-
-                                       actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
-                                       W_MachineGun_Attack_Burst(thiswep, actor, weaponentity, fire);
-                               }
-                       }
-                       else
-                       {
-
-                               if(fire & 1)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
-                               {
-                                       actor.misc_bulletcounter = 1;
-                                       W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); // sets attack_finished
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
-                               }
-
-                               if((fire & 2) && WEP_CVAR(machinegun, first))
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
-                               {
-                                       actor.misc_bulletcounter = 1;
-                                       W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, weaponentity); // sets attack_finished
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
-                               }
-                       }
-               }
-               METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(machinegun, mode) == 1)
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
-                       else
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
-
-                       if(WEP_CVAR(machinegun, reload_ammo))
-                       {
-                               if(WEP_CVAR(machinegun, mode) == 1)
-                                       ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, sustained_ammo);
-                               else
-                                       ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(machinegun, mode) == 1)
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
-                       else
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
-
-                       if(WEP_CVAR(machinegun, reload_ammo))
-                       {
-                               if(WEP_CVAR(machinegun, mode) == 1)
-                                       ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, burst_ammo);
-                               else
-                                       ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
-               }
-               METHOD(MachineGun, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(MachineGun, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_MACHINEGUN_MURDER_SNIPE;
-                       else
-                               return WEAPON_MACHINEGUN_MURDER_SPRAY;
-               }
+METHOD(MachineGun, wr_aim, void(entity thiswep))
+{
+    if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+    else
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+}
+METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(machinegun, reload_ammo) && actor.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    if(WEP_CVAR(machinegun, mode) == 1)
+    {
+        if(fire & 1)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+        {
+            actor.misc_bulletcounter = 0;
+            W_MachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
+        }
+
+        if(fire & 2)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
+        {
+            if(!thiswep.wr_checkammo2(thiswep))
+            if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+            {
+                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+                w_ready(thiswep, actor, weaponentity, fire);
+                return;
+            }
+
+            W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo));
+
+            actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
+            W_MachineGun_Attack_Burst(thiswep, actor, weaponentity, fire);
+        }
+    }
+    else
+    {
+
+        if(fire & 1)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+        {
+            actor.misc_bulletcounter = 1;
+            W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); // sets attack_finished
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
+        }
+
+        if((fire & 2) && WEP_CVAR(machinegun, first))
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
+        {
+            actor.misc_bulletcounter = 1;
+            W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, weaponentity); // sets attack_finished
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
+        }
+    }
+}
+METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(machinegun, mode) == 1)
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
+    else
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
+
+    if(WEP_CVAR(machinegun, reload_ammo))
+    {
+        if(WEP_CVAR(machinegun, mode) == 1)
+            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, sustained_ammo);
+        else
+            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
+    }
+    return ammo_amount;
+}
+METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(machinegun, mode) == 1)
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
+    else
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
+
+    if(WEP_CVAR(machinegun, reload_ammo))
+    {
+        if(WEP_CVAR(machinegun, mode) == 1)
+            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, burst_ammo);
+        else
+            ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
+    }
+    return ammo_amount;
+}
+METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
+}
+METHOD(MachineGun, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(MachineGun, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_MACHINEGUN_MURDER_SNIPE;
+    else
+        return WEAPON_MACHINEGUN_MURDER_SPRAY;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
-               }
+METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index e08b51d202cd6480f6ed650c1916bddb4a4b6957..8b88a0c5ab67f5b09df6683d593d327322897ebf 100644 (file)
@@ -404,175 +404,175 @@ float W_MineLayer_PlacedMines(float detonate)
        return minfound;
 }
 
-               METHOD(MineLayer, wr_aim, void(entity thiswep))
-               {
-                       // aim and decide to fire if appropriate
-                       if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
-                               PHYS_INPUT_BUTTON_ATCK(self) = false;
-                       else
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
-                       if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
-                       {
-                               // decide whether to detonate mines
-                               entity targetlist, targ;
-                               float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
-                               float selfdamage, teamdamage, enemydamage;
-                               edgedamage = WEP_CVAR(minelayer, edgedamage);
-                               coredamage = WEP_CVAR(minelayer, damage);
-                               edgeradius = WEP_CVAR(minelayer, radius);
-                               recipricoledgeradius = 1 / edgeradius;
-                               selfdamage = 0;
-                               teamdamage = 0;
-                               enemydamage = 0;
-                               targetlist = findchainfloat(bot_attack, true);
-                               entity mine = find(world, classname, "mine");
-                               while(mine)
-                               {
-                                       if(mine.realowner != self)
-                                       {
-                                               mine = find(mine, classname, "mine");
-                                               continue;
-                                       }
-                                       targ = targetlist;
-                                       while(targ)
-                                       {
-                                               d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - mine.origin);
-                                               d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
-                                               // count potential damage according to type of target
-                                               if(targ == self)
-                                                       selfdamage = selfdamage + d;
-                                               else if(targ.team == self.team && teamplay)
-                                                       teamdamage = teamdamage + d;
-                                               else if(bot_shouldattack(targ))
-                                                       enemydamage = enemydamage + d;
-                                               targ = targ.chain;
-                                       }
-                                       mine = find(mine, classname, "mine");
-                               }
-                               float desirabledamage;
-                               desirabledamage = enemydamage;
-                               if(time > self.invincible_finished && time > self.spawnshieldtime)
-                                       desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
-                               if(teamplay && self.team)
-                                       desirabledamage = desirabledamage - teamdamage;
-
-                               mine = find(world, classname, "mine");
-                               while(mine)
-                               {
-                                       if(mine.realowner != self)
-                                       {
-                                               mine = find(mine, classname, "mine");
-                                               continue;
-                                       }
-                                       makevectors(mine.v_angle);
-                                       targ = targetlist;
-                                       if(skill > 9) // normal players only do this for the target they are tracking
-                                       {
-                                               targ = targetlist;
-                                               while(targ)
-                                               {
-                                                       if(
-                                                               (v_forward * normalize(mine.origin - targ.origin)< 0.1)
-                                                               && desirabledamage > 0.1*coredamage
-                                                       ) PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                                       targ = targ.chain;
-                                               }
-                                       }else{
-                                               float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
-                                               //As the distance gets larger, a correct detonation gets near imposible
-                                               //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player
-                                               if(v_forward * normalize(mine.origin - self.enemy.origin)< 0.1)
-                                                       if(IS_PLAYER(self.enemy))
-                                                               if(desirabledamage >= 0.1*coredamage)
-                                                                       if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
-                                                                               PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                       //      dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
-                                       }
-
-                                       mine = find(mine, classname, "mine");
-                               }
-                               // if we would be doing at X percent of the core damage, detonate it
-                               // but don't fire a new shot at the same time!
-                               if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                               if((skill > 6.5) && (selfdamage > self.health))
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-                               //if(PHYS_INPUT_BUTTON_ATCK2(self) == true)
-                               //      dprint(ftos(desirabledamage),"\n");
-                               if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
-                       }
-               }
-               METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
-                       {
-                               // not if we're holding the minelayer without enough ammo, but can detonate existing mines
-                               if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
-                                       thiswep.wr_reload(thiswep, actor, weaponentity);
-                               }
-                       }
-                       else if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire)))
-                               {
-                                       W_MineLayer_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
-                               }
-                       }
-
-                       if(fire & 2)
-                       {
-                               if(W_MineLayer_PlacedMines(true))
-                                       sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
-                       }
-               }
-               METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
-               {
-                       int slot = 0; // TODO: unhardcode
-                       // don't switch while placing a mine
-                       if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
-                       {
-                               float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
-                               ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
-                               return ammo_amount;
-                       }
-                       return true;
-               }
-               METHOD(MineLayer, wr_checkammo2, bool(entity thiswep))
-               {
-                       if(W_MineLayer_PlacedMines(false))
-                               return true;
-                       else
-                               return false;
-               }
-               METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
-               {
-                       self.minelayer_mines = 0;
-               }
-               METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
-               }
-               METHOD(MineLayer, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_MINELAYER_SUICIDE;
-               }
-               METHOD(MineLayer, wr_killmessage, int(entity thiswep))
-               {
-                       return WEAPON_MINELAYER_MURDER;
-               }
+METHOD(MineLayer, wr_aim, void(entity thiswep))
+{
+    // aim and decide to fire if appropriate
+    if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
+        PHYS_INPUT_BUTTON_ATCK(self) = false;
+    else
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
+    if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
+    {
+        // decide whether to detonate mines
+        entity targetlist, targ;
+        float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
+        float selfdamage, teamdamage, enemydamage;
+        edgedamage = WEP_CVAR(minelayer, edgedamage);
+        coredamage = WEP_CVAR(minelayer, damage);
+        edgeradius = WEP_CVAR(minelayer, radius);
+        recipricoledgeradius = 1 / edgeradius;
+        selfdamage = 0;
+        teamdamage = 0;
+        enemydamage = 0;
+        targetlist = findchainfloat(bot_attack, true);
+        entity mine = find(world, classname, "mine");
+        while(mine)
+        {
+            if(mine.realowner != self)
+            {
+                mine = find(mine, classname, "mine");
+                continue;
+            }
+            targ = targetlist;
+            while(targ)
+            {
+                d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - mine.origin);
+                d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
+                // count potential damage according to type of target
+                if(targ == self)
+                    selfdamage = selfdamage + d;
+                else if(targ.team == self.team && teamplay)
+                    teamdamage = teamdamage + d;
+                else if(bot_shouldattack(targ))
+                    enemydamage = enemydamage + d;
+                targ = targ.chain;
+            }
+            mine = find(mine, classname, "mine");
+        }
+        float desirabledamage;
+        desirabledamage = enemydamage;
+        if(time > self.invincible_finished && time > self.spawnshieldtime)
+            desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
+        if(teamplay && self.team)
+            desirabledamage = desirabledamage - teamdamage;
+
+        mine = find(world, classname, "mine");
+        while(mine)
+        {
+            if(mine.realowner != self)
+            {
+                mine = find(mine, classname, "mine");
+                continue;
+            }
+            makevectors(mine.v_angle);
+            targ = targetlist;
+            if(skill > 9) // normal players only do this for the target they are tracking
+            {
+                targ = targetlist;
+                while(targ)
+                {
+                    if(
+                        (v_forward * normalize(mine.origin - targ.origin)< 0.1)
+                        && desirabledamage > 0.1*coredamage
+                    ) PHYS_INPUT_BUTTON_ATCK2(self) = true;
+                    targ = targ.chain;
+                }
+            }else{
+                float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
+                //As the distance gets larger, a correct detonation gets near imposible
+                //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player
+                if(v_forward * normalize(mine.origin - self.enemy.origin)< 0.1)
+                    if(IS_PLAYER(self.enemy))
+                        if(desirabledamage >= 0.1*coredamage)
+                            if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
+                                PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+            }
+
+            mine = find(mine, classname, "mine");
+        }
+        // if we would be doing at X percent of the core damage, detonate it
+        // but don't fire a new shot at the same time!
+        if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+        if((skill > 6.5) && (selfdamage > self.health))
+            PHYS_INPUT_BUTTON_ATCK2(self) = false;
+        //if(PHYS_INPUT_BUTTON_ATCK2(self) == true)
+        //     dprint(ftos(desirabledamage),"\n");
+        if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
+    }
+}
+METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
+    {
+        // not if we're holding the minelayer without enough ammo, but can detonate existing mines
+        if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
+            thiswep.wr_reload(thiswep, actor, weaponentity);
+        }
+    }
+    else if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire)))
+        {
+            W_MineLayer_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
+        }
+    }
+
+    if(fire & 2)
+    {
+        if(W_MineLayer_PlacedMines(true))
+            sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
+    }
+}
+METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
+{
+    int slot = 0; // TODO: unhardcode
+    // don't switch while placing a mine
+    if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
+    {
+        float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
+        ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
+        return ammo_amount;
+    }
+    return true;
+}
+METHOD(MineLayer, wr_checkammo2, bool(entity thiswep))
+{
+    if(W_MineLayer_PlacedMines(false))
+        return true;
+    else
+        return false;
+}
+METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
+{
+    self.minelayer_mines = 0;
+}
+METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
+}
+METHOD(MineLayer, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_MINELAYER_SUICIDE;
+}
+METHOD(MineLayer, wr_killmessage, int(entity thiswep))
+{
+    return WEAPON_MINELAYER_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 12;
-                       pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM);
-               }
+METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 12;
+    pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index e7c00bb0420bc025417716e983082c1d4eaa5009..0b7a295bfbf8fdc5637934486d384a1dae22d3db 100644 (file)
@@ -298,121 +298,121 @@ void W_Mortar_Attack2(Weapon thiswep)
 
 .float bot_secondary_grenademooth;
 
-               METHOD(Mortar, wr_aim, void(entity thiswep))
-               {
-                       PHYS_INPUT_BUTTON_ATCK(self) = false;
-                       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-                       if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
-                       {
-                               if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
-                               {
-                                       PHYS_INPUT_BUTTON_ATCK(self) = true;
-                                       if(random() < 0.01) self.bot_secondary_grenademooth = 1;
-                               }
-                       }
-                       else
-                       {
-                               if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
-                               {
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                       if(random() < 0.02) self.bot_secondary_grenademooth = 0;
-                               }
-                       }
-               }
-               /*case WR_CALCINFO:
-               {
-                       wepinfo_pri_refire = max3(sys_frametime, WEP_CVAR_PRI(mortar, refire), WEP_CVAR_PRI(mortar, animtime));
-                       wepinfo_pri_dps = (WEP_CVAR_PRI(mortar, damage) * (1 / wepinfo_pri_refire));
-                       wepinfo_pri_speed = (1 / max(1, (10000 / max(1, WEP_CVAR_PRI(mortar, speed)))));
-
-                       // for the range calculation, closer to 1 is better
-                       wepinfo_pri_range_max = 2000 * wepinfo_pri_speed;
-                       wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(mortar,
-
-                       wepinfo_sec_refire = max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime));
-                       wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / wepinfo_sec_refire));
-
-                       wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime))));
-                       wepinfo_ter_dps = 0;
-                       */
-               METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if(fire & 1)
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire)))
-                               {
-                                       W_Mortar_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               if(WEP_CVAR_SEC(mortar, remote_detonateprimary))
-                               {
-                                       bool nadefound = false;
-                                       entity nade;
-                                       for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == actor)
-                                       {
-                                               if(!nade.gl_detonate_later)
-                                               {
-                                                       nade.gl_detonate_later = true;
-                                                       nadefound = true;
-                                               }
-                                       }
-                                       if(nadefound)
-                                               sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
-                               }
-                               else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire)))
-                               {
-                                       W_Mortar_Attack2(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
-                               }
-                       }
-               }
-               METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
-                       ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
-                       ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
-               }
-               METHOD(Mortar, wr_suicidemessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_MORTAR_SUICIDE_BOUNCE;
-                       else
-                               return WEAPON_MORTAR_SUICIDE_EXPLODE;
-               }
-               METHOD(Mortar, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_MORTAR_MURDER_BOUNCE;
-                       else
-                               return WEAPON_MORTAR_MURDER_EXPLODE;
-               }
+METHOD(Mortar, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = false;
+    PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
+    {
+        if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
+        {
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+            if(random() < 0.01) self.bot_secondary_grenademooth = 1;
+        }
+    }
+    else
+    {
+        if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
+        {
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            if(random() < 0.02) self.bot_secondary_grenademooth = 0;
+        }
+    }
+}
+/*case WR_CALCINFO:
+{
+    wepinfo_pri_refire = max3(sys_frametime, WEP_CVAR_PRI(mortar, refire), WEP_CVAR_PRI(mortar, animtime));
+    wepinfo_pri_dps = (WEP_CVAR_PRI(mortar, damage) * (1 / wepinfo_pri_refire));
+    wepinfo_pri_speed = (1 / max(1, (10000 / max(1, WEP_CVAR_PRI(mortar, speed)))));
+
+    // for the range calculation, closer to 1 is better
+    wepinfo_pri_range_max = 2000 * wepinfo_pri_speed;
+    wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(mortar,
+
+    wepinfo_sec_refire = max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime));
+    wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / wepinfo_sec_refire));
+
+    wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime))));
+    wepinfo_ter_dps = 0;
+    */
+METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if(fire & 1)
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire)))
+        {
+            W_Mortar_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
+        }
+    }
+    else if(fire & 2)
+    {
+        if(WEP_CVAR_SEC(mortar, remote_detonateprimary))
+        {
+            bool nadefound = false;
+            entity nade;
+            for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == actor)
+            {
+                if(!nade.gl_detonate_later)
+                {
+                    nade.gl_detonate_later = true;
+                    nadefound = true;
+                }
+            }
+            if(nadefound)
+                sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
+        }
+        else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire)))
+        {
+            W_Mortar_Attack2(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
+        }
+    }
+}
+METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
+    ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
+    return ammo_amount;
+}
+METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
+    ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
+    return ammo_amount;
+}
+METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
+}
+METHOD(Mortar, wr_suicidemessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_MORTAR_SUICIDE_BOUNCE;
+    else
+        return WEAPON_MORTAR_SUICIDE_EXPLODE;
+}
+METHOD(Mortar, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_MORTAR_MURDER_BOUNCE;
+    else
+        return WEAPON_MORTAR_MURDER_EXPLODE;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Mortar, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 12;
-                       pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM);
-               }
+METHOD(Mortar, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 12;
+    pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM);
+}
 
 #endif
 #endif
index 97f993f9eb5aec5980a45b385bd7a4097500b526..be4387347ab1dbde10fd6fda7c2b1510405bfa0b 100644 (file)
@@ -292,95 +292,95 @@ void W_Porto_Attack(float type)
        MUTATOR_CALLHOOK(EditProjectile, self, gren);
 }
 
-               METHOD(PortoLaunch, wr_aim, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       PHYS_INPUT_BUTTON_ATCK(self) = false;
-                       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-                       if(!WEP_CVAR(porto, secondary))
-                               if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
-                                       PHYS_INPUT_BUTTON_ATCK(self) = true;
-               }
-               METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(porto, secondary))
-                       {
-                               if(fire & 1)
-                               if(!actor.porto_current)
-                               if(!actor.porto_forbidden)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
-                               {
-                                       W_Porto_Attack(0);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
-                               }
-
-                               if(fire & 2)
-                               if(!actor.porto_current)
-                               if(!actor.porto_forbidden)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(porto, refire)))
-                               {
-                                       W_Porto_Attack(1);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
-                               }
-                       }
-                       else
-                       {
-                               if(actor.porto_v_angle_held)
-                               {
-                                       if(!(fire & 2))
-                                       {
-                                               actor.porto_v_angle_held = 0;
-
-                                               ClientData_Touch(actor);
-                                       }
-                               }
-                               else
-                               {
-                                       if(fire & 2)
-                                       {
-                                               actor.porto_v_angle = actor.v_angle;
-                                               actor.porto_v_angle_held = 1;
-
-                                               ClientData_Touch(actor);
-                                       }
-                               }
-                               if(actor.porto_v_angle_held)
-                                       makevectors(actor.porto_v_angle); // override the previously set angles
-
-                               if(fire & 1)
-                               if(!actor.porto_current)
-                               if(!actor.porto_forbidden)
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
-                               {
-                                       W_Porto_Attack(-1);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
-                               }
-                       }
-               }
-               METHOD(PortoLaunch, wr_checkammo1, bool(entity this))
-               {
-                       // always allow infinite ammo
-                       return true;
-               }
-               METHOD(PortoLaunch, wr_checkammo2, bool(entity this))
-               {
-                       // always allow infinite ammo
-                       return true;
-               }
-               METHOD(PortoLaunch, wr_setup, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       self.ammo_field = ammo_none;
-               }
-               METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep))
-               {
-                       SELFPARAM();
-                       self.porto_current = world;
-               }
+METHOD(PortoLaunch, wr_aim, void(entity thiswep))
+{
+    SELFPARAM();
+    PHYS_INPUT_BUTTON_ATCK(self) = false;
+    PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(!WEP_CVAR(porto, secondary))
+        if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+}
+METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(porto, secondary))
+    {
+        if(fire & 1)
+        if(!actor.porto_current)
+        if(!actor.porto_forbidden)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
+        {
+            W_Porto_Attack(0);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
+        }
+
+        if(fire & 2)
+        if(!actor.porto_current)
+        if(!actor.porto_forbidden)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(porto, refire)))
+        {
+            W_Porto_Attack(1);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
+        }
+    }
+    else
+    {
+        if(actor.porto_v_angle_held)
+        {
+            if(!(fire & 2))
+            {
+                actor.porto_v_angle_held = 0;
+
+                ClientData_Touch(actor);
+            }
+        }
+        else
+        {
+            if(fire & 2)
+            {
+                actor.porto_v_angle = actor.v_angle;
+                actor.porto_v_angle_held = 1;
+
+                ClientData_Touch(actor);
+            }
+        }
+        if(actor.porto_v_angle_held)
+            makevectors(actor.porto_v_angle); // override the previously set angles
+
+        if(fire & 1)
+        if(!actor.porto_current)
+        if(!actor.porto_forbidden)
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
+        {
+            W_Porto_Attack(-1);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
+        }
+    }
+}
+METHOD(PortoLaunch, wr_checkammo1, bool(entity this))
+{
+    // always allow infinite ammo
+    return true;
+}
+METHOD(PortoLaunch, wr_checkammo2, bool(entity this))
+{
+    // always allow infinite ammo
+    return true;
+}
+METHOD(PortoLaunch, wr_setup, void(entity thiswep))
+{
+    SELFPARAM();
+    self.ammo_field = ammo_none;
+}
+METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep))
+{
+    SELFPARAM();
+    self.porto_current = world;
+}
 #endif
 #ifdef CSQC
-               METHOD(PortoLaunch, wr_impacteffect, void(entity this)) {
-                       LOG_WARNING("Since when does Porto send DamageInfo?\n");
-               }
+METHOD(PortoLaunch, wr_impacteffect, void(entity this)) {
+    LOG_WARNING("Since when does Porto send DamageInfo?\n");
+}
 #endif
 #endif
index f3291dfe1de71ef55c396a85edc4df0e1256a80f..d7df010f53fa1f1124aa239df59217c6a3f7e281 100644 (file)
@@ -138,139 +138,139 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
 
 .float bot_secondary_riflemooth;
 
-               METHOD(Rifle, wr_aim, void(entity thiswep))
-               {
-                       PHYS_INPUT_BUTTON_ATCK(self) = false;
-                       PHYS_INPUT_BUTTON_ATCK2(self) = false;
-                       if(vdist(self.origin - self.enemy.origin, >, 1000))
-                               self.bot_secondary_riflemooth = 0;
-                       if(self.bot_secondary_riflemooth == 0)
-                       {
-                               if(bot_aim(1000000, 0, 0.001, false))
-                               {
-                                       PHYS_INPUT_BUTTON_ATCK(self) = true;
-                                       if(random() < 0.01) self.bot_secondary_riflemooth = 1;
-                               }
-                       }
-                       else
-                       {
-                               if(bot_aim(1000000, 0, 0.001, false))
-                               {
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                                       if(random() < 0.03) self.bot_secondary_riflemooth = 0;
-                               }
-                       }
-               }
-               METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       {
-                               actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
-                               if(fire & 1)
-                               if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)))
-                               if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
-                               {
-                                       weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
-                                       W_Rifle_BulletHail(weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
-                                       actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
-                               }
-                               if(fire & 2)
-                               {
-                                       if(WEP_CVAR(rifle, secondary))
-                                       {
-                                               if(WEP_CVAR_SEC(rifle, reload)) {
-                                                       thiswep.wr_reload(thiswep, actor, weaponentity);
-                                               } else
-                                               {
-                                                       if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)))
-                                                       if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
-                                                       {
-                                                               weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
-                                                               W_Rifle_BulletHail(weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
-                                                               actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-               METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
-                       ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
-                       ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Rifle, wr_resetplayer, void(entity thiswep))
-               {
-                       self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
-               }
-               METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
-               }
-               METHOD(Rifle, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Rifle, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               if(w_deathtype & HITTYPE_BOUNCE)
-                                       return WEAPON_RIFLE_MURDER_HAIL_PIERCING;
-                               else
-                                       return WEAPON_RIFLE_MURDER_HAIL;
-                       }
-                       else
-                       {
-                               if(w_deathtype & HITTYPE_BOUNCE)
-                                       return WEAPON_RIFLE_MURDER_PIERCING;
-                               else
-                                       return WEAPON_RIFLE_MURDER;
-                       }
-               }
+METHOD(Rifle, wr_aim, void(entity thiswep))
+{
+    PHYS_INPUT_BUTTON_ATCK(self) = false;
+    PHYS_INPUT_BUTTON_ATCK2(self) = false;
+    if(vdist(self.origin - self.enemy.origin, >, 1000))
+        self.bot_secondary_riflemooth = 0;
+    if(self.bot_secondary_riflemooth == 0)
+    {
+        if(bot_aim(1000000, 0, 0.001, false))
+        {
+            PHYS_INPUT_BUTTON_ATCK(self) = true;
+            if(random() < 0.01) self.bot_secondary_riflemooth = 1;
+        }
+    }
+    else
+    {
+        if(bot_aim(1000000, 0, 0.001, false))
+        {
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+            if(random() < 0.03) self.bot_secondary_riflemooth = 0;
+        }
+    }
+}
+METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    {
+        actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
+        if(fire & 1)
+        if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)))
+        if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
+        {
+            weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
+            W_Rifle_BulletHail(weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+            actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
+        }
+        if(fire & 2)
+        {
+            if(WEP_CVAR(rifle, secondary))
+            {
+                if(WEP_CVAR_SEC(rifle, reload)) {
+                    thiswep.wr_reload(thiswep, actor, weaponentity);
+                } else
+                {
+                    if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)))
+                    if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
+                    {
+                        weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
+                        W_Rifle_BulletHail(weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+                        actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
+                    }
+                }
+            }
+        }
+    }
+}
+METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
+    ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
+    return ammo_amount;
+}
+METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
+    ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
+    return ammo_amount;
+}
+METHOD(Rifle, wr_resetplayer, void(entity thiswep))
+{
+    self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
+}
+METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
+}
+METHOD(Rifle, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Rifle, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        if(w_deathtype & HITTYPE_BOUNCE)
+            return WEAPON_RIFLE_MURDER_HAIL_PIERCING;
+        else
+            return WEAPON_RIFLE_MURDER_HAIL;
+    }
+    else
+    {
+        if(w_deathtype & HITTYPE_BOUNCE)
+            return WEAPON_RIFLE_MURDER_PIERCING;
+        else
+            return WEAPON_RIFLE_MURDER;
+    }
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Rifle, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent)
-                       {
-                               sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
-                       }
-               }
-               METHOD(Rifle, wr_init, void(entity thiswep))
-               {
-                       if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
-                       {
-                               precache_pic("gfx/reticle_nex");
-                       }
-               }
-               METHOD(Rifle, wr_zoomreticle, bool(entity thiswep))
-               {
-                       if(button_zoom || zoomscript_caught)
-                       {
-                               reticle_image = "gfx/reticle_nex";
-                               return true;
-                       }
-                       else
-                       {
-                               // no weapon specific image for this weapon
-                               return false;
-                       }
-               }
+METHOD(Rifle, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent)
+    {
+        sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
+    }
+}
+METHOD(Rifle, wr_init, void(entity thiswep))
+{
+    if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+    {
+        precache_pic("gfx/reticle_nex");
+    }
+}
+METHOD(Rifle, wr_zoomreticle, bool(entity thiswep))
+{
+    if(button_zoom || zoomscript_caught)
+    {
+        reticle_image = "gfx/reticle_nex";
+        return true;
+    }
+    else
+    {
+        // no weapon specific image for this weapon
+        return false;
+    }
+}
 
 #endif
 #endif
index 7642b3b7bc45efb114c24472618d4ffea3a6adc9..ac71e48a92ea3fa0fbb369eea0f5622c14eead29 100644 (file)
@@ -598,148 +598,148 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
 // Begin: Genereal weapon functions
 // ============================
 
-               METHOD(Seeker, wr_aim, void(entity thiswep))
-               {
-                       if(WEP_CVAR(seeker, type) == 1)
-                               if(W_Seeker_Tagged_Info(self, self.enemy) != world)
-                                       PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
-                               else
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
-                       else
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
-               }
-               METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if(fire & 1)
-                       {
-                               if(WEP_CVAR(seeker, type) == 1)
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire)))
-                                       {
-                                               W_Seeker_Attack();
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
-                                       }
-                               }
-                               else
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
-                                       {
-                                               W_Seeker_Fire_Tag(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
-                                       }
-                               }
-                       }
-
-                       else if(fire & 2)
-                       {
-                               if(WEP_CVAR(seeker, type) == 1)
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
-                                       {
-                                               W_Seeker_Fire_Tag(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
-                                       }
-                               }
-                               else
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire)))
-                                       {
-                                               W_Seeker_Fire_Flac(thiswep);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
-                                       }
-                               }
-                       }
-               }
-               METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(seeker, type) == 1)
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
-                               ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
-                       }
-                       else
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
-                               ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
-               {
-                       float ammo_amount;
-                       if(WEP_CVAR(seeker, type) == 1)
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
-                               ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
-                       }
-                       else
-                       {
-                               ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
-                               ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
-                       }
-                       return ammo_amount;
-               }
-               METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
-               }
-               METHOD(Seeker, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_SEEKER_SUICIDE;
-               }
-               METHOD(Seeker, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_SEEKER_MURDER_TAG;
-                       else
-                               return WEAPON_SEEKER_MURDER_SPRAY;
-               }
+METHOD(Seeker, wr_aim, void(entity thiswep))
+{
+    if(WEP_CVAR(seeker, type) == 1)
+        if(W_Seeker_Tagged_Info(self, self.enemy) != world)
+            PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
+        else
+            PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+    else
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+}
+METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if(fire & 1)
+    {
+        if(WEP_CVAR(seeker, type) == 1)
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire)))
+            {
+                W_Seeker_Attack();
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
+            }
+        }
+        else
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
+            {
+                W_Seeker_Fire_Tag(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
+            }
+        }
+    }
+
+    else if(fire & 2)
+    {
+        if(WEP_CVAR(seeker, type) == 1)
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
+            {
+                W_Seeker_Fire_Tag(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
+            }
+        }
+        else
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire)))
+            {
+                W_Seeker_Fire_Flac(thiswep);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
+            }
+        }
+    }
+}
+METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(seeker, type) == 1)
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
+        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
+    }
+    else
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
+    }
+    return ammo_amount;
+}
+METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
+{
+    float ammo_amount;
+    if(WEP_CVAR(seeker, type) == 1)
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
+    }
+    else
+    {
+        ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
+        ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
+    }
+    return ammo_amount;
+}
+METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
+}
+METHOD(Seeker, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_SEEKER_SUICIDE;
+}
+METHOD(Seeker, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_SEEKER_MURDER_TAG;
+    else
+        return WEAPON_SEEKER_MURDER_SPRAY;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Seeker, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2;
-                       org2 = w_org + w_backoff * 6;
-                       if(w_deathtype & HITTYPE_BOUNCE)
-                       {
-                               if(w_deathtype & HITTYPE_SECONDARY)
-                               {
-                                       if(!w_issilent)
-                                               sound(self, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM);
-                               }
-                               else
-                               {
-                                       pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
-                                       if(!w_issilent)
-                                       {
-                                               if(w_random<0.15)
-                                                       sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
-                                               else if(w_random<0.7)
-                                                       sound(self, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM);
-                                               else
-                                                       sound(self, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM);
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
-                               if(!w_issilent)
-                               {
-                                       if(w_random<0.15)
-                                               sound(self, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM);
-                                       else if(w_random<0.7)
-                                               sound(self, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM);
-                                       else
-                                               sound(self, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM);
-                               }
-                       }
-               }
+METHOD(Seeker, wr_impacteffect, void(entity thiswep))
+{
+    vector org2;
+    org2 = w_org + w_backoff * 6;
+    if(w_deathtype & HITTYPE_BOUNCE)
+    {
+        if(w_deathtype & HITTYPE_SECONDARY)
+        {
+            if(!w_issilent)
+                sound(self, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM);
+        }
+        else
+        {
+            pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
+            if(!w_issilent)
+            {
+                if(w_random<0.15)
+                    sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
+                else if(w_random<0.7)
+                    sound(self, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM);
+                else
+                    sound(self, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM);
+            }
+        }
+    }
+    else
+    {
+        pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
+        if(!w_issilent)
+        {
+            if(w_random<0.15)
+                sound(self, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM);
+            else if(w_random<0.7)
+                sound(self, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM);
+            else
+                sound(self, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM);
+        }
+    }
+}
 
 #endif
 #endif
index 88741989672b50a7fc62dd9d84ccef9516737b0a..9f4a88d783c215dd48d5458bbb5abc428c3128db 100644 (file)
@@ -672,58 +672,58 @@ void W_Shockwave_Attack()
        }
 }
 
-               METHOD(Shockwave, wr_aim, void(entity thiswep))
-               {
-                       if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
-                               { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); }
-                       else
-                               { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); }
-               }
-               METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(fire & 1)
-                       {
-                               if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
-                                       {
-                                               W_Shockwave_Attack();
-                                               actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
-                                       }
-                               }
-                       }
-                       else if(fire & 2)
-                       {
-                               //if(actor.clip_load >= 0) // we are not currently reloading
-                               if(!actor.crouch) // no crouchmelee please
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
-                               {
-                                       // attempt forcing playback of the anim by switching to another anim (that we never play) here...
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
-                               }
-                       }
-               }
-               METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
-               {
-                       return true; // infinite ammo
-               }
-               METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
-               {
-                       // shockwave has infinite ammo
-                       return true;
-               }
-               METHOD(Shockwave, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Shockwave, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_SHOCKWAVE_MURDER_SLAP;
-                       else
-                               return WEAPON_SHOCKWAVE_MURDER;
-               }
+METHOD(Shockwave, wr_aim, void(entity thiswep))
+{
+    if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
+        { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); }
+    else
+        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); }
+}
+METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(fire & 1)
+    {
+        if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
+            {
+                W_Shockwave_Attack();
+                actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
+            }
+        }
+    }
+    else if(fire & 2)
+    {
+        //if(actor.clip_load >= 0) // we are not currently reloading
+        if(!actor.crouch) // no crouchmelee please
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
+        {
+            // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
+        }
+    }
+}
+METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
+{
+    return true; // infinite ammo
+}
+METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
+{
+    // shockwave has infinite ammo
+    return true;
+}
+METHOD(Shockwave, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Shockwave, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_SHOCKWAVE_MURDER_SLAP;
+    else
+        return WEAPON_SHOCKWAVE_MURDER;
+}
 
 #endif
 #ifdef CSQC
@@ -853,13 +853,13 @@ void Net_ReadShockwaveParticle()
        shockwave.sw_time = time;
 }
 
-               METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
-               {
-                       // handled by Net_ReadShockwaveParticle
-                       //vector org2;
-                       //org2 = w_org + w_backoff * 2;
-                       //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
-               }
+METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
+{
+    // handled by Net_ReadShockwaveParticle
+    //vector org2;
+    //org2 = w_org + w_backoff * 2;
+    //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+}
 
 #endif
 #endif
index 9ca6cf5885e72a8aa1e8940cedd9506b9e381057..8575cd05bcc06ab61a9d516a4afc9e8c7c93298c 100644 (file)
@@ -227,117 +227,117 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
 
 .float shotgun_primarytime;
 
-               METHOD(Shotgun, wr_aim, void(entity thiswep))
-               {
-                       if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
-                               PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
-                       else
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
-               }
-               METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(shotgun, reload_ammo) && actor.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
-                       {
-                               // don't force reload an empty shotgun if its melee attack is active
-                               if(WEP_CVAR(shotgun, secondary) < 2) {
-                                       thiswep.wr_reload(thiswep, actor, weaponentity);
-                               }
-                       }
-                       else
-                       {
-                               if(fire & 1)
-                               {
-                                       if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
-                                       {
-                                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
-                                               {
-                                                       W_Shotgun_Attack(thiswep, true);
-                                                       actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
-                                               }
-                                       }
-                               }
-                               else if((fire & 2) && WEP_CVAR(shotgun, secondary) == 2)
-                               {
-                                       if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
-                                       {
-                                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
-                                               {
-                                                       W_Shotgun_Attack(thiswep, false);
-                                                       actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
-                                               }
-                                       }
-                               }
-                       }
-                       if(actor.clip_load >= 0) // we are not currently reloading
-                       if(!actor.crouch) // no crouchmelee please
-                       if(WEP_CVAR(shotgun, secondary) == 1)
-                       if(((fire & 1) && actor.(thiswep.ammo_field) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire)))
-                       {
-                               // attempt forcing playback of the anim by switching to another anim (that we never play) here...
-                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
-                       }
-               }
-               METHOD(Shotgun, wr_setup, void(entity thiswep))
-               {
-                       self.ammo_field = ammo_none;
-               }
-               METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
-                       ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
-               {
-                       if(IS_BOT_CLIENT(self))
-                       if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
-                               return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
-                       switch(WEP_CVAR(shotgun, secondary))
-                       {
-                               case 1: return true; // melee does not use ammo
-                               case 2: // secondary triple shot
-                               {
-                                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
-                                       ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
-                                       return ammo_amount;
-                               }
-                               default: return false; // secondary unavailable
-                       }
-               }
-               METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
-               }
-               METHOD(Shotgun, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Shotgun, wr_killmessage, int(entity thiswep))
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_SHOTGUN_MURDER_SLAP;
-                       else
-                               return WEAPON_SHOTGUN_MURDER;
-               }
+METHOD(Shotgun, wr_aim, void(entity thiswep))
+{
+    if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+    else
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+}
+METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(shotgun, reload_ammo) && actor.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
+    {
+        // don't force reload an empty shotgun if its melee attack is active
+        if(WEP_CVAR(shotgun, secondary) < 2) {
+            thiswep.wr_reload(thiswep, actor, weaponentity);
+        }
+    }
+    else
+    {
+        if(fire & 1)
+        {
+            if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+            {
+                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
+                {
+                    W_Shotgun_Attack(thiswep, true);
+                    actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
+                }
+            }
+        }
+        else if((fire & 2) && WEP_CVAR(shotgun, secondary) == 2)
+        {
+            if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+            {
+                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
+                {
+                    W_Shotgun_Attack(thiswep, false);
+                    actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
+                }
+            }
+        }
+    }
+    if(actor.clip_load >= 0) // we are not currently reloading
+    if(!actor.crouch) // no crouchmelee please
+    if(WEP_CVAR(shotgun, secondary) == 1)
+    if(((fire & 1) && actor.(thiswep.ammo_field) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
+    if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire)))
+    {
+        // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
+    }
+}
+METHOD(Shotgun, wr_setup, void(entity thiswep))
+{
+    self.ammo_field = ammo_none;
+}
+METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
+    ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
+    return ammo_amount;
+}
+METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
+{
+    if(IS_BOT_CLIENT(self))
+    if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
+        return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
+    switch(WEP_CVAR(shotgun, secondary))
+    {
+        case 1: return true; // melee does not use ammo
+        case 2: // secondary triple shot
+        {
+            float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
+            ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
+            return ammo_amount;
+        }
+        default: return false; // secondary unavailable
+    }
+}
+METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
+}
+METHOD(Shotgun, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Shotgun, wr_killmessage, int(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_SHOTGUN_MURDER_SLAP;
+    else
+        return WEAPON_SHOTGUN_MURDER;
+}
 
 #endif
 #ifdef CSQC
 .float prevric;
 
-               METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2 = w_org + w_backoff * 2;
-                       pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
-                       if(!w_issilent && time - self.prevric > 0.25)
-                       {
-                               if(w_random < 0.05)
-                                       sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
-                               self.prevric = time;
-                       }
-               }
+METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
+{
+    vector org2 = w_org + w_backoff * 2;
+    pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
+    if(!w_issilent && time - self.prevric > 0.25)
+    {
+        if(w_random < 0.05)
+            sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+        self.prevric = time;
+    }
+}
 
 #endif
 #endif
index f7b2c1026ba77ec7d4e6e8820dafcef1b8f9b5df..b0eed05078d8788b500c7bd5dec350fca1a2f7e7 100644 (file)
@@ -339,168 +339,168 @@ void W_RocketMinsta_Attack3 ()
     }
 }
 
-               METHOD(Vaporizer, wr_aim, void(entity thiswep))
-               {
-                       if(self.(thiswep.ammo_field) > 0)
-                               PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 1, false);
-                       else
-                               PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
-               }
-               METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-                       // if the laser uses load, we also consider its ammo for reloading
-                       if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       }
-                       if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
-                       {
-                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
-                               {
-                                       W_Vaporizer_Attack(thiswep);
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
-                               }
-                       }
-                       if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
-                       {
-                               if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
-                               {
-                                       bool rapid = autocvar_g_rm_laser_rapid;
-                                       if(actor.jump_interval <= time && !actor.held_down)
-                                       {
-                                               if(rapid)
-                                                       actor.held_down = true;
-                                               actor.jump_interval = time + autocvar_g_rm_laser_refire;
-                                               actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
-                                               damage_goodhits = 0;
-                                               W_RocketMinsta_Attack2();
-                                       }
-                                       else if(rapid && actor.jump_interval2 <= time && actor.held_down)
-                                       {
-                                               actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
-                                               damage_goodhits = 0;
-                                               W_RocketMinsta_Attack3();
-                                               //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
-                                       }
-                               }
-                               else if (actor.jump_interval <= time)
-                               {
-                                       // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
-                                       actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
-
-                                       // decrease ammo for the laser?
-                                       if(WEP_CVAR_SEC(vaporizer, ammo))
-                                               W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo));
-
-                                       // ugly instagib hack to reuse the fire mode of the laser
-                                       makevectors(actor.v_angle);
-                                       Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
-                                       PS(actor).m_weapon = WEP_BLASTER;
-                                       W_Blaster_Attack(
-                                               actor,
-                                               WEP_BLASTER.m_id | HITTYPE_SECONDARY,
-                                               WEP_CVAR_SEC(vaporizer, shotangle),
-                                               WEP_CVAR_SEC(vaporizer, damage),
-                                               WEP_CVAR_SEC(vaporizer, edgedamage),
-                                               WEP_CVAR_SEC(vaporizer, radius),
-                                               WEP_CVAR_SEC(vaporizer, force),
-                                               WEP_CVAR_SEC(vaporizer, speed),
-                                               WEP_CVAR_SEC(vaporizer, spread),
-                                               WEP_CVAR_SEC(vaporizer, delay),
-                                               WEP_CVAR_SEC(vaporizer, lifetime)
-                                       );
-                                       PS(actor).m_weapon = oldwep;
-
-                                       // now do normal refire
-                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
-                               }
-                       }
-                       else
-                               actor.held_down = false;
-               }
-               METHOD(Vaporizer, wr_setup, void(entity thiswep))
-               {
-                       self.ammo_field = (thiswep.ammo_field);
-                       self.vaporizer_lasthit = 0;
-               }
-               METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
-               {
-                       float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-                       float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
-                       ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
-                       return ammo_amount;
-               }
-               METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
-               {
-                       if(!WEP_CVAR_SEC(vaporizer, ammo))
-                               return true;
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
-                       ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
-                       return ammo_amount;
-               }
-               METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
-               {
-                       self.vaporizer_lasthit = 0;
-               }
-               METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-                       float used_ammo;
-                       if(WEP_CVAR_SEC(vaporizer, ammo))
-                               used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
-                       else
-                               used_ammo = vaporizer_ammo;
-
-                       W_Reload(self, used_ammo, SND(RELOAD));
-               }
-               METHOD(Vaporizer, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Vaporizer, wr_killmessage, int(entity thiswep))
-               {
-                       return WEAPON_VAPORIZER_MURDER;
-               }
+METHOD(Vaporizer, wr_aim, void(entity thiswep))
+{
+    if(self.(thiswep.ammo_field) > 0)
+        PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 1, false);
+    else
+        PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
+}
+METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+    // if the laser uses load, we also consider its ammo for reloading
+    if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    }
+    if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
+    {
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
+        {
+            W_Vaporizer_Attack(thiswep);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
+        }
+    }
+    if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
+    {
+        if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
+        {
+            bool rapid = autocvar_g_rm_laser_rapid;
+            if(actor.jump_interval <= time && !actor.held_down)
+            {
+                if(rapid)
+                    actor.held_down = true;
+                actor.jump_interval = time + autocvar_g_rm_laser_refire;
+                actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
+                damage_goodhits = 0;
+                W_RocketMinsta_Attack2();
+            }
+            else if(rapid && actor.jump_interval2 <= time && actor.held_down)
+            {
+                actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
+                damage_goodhits = 0;
+                W_RocketMinsta_Attack3();
+                //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
+            }
+        }
+        else if (actor.jump_interval <= time)
+        {
+            // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
+            actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
+
+            // decrease ammo for the laser?
+            if(WEP_CVAR_SEC(vaporizer, ammo))
+                W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo));
+
+            // ugly instagib hack to reuse the fire mode of the laser
+            makevectors(actor.v_angle);
+            Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
+            PS(actor).m_weapon = WEP_BLASTER;
+            W_Blaster_Attack(
+                actor,
+                WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+                WEP_CVAR_SEC(vaporizer, shotangle),
+                WEP_CVAR_SEC(vaporizer, damage),
+                WEP_CVAR_SEC(vaporizer, edgedamage),
+                WEP_CVAR_SEC(vaporizer, radius),
+                WEP_CVAR_SEC(vaporizer, force),
+                WEP_CVAR_SEC(vaporizer, speed),
+                WEP_CVAR_SEC(vaporizer, spread),
+                WEP_CVAR_SEC(vaporizer, delay),
+                WEP_CVAR_SEC(vaporizer, lifetime)
+            );
+            PS(actor).m_weapon = oldwep;
+
+            // now do normal refire
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
+        }
+    }
+    else
+        actor.held_down = false;
+}
+METHOD(Vaporizer, wr_setup, void(entity thiswep))
+{
+    self.ammo_field = (thiswep.ammo_field);
+    self.vaporizer_lasthit = 0;
+}
+METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
+{
+    float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+    float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
+    ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
+    return ammo_amount;
+}
+METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
+{
+    if(!WEP_CVAR_SEC(vaporizer, ammo))
+        return true;
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
+    ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
+    return ammo_amount;
+}
+METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
+{
+    self.vaporizer_lasthit = 0;
+}
+METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+    float used_ammo;
+    if(WEP_CVAR_SEC(vaporizer, ammo))
+        used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
+    else
+        used_ammo = vaporizer_ammo;
+
+    W_Reload(self, used_ammo, SND(RELOAD));
+}
+METHOD(Vaporizer, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Vaporizer, wr_killmessage, int(entity thiswep))
+{
+    return WEAPON_VAPORIZER_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2 = w_org + w_backoff * 6;
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
-                               if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
-                       }
-                       else
-                       {
-                               pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
-                               if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
-                       }
-               }
-               METHOD(Vaporizer, wr_init, void(entity thiswep))
-               {
-                       if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
-                       {
-                               precache_pic("gfx/reticle_nex");
-                       }
-               }
-               METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
-               {
-                       if(button_zoom || zoomscript_caught)
-                       {
-                               reticle_image = "gfx/reticle_nex";
-                               return true;
-                       }
-                       else
-                       {
-                               // no weapon specific image for this weapon
-                               return false;
-                       }
-               }
+METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
+{
+    vector org2 = w_org + w_backoff * 6;
+    if(w_deathtype & HITTYPE_SECONDARY)
+    {
+        pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+        if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+    }
+    else
+    {
+        pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
+        if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
+    }
+}
+METHOD(Vaporizer, wr_init, void(entity thiswep))
+{
+    if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+    {
+        precache_pic("gfx/reticle_nex");
+    }
+}
+METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
+{
+    if(button_zoom || zoomscript_caught)
+    {
+        reticle_image = "gfx/reticle_nex";
+        return true;
+    }
+    else
+    {
+        // no weapon specific image for this weapon
+        return false;
+    }
+}
 
 #endif
 #endif
index e44c51ee4c9892f653d6a52ad84f9ef3d0fbdd53..5f29839b126de05ae899cc18507522cf40c25f9c 100644 (file)
@@ -210,193 +210,193 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
 
 .float vortex_chargepool_pauseregen_finished;
 
-               METHOD(Vortex, wr_aim, void(entity thiswep))
-               {
-                       if(bot_aim(1000000, 0, 1, false))
-                               PHYS_INPUT_BUTTON_ATCK(self) = true;
-                       else
-                       {
-                               if(WEP_CVAR(vortex, charge))
-                                       PHYS_INPUT_BUTTON_ATCK2(self) = true;
-                       }
-               }
-               METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(WEP_CVAR(vortex, charge) && actor.vortex_charge < WEP_CVAR(vortex, charge_limit))
-                               actor.vortex_charge = min(1, actor.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
-
-                       if(WEP_CVAR_SEC(vortex, chargepool))
-                               if(actor.vortex_chargepool_ammo < 1)
-                               {
-                                       if(actor.vortex_chargepool_pauseregen_finished < time)
-                                               actor.vortex_chargepool_ammo = min(1, actor.vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME);
-                                       actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
-                               }
-
-                       if(autocvar_g_balance_vortex_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep, actor, weaponentity);
-                       } else
-                       {
-                               if(fire & 1)
-                               {
-                                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
-                                       {
-                                               W_Vortex_Attack(thiswep, 0);
-                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
-                                       }
-                               }
-                               if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2))
-                               {
-                                       if(WEP_CVAR(vortex, charge))
-                                       {
-                                               actor.vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
-                                               float dt = frametime / W_TICSPERFRAME;
-
-                                               if(actor.vortex_charge < 1)
-                                               {
-                                                       if(WEP_CVAR_SEC(vortex, chargepool))
-                                                       {
-                                                               if(WEP_CVAR_SEC(vortex, ammo))
-                                                               {
-                                                                       // always deplete if secondary is held
-                                                                       actor.vortex_chargepool_ammo = max(0, actor.vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
-
-                                                                       dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
-                                                                       actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen);
-                                                                       dt = min(dt, actor.vortex_chargepool_ammo);
-                                                                       dt = max(0, dt);
-
-                                                                       actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
-                                                               }
-                                                       }
-
-                                                       else if(WEP_CVAR_SEC(vortex, ammo))
-                                                       {
-                                                               if(fire & 2) // only eat ammo when the button is pressed
-                                                               {
-                                                                       dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
-                                                                       if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                                                                       {
-                                                                               // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
-                                                                               if(autocvar_g_balance_vortex_reload_ammo)
-                                                                               {
-                                                                                       dt = min(dt, (actor.clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
-                                                                                       dt = max(0, dt);
-                                                                                       if(dt > 0)
-                                                                                       {
-                                                                                               actor.clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
-                                                                                       }
-                                                                                       actor.(weapon_load[WEP_VORTEX.m_id]) = actor.clip_load;
-                                                                               }
-                                                                               else
-                                                                               {
-                                                                                       dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
-                                                                                       dt = max(0, dt);
-                                                                                       if(dt > 0)
-                                                                                       {
-                                                                                               actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(vortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(vortex, ammo) * dt);
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                                       actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
-                                                               }
-                                                       }
-
-                                                       else
-                                                       {
-                                                               dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
-                                                               actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
-                                                       }
-                                               }
-                                       }
-                                       else if(WEP_CVAR(vortex, secondary))
-                                       {
-                                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
-                                               {
-                                                       W_Vortex_Attack(thiswep, 1);
-                                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
-                                               }
-                                       }
-                               }
-                       }
-               }
-               METHOD(Vortex, wr_setup, void(entity thiswep))
-               {
-                       self.vortex_lasthit = 0;
-               }
-               METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
-               {
-                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
-                       ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
-                       return ammo_amount;
-               }
-               METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
-               {
-                       if(WEP_CVAR(vortex, secondary))
-                       {
-                               // don't allow charging if we don't have enough ammo
-                               float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
-                               ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
-                               return ammo_amount;
-                       }
-                       else
-                       {
-                               return false; // zoom is not a fire mode
-                       }
-               }
-               METHOD(Vortex, wr_resetplayer, void(entity thiswep))
-               {
-                       if (WEP_CVAR(vortex, charge)) {
-                               if (WEP_CVAR_SEC(vortex, chargepool)) {
-                                       self.vortex_chargepool_ammo = 1;
-                               }
-                               self.vortex_charge = WEP_CVAR(vortex, charge_start);
-                       }
-                       self.vortex_lasthit = 0;
-               }
-               METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-               {
-                       W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
-               }
-               METHOD(Vortex, wr_suicidemessage, int(entity thiswep))
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               METHOD(Vortex, wr_killmessage, int(entity thiswep))
-               {
-                       return WEAPON_VORTEX_MURDER;
-               }
+METHOD(Vortex, wr_aim, void(entity thiswep))
+{
+    if(bot_aim(1000000, 0, 1, false))
+        PHYS_INPUT_BUTTON_ATCK(self) = true;
+    else
+    {
+        if(WEP_CVAR(vortex, charge))
+            PHYS_INPUT_BUTTON_ATCK2(self) = true;
+    }
+}
+METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+    if(WEP_CVAR(vortex, charge) && actor.vortex_charge < WEP_CVAR(vortex, charge_limit))
+        actor.vortex_charge = min(1, actor.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
+
+    if(WEP_CVAR_SEC(vortex, chargepool))
+        if(actor.vortex_chargepool_ammo < 1)
+        {
+            if(actor.vortex_chargepool_pauseregen_finished < time)
+                actor.vortex_chargepool_ammo = min(1, actor.vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME);
+            actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
+        }
+
+    if(autocvar_g_balance_vortex_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
+        thiswep.wr_reload(thiswep, actor, weaponentity);
+    } else
+    {
+        if(fire & 1)
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
+            {
+                W_Vortex_Attack(thiswep, 0);
+                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
+            }
+        }
+        if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2))
+        {
+            if(WEP_CVAR(vortex, charge))
+            {
+                actor.vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
+                float dt = frametime / W_TICSPERFRAME;
+
+                if(actor.vortex_charge < 1)
+                {
+                    if(WEP_CVAR_SEC(vortex, chargepool))
+                    {
+                        if(WEP_CVAR_SEC(vortex, ammo))
+                        {
+                            // always deplete if secondary is held
+                            actor.vortex_chargepool_ammo = max(0, actor.vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
+
+                            dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
+                            actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen);
+                            dt = min(dt, actor.vortex_chargepool_ammo);
+                            dt = max(0, dt);
+
+                            actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+                        }
+                    }
+
+                    else if(WEP_CVAR_SEC(vortex, ammo))
+                    {
+                        if(fire & 2) // only eat ammo when the button is pressed
+                        {
+                            dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
+                            if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+                            {
+                                // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
+                                if(autocvar_g_balance_vortex_reload_ammo)
+                                {
+                                    dt = min(dt, (actor.clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+                                    dt = max(0, dt);
+                                    if(dt > 0)
+                                    {
+                                        actor.clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
+                                    }
+                                    actor.(weapon_load[WEP_VORTEX.m_id]) = actor.clip_load;
+                                }
+                                else
+                                {
+                                    dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+                                    dt = max(0, dt);
+                                    if(dt > 0)
+                                    {
+                                        actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(vortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(vortex, ammo) * dt);
+                                    }
+                                }
+                            }
+                            actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+                        }
+                    }
+
+                    else
+                    {
+                        dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
+                        actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+                    }
+                }
+            }
+            else if(WEP_CVAR(vortex, secondary))
+            {
+                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
+                {
+                    W_Vortex_Attack(thiswep, 1);
+                    weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
+                }
+            }
+        }
+    }
+}
+METHOD(Vortex, wr_setup, void(entity thiswep))
+{
+    self.vortex_lasthit = 0;
+}
+METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
+{
+    float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
+    ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
+    return ammo_amount;
+}
+METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
+{
+    if(WEP_CVAR(vortex, secondary))
+    {
+        // don't allow charging if we don't have enough ammo
+        float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
+        ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
+        return ammo_amount;
+    }
+    else
+    {
+        return false; // zoom is not a fire mode
+    }
+}
+METHOD(Vortex, wr_resetplayer, void(entity thiswep))
+{
+    if (WEP_CVAR(vortex, charge)) {
+        if (WEP_CVAR_SEC(vortex, chargepool)) {
+            self.vortex_chargepool_ammo = 1;
+        }
+        self.vortex_charge = WEP_CVAR(vortex, charge_start);
+    }
+    self.vortex_lasthit = 0;
+}
+METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
+}
+METHOD(Vortex, wr_suicidemessage, int(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Vortex, wr_killmessage, int(entity thiswep))
+{
+    return WEAPON_VORTEX_MURDER;
+}
 
 #endif
 #ifdef CSQC
 
-               METHOD(Vortex, wr_impacteffect, void(entity thiswep))
-               {
-                       vector org2 = w_org + w_backoff * 6;
-                       pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
-                       if(!w_issilent)
-                               sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
-               }
-               METHOD(Vortex, wr_init, void(entity thiswep))
-               {
-                       if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
-                       {
-                               precache_pic("gfx/reticle_nex");
-                       }
-               }
-               METHOD(Vortex, wr_zoomreticle, bool(entity thiswep))
-               {
-                       if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2))
-                       {
-                               reticle_image = "gfx/reticle_nex";
-                               return true;
-                       }
-                       else
-                       {
-                               // no weapon specific image for this weapon
-                               return false;
-                       }
-               }
+METHOD(Vortex, wr_impacteffect, void(entity thiswep))
+{
+    vector org2 = w_org + w_backoff * 6;
+    pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
+    if(!w_issilent)
+        sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
+}
+METHOD(Vortex, wr_init, void(entity thiswep))
+{
+    if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+    {
+        precache_pic("gfx/reticle_nex");
+    }
+}
+METHOD(Vortex, wr_zoomreticle, bool(entity thiswep))
+{
+    if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2))
+    {
+        reticle_image = "gfx/reticle_nex";
+        return true;
+    }
+    else
+    {
+        // no weapon specific image for this weapon
+        return false;
+    }
+}
 
 #endif
 #endif