diff Indoor.cpp @ 1640:afc1c3514dd5

Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
author Nomad
date Tue, 17 Sep 2013 17:40:59 +0200
parents ccde94f02b75
children 466c5e15f524
line wrap: on
line diff
--- a/Indoor.cpp	Tue Sep 17 15:40:36 2013 +0200
+++ b/Indoor.cpp	Tue Sep 17 17:40:59 2013 +0200
@@ -112,7 +112,6 @@
   pMobileLightsStack->uNumLightsActive = 0;
   //uNumMobileLightsApplied = 0;
   uNumDecorationsDrawnThisFrame = 0;
-  _unused000 = 0;
   uNumSpritesDrawnThisFrame = 0;
   uNumBillboardsToDraw = 0;
 
@@ -126,9 +125,9 @@
     //LOBYTE(v1) = byte_4E94D0;
     //v4 = pParty->flt_TorchlightColorR + 6.7553994e15;
     //v3 = pParty->flt_TorchlightColorG + 6.7553994e15;
-    pMobileLightsStack->AddLight(pBLVRenderParams->vPartyPos.x,
-                                 pBLVRenderParams->vPartyPos.y,
-                                 pBLVRenderParams->vPartyPos.z,
+    pMobileLightsStack->AddLight(pGame->pIndoorCameraD3D->vPartyPos.x,
+                                 pGame->pIndoorCameraD3D->vPartyPos.y,
+                                 pGame->pIndoorCameraD3D->vPartyPos.z,
                                  pBLVRenderParams->uPartySectorID,
                                  v5,
                                  floorf(pParty->flt_TorchlightColorR + 0.5f),
@@ -167,9 +166,9 @@
 int BLVRenderParams::Reset(IndoorLocation_drawstru *a2)
 {
   IndoorLocation_drawstru *v2; // ebx@1
-  int v4; // ST08_4@1
-  int v5; // ST04_4@1
-  int v6; // ST00_4@1
+  //int v4; // ST08_4@1
+  //int v5; // ST04_4@1
+  //int v6; // ST00_4@1
   int v7; // eax@1
   int v8; // ST08_4@2
   int v9; // ST04_4@2
@@ -197,35 +196,38 @@
   v2 = a2;
   this->field_0_timer_ = a2->field_0_timer;
   this->uFlags = a2->uFlags;
-  this->vPartyPos.x = a2->vPosition.x;
-  this->vPartyPos.y = a2->vPosition.y;
-  this->vPartyPos.z = a2->vPosition.z;
-  v4 = this->vPartyPos.z;
-  v5 = this->vPartyPos.y;
-  this->sPartyRotY = a2->sRotationY;
-  v6 = this->vPartyPos.x;
-  this->sPartyRotX = a2->sRotationX;
-  v7 = pIndoor->GetSector(v6, v5, v4);
+  //this->vPartyPos.x = a2->vPosition.x;
+  //this->vPartyPos.y = a2->vPosition.y;
+  //this->vPartyPos.z = a2->vPosition.z;
+  //v4 = this->vPartyPos.z;
+  //v5 = this->vPartyPos.y;
+  //this->sPartyRotY = a2->sRotationY;
+  //v6 = this->vPartyPos.x;
+  //this->sPartyRotX = a2->sRotationX;
+  v7 = pIndoor->GetSector(pGame->pIndoorCameraD3D->vPartyPos.x,
+                          pGame->pIndoorCameraD3D->vPartyPos.y,
+                          pGame->pIndoorCameraD3D->vPartyPos.z);
   this->uPartySectorID = v7;
   if ( !v7 )
   {
-    v8 = this->vPartyPos.z;
+    __debugbreak(); // shouldnt happen, please provide savegame
+    /*v8 = this->vPartyPos.z;
     this->vPartyPos.x = pParty->vPosition.x;
     v9 = pParty->vPosition.y;
     v10 = this->vPartyPos.x;
-    this->vPartyPos.y = pParty->vPosition.y;
+    this->vPartyPos.y = pParty->vPosition.y;*/
     this->uPartySectorID = pIndoor->GetSector(v10, v9, v8);
   }
   if ( pRenderer->pRenderD3D )
   {
-    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->sCosineY = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY);
+    this->sSineY = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY);
+    this->sCosineNegX = stru_5C6E00->Cos(-pGame->pIndoorCameraD3D->sRotationX);
+    this->sSineNegX = stru_5C6E00->Sin(-pGame->pIndoorCameraD3D->sRotationX);
+    this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125);
+    this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125);
+    this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125);
+    this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125);
     this->field_64 = a2->field_3C;
     v11 = this->uViewportW;
     v12 = this->uViewportX;
@@ -240,7 +242,8 @@
   }
   else
   {
-    this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY);
+    __debugbreak(); // no sw
+    /*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);
@@ -263,7 +266,7 @@
     v29 = v25;
     v26 = this->field_64;
     this->uViewportCenterX = (signed int)(v24 + v23) >> 1;
-    this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);
+    this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);*/
   }
   v27 = (unsigned int)(signed __int64)((double)this->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329)
                                      + 0.5) << 16;
@@ -699,16 +702,16 @@
   if (nodes[node_id].uFaceID == uFaceID)
     return;
   if (!node_id &&
-      pBLVRenderParams->vPartyPos.x >= pFace->pBounding.x1 - 16 &&  // we are probably standing at the portal plane
-      pBLVRenderParams->vPartyPos.x <= pFace->pBounding.x2 + 16 &&
-      pBLVRenderParams->vPartyPos.y >= pFace->pBounding.y1 - 16 &&
-      pBLVRenderParams->vPartyPos.y <= pFace->pBounding.y2 + 16 &&
-      pBLVRenderParams->vPartyPos.z >= pFace->pBounding.z1 - 16 &&
-      pBLVRenderParams->vPartyPos.z <= pFace->pBounding.z2 + 16 )
+      pGame->pIndoorCameraD3D->vPartyPos.x >= pFace->pBounding.x1 - 16 &&  // we are probably standing at the portal plane
+      pGame->pIndoorCameraD3D->vPartyPos.x <= pFace->pBounding.x2 + 16 &&
+      pGame->pIndoorCameraD3D->vPartyPos.y >= pFace->pBounding.y1 - 16 &&
+      pGame->pIndoorCameraD3D->vPartyPos.y <= pFace->pBounding.y2 + 16 &&
+      pGame->pIndoorCameraD3D->vPartyPos.z >= pFace->pBounding.z1 - 16 &&
+      pGame->pIndoorCameraD3D->vPartyPos.z <= pFace->pBounding.z2 + 16 )
   {
-    if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
-                                        + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
-                                        + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane
+    if ( abs(pFace->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
+                                        + pGame->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
+                                        + pGame->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane
     {
       pTransitionSector = pFace->uSectorID;
       if ( nodes[0].uSectorID == pTransitionSector )  // draw back sector
@@ -726,9 +729,9 @@
     }
   }
 
-  v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x)
-     + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y)
-     + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z);
+  v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pGame->pIndoorCameraD3D->vPartyPos.x)
+     + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pGame->pIndoorCameraD3D->vPartyPos.y)
+     + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pGame->pIndoorCameraD3D->vPartyPos.z);
   if (nodes[node_id].uSectorID != pFace->uSectorID)
     v9 = -v9;
   if (v9 >= 0)
@@ -843,16 +846,16 @@
     if ( uFaceID == *((short *)v5 + 2982) )
       return;
     if (!node_id
-      && pBLVRenderParams->vPartyPos.x >= v4->pBounding.x1 - 16
-      && pBLVRenderParams->vPartyPos.x <= v4->pBounding.x2 + 16
-      && pBLVRenderParams->vPartyPos.y >= v4->pBounding.y1 - 16
-      && pBLVRenderParams->vPartyPos.y <= v4->pBounding.y2 + 16
-      && pBLVRenderParams->vPartyPos.z >= v4->pBounding.z1 - 16
-      && pBLVRenderParams->vPartyPos.z <= v4->pBounding.z2 + 16 )
+      && pGame->pIndoorCameraD3D->vPartyPos.x >= v4->pBounding.x1 - 16
+      && pGame->pIndoorCameraD3D->vPartyPos.x <= v4->pBounding.x2 + 16
+      && pGame->pIndoorCameraD3D->vPartyPos.y >= v4->pBounding.y1 - 16
+      && pGame->pIndoorCameraD3D->vPartyPos.y <= v4->pBounding.y2 + 16
+      && pGame->pIndoorCameraD3D->vPartyPos.z >= v4->pBounding.z1 - 16
+      && pGame->pIndoorCameraD3D->vPartyPos.z <= v4->pBounding.z2 + 16 )
     {
-      if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x
-                                       + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y
-                                       + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
+      if ( abs(v4->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * v4->pFacePlane_old.vNormal.x
+                                       + pGame->pIndoorCameraD3D->vPartyPos.y * v4->pFacePlane_old.vNormal.y
+                                       + pGame->pIndoorCameraD3D->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
       {
         v6 = v21->uSectorID;
         if ( v3->nodes[0].uSectorID == v6 )
@@ -875,9 +878,9 @@
       v5 = v20;
     }
     v8 = &pIndoor->pVertices[*v4->pVertexIDs];
-    v9 = v4->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x)
-       + v4->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y)
-       + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z);
+    v9 = v4->pFacePlane_old.vNormal.x * (v8->x - pGame->pIndoorCameraD3D->vPartyPos.x)
+       + v4->pFacePlane_old.vNormal.y * (v8->y - pGame->pIndoorCameraD3D->vPartyPos.y)
+       + v4->pFacePlane_old.vNormal.z * (v8->z - pGame->pIndoorCameraD3D->vPartyPos.z);
     if ( *((short *)v5 + 2004) != v4->uSectorID )
       v9 = -v9;
     if ( v9 < 0 )
@@ -4498,7 +4501,7 @@
     a2 = p->vPosition.y;
     a1a = p->vPosition.x;
     a3 = p->vPosition.z;
-    v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y);
+    v4 = stru_5C6E00->Atan2(a1a - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y);
     LOWORD(v0) = p->uYawAngle;
     v5 = p->uCurrentActionAnimation;
     v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7;
@@ -4565,7 +4568,7 @@
       if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors )
         goto _continue;
     }
-    if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1)
+    if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1a, a2, a3, &x, &y, &z, 1)
       || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) )
       continue;
     pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6);
@@ -4712,8 +4715,8 @@
             v24 = v4;
             v30 = v4->uFlags;
             a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier;
-            v6 = stru_5C6E00->Atan2(p->vPosition.x - pBLVRenderParams->vPartyPos.x,
-                                    p->vPosition.y - pBLVRenderParams->vPartyPos.y);
+            v6 = stru_5C6E00->Atan2(p->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x,
+                                    p->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
             LOWORD(v7) = p->uFacing;
             v8 = v30;
             v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7;
@@ -4748,7 +4751,7 @@
                 v1->uParticleTrailColorB,
                 byte_4E94D3);
             }
-            if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(
+            if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(
                    a1,
                    a2,
                    a3,
@@ -4862,8 +4865,10 @@
     pSector = &pIndoor->pSectors[node->uSectorID];
     pNode = &pIndoor->pNodes[uFirstNode];
     pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]];
-    v5 = pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
-       + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation
+    v5 = pFace->pFacePlane_old.dist +
+         pGame->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x +
+         pGame->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y +
+         pGame->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation
     if (pFace->Portal() && pFace->uSectorID != node->uSectorID )
       v5 = -v5;
     //v11 = v5 > 0;
@@ -4972,7 +4977,7 @@
         a3 = v7;
         v8 = v2->field_10_y_rot
            + ((signed int)stru_5C6E00->uIntegerPi >> 3)
-           - stru_5C6E00->Atan2(v6 - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y);
+           - stru_5C6E00->Atan2(v6 - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y);
         v37 = pBLVRenderParams->field_0_timer_;
         v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7;
         if (pParty->bTurnBasedModeOn)
@@ -4990,7 +4995,7 @@
           LOBYTE(v30) = v30 | 0x80;
         if ( (256 << v9) & v13 )
           v30 |= 4u;
-        if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1, a2, a3, &x, &y, &z, 1) )
+        if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1, a2, a3, &x, &y, &z, 1) )
         {
           v14 = abs(x);
           if ( v14 >= abs(y) )
@@ -5133,30 +5138,30 @@
   //int v30; // [sp+30h] [bp+8h]@10
   //int v31; // [sp+3Ch] [bp+14h]@10
 
-  v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY);
-  v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY);
-  v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX);
-  v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX);
+  v8 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY);
+  v29 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY);
+  v28 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX);
+  v9 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX);
   //v11 = -pBLVRenderParams->vPartyPos.y;
   //v26 = -pBLVRenderParams->vPartyPos.x;
   //v27 = v9;
   //v12 = -pBLVRenderParams->vPartyPos.z;
-  if ( pBLVRenderParams->sPartyRotX )
+  if (pGame->pIndoorCameraD3D->sRotationX)
   {
-    v16 = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y;
-    v17 = -65536 * pBLVRenderParams->vPartyPos.z;
-    this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pBLVRenderParams->vPartyPos.z) << 16, v9);
-    this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x;
+    v16 = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y;
+    v17 = -65536 * pGame->pIndoorCameraD3D->vPartyPos.z;
+    this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v9);
+    this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x;
     this->field_8_party_dir_z = fixpoint_sub0(v17, v28) - fixpoint_sub0(v16, v9);
   }
   else
   {
-    this->field_0_party_dir_x = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y;
-    this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x;
-    this->field_8_party_dir_z = (-pBLVRenderParams->vPartyPos.z) << 16;
+    this->field_0_party_dir_x = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y;
+    this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x;
+    this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
   }
 
-  if (pBLVRenderParams->sPartyRotX)
+  if (pGame->pIndoorCameraD3D->sRotationX)
   {
     v19 = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29);
 
@@ -5171,7 +5176,7 @@
     this->field_14 = a4;
   }
 
-  if (pBLVRenderParams->sPartyRotX)
+  if (pGame->pIndoorCameraD3D->sRotationX)
   {
     v21 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29);
 
@@ -6463,9 +6468,9 @@
   memset(&PortalFace, 0, sizeof(stru367));
 
   //get direction the face(определение направленности фейса)*********************************************************************************
-  if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x)
-     + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y)
-     + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 )
+  if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pGame->pIndoorCameraD3D->vPartyPos.x)
+     + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pGame->pIndoorCameraD3D->vPartyPos.y)
+     + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pGame->pIndoorCameraD3D->vPartyPos.z) < 0 )
   {
     PortalFace.direction = true;
   }
@@ -6498,7 +6503,7 @@
   {
     for (uint i = 0; i < pFace->uNumVertices; ++i)
     {
-      pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(pIndoor->pVertices[pFace->pVertexIDs[i]].x,
+      pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pIndoor->pVertices[pFace->pVertexIDs[i]].x,
                                                                      pIndoor->pVertices[pFace->pVertexIDs[i]].y,
                                                                      pIndoor->pVertices[pFace->pVertexIDs[i]].z,
         &PortalFace._view_transformed_z[i + 3], &PortalFace._view_transformed_x[i + 3], &PortalFace._view_transformed_y[i + 3], 0);
@@ -6866,21 +6871,21 @@
   float v13; // [sp+Ch] [bp-4h]@2
   float v14; // [sp+Ch] [bp-4h]@6
 
-  if ( pBLVRenderParams->sPartyRotX )
+  if (pGame->pIndoorCameraD3D->sRotationX)
   {
     v13 = a1->vWorldPosition.x - (double)pParty->vPosition.x;
     v11 = a1->vWorldPosition.y - (double)pParty->vPosition.y;
     v4 = a1->vWorldPosition.z - (double)pParty->vPosition.z;
-    if ( pRenderer->pRenderD3D )
-    {
+    //if ( pRenderer->pRenderD3D )
+    //{
       v5 = v11 * pBLVRenderParams->fSineY + v13 * pBLVRenderParams->fCosineY;
       a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY - v11 * pBLVRenderParams->fCosineY;
-    }
+    /*}
     else
     {
       v5 = v13 * pBLVRenderParams->fCosineY - v11 * pBLVRenderParams->fSineY;
       a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY + v11 * pBLVRenderParams->fCosineY;
-    }
+    }*/
     a1->vWorldViewPosition.x = v5 * pBLVRenderParams->fCosineNegX - v4 * pBLVRenderParams->fSineNegX;
     a1->vWorldViewPosition.z = v5 * pBLVRenderParams->fSineNegX + v4 * pBLVRenderParams->fCosineNegX;
   }
@@ -6889,16 +6894,16 @@
     v14 = a1->vWorldPosition.x - (double)pParty->vPosition.x;
     v12 = a1->vWorldPosition.y - (double)pParty->vPosition.y;
     a1->vWorldViewPosition.z = a1->vWorldPosition.z - (double)pParty->vPosition.z;
-    if ( pRenderer->pRenderD3D )
-    {
+    //if ( pRenderer->pRenderD3D )
+    //{
       a1->vWorldViewPosition.x = v12 * pBLVRenderParams->fSineY + v14 * pBLVRenderParams->fCosineY;
       a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY - v12 * pBLVRenderParams->fCosineY;
-    }
+    /*}
     else
     {
       a1->vWorldViewPosition.x = v14 * pBLVRenderParams->fCosineY - v12 * pBLVRenderParams->fSineY;
       a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY + v12 * pBLVRenderParams->fCosineY;
-    }
+    }*/
   }
   return 0;
 }
\ No newline at end of file