hedgewars/uGears.pas
changeset 39 b78e7185ed13
parent 38 c1ec4b15d70e
child 42 72ffe21f027c
--- a/hedgewars/uGears.pas	Thu Jan 05 22:55:45 2006 +0000
+++ b/hedgewars/uGears.pas	Sat Jan 07 15:21:44 2006 +0000
@@ -112,7 +112,8 @@
                                                                doStepExplosion,
                                                                doStepMine,
                                                                doStepCase,
-                                                               doStepDEagleShot
+                                                               doStepDEagleShot,
+                                                               doStepDynamite
                                                                );
 
 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
@@ -209,6 +210,13 @@
                 Result.HalfHeight:= 1;
                 Result.Health:= 50
                 end;
+    gtDynamite: begin
+                Result.HalfWidth:= 3;
+                Result.HalfHeight:= 3;
+                Result.Elasticity:= 0.03;
+                Result.Friction:= 0.03;
+                Result.Timer:= 5000;
+                end;
      end;
 if GearsList = nil then GearsList:= Result
                    else begin
@@ -484,6 +492,11 @@
             gtMine: if ((Gear.State and gstAttacking) = 0)or((Gear.Timer and $3FF) < 420)
                        then DrawSprite(sprMineOff , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface)
                        else DrawSprite(sprMineOn  , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface);
+        //!!!              ACHTUNG!!!!
+        gtDynamite: if ((Gear.State and gstAttacking) = 0)or((Gear.Timer and $3FF) < 420)
+                       then DrawSprite(sprMineOff , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface)
+                       else DrawSprite(sprMineOn  , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface);
+        //!!!              ACHTUNG!!!!                     
             gtCase: DrawSprite(sprCase, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, 0, Surface);
               end;
       Gear:= Gear.NextGear
@@ -527,7 +540,6 @@
 DrawExplosion(X, Y, Radius);
 if Radius = 50 then AddGear(X, Y, gtExplosion, 0);
 if (Mask and EXPLAutoSound)<>0 then PlaySound(sndExplosion);
-if (Mask and EXPLNoDamage)<>0 then exit;
 if (Mask and EXPLAllDamageInRadius)=0 then Radius:= Radius shl 1;
 Gear:= GearsList;
 while Gear <> nil do
@@ -540,7 +552,7 @@
               gtHedgehog,
                   gtMine,
                   gtCase: begin
-                          inc(Gear.Damage, dmg);
+                          if (Mask and EXPLNoDamage) = 0 then inc(Gear.Damage, dmg);
                           Gear.dX:= Gear.dX + dmg / 200 * sign(Gear.X - X);
                           Gear.dY:= Gear.dY + dmg / 200 * sign(Gear.Y - Y);
                           Gear.Active:= true;