hedgewars/uWorld.pas
changeset 2375 99f05a01a6a3
parent 2374 d584bb4b836e
child 2376 ece7b87f1334
equal deleted inserted replaced
2374:d584bb4b836e 2375:99f05a01a6a3
   538 	end;
   538 	end;
   539 end;
   539 end;
   540 
   540 
   541 procedure MoveCamera;
   541 procedure MoveCamera;
   542 const PrevSentPointTime: LongWord = 0;
   542 const PrevSentPointTime: LongWord = 0;
   543 var EdgesDist, cw: LongInt;
   543 var EdgesDist, cw, wdy: LongInt;
   544 begin
   544 begin
   545 
   545 
   546 cw:= round(cScreenWidth / cScaleFactor);
   546 cw:= round(cScreenWidth / cScaleFactor);
   547 
   547 
   548 if (not (CurrentTeam^.ExtDriven and isCursorVisible)) and cHasFocus then
   548 if (not (CurrentTeam^.ExtDriven and isCursorVisible)) and cHasFocus then
   566 		else begin
   566 		else begin
   567 		CursorPoint.x:= (prevPoint.x * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100 + WorldDx) div 8;
   567 		CursorPoint.x:= (prevPoint.x * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100 + WorldDx) div 8;
   568 		//addcaption(inttostr(CursorPoint.X), $AFAFAF, capgrpGameState);
   568 		//addcaption(inttostr(CursorPoint.X), $AFAFAF, capgrpGameState);
   569 		CursorPoint.y:= (prevPoint.y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8;
   569 		CursorPoint.y:= (prevPoint.y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8;
   570 		end;
   570 		end;
       
   571 
       
   572 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater;
       
   573 if WorldDy < wdy then WorldDy:= wdy;
   571 
   574 
   572 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit;
   575 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit;
   573 
   576 
   574 if AMxShift < 210 then
   577 if AMxShift < 210 then
   575 	begin
   578 	begin
   624       CursorPoint.Y:= cScreenHeight div 2;
   627       CursorPoint.Y:= cScreenHeight div 2;
   625       end;
   628       end;
   626 
   629 
   627 prevPoint:= CursorPoint;
   630 prevPoint:= CursorPoint;
   628 if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y);
   631 if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y);
   629 if WorldDy < cScreenHeight - cWaterLine - cVisibleWater then WorldDy:= cScreenHeight - cWaterLine - cVisibleWater;
       
   630 if WorldDy > LAND_HEIGHT + 1024 then WorldDy:= LAND_HEIGHT + 1024;
   632 if WorldDy > LAND_HEIGHT + 1024 then WorldDy:= LAND_HEIGHT + 1024;
       
   633 if WorldDy < wdy then WorldDy:= wdy;
   631 if WorldDx < -round(LAND_WIDTH * 2 / cScaleFactor) then WorldDx:= -round(LAND_WIDTH * 2 / cScaleFactor);
   634 if WorldDx < -round(LAND_WIDTH * 2 / cScaleFactor) then WorldDx:= -round(LAND_WIDTH * 2 / cScaleFactor);
   632 if WorldDx > cw then WorldDx:= cw;
   635 if WorldDx > cw then WorldDx:= cw;
   633 end;
   636 end;
   634 
   637 
   635 initialization
   638 initialization