diff Indoor.cpp @ 1006:e865f349aa41

ui cleanup
author Gloval
date Sat, 18 May 2013 22:01:26 +0400
parents 0d96349d8c87
children 9ac94d00012e
line wrap: on
line diff
--- a/Indoor.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/Indoor.cpp	Sat May 18 22:01:26 2013 +0400
@@ -69,6 +69,21 @@
 };
 
 
+const char *_4E6BDC_loc_names[11]=
+    {
+    "mdt12.blv",
+    "d18.blv",
+    "mdt14.blv",
+    "d37.blv",
+    "mdk01.blv",
+    "mdt01.blv",
+    "mdr01.blv",
+    "mdt10.blv",
+    "mdt09.blv",
+    "mdt15.blv",
+    "mdt11.blv"
+    };
+
 
 //----- (0043F39E) --------------------------------------------------------
 void __fastcall PrepareDrawLists_BLV(IndoorLocation_drawstru *_this)
@@ -145,7 +160,6 @@
 int BLVRenderParams::Reset(IndoorLocation_drawstru *a2)
 {
   IndoorLocation_drawstru *v2; // ebx@1
-  BLVRenderParams *v3; // esi@1
   int v4; // ST08_4@1
   int v5; // ST04_4@1
   int v6; // ST00_4@1
@@ -174,7 +188,6 @@
   int v29; // [sp+24h] [bp+8h]@5
 
   v2 = a2;
-  v3 = this;
   this->field_0_timer_ = a2->field_0_timer;
   this->uFlags = a2->uFlags;
   this->vPartyPos.x = a2->vPosition.x;
@@ -186,82 +199,82 @@
   v6 = this->vPartyPos.x;
   this->sPartyRotX = a2->sRotationX;
   v7 = pIndoor->GetSector(v6, v5, v4);
-  v3->uPartySectorID = v7;
+  this->uPartySectorID = v7;
   if ( !v7 )
   {
-    v8 = v3->vPartyPos.z;
-    v3->vPartyPos.x = pParty->vPosition.x;
+    v8 = this->vPartyPos.z;
+    this->vPartyPos.x = pParty->vPosition.x;
     v9 = pParty->vPosition.y;
-    v10 = v3->vPartyPos.x;
-    v3->vPartyPos.y = pParty->vPosition.y;
-    v3->uPartySectorID = pIndoor->GetSector(v10, v9, v8);
+    v10 = this->vPartyPos.x;
+    this->vPartyPos.y = pParty->vPosition.y;
+    this->uPartySectorID = pIndoor->GetSector(v10, v9, v8);
   }
   if ( pRenderer->pRenderD3D )
   {
-    v3->sCosineY = stru_5C6E00->Cos(v3->sPartyRotY);
-    v3->sSineY = stru_5C6E00->Sin(v3->sPartyRotY);
-    v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX);
-    v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX);
-    v3->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125);
-    v3->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125);
-    v3->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125);
-    v3->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125);
-    v3->field_64 = a2->field_3C;
-    v11 = v3->uViewportW;
-    v12 = v3->uViewportX;
-    v13 = v3->uViewportZ - v12;
-    v14 = v3->uViewportZ + v12;
-    v3->field_70 = v13 + 1;
-    v15 = v3->uViewportY;
-    v3->uViewportHeight = v11 - v15 + 1;
-    v16 = v3->uViewportW;
-    v3->uViewportCenterX = v14 >> 1;
-    v3->uViewportCenterY = (signed int)(v16 + v15) >> 1;
+    this->sCosineY = stru_5C6E00->Cos(this->sPartyRotY);
+    this->sSineY = stru_5C6E00->Sin(this->sPartyRotY);
+    this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX);
+    this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX);
+    this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125);
+    this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125);
+    this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125);
+    this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125);
+    this->field_64 = a2->field_3C;
+    v11 = this->uViewportW;
+    v12 = this->uViewportX;
+    v13 = this->uViewportZ - v12;
+    v14 = this->uViewportZ + v12;
+    this->field_70 = v13 + 1;
+    v15 = this->uViewportY;
+    this->uViewportHeight = v11 - v15 + 1;
+    v16 = this->uViewportW;
+    this->uViewportCenterX = v14 >> 1;
+    this->uViewportCenterY = (signed int)(v16 + v15) >> 1;
   }
   else
   {
-    v3->sCosineY = stru_5C6E00->Cos(-v3->sPartyRotY);
-    v3->sSineY = stru_5C6E00->Sin(-v3->sPartyRotY);
-    v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX);
-    v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX);
-    v17 = cos((double)-v3->sPartyRotY * 0.0030664064);
-    v18 = v3->sPartyRotY;
-    v3->fCosineY = v17;
+    this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY);
+    this->sSineY = stru_5C6E00->Sin(-this->sPartyRotY);
+    this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX);
+    this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX);
+    v17 = cos((double)-this->sPartyRotY * 0.0030664064);
+    v18 = this->sPartyRotY;
+    this->fCosineY = v17;
     v19 = sin((double)-v18 * 0.0030664064);
-    v20 = v3->sPartyRotX;
-    v3->fSineY = v19;
+    v20 = this->sPartyRotX;
+    this->fSineY = v19;
     v21 = cos((double)-v20 * 0.0030664064);
-    v22 = v3->sPartyRotX;
-    v3->fCosineNegX = v21;
-    v3->fSineNegX = sin((double)-v22 * 0.0030664064);
-    v23 = v3->uViewportX;
-    v3->field_64 = a2->field_3C;
-    v24 = v3->uViewportZ;
-    v3->field_70 = v3->uViewportZ - v23 + 1;
-    v25 = v3->uViewportW - v3->uViewportY + 1;
-    v3->uViewportHeight = v25;
+    v22 = this->sPartyRotX;
+    this->fCosineNegX = v21;
+    this->fSineNegX = sin((double)-v22 * 0.0030664064);
+    v23 = this->uViewportX;
+    this->field_64 = a2->field_3C;
+    v24 = this->uViewportZ;
+    this->field_70 = this->uViewportZ - v23 + 1;
+    v25 = this->uViewportW - this->uViewportY + 1;
+    this->uViewportHeight = v25;
     v29 = v25;
-    v26 = v3->field_64;
-    v3->uViewportCenterX = (signed int)(v24 + v23) >> 1;
-    v3->uViewportCenterY = v3->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);
+    v26 = this->field_64;
+    this->uViewportCenterX = (signed int)(v24 + v23) >> 1;
+    this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);
   }
-  v27 = (unsigned int)(signed __int64)((double)v3->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329)
+  v27 = (unsigned int)(signed __int64)((double)this->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329)
                                      + 0.5) << 16;
-  v3->field_40 = v27;
-  LODWORD(v3->field_44) = 4294967296i64 / v27;
-  v3->pRenderTarget = v2->pRenderTarget;
-  v3->uTargetWidth = v2->uTargetWidth;
-  v3->uTargetHeight = v2->uTargetHeight;
-  v3->uViewportX = v2->uViewportX;
-  v3->uViewportY = v2->uViewportY;
-  v3->uViewportZ = v2->uViewportZ;
-  v3->uViewportW = v2->uViewportW;
-  v3->pTargetZBuffer = v2->pTargetZ;
+  this->field_40 = v27;
+  this->field_44 = 0x100000000i64 / v27;
+  this->pRenderTarget = v2->pRenderTarget;
+  this->uTargetWidth = v2->uTargetWidth;
+  this->uTargetHeight = v2->uTargetHeight;
+  this->uViewportX = v2->uViewportX;
+  this->uViewportY = v2->uViewportY;
+  this->uViewportZ = v2->uViewportZ;
+  this->uViewportW = v2->uViewportW;
+  this->pTargetZBuffer = v2->pTargetZ;
   result = 0;
-  v3->field_8C = 0;
-  v3->field_84 = 0;
-  v3->uNumFacesRenderedThisFrame = 0;
-  v3->field_88 = 0;
+  this->field_8C = 0;
+  this->field_84 = 0;
+  this->uNumFacesRenderedThisFrame = 0;
+  this->field_88 = 0;
   pBLVRenderParams->field_90 = 64;
   pBLVRenderParams->field_94 = 6;
   return result;
@@ -510,7 +523,8 @@
                      static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa )
       {
         a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel);
-        v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8);
+        v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel))
+            | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8);
         sub_4B0E07(uFaceID);
         pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
         pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
@@ -1638,8 +1652,8 @@
   v1->ptr_0002B0_sector_rdata = 0;
   pAllocator->FreeChunk(v1->ptr_0002B8_sector_lrdata);
   v1->ptr_0002B8_sector_lrdata = 0;
-  pAllocator->FreeChunk(v1->ptr_2AC);
-  v1->ptr_2AC = 0;
+  pAllocator->FreeChunk(v1->pLFaces);
+  v1->pLFaces = 0;
   pAllocator->FreeChunk(v1->pSpawnPoints);
   v3 = v1->pVertices;
   v1->pSpawnPoints = 0;
@@ -2435,30 +2449,30 @@
   pGameLoadingUI_ProgressBar->Progress();
 
   memcpy(pFaces, pData += 4, uNumFaces * sizeof (BLVFace));
-  ptr_2AC = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_2AC, blv.uFaces_fdata_Size, "L.FData");
-
-  memcpy(ptr_2AC, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size);
+  pLFaces = (unsigned __int16 *)pAllocator->AllocNamedChunk(pLFaces, blv.uFaces_fdata_Size, "L.FData");
+
+  memcpy(pLFaces, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size);
 
   for (uint i = 0, j = 0; i < uNumFaces; ++i)
   {
     auto pFace = pFaces + i;
 
-    pFace->pVertexIDs = ptr_2AC + j;
+    pFace->pVertexIDs = pLFaces + j;
     
     j += pFace->uNumVertices + 1;
-    pFace->pXInterceptDisplacements = (short *)(ptr_2AC + j);
+    pFace->pXInterceptDisplacements = (short *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
-    pFace->pYInterceptDisplacements = (short *)(ptr_2AC + j);
+    pFace->pYInterceptDisplacements = (short *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
-    pFace->pZInterceptDisplacements = (short *)(ptr_2AC + j);
+    pFace->pZInterceptDisplacements = (short *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
-    pFace->pVertexUIDs = (__int16 *)(ptr_2AC + j);
+    pFace->pVertexUIDs = (__int16 *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
-    pFace->pVertexVIDs = (__int16 *)(ptr_2AC + j);
+    pFace->pVertexVIDs = (__int16 *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
       /*v93 = &pFaces[v92];