DEADSOFTWARE

forcing centering of small maps (BlackDoomer request)
authorKetmar Dark <ketmar@ketmar.no-ip.org>
Thu, 24 Aug 2017 16:16:34 +0000 (19:16 +0300)
committerKetmar Dark <ketmar@ketmar.no-ip.org>
Thu, 24 Aug 2017 16:17:05 +0000 (19:17 +0300)
src/game/g_game.pas
src/game/g_map.pas
src/game/g_monsters.pas

index a2f74cdfe5c18f8b4568570408f869868916f396..02a46f2c4ab9cb90ae13a484b6b08ca7a590770f 100644 (file)
@@ -2855,8 +2855,19 @@ begin
   if px > gMapInfo.Width-(gPlayerScreenSize.X div 2) then a := -gMapInfo.Width+gPlayerScreenSize.X;
   if py > gMapInfo.Height-(gPlayerScreenSize.Y div 2) then b := -gMapInfo.Height+gPlayerScreenSize.Y;
 
-  if gMapInfo.Width <= gPlayerScreenSize.X then a := 0;
-  if gMapInfo.Height <= gPlayerScreenSize.Y then b := 0;
+       if (gMapInfo.Width = gPlayerScreenSize.X) then a := 0
+  else if (gMapInfo.Width < gPlayerScreenSize.X) then
+  begin
+    // hcenter
+    a := (gPlayerScreenSize.X-gMapInfo.Width) div 2;
+  end;
+
+       if (gMapInfo.Height = gPlayerScreenSize.Y) then b := 0
+  else if (gMapInfo.Height < gPlayerScreenSize.Y) then
+  begin
+    // vcenter
+    b := (gPlayerScreenSize.Y-gMapInfo.Height) div 2;
+  end;
 
   if p.IncCam <> 0 then
   begin
index f0419bf49cf4314ad47ee168b1eb3fd78c87ad8a..b9da59dd6d2064a97120d49f7bca56425d8533b3 100644 (file)
@@ -198,7 +198,7 @@ type
   TPanelGrid = specialize TBodyGridBase<TPanel>;
 
 var
-  mapGrid: TPanelGrid = nil;
+  mapGrid: TPanelGrid = nil; // DO NOT USE! public for debugging only!
 
 
 implementation
@@ -1226,6 +1226,7 @@ begin
   if (mapY1 < gMapInfo.Height-1) then mapY1 := gMapInfo.Height-1;
 
   mapGrid := TPanelGrid.Create(mapX0-128, mapY0-128, mapX1-mapX0+1+128*2, mapY1-mapY0+1+128*2);
+  //mapGrid := TPanelGrid.Create(0, 0, gMapInfo.Width, gMapInfo.Height);
 
   addPanelsToGrid(gWalls);
   addPanelsToGrid(gRenderBackgrounds);
index 280dc56a386d93137f5a306d9037e4344b45ae74..8c2f2d7e399093feed5c4d58481ffe2ded58cf95 100644 (file)
@@ -235,7 +235,7 @@ type
   TMonsterGrid = specialize TBodyGridBase<TMonster>;
 
 var
-  monsGrid: TMonsterGrid = nil;
+  monsGrid: TMonsterGrid = nil; // DO NOT USE! public for debugging only!
 
 
 var