support ridiculously large maps
authornemo
Mon, 05 Nov 2012 22:03:26 -0500
changeset 7974 7ac6699b6228
parent 7972 0dffb91eeb82
child 7976 e1029baf2483
support ridiculously large maps
hedgewars/uConsts.pas
hedgewars/uInputHandler.pas
hedgewars/uLand.pas
hedgewars/uVariables.pas
--- a/hedgewars/uConsts.pas	Tue Nov 06 00:28:47 2012 +0400
+++ b/hedgewars/uConsts.pas	Mon Nov 05 22:03:26 2012 -0500
@@ -161,18 +161,6 @@
     // do not change this value
     cDefaultZoomLevel = 2.0;
 
-{$IFDEF MOBILE}
-    cMaxZoomLevel = 0.5;
-    cMinZoomLevel = 3.5;
-    cZoomDelta = 0.20;
-{$ELSE}
-    cMaxZoomLevel = 1.0;
-    cMinZoomLevel = 3.0;
-    cZoomDelta = 0.25;
-{$ENDIF}
-
-    cMinMaxZoomLevelDelta = cMaxZoomLevel - cMinZoomLevel;
-
     cSendEmptyPacketTime = 1000;
     trigTurns = $80000001;
 
--- a/hedgewars/uInputHandler.pas	Tue Nov 06 00:28:47 2012 +0400
+++ b/hedgewars/uInputHandler.pas	Mon Nov 05 22:03:26 2012 -0500
@@ -280,8 +280,8 @@
 DefaultBinds[KeyNameToCode(_S'y')]:= 'confirm';
 
 DefaultBinds[KeyNameToCode('mousem')]:= 'zoomreset';
-DefaultBinds[KeyNameToCode('wheelup')]:= 'zoomin';
-DefaultBinds[KeyNameToCode('wheeldown')]:= 'zoomout';
+DefaultBinds[KeyNameToCode('wheelup')]:= 'zoomout';
+DefaultBinds[KeyNameToCode('wheeldown')]:= 'zoomin';
 
 DefaultBinds[KeyNameToCode('f12')]:= 'fullscr';
 
--- a/hedgewars/uLand.pas	Tue Nov 06 00:28:47 2012 +0400
+++ b/hedgewars/uLand.pas	Mon Nov 05 22:03:26 2012 -0500
@@ -54,6 +54,9 @@
 
     SetLength(Land, LAND_HEIGHT, LAND_WIDTH);
     SetLength(LandDirty, (LAND_HEIGHT div 32), (LAND_WIDTH div 32));
+    // 0.5 is already approaching on unplayable
+    if (width div 4096 >= 2) or (height div 2048 >= 2) then cMaxZoomLevel:= 0.5;
+    cMinMaxZoomLevelDelta:= cMaxZoomLevel - cMinZoomLevel
     end;
 end;
 
--- a/hedgewars/uVariables.pas	Tue Nov 06 00:28:47 2012 +0400
+++ b/hedgewars/uVariables.pas	Mon Nov 05 22:03:26 2012 -0500
@@ -108,7 +108,7 @@
     zoom             : GLfloat;
     ZoomValue        : GLfloat;
 
-    cWaterLine       : Word;
+    cWaterLine       : LongWord;
     cGearScrEdgesDist: LongInt;
     isAudioMuted     : boolean;
 
@@ -122,8 +122,8 @@
     Pathz: array[TPathType] of shortstring;
     UserPathz: array[TPathType] of shortstring;
     CountTexz: array[0..Pred(AMMO_INFINITE)] of PTexture;
-    LAND_WIDTH       : Word;
-    LAND_HEIGHT      : Word;
+    LAND_WIDTH       : LongWord;
+    LAND_HEIGHT      : LongWord;
     LAND_WIDTH_MASK  : LongWord;
     LAND_HEIGHT_MASK : LongWord;
 
@@ -164,6 +164,10 @@
     AmmoMenuInvalidated: boolean;
     AmmoRect		: TSDL_Rect;
     HHTexture       : PTexture;
+    cMaxZoomLevel   : real;
+    cMinZoomLevel   : real;
+    cZoomDelta      : real;
+    cMinMaxZoomLevelDelta : real;
 
 
     flagMakeCapture : boolean;
@@ -2632,6 +2636,18 @@
     cDamageModifier         := _1;
     TargetPoint             := cTargetPointRef;
 
+{$IFDEF MOBILE}
+    cMaxZoomLevel:= 0.5;
+    cMinZoomLevel:= 3.5;
+    cZoomDelta:= 0.20;
+{$ELSE}
+    cMaxZoomLevel:= 1.0;
+    cMinZoomLevel:= 3.0;
+    cZoomDelta:= 0.25;
+{$ENDIF}
+
+    cMinMaxZoomLevelDelta:= cMaxZoomLevel - cMinZoomLevel;
+
     // int, longint longword and byte
     CursorMovementX     := 0;
     CursorMovementY     := 0;