hedgewars/GSHandlers.inc
changeset 3509 d72c2219595d
parent 3505 ada9f697eb11
child 3519 56cbc035b74b
equal deleted inserted replaced
3507:2e40893e6034 3509:d72c2219595d
   810             DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
   810             DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
   811             inc(i, 1)
   811             inc(i, 1)
   812         end;
   812         end;
   813 
   813 
   814         if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9)
   814         if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9)
   815            , COLOR_INDESTRUCTIBLE) then
   815            , LAND_INDESTRUCTIBLE) then
   816         begin
   816         begin
   817             Gear^.X := Gear^.X + Gear^.dX;
   817             Gear^.X := Gear^.X + Gear^.dX;
   818             Gear^.Y := Gear^.Y + _1_9;
   818             Gear^.Y := Gear^.Y + _1_9;
   819         end;
   819         end;
   820         SetAllHHToActive;
   820         SetAllHHToActive;
   920             prevX := hwRound(HHGear^.X);
   920             prevX := hwRound(HHGear^.X);
   921 
   921 
   922             // why the call to HedgehogStep then a further increment of X?
   922             // why the call to HedgehogStep then a further increment of X?
   923             if (prevX = hwRound(HHGear^.X)) and
   923             if (prevX = hwRound(HHGear^.X)) and
   924                CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y),
   924                CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y),
   925                COLOR_INDESTRUCTIBLE) then HedgehogStep(HHGear);
   925                LAND_INDESTRUCTIBLE) then HedgehogStep(HHGear);
   926 
   926 
   927             if (prevX = hwRound(HHGear^.X)) and
   927             if (prevX = hwRound(HHGear^.X)) and
   928                CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y),
   928                CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y),
   929                COLOR_INDESTRUCTIBLE) then HHGear^.X := HHGear^.X + SignAs(_1, HHGear^.dX);
   929                LAND_INDESTRUCTIBLE) then HHGear^.X := HHGear^.X + SignAs(_1, HHGear^.dX);
   930             HHGear^.State := HHGear^.State or gstAttacking
   930             HHGear^.State := HHGear^.State or gstAttacking
   931         end;
   931         end;
   932 
   932 
   933         inc(BTSteps);
   933         inc(BTSteps);
   934         if BTSteps = 7 then
   934         if BTSteps = 7 then
   935         begin
   935         begin
   936             BTSteps := 0;
   936             BTSteps := 0;
   937             if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,
   937             if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,
   938                Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)),
   938                Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)),
   939                COLOR_INDESTRUCTIBLE) then
   939                LAND_INDESTRUCTIBLE) then
   940             begin
   940             begin
   941                 Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
   941                 Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
   942                 Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
   942                 Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
   943             end;
   943             end;
   944             HHGear^.State := HHGear^.State or gstNoDamage;
   944             HHGear^.State := HHGear^.State or gstNoDamage;
  1793         AfterAttack;
  1793         AfterAttack;
  1794         exit
  1794         exit
  1795     end;
  1795     end;
  1796 
  1796 
  1797     if CheckLandValue(hwRound(HHGear^.X), hwRound(HHGear^.Y + HHGear^.dY + SignAs(_6,Gear^.dY)),
  1797     if CheckLandValue(hwRound(HHGear^.X), hwRound(HHGear^.Y + HHGear^.dY + SignAs(_6,Gear^.dY)),
  1798        COLOR_INDESTRUCTIBLE) then
  1798        LAND_INDESTRUCTIBLE) then
  1799         HHGear^.Y := HHGear^.Y + HHGear^.dY
  1799         HHGear^.Y := HHGear^.Y + HHGear^.dY
  1800 end;
  1800 end;
  1801 
  1801 
  1802 procedure doStepFirePunch(Gear: PGear);
  1802 procedure doStepFirePunch(Gear: PGear);
  1803 var 
  1803 var 
  2542     //fixes drill not exploding when touching HH bug
  2542     //fixes drill not exploding when touching HH bug
  2543     if (Gear^.Timer = 0)
  2543     if (Gear^.Timer = 0)
  2544        or (t^.Count <> 0)
  2544        or (t^.Count <> 0)
  2545        or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY))
  2545        or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY))
  2546        and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)))
  2546        and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)))
  2547        or (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] = COLOR_INDESTRUCTIBLE) then
  2547 // CheckLandValue returns true if the type isn't matched
       
  2548        or not CheckLandValue(hwRound(Gear^.Y), hwRound(Gear^.X), LAND_INDESTRUCTIBLE) then
  2548     begin
  2549     begin
  2549         //out of time or exited ground
  2550         //out of time or exited ground
  2550         StopSound(Gear^.SoundChannel);
  2551         StopSound(Gear^.SoundChannel);
  2551         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
  2552         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
  2552         DeleteGear(Gear);
  2553         DeleteGear(Gear);