hedgewars/GSHandlers.inc
changeset 7759 b64afd109cf7
parent 7758 a225cc45513e
child 7767 d1ea9b3f543e
equal deleted inserted replaced
7758:a225cc45513e 7759:b64afd109cf7
  5245 var ox, oy: LongInt;
  5245 var ox, oy: LongInt;
  5246     la: hwFloat;
  5246     la: hwFloat;
  5247 begin
  5247 begin
  5248     // Gear is shrunk so it can actually escape the hog without carving into the terrain
  5248     // Gear is shrunk so it can actually escape the hog without carving into the terrain
  5249     if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16;
  5249     if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16;
       
  5250     if Gear^.Timer > 0 then dec(Gear^.Timer);
  5250     if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then
  5251     if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then
  5251         begin
  5252         begin
  5252         DeleteCI(Gear);
  5253         DeleteCI(Gear);
  5253         // used for damage and impact calc. needs balancing I think
  5254         // used for damage and impact calc. needs balancing I think
  5254         Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4));
  5255         Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4));
  5255         doStepFallingGear(Gear);
  5256         doStepFallingGear(Gear);
  5256         AllInactive := false;
  5257         AllInactive := false;
  5257         CalcRotationDirAngle(Gear)
  5258         CalcRotationDirAngle(Gear)
  5258         end
  5259         end
  5259     else if Gear^.CollisionIndex = -1 then
  5260     else if (Gear^.CollisionIndex = -1) and (Gear^.Timer = 0) then
  5260         begin
  5261         begin
  5261         ox:= 0; oy:= 0;
  5262         ox:= 0; oy:= 0;
  5262         if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1;
  5263         if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1;
  5263         if TestCollisionXwithGear(Gear, 1)       then ox:=  1;
  5264         if TestCollisionXwithGear(Gear, 1)       then ox:=  1;
  5264         if TestCollisionXwithGear(Gear, -1)      then ox:= -1;
  5265         if TestCollisionXwithGear(Gear, -1)      then ox:= -1;
  5285         Gear^.State:= Gear^.State and (not gstMoving) or gstCollision;
  5286         Gear^.State:= Gear^.State and (not gstMoving) or gstCollision;
  5286         Gear^.Radius:= 20;
  5287         Gear^.Radius:= 20;
  5287         if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);
  5288         if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);
  5288         Gear^.Radius:= 16;
  5289         Gear^.Radius:= 16;
  5289         Gear^.Health:= 0;
  5290         Gear^.Health:= 0;
       
  5291         Gear^.Timer:= 500;
  5290         AddGearCI(Gear)
  5292         AddGearCI(Gear)
  5291         end
  5293         end
  5292     else if GameTicks and $3F = 0 then
  5294     else if GameTicks and $3F = 0 then
  5293         begin
  5295         begin
  5294         if  (TestCollisionYwithGear(Gear, -1) = 0)
  5296         if  (TestCollisionYwithGear(Gear, -1) = 0)