# HG changeset patch # User unc0rr # Date 1252596154 0 # Node ID 99f05a01a6a3435672a04b96e66e3c4e5cf6fc2e # Parent d584bb4b836e2ecf869544577f75596caf743d2a Don't allow to look too deep diff -r d584bb4b836e -r 99f05a01a6a3 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Sep 10 12:55:10 2009 +0000 +++ b/hedgewars/uWorld.pas Thu Sep 10 15:22:34 2009 +0000 @@ -540,7 +540,7 @@ procedure MoveCamera; const PrevSentPointTime: LongWord = 0; -var EdgesDist, cw: LongInt; +var EdgesDist, cw, wdy: LongInt; begin cw:= round(cScreenWidth / cScaleFactor); @@ -569,6 +569,9 @@ CursorPoint.y:= (prevPoint.y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8; end; +wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; +if WorldDy < wdy then WorldDy:= wdy; + if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit; if AMxShift < 210 then @@ -626,8 +629,8 @@ prevPoint:= CursorPoint; if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); -if WorldDy < cScreenHeight - cWaterLine - cVisibleWater then WorldDy:= cScreenHeight - cWaterLine - cVisibleWater; if WorldDy > LAND_HEIGHT + 1024 then WorldDy:= LAND_HEIGHT + 1024; +if WorldDy < wdy then WorldDy:= wdy; if WorldDx < -round(LAND_WIDTH * 2 / cScaleFactor) then WorldDx:= -round(LAND_WIDTH * 2 / cScaleFactor); if WorldDx > cw then WorldDx:= cw; end;