# HG changeset patch # User unc0rr # Date 1164815252 0 # Node ID 22ce72bd637f4ee617f0c1e8201f5349f9786385 # Parent 28d105f378f11f9e604015368c4e7a744d2fd818 Let mouse cursor be closer to screen edges diff -r 28d105f378f1 -r 22ce72bd637f hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Tue Nov 28 18:22:03 2006 +0000 +++ b/hedgewars/uMisc.pas Wed Nov 29 15:47:32 2006 +0000 @@ -46,7 +46,8 @@ cWaterLine : integer = 1024; cVisibleWater : integer = 128; - cScreenEdgesDist : integer = 240; + cGearScrEdgesDist: integer = 240; + cCursorEdgesDist : integer = 40; cTeamHealthWidth : integer = 128; GameTicks : LongWord = 0; diff -r 28d105f378f1 -r 22ce72bd637f hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Tue Nov 28 18:22:03 2006 +0000 +++ b/hedgewars/uWorld.pas Wed Nov 29 15:47:32 2006 +0000 @@ -57,7 +57,7 @@ procedure InitWorld; begin cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width); -cScreenEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50); +cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50); SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); prevPoint.X:= cScreenWidth div 2; prevPoint.Y:= cScreenHeight div 2; @@ -406,6 +406,7 @@ procedure MoveCamera; const PrevSentPointTime: LongWord = 0; +var EdgesDist: integer; begin if not (CurrentTeam.ExtDriven and isCursorVisible) then SDL_GetMouseState(@CursorPoint.X, @CursorPoint.Y); if (FollowGear <> nil) then @@ -440,27 +441,30 @@ PrevSentPointTime:= GameTicks end; end; + if isCursorVisible or (FollowGear <> nil) then begin - if CursorPoint.X < cScreenEdgesDist then + if isCursorVisible then EdgesDist:= cCursorEdgesDist + else EdgesDist:= cGearScrEdgesDist; + if CursorPoint.X < EdgesDist then begin - WorldDx:= WorldDx - CursorPoint.X + cScreenEdgesDist; - CursorPoint.X:= cScreenEdgesDist + WorldDx:= WorldDx - CursorPoint.X + EdgesDist; + CursorPoint.X:= EdgesDist end else - if CursorPoint.X > cScreenWidth - cScreenEdgesDist then + if CursorPoint.X > cScreenWidth - EdgesDist then begin - WorldDx:= WorldDx - CursorPoint.X + cScreenWidth - cScreenEdgesDist; - CursorPoint.X:= cScreenWidth - cScreenEdgesDist + WorldDx:= WorldDx - CursorPoint.X + cScreenWidth - EdgesDist; + CursorPoint.X:= cScreenWidth - EdgesDist end; - if CursorPoint.Y < cScreenEdgesDist then + if CursorPoint.Y < EdgesDist then begin - WorldDy:= WorldDy - CursorPoint.Y + cScreenEdgesDist; - CursorPoint.Y:= cScreenEdgesDist + WorldDy:= WorldDy - CursorPoint.Y + EdgesDist; + CursorPoint.Y:= EdgesDist end else - if CursorPoint.Y > cScreenHeight - cScreenEdgesDist then + if CursorPoint.Y > cScreenHeight - EdgesDist then begin - WorldDy:= WorldDy - CursorPoint.Y + cScreenHeight - cScreenEdgesDist; - CursorPoint.Y:= cScreenHeight - cScreenEdgesDist + WorldDy:= WorldDy - CursorPoint.Y + cScreenHeight - EdgesDist; + CursorPoint.Y:= cScreenHeight - EdgesDist end; end else begin