diff mm7_5.cpp @ 693:e0a1fccc89b1

map render fixes
author Gloval
date Sun, 17 Mar 2013 01:50:34 +0400
parents 26dfde53decd
children 2dfb67633b01
line wrap: on
line diff
--- a/mm7_5.cpp	Sat Mar 16 21:57:32 2013 +0400
+++ b/mm7_5.cpp	Sun Mar 17 01:50:34 2013 +0400
@@ -963,8 +963,8 @@
           if ( pCurrentScreen )
             pGUIWindow_CurrentMenu->Release();
           pEventTimer->Pause();
-          viewparams->sPartyPosX = pParty->vPosition.x;
-          viewparams->sPartyPosZ = pParty->vPosition.y;
+          viewparams->sViewCenterX = pParty->vPosition.x;
+          viewparams->sViewCenterY = pParty->vPosition.y;
           pAudioPlayer->StopChannels(-1, -1);
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0);
           pBooksWindow = GUIWindow::Create(546, 353, 0, 0, (enum WindowType)99, (int)pBtn_Maps, 0);
@@ -13409,8 +13409,8 @@
           {
 			v7 = v0->lastOpenedSpellbookPage;
            // v7 =  (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
-            v19 = pViewport->uViewportY +  pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos;
-            v17 = pViewport->uViewportX +  pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos;
+            v19 = pViewport->uViewportTL_Y +  pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos;
+            v17 = pViewport->uViewportTL_X +  pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos;
             if ( BYTE1(v6->pBits) & 2 )
               pRenderer->DrawTextureTransparent(v17, v19, v6);
             else
@@ -13434,8 +13434,8 @@
       v21 = dword_5063D8[v10];
 	  v12 = v0->lastOpenedSpellbookPage;
     //  v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
-      v20 = pViewport->uViewportY +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos;
-      v18 = pViewport->uViewportX +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos;
+      v20 = pViewport->uViewportTL_Y +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos;
+      v18 = pViewport->uViewportTL_X +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos;
       if ( BYTE1(v11->pBits) & 2 )
         pRenderer->DrawTextureTransparent(v18, v20, v21);
       else
@@ -13570,31 +13570,31 @@
   Texture *v14; // [sp-4h] [bp-60h]@7
   GUIWindow a1; // [sp+8h] [bp-54h]@10
 
-  pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pSpellBookPagesTextr_11);
+  pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11);
   if ( dword_506548 || !dword_506528 )
   {
     v13 = pTex_tab_an_6a__zoom_off;
-    v11 = pViewport->uViewportY + 2;
-    v0 = pViewport->uViewportX + 407;
+    v11 = pViewport->uViewportTL_Y + 2;
+    v0 = pViewport->uViewportTL_X + 407;
   }
   else
   {
     v13 = pTex_tab_an_6b__zoom_on;
-    v11 = pViewport->uViewportY + 1;
-    v0 = pViewport->uViewportX + 398;
+    v11 = pViewport->uViewportTL_Y + 1;
+    v0 = pViewport->uViewportTL_X + 398;
   }
   pRenderer->DrawTextureTransparent(v0, v11, v13);
   if ( dword_506544 || dword_506528 + awards_count >= awards_count2 )
   {
     v14 = pTex_tab_an_7a__zoot_off;
-    v12 = pViewport->uViewportY + 38;
-    v1 = pViewport->uViewportX + 407;
+    v12 = pViewport->uViewportTL_Y + 38;
+    v1 = pViewport->uViewportTL_X + 407;
   }
   else
   {
     v14 = pTex_tab_an_7b__zoot_on;
-    v12 = pViewport->uViewportY + 38;
-    v1 = pViewport->uViewportX + 398;
+    v12 = pViewport->uViewportTL_Y + 38;
+    v1 = pViewport->uViewportTL_X + 398;
   }
   pRenderer->DrawTextureTransparent(v1, v12, v14);
   if ( !byte_5C6D50[dword_506528] )
@@ -13676,31 +13676,31 @@
   Texture *v11; // [sp-4h] [bp-64h]@7
   GUIWindow a1; // [sp+Ch] [bp-54h]@9
 
-  pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pTexture_CurrentBook);
+  pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook);
   if ( dword_506548 || !dword_506528 )
   {
     v10 = pTex_tab_an_6a__zoom_off;
-    v8 = pViewport->uViewportY + 2;
-    v0 = pViewport->uViewportX + 407;
+    v8 = pViewport->uViewportTL_Y + 2;
+    v0 = pViewport->uViewportTL_X + 407;
   }
   else
   {
     v10 = pTex_tab_an_6b__zoom_on;
-    v8 = pViewport->uViewportY + 1;
-    v0 = pViewport->uViewportX + 398;
+    v8 = pViewport->uViewportTL_Y + 1;
+    v0 = pViewport->uViewportTL_X + 398;
   }
   pRenderer->DrawTextureTransparent(v0, v8, v10);
   if ( dword_506544 || dword_506528 + awards_count >= awards_count2 )
   {
     v11 = pTex_tab_an_7a__zoot_off;
-    v9 = pViewport->uViewportY + 38;
-    v1 = pViewport->uViewportX + 407;
+    v9 = pViewport->uViewportTL_Y + 38;
+    v1 = pViewport->uViewportTL_X + 407;
   }
   else
   {
     v11 = pTex_tab_an_7b__zoot_on;
-    v9 = pViewport->uViewportY + 38;
-    v1 = pViewport->uViewportX + 398;
+    v9 = pViewport->uViewportTL_Y + 38;
+    v1 = pViewport->uViewportTL_X + 398;
   }
   pRenderer->DrawTextureTransparent(v1, v9, v11);
   a1.uFrameWidth = 460;
@@ -13794,31 +13794,31 @@
   GUIWindow a1; // [sp+14h] [bp-54h]@46
 
   v31 = 0;
-  pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pTexture_AutonotesBook);
+  pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook);
   if ( dword_506548 || !dword_506528 )
   {
     v24 = pTex_tab_an_6a__zoom_off;
-    v17 = pViewport->uViewportY + 2;
-    v0 = pViewport->uViewportX + 407;
+    v17 = pViewport->uViewportTL_Y + 2;
+    v0 = pViewport->uViewportTL_X + 407;
   }
   else
   {
     v24 = pTex_tab_an_6b__zoom_on;
-    v17 = pViewport->uViewportY + 1;
-    v0 = pViewport->uViewportX + 398;
+    v17 = pViewport->uViewportTL_Y + 1;
+    v0 = pViewport->uViewportTL_X + 398;
   }
   pRenderer->DrawTextureTransparent(v0, v17, v24);
   if ( dword_506544 || dword_506528 + awards_count >= awards_count2 )
   {
     v25 = pTex_tab_an_7a__zoot_off;
-    v18 = pViewport->uViewportY + 38;
-    v1 = pViewport->uViewportX + 407;
+    v18 = pViewport->uViewportTL_Y + 38;
+    v1 = pViewport->uViewportTL_X + 407;
   }
   else
   {
     v25 = pTex_tab_an_7b__zoot_on;
-    v18 = pViewport->uViewportY + 38;
-    v1 = pViewport->uViewportX + 398;
+    v18 = pViewport->uViewportTL_Y + 38;
+    v1 = pViewport->uViewportTL_X + 398;
   }
   pRenderer->DrawTextureTransparent(v1, v18, v25);
   if ( !dword_506540 )
@@ -13826,8 +13826,8 @@
     if ( dword_506568 )
     {
       pRenderer->DrawTextureTransparent(
-        pViewport->uViewportX + 408,
-        pViewport->uViewportY + 113,
+        pViewport->uViewportTL_X + 408,
+        pViewport->uViewportTL_Y + 113,
         pTexture_506390);
       v2 = 1;
       goto LABEL_16;
@@ -13845,7 +13845,7 @@
   pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
 LABEL_15:
   dword_506568 = 0;
-  pRenderer->DrawTextureTransparent(pViewport->uViewportX + 398, pViewport->uViewportY + 113, pTexture_506394);
+  pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394);
 LABEL_16:
   if ( dword_50653C )
   {
@@ -13860,15 +13860,15 @@
     if ( dword_506568 != v2 )
     {
       v26 = pTexture_506388;
-      v19 = pViewport->uViewportY + 150;
-      v3 = pViewport->uViewportX + 408;
+      v19 = pViewport->uViewportTL_Y + 150;
+      v3 = pViewport->uViewportTL_X + 408;
       goto LABEL_22;
     }
   }
   v26 = pTexture_50638C;
   dword_506568 = v2;
-  v19 = pViewport->uViewportY + 150;
-  v3 = pViewport->uViewportX + 399;
+  v19 = pViewport->uViewportTL_Y + 150;
+  v3 = pViewport->uViewportTL_X + 399;
 LABEL_22:
   pRenderer->DrawTextureTransparent(v3, v19, v26);
   if ( dword_506538 )
@@ -13884,15 +13884,15 @@
     if ( dword_506568 != 2 )
     {
       v27 = pTexture_506380;
-      v20 = pViewport->uViewportY + 188;
-      v4 = pViewport->uViewportX + 408;
+      v20 = pViewport->uViewportTL_Y + 188;
+      v4 = pViewport->uViewportTL_X + 408;
       goto LABEL_28;
     }
   }
   v27 = pTexture_506384;
   dword_506568 = 2;
-  v20 = pViewport->uViewportY + 188;
-  v4 = pViewport->uViewportX + 397;
+  v20 = pViewport->uViewportTL_Y + 188;
+  v4 = pViewport->uViewportTL_X + 397;
 LABEL_28:
   pRenderer->DrawTextureTransparent(v4, v20, v27);
   if ( dword_506534 )
@@ -13908,15 +13908,15 @@
     if ( dword_506568 != 3 )
     {
       v28 = pTexture_506378;
-      v21 = pViewport->uViewportY + 226;
-      v5 = pViewport->uViewportX + 408;
+      v21 = pViewport->uViewportTL_Y + 226;
+      v5 = pViewport->uViewportTL_X + 408;
       goto LABEL_34;
     }
   }
   v28 = pTexture_50637C;
   dword_506568 = 3;
-  v21 = pViewport->uViewportY + 226;
-  v5 = pViewport->uViewportX + 397;
+  v21 = pViewport->uViewportTL_Y + 226;
+  v5 = pViewport->uViewportTL_X + 397;
 LABEL_34:
   pRenderer->DrawTextureTransparent(v5, v21, v28);
   if ( dword_506530 )
@@ -13932,15 +13932,15 @@
     if ( dword_506568 != 4 )
     {
       v29 = pTexture_506370;
-      v22 = pViewport->uViewportY + 263;
-      v6 = pViewport->uViewportX + 408;
+      v22 = pViewport->uViewportTL_Y + 263;
+      v6 = pViewport->uViewportTL_X + 408;
       goto LABEL_40;
     }
   }
   v29 = pTexture_506374;
   dword_506568 = 4;
-  v22 = pViewport->uViewportY + 264;
-  v6 = pViewport->uViewportX + 397;
+  v22 = pViewport->uViewportTL_Y + 264;
+  v6 = pViewport->uViewportTL_X + 397;
 LABEL_40:
   pRenderer->DrawTextureTransparent(v6, v22, v29);
   if ( dword_50652C )
@@ -13956,15 +13956,15 @@
     if ( dword_506568 != 5 )
     {
       v30 = pTexture_506368;
-      v23 = pViewport->uViewportY + 302;
-      v7 = pViewport->uViewportX + 408;
+      v23 = pViewport->uViewportTL_Y + 302;
+      v7 = pViewport->uViewportTL_X + 408;
       goto LABEL_46;
     }
   }
   v30 = pTexture_50636C;
   dword_506568 = 5;
-  v23 = pViewport->uViewportY + 302;
-  v7 = pViewport->uViewportX + 397;
+  v23 = pViewport->uViewportTL_Y + 302;
+  v7 = pViewport->uViewportTL_X + 397;
 LABEL_46:
   pRenderer->DrawTextureTransparent(v7, v23, v30);
   a1.uFrameWidth = 460;
@@ -14073,89 +14073,89 @@
   GUIWindow map_window; // [sp+84h] [bp-54h]@35
   unsigned int textrX, textrY;
 
-  pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pSpellBookPagesTextr_12);
+  pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12);
   if ( dword_506548 || viewparams->field_2C / 128 >= 12 )
   {
     buttnTxtr = pTex_tab_an_6a__zoom_off;
-    textrY = pViewport->uViewportY + 2;
-    textrX = pViewport->uViewportX + 408;
+    textrY = pViewport->uViewportTL_Y + 2;
+    textrX = pViewport->uViewportTL_X + 408;
   }
   else
   {
     buttnTxtr = pTex_tab_an_6b__zoom_on;
-    textrY = pViewport->uViewportY + 1;
-    textrX = pViewport->uViewportX + 398;
+    textrY = pViewport->uViewportTL_Y + 1;
+    textrX = pViewport->uViewportTL_X + 398;
   }
   pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
   if ( dword_506544 || viewparams->field_2C / 128 <= 3 )
   {
     buttnTxtr = pTex_tab_an_7a__zoot_off;
-    textrY = pViewport->uViewportY + 38;
-    textrX = pViewport->uViewportX + 408;
+    textrY = pViewport->uViewportTL_Y + 38;
+    textrX = pViewport->uViewportTL_X + 408;
   }
   else
   {
     buttnTxtr = pTex_tab_an_7b__zoot_on;
-    textrY = pViewport->uViewportY + 38;
-    textrX = pViewport->uViewportX + 398;
+    textrY = pViewport->uViewportTL_Y + 38;
+    textrX = pViewport->uViewportTL_X + 398;
   }
   pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
   if ( dword_506540 )
   {
     buttnTxtr = pTexture_506390;
-    textrY = pViewport->uViewportY + 113;
-    textrX = pViewport->uViewportX + 408;
+    textrY = pViewport->uViewportTL_Y + 113;
+    textrX = pViewport->uViewportTL_X + 408;
   }
   else
   {
     buttnTxtr = pTexture_506394;
-    textrY = pViewport->uViewportY + 113;
-    textrX = pViewport->uViewportX + 398;
+    textrY = pViewport->uViewportTL_Y + 113;
+    textrX = pViewport->uViewportTL_X + 398;
   }
   pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
   if ( dword_50653C )
   {
     buttnTxtr = pTexture_506388;
-    textrY = pViewport->uViewportX + 150;
-    textrX = pViewport->uViewportY + 408;
+    textrY = pViewport->uViewportTL_X + 150;
+    textrX = pViewport->uViewportTL_Y + 408;
   }
   else
   {
     buttnTxtr = pTexture_50638C;
-    textrY = pViewport->uViewportX + 150;
-    textrX = pViewport->uViewportY + 399;
+    textrY = pViewport->uViewportTL_X + 150;
+    textrX = pViewport->uViewportTL_Y + 399;
   }
   pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
   if ( dword_506538 )
   {
     buttnTxtr = pTexture_506380;
-    textrY = pViewport->uViewportY + 188;
-    textrX = pViewport->uViewportX + 408;
+    textrY = pViewport->uViewportTL_Y + 188;
+    textrX = pViewport->uViewportTL_X + 408;
   }
   else
   {
     buttnTxtr = pTexture_506384;
-    textrY = pViewport->uViewportY + 188;
-    textrX = pViewport->uViewportX + 397;
+    textrY = pViewport->uViewportTL_Y + 188;
+    textrX = pViewport->uViewportTL_X + 397;
   }
   pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
   if ( dword_506534 )
   {
     buttnTxtr = pTexture_506378;
-    textrY = pViewport->uViewportY + 226;
-    textrX = pViewport->uViewportX + 408;
+    textrY = pViewport->uViewportTL_Y + 226;
+    textrX = pViewport->uViewportTL_X + 408;
   }
   else
   {
     buttnTxtr = pTexture_50637C;
-    textrY = pViewport->uViewportY + 226;
-    textrX = pViewport->uViewportX + 397;
+    textrY = pViewport->uViewportTL_Y + 226;
+    textrX = pViewport->uViewportTL_X + 397;
   }
   pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
   if ( dword_506544 )
-    viewparams->_443291();
+    viewparams->CenterOnParty2();
   if ( dword_506548 )
-    viewparams->_443249();
+    viewparams->CenterOnParty();
   if ( dword_506540 )
     viewparams->_443219();
   if ( dword_50653C )
@@ -14253,7 +14253,7 @@
   v0 = pParty->uCurrentHour;
   v6 = pMapStats->GetMapInfo(pCurrentMapName);
   a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x4Bu, 0x4Bu, 0x4Bu);
-  pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pSpellBookPagesTextr_13);
+  pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13);
   v7 = (unsigned __int8)pDayMoonPhase[pParty->uDaysPlayed];
   if ( (signed int)v0 <= 12 )
   {
@@ -15053,8 +15053,8 @@
 		case WINDOW_3:
 			{
 			pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0);//pWindowType == 3 (0x3)
-			pY = pViewport->uViewportY;
-			pX = pViewport->uViewportX;
+			pY = pViewport->uViewportTL_Y;
+			pX = pViewport->uViewportTL_X;
 			pRenderer->DrawTextureIndexed(pX, pY, pTexture);
 			viewparams->bRedrawGameUI = 1;
 			break;
@@ -15959,7 +15959,7 @@
 		if (GetCurrentMenuID() > 0)
 			break;
 
-		if ( (signed int)pY > (signed int)pViewport->uViewportW )
+		if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y )
 		{
 			pWindow.ptr_1C = (void *)((signed int)pX / 118);
 			if ( (signed int)pX / 118 < 4 )
@@ -15973,7 +15973,7 @@
 				pWindow.DrawQuickCharRecord();
 			}
 		}
-		else if ( (signed int)pX > (signed int)pViewport->uViewportZ )
+		else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X )
 		{
 			if ( (signed int)pY >= 130 )
 			{
@@ -16061,10 +16061,10 @@
     case SCREEN_BOOKS:
 		{
         if ( !dword_506364
-          || (signed int)pX < (signed int)pViewport->uViewportX
-          || (signed int)pX > (signed int)pViewport->uViewportZ
-          || (signed int)pY < (signed int)pViewport->uViewportY
-          || (signed int)pY > (signed int)pViewport->uViewportW
+          || (signed int)pX < (signed int)pViewport->uViewportTL_X
+          || (signed int)pX > (signed int)pViewport->uViewportBR_X
+          || (signed int)pY < (signed int)pViewport->uViewportTL_Y
+          || (signed int)pY > (signed int)pViewport->uViewportBR_Y
           || (v2 = (char *)sub_444564(), (pWindow.Hint = v2) == 0) )
           break;
         v30 = (double)(pFontArrus->GetLineWidth(v2) + 32);
@@ -16255,8 +16255,8 @@
   v4 = GetCurrentMenuID();
   x = pX;
   if ( (v4 & 0x80000000u) == 0
-    || (signed int)pX < (signed int)pViewport->uViewportX
-    || (signed int)pX > (signed int)pViewport->uViewportZ )
+    || (signed int)pX < (signed int)pViewport->uViewportTL_X
+    || (signed int)pX > (signed int)pViewport->uViewportBR_X )
   {
     y = pY;
 LABEL_30:
@@ -16311,7 +16311,7 @@
     goto LABEL_45;
   }
   y = pY;
-  if ( (signed int)pY < (signed int)pViewport->uViewportY || (signed int)pY > (signed int)pViewport->uViewportW )
+  if ( (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y )
     goto LABEL_30;
   if ( pRenderer->pRenderD3D )
     v5 = pGame->pVisInstance->get_picked_object_zbuf_val();