diff mm7_2.cpp @ 819:9359c114f98c

More on screenshot
author Nomad
date Tue, 26 Mar 2013 14:14:39 +0200
parents 352c5161fade
children 522591080ac5
line wrap: on
line diff
--- a/mm7_2.cpp	Tue Mar 26 13:14:41 2013 +0200
+++ b/mm7_2.cpp	Tue Mar 26 14:14:39 2013 +0200
@@ -562,7 +562,7 @@
   v26 = 0;
   pParty->field_7B5_in_arena_quest = uDialogueType;
   memcpy(&window, pDialogueWindow, sizeof(window));
-  window.uFrameWidth = 460;
+  window.uFrameWidth = game_viewport_width;
   window.uFrameZ = 452;
   v0 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[575], &window, 13, 0) + 7;
   pRenderer->BeginSceneD3D();
@@ -6290,10 +6290,12 @@
   //v30 = width;
   //v2 = height;
   //v27 = height;
-  v23 = 452.0 / (double)width;
-  v25 = 336.0 / (double)height;
+  v23 = game_viewport_width / (double)width;
+  v25 = game_viewport_height / (double)height;
+
   pPixels = (unsigned __int16 *)malloc(2 * height * width);
   memset(pPixels, 0 , 2 * height * width);
+
   v3 = pPixels;
   if ( pRenderer->pRenderD3D )
   {
@@ -6310,17 +6312,24 @@
 
     if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
     {
+      for (uint i = game_viewport_y; i < game_viewport_y+16; ++i)
+        memset32((char *)Dst.lpSurface + i * Dst.lPitch, 0xF800F800, Dst.lPitch / 4);
+      for (uint i = game_viewport_y+32; i < game_viewport_y+32+16; ++i)
+        memset32((char *)Dst.lpSurface + i * Dst.lPitch, 0x07E007E0, Dst.lPitch / 4);
+      for (uint i = game_viewport_y+64; i < game_viewport_y+64+16; ++i)
+        memset32((char *)Dst.lpSurface + i * Dst.lPitch, 0x001F001F, Dst.lPitch / 4);
+
       auto src = (unsigned __int16 *)Dst.lpSurface;
       auto dst = pPixels;
       for (uint y = 0; y < height; ++y)
       {
-        uint src_y = (y * v25 + 8.0f) * (Dst.lPitch / sizeof(short));
-        assert(y * v25 + 8.0f < Dst.dwHeight);
+        uint src_y = (game_viewport_y + y * v25) * (Dst.lPitch / sizeof(short));
+        assert((y + game_viewport_y) * v25 < Dst.dwHeight);
         assert(y < height);
 
         for (uint x = 0; x < width; ++x)
         {
-          uint src_x = x * v23 + 8.0;
+          uint src_x = game_viewport_x + x * v23;
           assert(src_x < Dst.dwWidth);
           assert(x < width);
 
@@ -9196,10 +9205,12 @@
   //_getcwd(v5, 120);
   //sprintfex(pIniFilename, "%s\\mm6.ini", v5);
   viewparams = new ViewingParams;
-  viewparams->uScreen_topL_X = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename);
-  viewparams->uScreen_topL_Y = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename);
-  viewparams->uScreen_BttmR_X = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename);
-  viewparams->uScreen_BttmR_Y = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename);
+  game_viewport_x = viewparams->uScreen_topL_X = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename);
+  game_viewport_y = viewparams->uScreen_topL_Y = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename);
+  game_viewport_z = viewparams->uScreen_BttmR_X = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename);
+  game_viewport_w = viewparams->uScreen_BttmR_Y = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename);
+  game_viewport_width = game_viewport_z - game_viewport_x;
+  game_viewport_height = game_viewport_w - game_viewport_y + 1;
 
 
   pAudioPlayer = new AudioPlayer;
@@ -9435,508 +9446,6 @@
   return uCurrentMenuID;
 }
 
-/*
-    v17 = 0;
-    if ( v4 > -2005532222 )
-    {
-      switch ( v4 + 2005532212 )
-      {
-        case 0:
-          v7 = "DDERR_SURFACENOTATTACHED";
-          goto LABEL_173;
-        case 10:
-          v7 = "DDERR_TOOBIGHEIGHT";
-          goto LABEL_173;
-        case 20:
-          v7 = "DDERR_TOOBIGSIZE";
-          goto LABEL_173;
-        case 30:
-          v7 = "DDERR_TOOBIGWIDTH";
-          goto LABEL_173;
-        case 50:
-          v7 = "DDERR_UNSUPPORTEDFORMAT";
-          goto LABEL_173;
-        case 60:
-          v7 = "DDERR_UNSUPPORTEDMASK";
-          goto LABEL_173;
-        case 61:
-          v7 = "DDERR_INVALIDSTREAM";
-          goto LABEL_173;
-        case 77:
-          v7 = "DDERR_VERTICALBLANKINPROGRESS";
-          goto LABEL_173;
-        case 80:
-          v7 = "DDERR_WASSTILLDRAWING";
-          goto LABEL_173;
-        case 100:
-          v7 = "DDERR_XALIGN";
-          goto LABEL_173;
-        case 101:
-          v7 = "DDERR_INVALIDDIRECTDRAWGUID";
-          goto LABEL_173;
-        case 102:
-          v7 = "DDERR_DIRECTDRAWALREADYCREATED";
-          goto LABEL_173;
-        case 103:
-          v7 = "DDERR_NODIRECTDRAWHW";
-          goto LABEL_173;
-        case 104:
-          v7 = "DDERR_PRIMARYSURFACEALREADYEXISTS";
-          goto LABEL_173;
-        case 105:
-          v7 = "DDERR_NOEMULATION";
-          goto LABEL_173;
-        case 106:
-          v7 = "DDERR_REGIONTOOSMALL";
-          goto LABEL_173;
-        case 107:
-          v7 = "DDERR_CLIPPERISUSINGHWND";
-          goto LABEL_173;
-        case 108:
-          v7 = "DDERR_NOCLIPPERATTACHED";
-          goto LABEL_173;
-        case 109:
-          v7 = "DDERR_NOHWND";
-          goto LABEL_173;
-        case 110:
-          v7 = "DDERR_HWNDSUBCLASSED";
-          goto LABEL_173;
-        case 111:
-          v7 = "DDERR_HWNDALREADYSET";
-          goto LABEL_173;
-        case 112:
-          v7 = "DDERR_NOPALETTEATTACHED";
-          goto LABEL_173;
-        case 113:
-          v7 = "DDERR_NOPALETTEHW";
-          goto LABEL_173;
-        case 114:
-          v7 = "DDERR_BLTFASTCANTCLIP";
-          goto LABEL_173;
-        case 115:
-          v7 = "DDERR_NOBLTHW";
-          goto LABEL_173;
-        case 116:
-          v7 = "DDERR_NODDROPSHW";
-          goto LABEL_173;
-        case 117:
-          v7 = "DDERR_OVERLAYNOTVISIBLE";
-          goto LABEL_173;
-        case 118:
-          v7 = "DDERR_NOOVERLAYDEST";
-          goto LABEL_173;
-        case 119:
-          v7 = "DDERR_INVALIDPOSITION";
-          goto LABEL_173;
-        case 120:
-          v7 = "DDERR_NOTAOVERLAYSURFACE";
-          goto LABEL_173;
-        case 121:
-          v7 = "DDERR_EXCLUSIVEMODEALREADYSET";
-          goto LABEL_173;
-        case 122:
-          v7 = "DDERR_NOTFLIPPABLE";
-          goto LABEL_173;
-        case 123:
-          v7 = "DDERR_CANTDUPLICATE";
-          goto LABEL_173;
-        case 125:
-          v7 = "DDERR_CANTCREATEDC";
-          goto LABEL_173;
-        case 126:
-          v7 = "DDERR_NODC";
-          goto LABEL_173;
-        case 127:
-          v7 = "DDERR_WRONGMODE";
-          goto LABEL_173;
-        case 128:
-          v7 = "DDERR_IMPLICITLYCREATED";
-          goto LABEL_173;
-        case 129:
-          v7 = "DDERR_NOTPALETTIZED";
-          goto LABEL_173;
-        case 130:
-          v7 = "DDERR_UNSUPPORTEDMODE";
-          goto LABEL_173;
-        case 131:
-          v7 = "DDERR_NOMIPMAPHW";
-          goto LABEL_173;
-        case 132:
-          v7 = "DDERR_INVALIDSURFACETYPE";
-          goto LABEL_173;
-        case 140:
-          v7 = "DDERR_NOOPTIMIZEHW";
-          goto LABEL_173;
-        case 141:
-          v7 = "DDERR_NOTLOADED";
-          goto LABEL_173;
-        case 142:
-          v7 = "DDERR_NOFOCUSWINDOW";
-          goto LABEL_173;
-        case 160:
-          v7 = "DDERR_DCALREADYCREATED";
-          goto LABEL_173;
-        case 170:
-          v7 = "DDERR_NONONLOCALVIDMEM";
-          goto LABEL_173;
-        case 180:
-          v7 = "DDERR_CANTPAGELOCK";
-          goto LABEL_173;
-        case 200:
-          v7 = "DDERR_CANTPAGEUNLOCK";
-          goto LABEL_173;
-        case 220:
-          v7 = "DDERR_NOTPAGELOCKED";
-          goto LABEL_173;
-        case 230:
-          v7 = "DDERR_MOREDATA";
-          goto LABEL_173;
-        case 231:
-          v7 = "DDERR_EXPIRED";
-          goto LABEL_173;
-        case 235:
-          v7 = "DDERR_VIDEONOTACTIVE";
-          goto LABEL_173;
-        case 239:
-          v7 = "DDERR_DEVICEDOESNTOWNSURFACE";
-          goto LABEL_173;
-        default:
-          goto LABEL_174;
-        case 124:
-          goto LABEL_176;
-      }
-      goto LABEL_176;
-    }
-    if ( v4 != -2005532222 )
-    {
-      if ( v4 > -2005532447 )
-      {
-        if ( v4 <= -2005532337 )
-        {
-          if ( v4 == -2005532337 )
-          {
-            v7 = "DDERR_NOVSYNCHW";
-            goto LABEL_173;
-          }
-          if ( v4 > -2005532392 )
-          {
-            if ( v4 == -2005532382 )
-            {
-              v7 = "DDERR_NOROTATIONHW";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532362 )
-            {
-              v7 = "DDERR_NOSTRETCHHW";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532356 )
-            {
-              v7 = "DDERR_NOT4BITCOLOR";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532355 )
-            {
-              v7 = "DDERR_NOT4BITCOLORINDEX";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532352 )
-            {
-              v7 = "DDERR_NOT8BITCOLOR";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532342 )
-            {
-              v7 = "DDERR_NOTEXTUREHW";
-              goto LABEL_173;
-            }
-          }
-          else
-          {
-            if ( v4 == -2005532392 )
-            {
-              v7 = "DDERR_NORASTEROPHW";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532442 )
-            {
-              v7 = "DDERR_NOFLIPHW";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532432 )
-            {
-              v7 = "DDERR_NOGDI";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532422 )
-            {
-              v7 = "DDERR_NOMIRRORHW";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532417 )
-            {
-              v7 = "DDERR_NOTFOUND";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532412 )
-            {
-              v7 = "DDERR_NOOVERLAYHW";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532402 )
-            {
-              v7 = "DDERR_OVERLAPPINGRECTS";
-              goto LABEL_173;
-            }
-          }
-          goto LABEL_174;
-        }
-        if ( v4 <= -2005532285 )
-        {
-          if ( v4 == -2005532285 )
-          {
-            v7 = "DDERR_PALETTEBUSY";
-            goto LABEL_173;
-          }
-          if ( v4 == -2005532332 )
-          {
-            v7 = "DDERR_NOZBUFFERHW";
-            goto LABEL_173;
-          }
-          if ( v4 == -2005532322 )
-          {
-            v7 = "DDERR_NOZOVERLAYHW";
-            goto LABEL_173;
-          }
-          if ( v4 == DDERR_OUTOFCAPS )
-          {
-            v7 = "DDERR_OUTOFCAPS";
-            goto LABEL_173;
-          }
-          if ( v4 == DDERR_OUTOFVIDEOMEMORY )
-          {
-            v7 = "DDERR_OUTOFVIDEOMEMORY";
-            goto LABEL_173;
-          }
-          if ( v4 == DDERR_OVERLAYCANTCLIP )
-          {
-            v7 = "DDERR_OVERLAYCANTCLIP";
-            goto LABEL_173;
-          }
-          if ( v4 == DDERR_OVERLAYCOLORKEYONLYONEACTIVE )
-          {
-            v7 = "DDERR_OVERLAYCOLORKEYONLYONEACTIVE";
-            goto LABEL_173;
-          }
-          goto LABEL_174;
-        }
-        if ( v4 == -2005532272 )
-        {
-          v7 = "DDERR_COLORKEYNOTSET";
-          goto LABEL_173;
-        }
-        if ( v4 == -2005532262 )
-        {
-          v7 = "DDERR_SURFACEALREADYATTACHED";
-          goto LABEL_173;
-        }
-        if ( v4 == -2005532252 )
-        {
-          v7 = "DDERR_SURFACEALREADYDEPENDENT";
-          goto LABEL_173;
-        }
-        if ( v4 != -2005532242 )
-        {
-          if ( v4 == -2005532237 )
-          {
-            v7 = "DDERR_CANTLOCKSURFACE";
-            goto LABEL_173;
-          }
-          if ( v4 == -2005532232 )
-          {
-            v7 = "DDERR_SURFACEISOBSCURED";
-            goto LABEL_173;
-          }
-          goto LABEL_174;
-        }
-      }
-      else
-      {
-        if ( v4 == -2005532447 )
-        {
-          v7 = "DDERR_NOEXCLUSIVEMODE";
-          goto LABEL_173;
-        }
-        if ( v4 <= -2005532562 )
-        {
-          if ( v4 == -2005532562 )
-          {
-            v7 = "DDERR_INVALIDCLIPLIST";
-            goto LABEL_173;
-          }
-          if ( v4 > -2005532662 )
-          {
-            if ( v4 == -2005532652 )
-            {
-              v7 = "DDERR_CANNOTDETACHSURFACE";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532632 )
-            {
-              v7 = "DDERR_CURRENTLYNOTAVAIL";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532617 )
-            {
-              v7 = "DDERR_EXCEPTION";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532582 )
-            {
-              v7 = "DDERR_HEIGHTALIGN";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532577 )
-            {
-              v7 = "DDERR_INCOMPATIBLEPRIMARY";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532572 )
-            {
-              v7 = "DDERR_INVALIDCAPS";
-              goto LABEL_173;
-            }
-          }
-          else
-          {
-            if ( v4 == -2005532662 )
-            {
-              v7 = "DDERR_CANNOTATTACHSURFACE";
-              goto LABEL_173;
-            }
-            if ( v4 == -2147467263 )
-            {
-              v7 = "DDERR_UNSUPPORTED";
-              goto LABEL_173;
-            }
-            if ( v4 == -2147467259 )
-            {
-              v7 = "DDERR_GENERIC";
-              goto LABEL_173;
-            }
-            if ( v4 == -2147221008 )
-            {
-              v7 = "DDERR_NOTINITIALIZED";
-              goto LABEL_173;
-            }
-            if ( v4 == -2147024882 )
-            {
-              v7 = "DDERR_OUTOFMEMORY";
-              goto LABEL_173;
-            }
-            if ( v4 == -2147024809 )
-            {
-              v7 = "DDERR_INVALIDPARAMS";
-              goto LABEL_173;
-            }
-            if ( v4 == -2005532667 )
-            {
-              v7 = "DDERR_ALREADYINITIALIZED";
-LABEL_173:
-              v13 = strlen(v7);
-              v12 = (char *)v7;
-LABEL_175:
-              std::stringoperator_assign__const_char_ptr__(&a1, v12, v13);
-              v13 = a3;
-              pRenderer->field_40110 = 0;
-              v15 = &v11;
-              std::string40E2C8(&v11, Str, (int)((char *)&hr + 3));
-              v10 = 48;
-              LOBYTE(v17) = 1;
-              Str = (char *)&v9;
-              std::string40E2C8(&v9, "Direct Draw Error", (int)((char *)&a3 + 3));
-              LOBYTE(v17) = 0;
-              CheckHRESULT_stru0::ShowMessageBox(v6, &a1, v9, v10, v11, v13);
-              v5 = 1;
-              goto LABEL_176;
-            }
-          }
-LABEL_174:
-          sprintfex(&Src, "Unknown DirectDraw/Direct3D error number %X", v4);
-          v13 = strlen(&Src);
-          v12 = &Src;
-          goto LABEL_175;
-        }
-        if ( v4 > -2005532492 )
-        {
-          if ( v4 == -2005532467 )
-          {
-            v7 = "DDERR_NOCLIPLIST";
-            goto LABEL_173;
-          }
-          if ( v4 == -2005532462 )
-          {
-            v7 = "DDERR_NOCOLORCONVHW";
-            goto LABEL_173;
-          }
-          if ( v4 == -2005532460 )
-          {
-            v7 = "DDERR_NOCOOPERATIVELEVELSET";
-            goto LABEL_173;
-          }
-          if ( v4 == -2005532457 )
-          {
-            v7 = "DDERR_NOCOLORKEY";
-            goto LABEL_173;
-          }
-          if ( v4 == -2005532452 )
-          {
-            v7 = "DDERR_NOCOLORKEYHW";
-            goto LABEL_173;
-          }
-          if ( v4 == -2005532450 )
-          {
-            v7 = "DDERR_NODIRECTDRAWSUPPORT";
-            goto LABEL_173;
-          }
-          goto LABEL_174;
-        }
-        if ( v4 == -2005532492 )
-        {
-          v7 = "DDERR_NOALPHAHW";
-          goto LABEL_173;
-        }
-        if ( v4 == -2005532552 )
-        {
-          v7 = "DDERR_INVALIDMODE";
-          goto LABEL_173;
-        }
-        if ( v4 == -2005532542 )
-        {
-          v7 = "DDERR_INVALIDOBJECT";
-          goto LABEL_173;
-        }
-        if ( v4 == -2005532527 )
-        {
-          v7 = "DDERR_INVALIDPIXELFORMAT";
-          goto LABEL_173;
-        }
-        if ( v4 != -2005532522 )
-        {
-          if ( v4 == -2005532512 )
-          {
-            v7 = "DDERR_LOCKEDSURFACES";
-            goto LABEL_173;
-          }
-          if ( v4 == -2005532502 )
-          {
-            v7 = "DDERR_NO3D";
-            goto LABEL_173;
-          }
-          goto LABEL_174;
-        }
-      }*/
-
 //----- (00467D5D) --------------------------------------------------------
 int __thiscall sub_467D5D(int _this)
 {