let players set timer of drill strike. yes. drill strike :3 the timer starts to tick on first impact
authorsheepluva
Sat, 22 Jan 2011 19:40:57 +0100
changeset 4867 e604ee83e34f
parent 4865 3a48fbc4a281
child 4868 652139f230c7
let players set timer of drill strike. yes. drill strike :3 the timer starts to tick on first impact
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uGears.pas
hedgewars/uVariables.pas
--- a/hedgewars/GSHandlers.inc	Fri Jan 21 17:07:42 2011 -0500
+++ b/hedgewars/GSHandlers.inc	Sat Jan 22 19:40:57 2011 +0100
@@ -2299,7 +2299,7 @@
             2: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtNapalmBomb, 0, cBombsSpeed *
                              Gear^.Tag, _0, 0);
             3: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtDrill, gsttmpFlag, cBombsSpeed *
-                             Gear^.Tag, _0, 0);
+                             Gear^.Tag, _0, Gear^.Timer + 1);
             //4: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtWaterMelon, 0, cBombsSpeed *
             //                 Gear^.Tag, _0, 5000);
         end;
@@ -2981,6 +2981,7 @@
     else if not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) then
         begin
         StopSound(Gear^.SoundChannel);
+        Gear^.Tag := 1;
         Gear^.doStep := @doStepDrill
         end;
 
@@ -3033,8 +3034,20 @@
 
         Gear^.SoundChannel := LoopSound(sndDrillRocket);
         Gear^.doStep := @doStepDrillDrilling;
+        if (Gear^.State and gsttmpFlag) <> 0 then
+            gear^.RenderTimer:= true;
         dec(Gear^.Timer)
     end
+    else if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Tag <> 0) then
+         begin
+            if Gear^.Timer = 0 then
+            begin
+                doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
+                DeleteGear(Gear);
+            end
+            else
+                dec(Gear^.Timer);
+         end;
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/HHHandlers.inc	Fri Jan 21 17:07:42 2011 -0500
+++ b/hedgewars/HHHandlers.inc	Sat Jan 22 19:40:57 2011 +0100
@@ -313,7 +313,7 @@
                                 gtResurrector, 0, _0, _0, 0);
                         CurAmmoGear^.SoundChannel := LoopSound(sndResurrector);
                     end;
-                   amDrillStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, 0);
+                   amDrillStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer);
                    //amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0);
                   end;
 
--- a/hedgewars/uGears.pas	Fri Jan 21 17:07:42 2011 -0500
+++ b/hedgewars/uGears.pas	Sat Jan 22 19:40:57 2011 +0100
@@ -427,7 +427,9 @@
                 gear^.Timer:= 5000
                 end;
        gtDrill: begin
-                gear^.Timer:= 5000;
+                if gear^.Timer = 0 then gear^.Timer:= 5000;
+                // Tag for drill strike. if 1 then first impact occured already
+                gear^.Tag := 0;
                 gear^.Radius:= 4;
                 gear^.Density:= _1;
                 end;
--- a/hedgewars/uVariables.pas	Fri Jan 21 17:07:42 2011 -0500
+++ b/hedgewars/uVariables.pas	Sat Jan 22 19:40:57 2011 +0100
@@ -1926,7 +1926,7 @@
             ejectX: 0;
             ejectY: 0),
 
-// Ressurrector
+// Resurrector
         (NameId: sidResurrector;
             NameTex: nil;
             Probability: 0;
@@ -1960,10 +1960,11 @@
                             ammoprop_NeedTarget or
                             ammoprop_AttackingPut or
                             ammoprop_DontHold or
+                            ammoprop_Timerable or
                             ammoprop_NotBorder;
                 Count: 1;
                 NumPerTurn: 0;
-                Timer: 0;
+                Timer: 5000;
                 Pos: 0;
                 AmmoType: amDrillStrike;
                 AttackVoice: sndIncoming);
@@ -1977,6 +1978,7 @@
             PosSprite: sprAmAirplane;
             ejectX: 0;
             ejectY: 0),
+
 // Snowball/Mudball
             (NameId: sidSnowball;
             NameTex: nil;