changeset 2429:6d5877899730

* -novideo disables shop videos * replaced bicubic resampling for linear
author a.parshin
date Wed, 23 Jul 2014 19:42:39 +0300
parents c99c99439f6c
children cb66a1082fcf
files Build/Visual Studio 2012/World of Might and Magic.vcxproj.user GUIProgressBar.cpp GUIProgressBar.h OSWindow.h Render.cpp VideoPlayer.cpp
diffstat 6 files changed, 33 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.user	Wed Jul 23 13:32:09 2014 +0300
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.user	Wed Jul 23 19:42:39 2014 +0300
@@ -4,6 +4,6 @@
     <LocalDebuggerCommand>$(OutDir)$(TargetName)$(TargetExt)</LocalDebuggerCommand>
     <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
-    <LocalDebuggerCommandArguments>-nomarg -window -nointro -nologo</LocalDebuggerCommandArguments>
+    <LocalDebuggerCommandArguments>-nomarg -window -nointro -nologo -novideo</LocalDebuggerCommandArguments>
   </PropertyGroup>
 </Project>
\ No newline at end of file
--- a/GUIProgressBar.cpp	Wed Jul 23 13:32:09 2014 +0300
+++ b/GUIProgressBar.cpp	Wed Jul 23 19:42:39 2014 +0300
@@ -27,7 +27,7 @@
   //GUIProgressBar *v2; // esi@1
   signed int v4; // eax@7
   int v5; // ecx@8
-  int v6; // edi@8
+  //int v6; // edi@8
   int v7; // edx@14
   //const char *v8; // [sp-8h] [bp-84h]@20
   //unsigned int v9; // [sp-4h] [bp-80h]@20
@@ -56,22 +56,22 @@
   if (uType == TYPE_Fullscreen)
   {
     v5 = 0;
-    v6 = (int)&field_10;
+    //v6 = (int)&field_10;
     do
     {
-      if ( *(char *)(v6 + v4) == 1 ) //Uninitialized memory access (v6)
+      if ( field_10[v4] == 1 )
         ++v5;
       ++v4;
     }
     while ( v4 <= 5 );
     if ( v5 == 5 )
-      memset(&field_10, 0, 8);
+      memset(field_10, 0, 8);
     v7 = rand() % 5 + 1;
-    if ( *(&field_10 + v7) == 1 )
+    if ( field_10[v7] == 1 )
     {
       do
         v7 = rand() % 5 + 1;
-      while ( *(char *)(v6 + v7) == 1 );
+      while ( field_10[v7] == 1 );
     }
     sprintf(Str1, "loading%d.pcx", v7);
     pLoadingBg.Load(Str1, 2);
@@ -86,25 +86,6 @@
     return true;
   }
 
-  /*if ( !pParty->uAlignment )
-  {
-    v9 = 2;
-    v8 = "bardata-b";
-    goto LABEL_23;
-  }
-  if ( pParty->uAlignment == 1 )
-  {
-    v9 = 2;
-    v8 = "bardata";
-    goto LABEL_23;
-  }
-  if ( pParty->uAlignment == 2 )
-  {
-    v9 = 2;
-    v8 = "bardata-c";
-LABEL_23:
-    pIcons_LOD->_410522(&pBardata, v8, v9);
-  }*/
   switch (pParty->alignment)
   {
     case PartyAlignment_Good:    pIcons_LOD->_410522(&pBardata, "bardata-b", 2); break;
--- a/GUIProgressBar.h	Wed Jul 23 13:32:09 2014 +0300
+++ b/GUIProgressBar.h	Wed Jul 23 19:42:39 2014 +0300
@@ -28,14 +28,14 @@
   char uProgressMax;
   char uProgressCurrent;
   Type uType;
-  char field_10;
-  char field_11;
-  char field_12;
-  char field_13;
-  char field_14;
-  char field_15;
-  char field_16;
-  char field_17;
+  char field_10[8];
+  //char field_11;
+  //char field_12;
+  //char field_13;
+  //char field_14;
+  //char field_15;
+  //char field_16;
+  //char field_17;
   RGBTexture pLoadingBg;
   RGBTexture field_40;
   RGBTexture field_68;
--- a/OSWindow.h	Wed Jul 23 13:32:09 2014 +0300
+++ b/OSWindow.h	Wed Jul 23 19:42:39 2014 +0300
@@ -43,7 +43,7 @@
     bool Initialize(const wchar_t *title, int window_width, int window_height);
     bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result);
 
-    HWND    api_handle;
+    HWND api_handle;
 
   private:
     static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
--- a/Render.cpp	Wed Jul 23 13:32:09 2014 +0300
+++ b/Render.cpp	Wed Jul 23 19:42:39 2014 +0300
@@ -6281,8 +6281,22 @@
 
         if ( LockSurface_DDraw4(pNextSurf, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) )
         {
-          Dst.sub_451007_scale_image_bicubic(pHWLTexture->pPixels, pHWLTexture->uWidth, pHWLTexture->uHeight, pHWLTexture->uWidth,
-            (unsigned short *)desc.lpSurface, desc.dwWidth, desc.dwHeight, desc.lPitch >> 1, 0, 0);
+			// linear scaling
+		  for (int s = 0; s < desc.dwHeight; ++s)
+			  for (int t = 0; t < desc.dwWidth; ++t)
+			  {
+				  unsigned int resampled_x = t * pHWLTexture->uWidth / desc.dwWidth,
+					           resampled_y = s * pHWLTexture->uHeight / desc.dwHeight;
+				  unsigned short sample = pHWLTexture->pPixels[resampled_y * pHWLTexture->uWidth + resampled_x];
+
+				  ((unsigned short *)desc.lpSurface)[s * (desc.lPitch >> 1) + t] = sample;
+			  }
+
+			
+			  //bicubic sampling
+          //Dst.sub_451007_scale_image_bicubic(pHWLTexture->pPixels, pHWLTexture->uWidth, pHWLTexture->uHeight, pHWLTexture->uWidth,
+          //  (unsigned short *)desc.lpSurface, desc.dwWidth, desc.dwHeight, desc.lPitch >> 1, 0, 0);
+
           ErrD3D(pNextSurf->Unlock(0));
           //bMipMaps = 0x4D86ACu;
         }
--- a/VideoPlayer.cpp	Wed Jul 23 13:32:09 2014 +0300
+++ b/VideoPlayer.cpp	Wed Jul 23 19:42:39 2014 +0300
@@ -267,7 +267,7 @@
 
 void VideoPlayer::_inlined_in_463149()
 {
-	if (pMovie_Track)
+	if (pMovie_Track && !bNoVideo)
 	{
 		pRenderer->BeginScene();
 		pMouse->DrawCursorToTarget();