hedgewars/uWorld.pas
changeset 10160 4608f10ae65f
parent 10147 9a772dc5dfbe
child 10251 a3b42e81803c
equal deleted inserted replaced
10159:5848ed144e0b 10160:4608f10ae65f
  1849 end;
  1849 end;
  1850 
  1850 
  1851 var PrevSentPointTime: LongWord = 0;
  1851 var PrevSentPointTime: LongWord = 0;
  1852 
  1852 
  1853 procedure MoveCamera;
  1853 procedure MoveCamera;
  1854 var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY: LongInt;
  1854 var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY, cameraJump: LongInt;
  1855     inbtwnTrgtAttks: Boolean;
  1855     inbtwnTrgtAttks: Boolean;
  1856 begin
  1856 begin
  1857 {$IFNDEF MOBILE}
  1857 {$IFNDEF MOBILE}
  1858 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu) and autoCameraOn)) and cHasFocus and (GameState <> gsConfirm) then
  1858 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu) and autoCameraOn)) and cHasFocus and (GameState <> gsConfirm) then
  1859     uCursor.updatePosition();
  1859     uCursor.updatePosition();
  1867         prevPoint:= CursorPoint;
  1867         prevPoint:= CursorPoint;
  1868         exit
  1868         exit
  1869         end
  1869         end
  1870     else
  1870     else
  1871         begin
  1871         begin
       
  1872         if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > rightX - leftX - 100 then
       
  1873             begin
       
  1874             if (prevPoint.X - WorldDx) * 2 < rightX + leftX then
       
  1875                 cameraJump:= rightX - leftX
       
  1876                 else
       
  1877                 cameraJump:= leftX - rightX;
       
  1878             WorldDx:= WorldDx - cameraJump;
       
  1879             end;
       
  1880 
  1872         CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8;
  1881         CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8;
       
  1882 
  1873         if isPhone() or (cScreenHeight < 600) or ((hwSign(FollowGear^.dY) * z) < 10)  then
  1883         if isPhone() or (cScreenHeight < 600) or ((hwSign(FollowGear^.dY) * z) < 10)  then
  1874             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8
  1884             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8
  1875         else
  1885         else
  1876             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
  1886             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
  1877         end;
  1887         end;