diff Render.cpp @ 1655:a7eebb6ee7a2

Window Resize (change arguments to MM7_Initialize)
author Nomad
date Wed, 18 Sep 2013 11:13:38 +0200
parents dbd6f940f26c
children 5dd790bb52bf
line wrap: on
line diff
--- a/Render.cpp	Wed Sep 18 11:05:06 2013 +0600
+++ b/Render.cpp	Wed Sep 18 11:13:38 2013 +0200
@@ -2094,10 +2094,14 @@
   hd_water_current_frame = 0;
 }
 
-bool Render::Initialize(bool bWindowed, uint32_t uDefaultDevice, bool bColoredLights, uint32_t uDetailLevel, bool bTinting)
+bool Render::Initialize(bool bWindowed, int windowed_width, int windowed_height, uint32_t uDefaultDevice,
+                        bool bColoredLights, uint32_t uDetailLevel, bool bTinting)
 {
   bUserDirect3D = true;//ReadWindowsRegistryInt("Use D3D", 0);
+
   bStartInWindow = bWindowed;
+  windowed_mode_width = windowed_width;
+  windowed_mode_height = windowed_height;
 
   uDesiredDirect3DDevice = uDefaultDevice;//ReadWindowsRegistryInt("D3D Device", 1);
 
@@ -2177,30 +2181,21 @@
 //----- (0049ED18) --------------------------------------------------------
 void Render::PresentBlackScreen()
 {
-  LONG w; // edx@3
   IDirectDrawSurface *v2; // eax@3
   DDBLTFX v3; // [sp+4h] [bp-74h]@5
   RECT x; // [sp+68h] [bp-10h]@3
 
   memset(&v3, 0, sizeof(DDBLTFX));
+  GetWindowRect(hWnd, &x);
   if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
       pVersion->pVersionInfo.dwMajorVersion >= 5)
   {
-    x.left = uWindowX;
-    x.right = uWindowX + uWindowHeight;
-    x.top = uWindowY;
-    w = uWindowY + uWindowWidth;
     v2 = (IDirectDrawSurface *)this->pBackBuffer4;
   }
   else
   {
-    x.left = uWindowX;
-    x.right = uWindowX + uWindowHeight;
-    x.top = uWindowY;
-    w = uWindowY + uWindowWidth;
     v2 = (IDirectDrawSurface *)this->pBackBuffer2;
   }
-  x.bottom = w;
   v3.dwFillColor = 0;
   v3.dwSize = 100;
   v2->Blt(&x, 0, 0, DDBLT_COLORFILL, &v3);
@@ -8361,13 +8356,6 @@
     }
     if ( pRenderer->bWindowMode )
     {
-      if ( GetWindowRect(hWnd, &Rect) )
-      {
-        WriteWindowsRegistryInt("window X", Rect.left);
-        WriteWindowsRegistryInt("window Y", Rect.top);
-        uWindowX = Rect.left;
-        uWindowY = Rect.top;
-      }
       SetMenu(hWnd, 0);
       SetWindowLongA(hWnd, -20, 0);
       SetWindowLongA(hWnd, -16, 0x10000000u);
@@ -8379,7 +8367,6 @@
     {
       ClipCursor(0);
       pRenderer->SwitchToWindow(hWnd);
-      SetWindowLongA(hWnd, -16, uWindowStyle);
     }
     if ( pRenderer->pRenderD3D )
     {
@@ -8434,14 +8421,14 @@
     pMouse->SetCurrentCursorBitmap();
     if ( pRenderer->bWindowMode )
     {
-      InvalidateRect(0, 0, 0);
-      MoveWindow(hWnd, uWindowX, uWindowY, uWindowWidth, uWindowHeight, 0);
+      //MoveWindow(hWnd, uWindowX, uWindowY, uWindowWidth, uWindowHeight, 0);
+      CenterWindowAndAdjustSize(hWnd, windowed_mode_width, windowed_mode_height);
       ShowWindow(hWnd, SW_SHOWNORMAL);
     }
     pMouse->bActive = 1;
     if ( pVideoPlayer->AnyMovieLoaded() )
       pVideoPlayer->SelectMovieType();
-    if ( BYTE1(dword_6BE364_game_settings_1) & 8 )
+    if (dword_6BE364_game_settings_1 & 0x0800 )
       BYTE1(dword_6BE364_game_settings_1) &= 0xF7u;
     else
       pEventTimer->Resume();