First implementation of Blow Torch
authorunc0rr
Sun, 17 Dec 2006 17:55:41 +0000
changeset 302 7aca131ecd7f
parent 301 29bf9c1a3ad3
child 303 1659c4aad5ab
First implementation of Blow Torch
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/hwengine.dpr
hedgewars/uAIAmmoTests.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uLocale.pas
share/hedgewars/Data/Locale/en.txt
share/hedgewars/Data/Locale/ru.txt
--- a/hedgewars/GSHandlers.inc	Fri Dec 15 12:48:40 2006 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Dec 17 17:55:41 2006 +0000
@@ -424,6 +424,32 @@
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
+
+procedure doStepBlowTorch(Gear: PGear);
+var HHGear: PGear;
+begin
+AllInactive:= false;
+dec(Gear.Timer);
+HHGear:= PHedgehog(Gear.Hedgehog).Gear;
+if Gear.Timer mod cHHStepTicks = 0 then
+   begin
+   DrawTunnel(HHGear.X, HHGear.Y - 1, Gear.dX, 0, cHHRadius * 2, cHHRadius * 2);
+   HHGear.State:= HHGear.State and not gstAttacking;
+   if Gear.dX < 0 then HHGear.Message:= gm_Left
+                  else HHGear.Message:= gm_Right;
+   HedgehogStep(HHGear);
+   if (HHGear.State and gstFalling) <> 0 then Gear.Timer:= 0
+   end;
+if Gear.Timer = 0 then
+   begin
+   HHGear.Message:= 0;
+   DeleteGear(Gear);
+   AfterAttack
+   end
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+
 procedure doStepRopeWork(Gear: PGear);
 const flCheck: boolean = false;
 var HHGear: PGear;
--- a/hedgewars/HHHandlers.inc	Fri Dec 15 12:48:40 2006 +0000
+++ b/hedgewars/HHHandlers.inc	Sun Dec 17 17:55:41 2006 +0000
@@ -70,6 +70,7 @@
                     amParachute: CurAmmoGear:= AddGear(round(X), round(Y), gtParachute, 0);
                     amAirAttack: AddGear(0, 0, gtAirAttack, 0);
                    amMineStrike: AddGear(0, 0, gtAirAttack, 1);
+                    amBlowTorch: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y), gtBlowTorch, 0, hwSign(Gear.dX) * 0.5);
                   end;
         Power:= 0;
         if CurAmmoGear <> nil then
@@ -126,82 +127,12 @@
      end;
 end;
 
-procedure doStepHedgehog(Gear: PGear); forward;
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepHedgehogDriven(Gear: PGear);
 const StepTicks: LongWord = 0;
-var t: PGear;
-    PrevdX: integer;
-begin
-if isInMultiShoot and (Gear.Damage = 0) then
-   begin
-   exit
-   end;
-AllInactive:= false;
-DeleteCI(Gear);
-if (TurnTimeLeft = 0) or (Gear.Damage > 0) then
-   begin
-   TurnTimeLeft:= 0;
-   Gear.State:= Gear.State and not gstHHDriven;
-   if Gear.Damage > 0 then
-      Gear.State:= Gear.State and not gstHHJumping;
-   exit
-   end;
-if ((Gear.State and gstFalling) <> 0) or (StepTicks = cHHStepTicks)
-   or (CurAmmoGear <> nil) then // we're moving
-   begin
-   // check for case with ammo
-   t:= CheckGearNear(Gear, gtCase, 36, 36);
-   if t <> nil then
-      PickUp(Gear, t)
-   end;
-
-if CurAmmoGear <> nil then
-   begin
-   CurAmmoGear.Message:= Gear.Message;
-   exit
-   end;
 
-if ((Gear.Message and gm_Attack) <> 0) or
-   ((Gear.State and gstAttacking) <> 0)then Attack(Gear);
-
-if (Gear.State and gstFalling) <> 0 then
-   begin
-   // it could be the source to trick: double-backspace jump -> vertical wall
-   // collision - > (abs(Gear.dX) < 0.0000002) -> backspace -> even more high jump
-   if ((Gear.Message and gm_HJump) <> 0) and ((Gear.State and gstHHJumping) <> 0) then
-      if (abs(Gear.dX) < 2 * cLittle) and (Gear.dY < -0.02) then
-         begin
-         Gear.dY:= -0.25;
-         Gear.dX:= hwSign(Gear.dX) * 0.02
-         end;
-   Gear.Message:= Gear.Message and not (gm_LJump or gm_HJump);     
-   if TestCollisionXwithGear(Gear, hwSign(Gear.dX)) then SetLittle(Gear.dX);
-   Gear.X:= Gear.X + Gear.dX;
-   Gear.dY:= Gear.dY + cGravity;
-   if (Gear.dY < 0)and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
-   Gear.Y:= Gear.Y + Gear.dY;
-   if (Gear.dY >= 0)and TestCollisionYwithGear(Gear, 1) then
-      begin
-      CheckHHDamage(Gear);
-      if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55)
-         and ((Gear.State and gstHHJumping) <> 0) then SetLittle(Gear.dX);
-      Gear.State:= Gear.State and not (gstFalling or gstHHJumping);
-      StepTicks:= 300; 
-      Gear.dY:= 0
-      end;
-   CheckGearDrowning(Gear);
-   exit
-   end ;//else if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear);
-
-if StepTicks > 0 then dec(StepTicks);
-
-if ((Gear.State and (gstMoving or gstFalling)) = 0) then
-   if (Gear.Message and gm_Up    )<>0 then if Gear.Angle > 0         then dec(Gear.Angle)
-      else else
-   if (Gear.Message and gm_Down  )<>0 then if Gear.Angle < cMaxAngle then inc(Gear.Angle);
-
-if ((Gear.State and (gstAttacking or gstMoving or gstFalling)) = 0)and(StepTicks = 0) then
+procedure HedgehogStep(Gear: PGear);
+var PrevdX: integer;
+begin
+if ((Gear.State and (gstAttacking or gstMoving or gstFalling)) = 0) then
    begin
    if ((Gear.Message and gm_LJump ) <> 0) then
       begin
@@ -288,6 +219,81 @@
    end
 end;
 
+procedure doStepHedgehog(Gear: PGear); forward;
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepHedgehogDriven(Gear: PGear);
+var t: PGear;
+begin
+if isInMultiShoot and (Gear.Damage = 0) then
+   begin
+   exit
+   end;
+AllInactive:= false;
+DeleteCI(Gear);
+if (TurnTimeLeft = 0) or (Gear.Damage > 0) then
+   begin
+   TurnTimeLeft:= 0;
+   Gear.State:= Gear.State and not gstHHDriven;
+   if Gear.Damage > 0 then
+      Gear.State:= Gear.State and not gstHHJumping;
+   exit
+   end;
+if ((Gear.State and gstFalling) <> 0) or (StepTicks = cHHStepTicks)
+   or (CurAmmoGear <> nil) then // we're moving
+   begin
+   // check for case with ammo
+   t:= CheckGearNear(Gear, gtCase, 36, 36);
+   if t <> nil then
+      PickUp(Gear, t)
+   end;
+
+if CurAmmoGear <> nil then
+   begin
+   CurAmmoGear.Message:= Gear.Message;
+   exit
+   end;
+
+if ((Gear.Message and gm_Attack) <> 0) or
+   ((Gear.State and gstAttacking) <> 0)then Attack(Gear);
+
+if (Gear.State and gstFalling) <> 0 then
+   begin
+   // it could be the source to trick: double-backspace jump -> vertical wall
+   // collision - > (abs(Gear.dX) < 0.0000002) -> backspace -> even more high jump
+   if ((Gear.Message and gm_HJump) <> 0) and ((Gear.State and gstHHJumping) <> 0) then
+      if (abs(Gear.dX) < 2 * cLittle) and (Gear.dY < -0.02) then
+         begin
+         Gear.dY:= -0.25;
+         Gear.dX:= hwSign(Gear.dX) * 0.02
+         end;
+   Gear.Message:= Gear.Message and not (gm_LJump or gm_HJump);     
+   if TestCollisionXwithGear(Gear, hwSign(Gear.dX)) then SetLittle(Gear.dX);
+   Gear.X:= Gear.X + Gear.dX;
+   Gear.dY:= Gear.dY + cGravity;
+   if (Gear.dY < 0)and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
+   Gear.Y:= Gear.Y + Gear.dY;
+   if (Gear.dY >= 0)and TestCollisionYwithGear(Gear, 1) then
+      begin
+      CheckHHDamage(Gear);
+      if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55)
+         and ((Gear.State and gstHHJumping) <> 0) then SetLittle(Gear.dX);
+      Gear.State:= Gear.State and not (gstFalling or gstHHJumping);
+      StepTicks:= 300; 
+      Gear.dY:= 0
+      end;
+   CheckGearDrowning(Gear);
+   exit
+   end ;//else if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear);
+
+   if ((Gear.State and (gstMoving or gstFalling)) = 0) then
+      if (Gear.Message and gm_Up    )<>0 then if Gear.Angle > 0         then dec(Gear.Angle)
+         else else
+      if (Gear.Message and gm_Down  )<>0 then if Gear.Angle < cMaxAngle then inc(Gear.Angle);
+
+   if StepTicks > 0 then dec(StepTicks);
+   if (StepTicks = 0) then HedgehogStep(Gear)
+end;
+
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepHedgehogFree(Gear: PGear);
 begin
--- a/hedgewars/hwengine.dpr	Fri Dec 15 12:48:40 2006 +0000
+++ b/hedgewars/hwengine.dpr	Sun Dec 17 17:55:41 2006 +0000
@@ -222,7 +222,7 @@
 SendIPCRaw(@s[0], Length(s) + 1); // send proto version
 
 InitTeams;
-ParseCommand('ammstore 9191111111111110');
+ParseCommand('ammstore 91911111111111108');
 AssignStores;
 
 if isSoundEnabled then InitSound;
--- a/hedgewars/uAIAmmoTests.pas	Fri Dec 15 12:48:40 2006 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Sun Dec 17 17:55:41 2006 +0000
@@ -45,7 +45,8 @@
 {amBaseballBat}   TestBaseballBat,
 {amParachute}     nil,
 {amAirAttack}     nil,
-{amMineStrike}    nil
+{amMineStrike}    nil,
+{amBlowTorch}     nil
                   );
 
 const BadTurn = Low(integer);
--- a/hedgewars/uConsts.pas	Fri Dec 15 12:48:40 2006 +0000
+++ b/hedgewars/uConsts.pas	Sun Dec 17 17:55:41 2006 +0000
@@ -46,7 +46,7 @@
                    gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot, gtDynamite,
                    gtTeamHealthSorter, gtClusterBomb, gtCluster, gtShover, gtFlame,
                    gtFirePunch, gtATStartGame, gtATSmoothWindCh, gtATFinishGame,
-                   gtParachute, gtAirAttack, gtAirBomb);
+                   gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch);
 
      TGearsType = set of TGearType;
 
@@ -56,7 +56,7 @@
 
      TAmmoType  = (amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer,
                    amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch,
-                   amBaseballBat, amParachute, amAirAttack, amMineStrike);
+                   amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch);
 
      THWFont    = (fnt16, fntBig);
 
@@ -439,7 +439,15 @@
                                           Timer: 0;
                                           AmmoType: amMineStrike);
                                    Slot: 5;
-                                   TimeAfterTurn: 0));
+                                   TimeAfterTurn: 0),
+                                  (NameId: sidBlowTorch;
+                                   Ammo: (Propz: ammoprop_ForwMsgs;
+                                          Count: 1;
+                                          NumPerTurn: 0;
+                                          Timer: 0;
+                                          AmmoType: amBlowTorch);
+                                   Slot: 6;
+                                   TimeAfterTurn: 3000));
 
 implementation
 
--- a/hedgewars/uGears.pas	Fri Dec 15 12:48:40 2006 +0000
+++ b/hedgewars/uGears.pas	Sun Dec 17 17:55:41 2006 +0000
@@ -86,6 +86,7 @@
 procedure SpawnBoxOfSmth; forward;
 procedure AfterAttack; forward;
 procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: integer); forward;
+procedure HedgehogStep(Gear: PGear); forward;
 
 {$INCLUDE GSHandlers.inc}
 {$INCLUDE HHHandlers.inc}
@@ -118,7 +119,8 @@
                                                                doStepActionTimer,
                                                                doStepParachute,
                                                                doStepAirAttack,
-                                                               doStepAirBomb
+                                                               doStepAirBomb,
+                                                               doStepBlowTorch
                                                                );
 
 procedure InsertGearToList(Gear: PGear);
@@ -259,9 +261,12 @@
                 Result.Radius:= 15;
                 Result.Tag:= Y
                 end;
-    gtAirBomb: begin
-               Result.Radius:= 10;
-               end;
+     gtAirBomb: begin
+                Result.Radius:= 10;
+                end;
+   gtBlowTorch: begin
+                Result.Timer:= 6000;
+                end;
      end;
 InsertGearToList(Result)
 end;
--- a/hedgewars/uLocale.pas	Fri Dec 15 12:48:40 2006 +0000
+++ b/hedgewars/uLocale.pas	Sun Dec 17 17:55:41 2006 +0000
@@ -21,7 +21,7 @@
 type TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidUFO, sidShotgun,
                    sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
                    sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds,
-                   sidParachute, sidAirAttack, sidMineStrike);
+                   sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch);
 
      TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused);
 
--- a/share/hedgewars/Data/Locale/en.txt	Fri Dec 15 12:48:40 2006 +0000
+++ b/share/hedgewars/Data/Locale/en.txt	Sun Dec 17 17:55:41 2006 +0000
@@ -17,6 +17,7 @@
 00:14=Parachute
 00:15=Air Attack
 00:16=Mine Strike
+00:17=Blow Torch
 
 01:00=Let's fight!
 01:01=Round draw
--- a/share/hedgewars/Data/Locale/ru.txt	Fri Dec 15 12:48:40 2006 +0000
+++ b/share/hedgewars/Data/Locale/ru.txt	Sun Dec 17 17:55:41 2006 +0000
@@ -17,6 +17,7 @@
 00:14=Парашют
 00:15=Воздушная атака
 00:16=Минный удар
+00:17=Бур
 
 01:00=Вперёд к победе!
 01:01=Ничья