hedgewars/uGearsUtils.pas
changeset 10160 4608f10ae65f
parent 10124 aabd1b75d5a3
child 10245 3ccc054c3c3e
equal deleted inserted replaced
10159:5848ed144e0b 10160:4608f10ae65f
  1230 function WorldWrap(var Gear: PGear): boolean;
  1230 function WorldWrap(var Gear: PGear): boolean;
  1231 var tdx: hwFloat;
  1231 var tdx: hwFloat;
  1232 begin
  1232 begin
  1233 WorldWrap:= false;
  1233 WorldWrap:= false;
  1234 if WorldEdge = weNone then exit(false);
  1234 if WorldEdge = weNone then exit(false);
  1235 if (hwRound(Gear^.X) - Gear^.Radius < LongInt(leftX)) or
  1235 if (hwRound(Gear^.X) < LongInt(leftX)) or
  1236    (hwRound(Gear^.X) + LongInt(Gear^.Radius) > LongInt(rightX)) then
  1236    (hwRound(Gear^.X) > LongInt(rightX)) then
  1237     begin
  1237     begin
  1238     if WorldEdge = weWrap then
  1238     if WorldEdge = weWrap then
  1239         begin
  1239         begin
  1240         if (hwRound(Gear^.X) - Gear^.Radius < LongInt(leftX)) then
  1240         if (hwRound(Gear^.X) < LongInt(leftX)) then
  1241              Gear^.X:= int2hwfloat(rightX - Gear^.Radius)
  1241              Gear^.X:= Gear^.X + int2hwfloat(rightX - leftX)
  1242         else Gear^.X:= int2hwfloat(LongInt(leftX) + Gear^.Radius);
  1242         else Gear^.X:= Gear^.X - int2hwfloat(rightX - leftX);
  1243         LeftImpactTimer:= 150;
  1243         LeftImpactTimer:= 150;
  1244         RightImpactTimer:= 150
  1244         RightImpactTimer:= 150
  1245         end
  1245         end
  1246     else if WorldEdge = weBounce then
  1246     else if WorldEdge = weBounce then
  1247         begin
  1247         begin