diff mm7_2.cpp @ 692:066e2b29b30f

viewport.cpp added
author Gloval
date Sat, 16 Mar 2013 21:57:32 +0400
parents 551f74425b17
children e0a1fccc89b1
line wrap: on
line diff
--- a/mm7_2.cpp	Sat Mar 16 14:33:23 2013 +0200
+++ b/mm7_2.cpp	Sat Mar 16 21:57:32 2013 +0400
@@ -2884,87 +2884,6 @@
 }
 
 
-//----- (004C0262) --------------------------------------------------------
-void Viewport::SetScreen(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW)
-{
-  unsigned int x; // edx@1
-  unsigned int z; // esi@1
-  unsigned int y; // edi@3
-  unsigned int w; // eax@3
-  char no_3d; // zf@5
-  int v10; // eax@7
-
-  x = uX;
-  z = uZ;
-  if ( (signed int)uX > (signed int)uZ )
-  {
-    z = uZ ^ uX ^ uZ;                           // swap x and z
-    x = z ^ uZ ^ uX;
-  }
-  y = uY;
-  w = uW;
-  if ( (signed int)uY > (signed int)uW )
-  {
-    w = uW ^ uY ^ uW;                           // swap y and w
-    y = w ^ uW ^ uY;
-  }
-  this->uScreenX = x;
-  this->uScreenY = y;
-  this->uScreenZ = z;
-  this->uScreenW = w;
-  no_3d = pRenderer->pRenderD3D == 0;
-  this->uScreenWidth = z - x + 1;
-  this->uScreenCenterX = (signed int)(z + x) >> 1;
-  if ( no_3d )
-  {
-    v10 = w - y + 1;
-    this->uScreenHeight = v10;
-    this->uScreenCenterY = this->uScreenW - ((unsigned __int64)(this->field_30 * (signed __int64)v10) >> 16);
-  }
-  else
-  {
-    this->uScreenHeight = w - y + 1;
-    this->uScreenCenterY = (signed int)(w + y) >> 1;
-  }
-  SetViewport(this->uScreenX, this->uScreenY, this->uScreenZ, this->uScreenW);
-}
-
-//----- (004C02F8) --------------------------------------------------------
-void Viewport::_4C02F8(int a2)
-{
-  unsigned int v2; // ST0C_4@1
-
-  v2 = this->uScreenW;
-  this->field_30 = a2;
-  SetScreen(this->uScreenX, this->uScreenY, this->uScreenZ, v2);
-}
-
-//----- (004C0312) --------------------------------------------------------
-void Viewport::SetViewport(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW)
-{
-  unsigned int x; // ebx@1
-  unsigned int y; // edi@3
-  unsigned int z; // edx@5
-  unsigned int w; // eax@7
-
-  x = uX;
-  if ( (signed int)uX < (signed int)this->uScreenX )
-    x = this->uScreenX;
-  y = uY;
-  if ( (signed int)uY < (signed int)this->uScreenY )
-    y = this->uScreenY;
-  z = uZ;
-  if ( (signed int)uZ > (signed int)this->uScreenZ )
-    z = this->uScreenZ;
-  w = uW;
-  if ( (signed int)uW > (signed int)this->uScreenW )
-    w = this->uScreenW;
-  this->uViewportY = y;
-  this->uViewportX = x;
-  this->uViewportZ = z;
-  this->uViewportW = w;
-}
-
 
 
 
@@ -9834,8 +9753,8 @@
   pIndoorCamera = new IndoorCamera;
   pIndoorCamera->Initialize(
     65,
-    viewparams->uScreenZ - viewparams->uScreenX + 1,
-    viewparams->uScreenW - viewparams->uScreenY + 1);
+    viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1,
+    viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1);
 
   InitializeTurnBasedAnimations(&stru_50C198);
   pBitmaps_LOD->dword_11B84 = pBitmaps_LOD->uNumLoadedFiles;
@@ -11196,10 +11115,10 @@
   //_getcwd(v5, 120);
   //sprintfex(pIniFilename, "%s\\mm6.ini", v5);
   viewparams = new ViewingParams;
-  viewparams->uScreenX = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename);
-  viewparams->uScreenY = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename);
-  viewparams->uScreenZ = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename);
-  viewparams->uScreenW = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename);
+  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);
 
 
   pAudioPlayer = new AudioPlayer;
@@ -11352,12 +11271,12 @@
     LOBYTE(viewparams->field_20) = 0;
   }
   pParty->uFlags |= 2u;
-  viewparams->uSomeY = viewparams->uScreenY;
-  viewparams->uSomeX = viewparams->uScreenX;
-  viewparams->uSomeZ = viewparams->uScreenZ;
-  viewparams->uSomeW = viewparams->uScreenW;
-
-  pViewport->SetScreen(viewparams->uScreenX, viewparams->uScreenY, viewparams->uScreenZ, viewparams->uScreenW);
+  viewparams->uSomeY = viewparams->uScreen_topL_Y;
+  viewparams->uSomeX = viewparams->uScreen_topL_X;
+  viewparams->uSomeZ = viewparams->uScreen_BttmR_X;
+  viewparams->uSomeW = viewparams->uScreen_BttmR_Y;
+
+  pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y);
   if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
     pOutdoorCamera->_485F64();
 }
@@ -12685,15 +12604,15 @@
       DoInteractionWithTopmostZObject((unsigned __int16)v1, (signed int)(unsigned __int16)v1 >> 3);
   }
   v22 = 0;
-  v1 = (int *)((signed int)(viewparams->uScreenZ + viewparams->uScreenX) >> 1);
-  if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW )
+  v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1);
+  if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
   {
 	  v2 = (char *)v1 - 50;
 	  v1 = (int *)((char *)v1 + 50);
-	  v3 = 640 * viewparams->uScreenY;
+	  v3 = 640 * viewparams->uScreen_topL_Y;
 	  v17 = v2;
 	  v20 = v1;
-	  v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1;
+	  v18 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1;
 	  do
 	  {
 		if ( (signed int)v2 < (signed int)v20 )
@@ -12979,12 +12898,12 @@
   else
   {
     v16 = 0;
-    v4 = viewparams->uScreenX;
-    v12 = viewparams->uScreenZ;
-    if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW )
-    {
-      v15 = &pRenderer->pActiveZBuffer[viewparams->uScreenX + 640 * viewparams->uScreenY];
-      v13 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1;
+    v4 = viewparams->uScreen_topL_X;
+    v12 = viewparams->uScreen_BttmR_X;
+    if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
+    {
+      v15 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
+      v13 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1;
       do
       {
         if ( (signed int)v4 < (signed int)v12 )
@@ -13225,8 +13144,8 @@
   int v32; // [sp+20h] [bp-4h]@1
 
   v0 = 0;
-  v1 = (signed int)(viewparams->uScreenW + viewparams->uScreenY) >> 1;
-  v2 = (signed int)(viewparams->uScreenX + viewparams->uScreenZ) >> 1;
+  v1 = (signed int)(viewparams->uScreen_BttmR_Y + viewparams->uScreen_topL_Y) >> 1;
+  v2 = (signed int)(viewparams->uScreen_topL_X + viewparams->uScreen_BttmR_X) >> 1;
   v3 = v1 - 50;
   v32 = 0;
   v4 = 100;