hedgewars/uGearsHandlersMess.pas
changeset 15819 c5198f55ee1c
parent 15803 b06b33cf0a89
child 15821 4a1e3d824c34
equal deleted inserted replaced
15818:0c21cdbc5207 15819:c5198f55ee1c
  1847 
  1847 
  1848 procedure doStepBlowTorchWork(Gear: PGear);
  1848 procedure doStepBlowTorchWork(Gear: PGear);
  1849 var
  1849 var
  1850     HHGear: PGear;
  1850     HHGear: PGear;
  1851     dig, hit: boolean;
  1851     dig, hit: boolean;
       
  1852     newX, newY: hwFloat;
  1852 begin
  1853 begin
  1853     AllInactive := false;
  1854     AllInactive := false;
  1854     WorldWrap(Gear);
  1855     WorldWrap(Gear);
  1855     dec(Gear^.Timer);
  1856     dec(Gear^.Timer);
  1856 
  1857 
  1877 
  1878 
  1878         BTPrevAngle := HHGear^.Angle;
  1879         BTPrevAngle := HHGear^.Angle;
  1879         dig := true
  1880         dig := true
  1880         end;
  1881         end;
  1881 
  1882 
  1882     if ((HHGear^.State and gstMoving) <> 0) then
  1883     if (HHGear^.State and gstMoving) <> 0 then
  1883         begin
  1884         begin
  1884         doStepHedgehogMoving(HHGear);
  1885         doStepHedgehogMoving(HHGear);
  1885         if (HHGear^.State and gstHHDriven) = 0 then
  1886         if (HHGear^.State and gstHHDriven) = 0 then
  1886             Gear^.Timer := 0
  1887             Gear^.Timer := 0
  1887         end;
  1888         end;
  1895         if Gear^.dX.isNegative then
  1896         if Gear^.dX.isNegative then
  1896             HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmLeft
  1897             HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmLeft
  1897         else
  1898         else
  1898             HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmRight;
  1899             HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmRight;
  1899 
  1900 
  1900         if ((HHGear^.State and gstMoving) = 0) then
  1901         if (HHGear^.State and gstMoving) = 0 then
  1901             begin
  1902             begin
  1902             HHGear^.State := HHGear^.State and (not gstAttacking);
  1903             HHGear^.State := HHGear^.State and (not gstAttacking);
  1903 
  1904 
  1904             if CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y),lfIndestructible) then
  1905             if CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), lfIndestructible) then
  1905                 HedgehogStep(HHGear);
  1906                 HedgehogStep(HHGear);
  1906 
  1907 
  1907             HHGear^.State := HHGear^.State or gstAttacking
  1908             HHGear^.State := HHGear^.State or gstAttacking
  1908             end;
  1909             end;
  1909 
  1910 
       
  1911             newX := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
       
  1912             newY := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
       
  1913             if CheckLandValue(hwRound(newX + SignAs(_6, Gear^.dX)), hwRound(newY), lfIndestructible) then
       
  1914                 begin
       
  1915                 Gear^.X := newX;
       
  1916                 Gear^.Y := newY;
       
  1917                 end;
       
  1918 
  1910         inc(BTSteps);
  1919         inc(BTSteps);
  1911         if BTSteps = 11 then
  1920         if BTSteps = 15 then
  1912             begin
  1921             begin
  1913             BTSteps := 0;
  1922             BTSteps := 0;
  1914             if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)),lfIndestructible) then
       
  1915                 begin
       
  1916                 Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
       
  1917                 Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
       
  1918                 end;
       
  1919             hit := true
  1923             hit := true
  1920             end;
  1924             end;
  1921         end;
  1925         end;
  1922 
  1926 
  1923     if dig then
  1927     if dig then