hedgewars/uGearsUtils.pas
changeset 14571 1d3dc553829c
parent 14563 ca9c632db2cf
child 14572 34e810295d08
equal deleted inserted replaced
14570:0da43a3d5500 14571:1d3dc553829c
  1757         begin
  1757         begin
  1758         if (hwRound(Gear^.X) < leftX) then
  1758         if (hwRound(Gear^.X) < leftX) then
  1759              Gear^.X:= Gear^.X + int2hwfloat(rightX - leftX)
  1759              Gear^.X:= Gear^.X + int2hwfloat(rightX - leftX)
  1760         else Gear^.X:= Gear^.X - int2hwfloat(rightX - leftX);
  1760         else Gear^.X:= Gear^.X - int2hwfloat(rightX - leftX);
  1761         LeftImpactTimer:= 150;
  1761         LeftImpactTimer:= 150;
  1762         RightImpactTimer:= 150
  1762         RightImpactTimer:= 150;
       
  1763         WorldWrap:= true;
  1763         end
  1764         end
  1764     else if WorldEdge = weBounce then
  1765     else if WorldEdge = weBounce then
  1765         begin
  1766         begin
  1766         bounced:= false;
  1767         bounced:= false;
  1767         if (hwRound(Gear^.X) - Gear^.Radius < leftX) and (hwSign(Gear^.dX) = -1) and (not isZero(Gear^.dX)) then
  1768         if (hwRound(Gear^.X) - Gear^.Radius < leftX) and (hwSign(Gear^.dX) = -1) and (not isZero(Gear^.dX)) then
  1776             RightImpactTimer:= 333;
  1777             RightImpactTimer:= 333;
  1777             Gear^.dX.isNegative:= true;
  1778             Gear^.dX.isNegative:= true;
  1778             Gear^.X:= int2hwfloat(rightX-Gear^.Radius);
  1779             Gear^.X:= int2hwfloat(rightX-Gear^.Radius);
  1779             bounced:= true;
  1780             bounced:= true;
  1780             end;
  1781             end;
  1781         if (bounced) and (Gear^.Radius > 2) and (Gear^.dX.QWordValue > _0_001.QWordValue) then
  1782         if (bounced) then
  1782             AddBounceEffectForGear(Gear);
  1783             begin
  1783         end{
  1784             WorldWrap:= true;
  1784     else if WorldEdge = weSea then
  1785             if (Gear^.Radius > 2) and (Gear^.dX.QWordValue > _0_001.QWordValue) then
       
  1786                AddBounceEffectForGear(Gear);
       
  1787             end;
       
  1788         end
       
  1789     else
       
  1790         WorldWrap:= true;
       
  1791 {  else if WorldEdge = weSea then
  1785         begin
  1792         begin
  1786         if (hwRound(Gear^.Y) > cWaterLine) and (Gear^.State and gstSubmersible <> 0) then
  1793         if (hwRound(Gear^.Y) > cWaterLine) and (Gear^.State and gstSubmersible <> 0) then
  1787             Gear^.State:= Gear^.State and (not gstSubmersible)
  1794             Gear^.State:= Gear^.State and (not gstSubmersible)
  1788         else
  1795         else
  1789             begin
  1796             begin
  1793             tdx:= Gear^.dX;
  1800             tdx:= Gear^.dX;
  1794             Gear^.dX:= -Gear^.dY;
  1801             Gear^.dX:= -Gear^.dY;
  1795             Gear^.dY:= tdx;
  1802             Gear^.dY:= tdx;
  1796             Gear^.dY.isNegative:= true
  1803             Gear^.dY.isNegative:= true
  1797             end
  1804             end
  1798         end};
  1805         end;
  1799 (*
  1806 
       
  1807 ---
       
  1808 
  1800 * Window in the sky (Gear moved high into the sky, Y is used to determine X) [unfortunately, not a safe thing to do. shame, I thought aerial bombardment would be kinda neat
  1809 * Window in the sky (Gear moved high into the sky, Y is used to determine X) [unfortunately, not a safe thing to do. shame, I thought aerial bombardment would be kinda neat
  1801 This one would be really easy to freeze game unless it was flagged unfortunately.
  1810 This one would be really easy to freeze game unless it was flagged unfortunately.
  1802 
  1811 
  1803     else
  1812     else
  1804         begin
  1813         begin
  1807         tdx:= Gear^.dX;
  1816         tdx:= Gear^.dX;
  1808         Gear^.dX:= Gear^.dY;
  1817         Gear^.dX:= Gear^.dY;
  1809         Gear^.dY:= tdx;
  1818         Gear^.dY:= tdx;
  1810         Gear^.dY.isNegative:= false
  1819         Gear^.dY.isNegative:= false
  1811         end
  1820         end
  1812 *)
  1821 }
  1813     WorldWrap:= true
       
  1814     end;
  1822     end;
  1815 end;
  1823 end;
  1816 
  1824 
  1817 (*
  1825 (*
  1818 Applies wrap-around logic for the target of homing gears.
  1826 Applies wrap-around logic for the target of homing gears.