diff mm7_3.cpp @ 87:c0cf9393af64

Слияние
author Ritor1
date Mon, 29 Oct 2012 09:28:08 +0600
parents 8b0c4d626477
children 6c42178c226e 51a5b0dc3f30
line wrap: on
line diff
--- a/mm7_3.cpp	Mon Oct 22 09:20:49 2012 +0600
+++ b/mm7_3.cpp	Mon Oct 29 09:28:08 2012 +0600
@@ -122,7 +122,7 @@
     {
       v9 = &pIndoor->pSectors[v33[result]];
       v10 = 0;
-      v32 = v9->field_4 + v9->field_C + v9->field_14;
+      v32 = v9->uNumFloors + v9->field_C + v9->field_14;
       v26 = 0;
       if ( v32 > 0 )
         break;
@@ -346,7 +346,7 @@
       f.pFacePlane_old.vNormal.z = v4->pFacePlane.vNormal.z;
       v6 = v4->pFacePlane.dist;
       f.pFacePlane_old.dist = v4->pFacePlane.dist;
-      v7 = v4->uFaceAttributes;
+      v7 = v4->uAttributes;
       f.uAttributes = v7;
       f.pBounding.x1 = v4->pBoundingBox.x1;
       f.pBounding.y1 = v4->pBoundingBox.y1;
@@ -518,25 +518,25 @@
 
 
 //----- (0046ED1B) --------------------------------------------------------
-int __fastcall _46ED1B_collide_against_floor(signed int a1, signed int a2, int a3, unsigned int *pSectorID, int *a5)
-{
-  unsigned int *v5; // edi@1
-  int result; // eax@1
-  int v7; // eax@3
-  int v8; // [sp+Ch] [bp-8h]@1
-  int v9; // [sp+10h] [bp-4h]@1
-
-  v5 = pSectorID;
-  v9 = a2;
-  v8 = a1;
-  result = _46CEC3_get_floor_level(a1, a2, a3, *pSectorID, (int *)&pSectorID);
-  if ( result != -30000 && result <= a3 + 50
-    || (v7 = pIndoor->GetSector(v8, v9, a3), (*v5 = v7) != 0)
-    && (result = _46CEC3_get_floor_level(v8, v9, a3, v7, (int *)&pSectorID), result != -30000) )
-    *a5 = (int)pSectorID;
-  else
-    result = -30000;
-  return result;
+int _46ED1B_collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
+{
+  uint uFaceID = -1;
+  int floor_level = _46CEC3_get_floor_level(x, y, z, *pSectorID, &uFaceID);
+
+  if (floor_level != -30000 && floor_level <= z + 50)
+  {
+    *pFaceID = uFaceID;
+    return floor_level;
+  }
+
+  uint uSectorID = pIndoor->GetSector(x, y, z);
+  *pSectorID = uSectorID;
+
+  floor_level = _46CEC3_get_floor_level(x, y, z, uSectorID, &uFaceID);
+  if (uSectorID && floor_level != -30000)
+    *pFaceID = uFaceID;
+  else return -30000;
+  return floor_level;
 }
 
 //----- (0046ED8A) --------------------------------------------------------
@@ -649,21 +649,21 @@
   {
     if ( stru_721530.sMinX >= pParty->vPosition.x - v1 )
     {
-      if ( stru_721530.sMaxY <= pParty->vPosition.z + v1 )
-      {
-        if ( stru_721530.sMinY >= pParty->vPosition.z - v1 )
-        {
-          if ( stru_721530.sMaxZ <= (signed int)(pParty->vPosition.y + pParty->uPartyHeight) )
-          {
-            if ( stru_721530.sMinZ >= pParty->vPosition.y )
+      if ( stru_721530.sMaxY <= pParty->vPosition.y + v1 )
+      {
+        if ( stru_721530.sMinY >= pParty->vPosition.y - v1 )
+        {
+          if ( stru_721530.sMaxZ <= (signed int)(pParty->vPosition.z + pParty->uPartyHeight) )
+          {
+            if ( stru_721530.sMinZ >= pParty->vPosition.z )
             {
               v3 = stru_721530.prolly_normal_d + v1;
               v11 = pParty->vPosition.x - stru_721530.normal.x;
               v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y
-                  - (pParty->vPosition.z - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
-              v10 = pParty->vPosition.z - stru_721530.normal.y;
+                  - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
+              v10 = pParty->vPosition.y - stru_721530.normal.y;
               result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y
-                          - (pParty->vPosition.z - stru_721530.normal.y) * stru_721530.field_58.x) >> 16);
+                          - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16);
               if ( result <= v3 )
               {
                 result = v10 * stru_721530.field_58.y;
@@ -671,11 +671,11 @@
                 if ( v5 > 0 )
                 {
                   v6 = ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v5) >> 16) + stru_721530.normal.z;
-                  result = pParty->vPosition.y;
-                  if ( v6 >= pParty->vPosition.y )
+                  result = pParty->vPosition.z;
+                  if ( v6 >= pParty->vPosition.z )
                   {
-                    result = v9 + pParty->vPosition.y;
-                    if ( v6 <= (signed int)(v9 + pParty->vPosition.y) || v8 )
+                    result = v9 + pParty->vPosition.z;
+                    if ( v6 <= (signed int)(v9 + pParty->vPosition.z) || v8 )
                     {
                       result = sub_452A9E(v3 * v3 - v4 * v4);
                       v7 = v5 - result;
@@ -1011,7 +1011,7 @@
       v72 = 1;
     if ( v0->uAIState == 5 && v76 && !v72 )
     {
-      v0->uAIState = 11;
+      v0->uAIState = Removed;
       goto LABEL_121;
     }
     if ( v0->uCurrentActionAnimation == 1 )
@@ -1114,7 +1114,7 @@
       v0->vVelocity.y += rand() % 100 - 50;
       v0->vVelocity.z += rand() % 100 - 20;
       v25 = rand();
-      v0->uAIState = 8;
+      v0->uAIState = Stunned;
       v0->uYawAngle += v25 % 32 - 16;
       v0->UpdateAnimation();
     }
@@ -1191,7 +1191,7 @@
             else
               v61 = v68 + 60;
             sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61);
-            v0->uAIState = 11;
+            v0->uAIState = Removed;
             return;
           }
         }
@@ -1274,7 +1274,7 @@
         case 6:
           v40 = &pOutdoor->pBModels[v38 >> 9];
           v41 = &v40->pFaces[v39 & 0x3F];
-          if ( !(BYTE3(v41->uFaceAttributes) & 0x20) )
+          if ( !(BYTE3(v41->uAttributes) & 0x20) )
           {
             v42 = v41->uPolygonType;
             if ( v42 == 3 )
@@ -1372,7 +1372,7 @@
           v0->uYawAngle -= 32;
           v0->uCurrentActionTime = 0;
           v0->uCurrentActionLength = 128;
-          v0->uAIState = 7;
+          v0->uAIState = Fleeing;
         }
       }
     }
@@ -1381,10 +1381,6 @@
   }
   while ( (signed int)v75 < (signed int)uNumActors );
 }
-// 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
-// 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
-// 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int);
-// 4F75D8: using guessed type int ai_arrays_size;
 
 
 
@@ -1428,7 +1424,7 @@
   Particle_ Dst; // [sp+Ch] [bp-84h]@18
   unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1
   ObjectDesc *v37; // [sp+78h] [bp-18h]@1
-  int v38; // [sp+7Ch] [bp-14h]@4
+  unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4
   int v39; // [sp+80h] [bp-10h]@33
   int v40; // [sp+84h] [bp-Ch]@28
   int v41; // [sp+88h] [bp-8h]@34
@@ -1442,11 +1438,11 @@
   if ( abs(v3) > 32767
     || abs(v1->vPosition.y) > 32767
     || abs(v1->vPosition.z) > 20000
-    || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v1->uSectorID, &v38),
+    || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v1->uSectorID, &uFaceID),
         v42 <= -30000)
     && ((v4 = pIndoor->GetSector(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z),
          (v1->uSectorID = v4) == 0)
-     || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v4, &v38), v42 == -30000)) )
+     || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v4, &uFaceID), v42 == -30000)) )
   {
     LayingItem::_42F933(uLayingItemID_);
     return;
@@ -1458,7 +1454,7 @@
     v8 = 0;
 LABEL_25:
     stru_721530.field_0 = v8;
-    v38 = v8;
+    uFaceID = v8;
     stru_721530.prolly_normal_d = v2->uRadius;
     v12 = v2->uHeight;
     stru_721530.field_84 = -1;
@@ -1559,7 +1555,7 @@
           v34 = (TEXTURE_TYPE)v8;
           v32 = "effpar03";
         }
-        Dst.field_20 = (unsigned __int8)(v30 & 0x80) + 128;
+        Dst.timeToLive = (unsigned __int8)(v30 & 0x80) + 128;
         Dst.uTextureID = pBitmaps_LOD->LoadTexture(v32, v34);
         goto LABEL_71;
       }
@@ -1660,9 +1656,9 @@
       v1->vVelocity.y = v41;
       v41 = v1->vVelocity.z;
       v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16;
-      ++v38;
-      v28 = __OFSUB__(v38, 100);
-      v27 = v38 - 100 < 0;
+      ++uFaceID;
+      v28 = __OFSUB__(uFaceID, 100);
+      v27 = uFaceID - 100 < 0;
       v1->vVelocity.z = v41;
       if ( !(v27 ^ v28) )
         return;
@@ -1678,7 +1674,7 @@
   {
     v6 = pIndoor->pFaces;
     v1->vPosition.z = v42 + 1;
-    v7 = &v6[v38];
+    v7 = &v6[uFaceID];
     if ( v7->uPolygonType == 3 )
     {
       v8 = 0;
@@ -1691,15 +1687,15 @@
       v8 = 0;
     }
     v42 = v1->vVelocity.x;
-    v38 = 58500;
+    uFaceID = 58500;
     v42 = (unsigned __int64)(58500i64 * v42) >> 16;
     v1->vVelocity.x = v42;
     v42 = v1->vVelocity.y;
-    v42 = (unsigned __int64)(v38 * (signed __int64)v42) >> 16;
-    v38 = 58500;
+    v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16;
+    uFaceID = 58500;
     v1->vVelocity.y = v42;
     v42 = v1->vVelocity.z;
-    v42 = (unsigned __int64)(v38 * (signed __int64)v42) >> 16;
+    v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16;
     v9 = v1->vVelocity.x;
     v1->vVelocity.z = v42;
     if ( v9 * v9 + v1->vVelocity.y * v1->vVelocity.y < 400 )
@@ -1733,7 +1729,7 @@
 LABEL_70:
           Dst.bFree = 512;
           Dst.uDiffuse = rand();
-          Dst.field_20 = 64;
+          Dst.timeToLive = 64;
           Dst.uTextureID = v8;
 LABEL_71:
           Dst.flt_28 = 1.0;
@@ -1746,7 +1742,7 @@
         v33 = (TEXTURE_TYPE)v8;
         v31 = "effpar03";
       }
-      Dst.field_20 = (unsigned __int8)(v11 & 0x80) + 128;
+      Dst.timeToLive = (unsigned __int8)(v11 & 0x80) + 128;
       Dst.uTextureID = pBitmaps_LOD->LoadTexture(v31, v33);
 LABEL_72:
       pGame->pParticleEngine->AddParticle(&Dst);
@@ -1927,7 +1923,7 @@
       {
         Dst.bFree = 512;
         Dst.uDiffuse = rand();
-        Dst.field_20 = 64;
+        Dst.timeToLive = 64;
         Dst.uTextureID = 0;
 LABEL_89:
         Dst.flt_28 = 1.0;
@@ -1941,7 +1937,7 @@
 LABEL_87:
       v47 = "effpar03";
     }
-    Dst.field_20 = (unsigned __int8)(v24 & 0x80) + 128;
+    Dst.timeToLive = (unsigned __int8)(v24 & 0x80) + 128;
     Dst.uTextureID = pBitmaps_LOD->LoadTexture(v47, v48);
     goto LABEL_89;
   }
@@ -2066,7 +2062,7 @@
           v46 = rand();
           Dst.uTextureID = 0;
           Dst.uDiffuse = v46;
-          Dst.field_20 = 64;
+          Dst.timeToLive = 64;
           goto LABEL_89;
         }
         Dst.bFree = 1032;
@@ -2127,7 +2123,7 @@
           }
           v1->vVelocity.z += v37;
 LABEL_70:
-          if ( BYTE3(v32->uFaceAttributes) & 0x10 )
+          if ( BYTE3(v32->uAttributes) & 0x10 )
             EventProcessor(v32->sCogTriggeredID, 0, 1);
           goto LABEL_74;
         }
@@ -2214,6 +2210,7 @@
   v20 = 0;
   if ( (signed int)uNumLayingItems > 0 )
   {
+    __debugbreak();
     v2 = (char *)&pLayingItems[0].uSpriteFrameID;
     do
     {
@@ -2272,8 +2269,8 @@
             if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) )
               goto LABEL_36;
             v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26));
-            v18 = abs(pParty->vPosition.z - *(int *)(v2 - 22));
-            v19 = abs(pParty->vPosition.y - *(int *)(v2 - 18));
+            v18 = abs(pParty->vPosition.y - *(int *)(v2 - 22));
+            v19 = abs(pParty->vPosition.z - *(int *)(v2 - 18));
             v13 = v12;
             v14 = v18;
             v15 = v19;
@@ -2316,34 +2313,35 @@
 }
 
 //----- (0047272C) --------------------------------------------------------
-int __fastcall _47272C_collide_agains_some_secotors_floors(int x, int y, int z, unsigned int *pSectorID, int *a5)
+int _47272C_collide_agains_some_secotors_floors(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
 {
   signed int v5; // ebx@1
   int result; // eax@1
   int v7; // [sp+10h] [bp-8h]@1
   signed int v8; // [sp+14h] [bp-4h]@1
 
+  __debugbreak();
   v5 = x - 2;
   v7 = x;
   v8 = y;
   *pSectorID = pIndoor->GetSector(x - 2, y, z + 40);
-  result = _46ED1B_collide_against_floor(v5, v8, z + 40, pSectorID, a5);
+  result = _46ED1B_collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID);
   if ( result == -30000 || !*pSectorID )
   {
     *pSectorID = pIndoor->GetSector(v7 + 2, v8, z + 40);
-    result = _46ED1B_collide_against_floor(v7 + 2, v8, z + 40, pSectorID, a5);
+    result = _46ED1B_collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID);
     if ( result == -30000 || !*pSectorID )
     {
       *pSectorID = pIndoor->GetSector(v7, v8 - 2, z + 40);
-      result = _46ED1B_collide_against_floor(v7, v8 - 2, z + 40, pSectorID, a5);
+      result = _46ED1B_collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID);
       if ( result == -30000 || !*pSectorID )
       {
         *pSectorID = pIndoor->GetSector(v7, v8 + 2, z + 40);
-        result = _46ED1B_collide_against_floor(v7, v8 + 2, z + 40, pSectorID, a5);
+        result = _46ED1B_collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID);
         if ( result == -30000 || !*pSectorID )
         {
           *pSectorID = pIndoor->GetSector(v7, v8, z + 140);
-          result = _46ED1B_collide_against_floor(v7, v8, z + 140, pSectorID, a5);
+          result = _46ED1B_collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID);
         }
       }
     }
@@ -2352,20 +2350,14 @@
 }
 
 //----- (00472866) --------------------------------------------------------
-void __cdecl BLV_ProcessPartyActions()
-{
-  int v0; // esi@1
+void BLV_ProcessPartyActions()
+{
   int v1; // ebx@1
   int v2; // edi@1
-  int v3; // esi@1
-  float v4; // ST40_4@8
-  Player **v5; // esi@15
   int v6; // eax@18
-  Player **v7; // esi@24
   signed __int64 v8; // qax@27
   int v9; // eax@27
   double v10; // st7@27
-  BLVFace *v11; // edx@41
   unsigned int v12; // eax@49
   double v13; // st7@50
   int v14; // eax@51
@@ -2383,15 +2375,9 @@
   int v26; // eax@67
   double v27; // st7@67
   int v28; // ST40_4@67
-  int v29; // eax@69
-  double v30; // st7@69
-  int v31; // ST3C_4@69
-  int v32; // eax@71
-  double v33; // st7@71
-  int v34; // ST3C_4@71
   unsigned int v35; // eax@74
   int v36; // ecx@88
-  int v37; // esi@96
+  int new_party_z; // esi@96
   int v38; // eax@96
   int v39; // ecx@106
   int v40; // eax@106
@@ -2421,160 +2407,151 @@
   unsigned int v64; // [sp-8h] [bp-68h]@161
   int v65; // [sp-4h] [bp-64h]@75
   int v66; // [sp-4h] [bp-64h]@161
-  double v67; // [sp+Ch] [bp-54h]@8
   int v68; // [sp+10h] [bp-50h]@45
   int v69; // [sp+10h] [bp-50h]@140
-  int v70; // [sp+14h] [bp-4Ch]@1
+  unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1
   signed int v71; // [sp+18h] [bp-48h]@1
   signed int v72; // [sp+1Ch] [bp-44h]@1
   signed int v73; // [sp+20h] [bp-40h]@100
   int v74; // [sp+20h] [bp-40h]@140
-  signed int bFeatherFall; // [sp+24h] [bp-3Ch]@15
-  bool bFeatherFalla; // [sp+24h] [bp-3Ch]@33
-  unsigned int v77; // [sp+28h] [bp-38h]@1
+  bool bFeatherFall; // [sp+24h] [bp-3Ch]@15
+  unsigned int uSectorID; // [sp+28h] [bp-38h]@1
   int v78; // [sp+2Ch] [bp-34h]@1
-  int v79; // [sp+30h] [bp-30h]@1
-  int i; // [sp+34h] [bp-2Ch]@1
+  unsigned int uFaceID; // [sp+30h] [bp-30h]@1
+  int v80; // [sp+34h] [bp-2Ch]@1
   int v81; // [sp+38h] [bp-28h]@47
   int v82; // [sp+3Ch] [bp-24h]@47
-  int v83; // [sp+40h] [bp-20h]@47
+  int _view_angle; // [sp+40h] [bp-20h]@47
   int bJumping; // [sp+44h] [bp-1Ch]@1
-  int v85; // [sp+48h] [bp-18h]@1
-  int v86; // [sp+4Ch] [bp-14h]@1
-  int v87; // [sp+50h] [bp-10h]@1
-  float v88; // [sp+54h] [bp-Ch]@62
+  int new_party_y; // [sp+48h] [bp-18h]@1
+  int new_party_x; // [sp+4Ch] [bp-14h]@1
+  int party_z; // [sp+50h] [bp-10h]@1
   int v89; // [sp+58h] [bp-8h]@1
   int angle; // [sp+5Ch] [bp-4h]@47
 
-  v0 = pParty->vPosition.y;
+  uFaceEvent = 0;
   v89 = pParty->uFallSpeed;
   v1 = 0;
-  v85 = pParty->vPosition.z;
-  v70 = 0;
+  new_party_y = pParty->vPosition.y;
   v2 = 0;
-  v86 = pParty->vPosition.x;
-  v87 = pParty->vPosition.y;
-  v77 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y);
+  new_party_x = pParty->vPosition.x;
+  party_z = pParty->vPosition.z;
+  uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
   v72 = 0;
   v78 = 0;
   v71 = 0;
   bJumping = 0;
-  v3 = v0 + 40;
-  i = _46ED1B_collide_against_floor(v86, v85, v3, &v77, &v79);
+  v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
   if ( pParty->bFlying )
   {
     pParty->bFlying = 0;
-    if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 )
+    __debugbreak();
+    if (pParty->FlyActive())
       stru_5E4C90.field_4B[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;// 005E4D58 pOtherOverlayList [negindexing]
   }
-  if ( i == -30000 )
-  {
-    i = _47272C_collide_agains_some_secotors_floors(v86, v85, v3, &v77, &v79);
-    if ( i == -30000 )
+  if ( v80 == -30000 )
+  {
+    v80 = _47272C_collide_agains_some_secotors_floors(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
+    if ( v80 == -30000 )
     {
       pParty->vPosition.x = blv_prev_party_x;
-      pParty->vPosition.z = blv_prev_party_z;
-      pParty->vPosition.y = blv_prev_party_y;
+      pParty->vPosition.y = blv_prev_party_z;
+      pParty->vPosition.z = blv_prev_party_y;
       pParty->uFallStartY = blv_prev_party_y;
       return;
     }
   }
   blv_prev_party_x = pParty->vPosition.x;
-  blv_prev_party_z = pParty->vPosition.z;
-  blv_prev_party_y = pParty->vPosition.y;
-  if ( pParty->bTurnBasedModeOn != 1 )
-  {
-    v4 = (double)(GetTickCount() / 0x1F4);
-    v67 = v4 + 6.7553994e15;
-    if ( *(int *)&word_720C10_intercepts_xs[102] != LODWORD(v67) )
-    {
-      dword_4F8584[3 * dword_4F8580[0]] = pParty->vPosition.x;
-      dword_4F8588[3 * dword_4F8580[0]] = pParty->vPosition.z;
-      dword_4F8580[3 * dword_4F8580[0]++ + 3] = pParty->vPosition.y;
+  blv_prev_party_z = pParty->vPosition.y;
+  blv_prev_party_y = pParty->vPosition.z;
+  if (!pParty->bTurnBasedModeOn)
+  {
+    auto v67 = GetTickCount() / 500;
+    if (dword_720CDC != v67 )
+    {
+      dword_4F8580[3 * dword_4F8580[0] + 1] = pParty->vPosition.x;
+      dword_4F8580[3 * dword_4F8580[0] + 2] = pParty->vPosition.y;
+      dword_4F8580[3 * dword_4F8580[0]++ + 3] = pParty->vPosition.z;
       if ( dword_4F8580[0] > 60 )
         dword_4F8580[0] = 1;
     }
-    *(int *)&word_720C10_intercepts_xs[102] = LODWORD(v67);
-  }
-  if ( SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0
-    || SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 && LODWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 )
-  {
-    bFeatherFall = 0;
-    v5 = &pPlayers[1];
-    while ( !(*v5)->WearsItem(536, 16) )
-    {
-      ++v5;
-      if ( (signed int)v5 > (signed int)&pPlayers[4] )
-      {
-        v6 = pParty->uFallStartY;
-        goto LABEL_20;
-      }
-    }
-  }
-  v6 = i;
-  bFeatherFall = 1;
-  pParty->uFallStartY = i;
+    dword_720CDC = v67;
+  }
+  if (!pParty->FeatherFallActive())
+  {
+    bFeatherFall = false;
+    if (!pParty->pPlayers[0].WearsItem(536, 16) &&
+        !pParty->pPlayers[1].WearsItem(536, 16) &&
+        !pParty->pPlayers[2].WearsItem(536, 16) &&
+        !pParty->pPlayers[3].WearsItem(536, 16))
+    {
+      v6 = pParty->uFallStartY;
+    }
+  }
+  else
+  {
+    v6 = v80;
+    bFeatherFall = true;
+    pParty->uFallStartY = v80;
+  }
 LABEL_20:
-  if ( v6 - v87 > 512 && !bFeatherFall && v87 <= i + 1 )
+  if ( v6 - party_z > 512 && !bFeatherFall && party_z <= v80 + 1 )
   {
     if ( BYTE1(pParty->uFlags) & 1 )
     {
       BYTE1(pParty->uFlags) &= 0xFEu;
     }
-    else
-    {
-      v7 = &pPlayers[1];                        // receive falling damage
-      do
-      {
-        if ( !(*v7)->HasEnchantedItemEquipped(72) && !(*v7)->WearsItem(529, 8) )
-        {
-          v8 = (signed __int64)((double)(*v7)->GetMaxHealth() * 0.1);
-          (*v7)->ReceiveDamage((pParty->uFallStartY - v87) * (signed int)v8 / 256, 4);
-          v9 = (*v7)->GetActualEndurance();
-          v10 = (double)(20 - (*v7)->_48EA1B_get_static_effect(v9)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
-          (*v7)->SetRecoveryTime((signed __int64)v10);
-        }
-        ++v7;
-      }
-      while ( (signed int)v7 <= (signed int)&pPlayers[4] );
-    }
-  }
-  if ( v87 > i + 1 )
+    else for (uint i = 0; i < 4; ++i)
+    {                                      // receive falling damage
+      auto pPlayer = pParty->pPlayers + i;
+           
+      if (!pPlayer->HasEnchantedItemEquipped(72) &&
+          !pPlayer->WearsItem(529, 8))
+      {
+        v8 = (signed __int64)((double)pPlayer->GetMaxHealth() * 0.1);
+        pPlayer->ReceiveDamage((pParty->uFallStartY - party_z) * (signed int)v8 / 256, 4);
+        v9 = pPlayer->GetActualEndurance();
+        v10 = (double)(20 - pPlayer->_48EA1B_get_static_effect(v9)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
+        pPlayer->SetRecoveryTime((signed __int64)v10);
+      }
+    }
+  }
+  if ( party_z > v80 + 1 )
     bJumping = 1;
-  bFeatherFalla = v87 - i <= 32;
-  if ( v87 - i <= 32 )
-    pParty->uFallStartY = v87;
+  bFeatherFall = party_z - v80 <= 32;
+  if ( party_z - v80 <= 32 )
+    pParty->uFallStartY = party_z;
   if ( bWalkSound && pParty->field_6F8 > 0 )
     pParty->field_6F8 -= pEventTimer->uTimeElapsed;
-  if ( v87 > i + 1 )
+  if ( party_z > v80 + 1 )
   {
 LABEL_43:
     if ( bJumping )
       goto LABEL_45;
     goto LABEL_44;
   }
-  v87 = i + 1;
-  pParty->uFallStartY = i + 1;
+  party_z = v80 + 1;
+  pParty->uFallStartY = v80 + 1;
   if ( bJumping )
     goto LABEL_45;
-  if ( pParty->field_6F4_packedid != v79 )
-  {
-    v11 = &pIndoor->pFaces[v79];
-    if ( BYTE3(v11->uAttributes) & 4 )
-    {
-      v70 = pIndoor->pFaceExtras[v11->uFaceExtraID].uEventID;
+  if (pParty->field_6F4_packedid != uFaceID)
+  {
+    auto pFace = &pIndoor->pFaces[uFaceID];
+    if (pFace->uAttributes & 0x04000000 )
+    {
+      uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
       goto LABEL_43;
     }
   }
 LABEL_44:
-  pParty->field_6F4_packedid = v79;
+  pParty->field_6F4_packedid = uFaceID;
 LABEL_45:
-  v68 = v79;
-  if ( pIndoor->pFaces[v79].uAttributes & 0x10 )
+  v68 = uFaceID;
+  if ( pIndoor->pFaces[uFaceID].uAttributes & 0x10 )
     v71 = 1;
   v81 = pParty->uWalkSpeed;
   angle = pParty->sRotationY;
-  v83 = pParty->sRotationX;
+  _view_angle = pParty->sRotationX;
   v82 = (unsigned __int64)(pEventTimer->dt_in_some_format
                          * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed * stru_5C6E00->uIntegerPi)
                                           / 180)) >> 16;
@@ -2584,12 +2561,14 @@
     switch ( pPartyActionQueue->Next() )
     {
       case PARTY_TurnLeft:
+        __debugbreak();
         v12 = uTurnSpeed;
         if ( uTurnSpeed )
           goto LABEL_58;
         v13 = (double)v82 * fTurnSpeedMultiplier;
         goto LABEL_51;
       case PARTY_TurnRight:
+        __debugbreak();
         LODWORD(v15) = uTurnSpeed;
         if ( uTurnSpeed )
           goto LABEL_56;
@@ -2622,79 +2601,77 @@
         angle = stru_5C6E00->uDoublePiMask & (angle - v15);
         goto LABEL_87;
       case PARTY_StrafeLeft:
+        __debugbreak();
         v17 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
         v18 = (double)v81;
-        v88 = v18;
+        //v88 = v18;
         v78 = (unsigned __int64)(v17 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16;
         v2 -= v78;
         v19 = stru_5C6E00->SinCos(angle);
-        v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v88 * fWalkSpeedMultiplier) >> 1)) >> 16;
+        v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16;
         goto LABEL_63;
       case PARTY_StrafeRight:
+        __debugbreak();
         v20 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
         v21 = (double)v81;
-        v88 = v21;
+        //v88 = v21;
         v78 = (unsigned __int64)(v20 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16;
         v2 += v78;
         v22 = stru_5C6E00->SinCos(angle);
-        v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v88 * fWalkSpeedMultiplier) >> 1)) >> 16;
+        v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16;
         goto LABEL_68;
       case PARTY_WalkForward:
+        __debugbreak();
         v23 = stru_5C6E00->SinCos(angle);
         v24 = (double)v81;
-        v88 = v24;
+        //v88 = v24;
         v78 = (unsigned __int64)(v23 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16;
         v2 += v78;
         v25 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
-        v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v88 * fWalkSpeedMultiplier)) >> 16;
+        v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16;
 LABEL_63:
         v1 += v78;
         goto LABEL_64;
       case PARTY_WalkBackward:
+        __debugbreak();
         v26 = stru_5C6E00->SinCos(angle);
         v27 = (double)v81;
-        v88 = v27;
+        //v88 = v27;
         v78 = (unsigned __int64)(v26
-                               * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardMovementSlowdownMultiplier)) >> 16;
+                               * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16;
         v2 -= v78;
         v28 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
         v78 = (unsigned __int64)(v28
-                               * (signed __int64)(signed int)(signed __int64)(v88 * fBackwardMovementSlowdownMultiplier)) >> 16;
+                               * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16;
 LABEL_68:
         v1 -= v78;
 LABEL_64:
         v78 = 1;
         goto LABEL_87;
       case PARTY_RunForward:
-        v29 = stru_5C6E00->SinCos(angle);
-        v30 = (double)v81;
-        v88 = v30;
-        v2 += (unsigned __int64)(v29
-                               * (signed __int64)(signed int)(2
-                                                            * (unsigned __int64)(signed __int64)(v30
-                                                                                               * fWalkSpeedMultiplier))) >> 16;
-        v31 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
-        v1 += (unsigned __int64)(v31
-                               * (signed __int64)(signed int)(2
-                                                            * (unsigned __int64)(signed __int64)(v88
-                                                                                               * fWalkSpeedMultiplier))) >> 16;
-        goto LABEL_70;
+        //v29 = stru_5C6E00->SinCos(angle);
+        //v30 = (double)v81;
+        //v88 = (double)v81;
+        v2 += (unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16;
+        //v31 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
+        v1 += (unsigned __int64)(stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16;
+        v72 = 1;
+        goto LABEL_87;
       case PARTY_RunBackward:
-        v32 = stru_5C6E00->SinCos(angle);
-        v33 = (double)v81;
-        v88 = v33;
-        v2 -= (unsigned __int64)(v32
-                               * (signed __int64)(signed int)(signed __int64)(v33 * fBackwardMovementSlowdownMultiplier)) >> 16;
-        v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
-        v1 -= (unsigned __int64)(v34
-                               * (signed __int64)(signed int)(signed __int64)(v88 * fBackwardMovementSlowdownMultiplier)) >> 16;
-LABEL_70:
+        //v32 = stru_5C6E00->SinCos(angle);
+        //v33 = (double)v81;
+        //v88 = (double)v81;
+        v2 -= (unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
+        //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
+        v1 -= (unsigned __int64)(stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
+//LABEL_70:
         v72 = 1;
         goto LABEL_87;
       case PARTY_LookUp:
-        v83 += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
-        if ( v83 > 128 )
-          v83 = 128;
+        __debugbreak();
+        _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
+        if ( _view_angle > 128 )
+          _view_angle = 128;
         v35 = uActiveCharacter;
         if ( !uActiveCharacter )
           goto LABEL_87;
@@ -2702,9 +2679,10 @@
         v63 = 63;
         goto LABEL_76;
       case PARTY_LookDown:
-        v83 += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
-        if ( v83 < -128 )
-          v83 = -128;
+        __debugbreak();
+        _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
+        if ( _view_angle < -128 )
+          _view_angle = -128;
         v35 = uActiveCharacter;
         if ( uActiveCharacter )
         {
@@ -2715,10 +2693,12 @@
         }
         break;
       case PARTY_CenterView:
-        v83 = 0;
+        __debugbreak();
+        _view_angle = 0;
         break;
       case PARTY_Jump:
-        if ( (!bJumping || v87 <= i + 6 && v89 <= 0) && pParty->field_24 )
+        __debugbreak();
+        if ( (!bJumping || party_z <= v80 + 6 && v89 <= 0) && pParty->field_24 )
         {
           bJumping = 1;
           v89 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v89);
@@ -2730,7 +2710,7 @@
   }
   v36 = 0;
   pParty->sRotationY = angle;
-  pParty->sRotationX = v83;
+  pParty->sRotationX = _view_angle;
   if ( bJumping )
   {
     v89 += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
@@ -2762,7 +2742,7 @@
     goto LABEL_93;
   }
 LABEL_92:
-  pParty->uFallStartY = v87;
+  pParty->uFallStartY = party_z;
 LABEL_93:
   if ( v2 * v2 + v1 * v1 < 400 )
   {
@@ -2773,22 +2753,22 @@
   stru_721530.field_70 = 0;
   stru_721530.prolly_normal_d = pParty->field_14;
   stru_721530.field_8 = pParty->field_14 >> 1;
-  v83 = 0;
+  auto v83 = 0;
   stru_721530.field_0 = 1;
   stru_721530.field_C = pParty->uPartyHeight - 32;
   while ( 1 )
   {
-    v37 = v87;
-    stru_721530.field_34.x = v86;
-    stru_721530.normal.x = v86;
+    new_party_z = party_z;
+    stru_721530.field_34.x = new_party_x;
+    stru_721530.normal.x = new_party_x;
     stru_721530.field_1C = v2;
-    stru_721530.field_34.y = v85;
-    stru_721530.normal.y = v85;
+    stru_721530.field_34.y = new_party_y;
+    stru_721530.normal.y = new_party_y;
     stru_721530.field_20 = v1;
-    stru_721530.normal.z = stru_721530.prolly_normal_d + v87 + 1;
-    stru_721530.field_34.z = stru_721530.field_C + v87 + 1;
+    stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1;
+    stru_721530.field_34.z = stru_721530.field_C + party_z + 1;
     stru_721530.field_24 = v89;
-    stru_721530.uSectorID = v77;
+    stru_721530.uSectorID = uSectorID;
     v38 = 0;
     if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 )
       v38 = 13312;
@@ -2799,8 +2779,8 @@
     {
       _46E44E_collide_against_faces_and_portals(1u);
       _46E0B2_collide_against_decorations();
-      for ( i = 0; i < (signed int)uNumActors; ++i )
-        _46DF1A_collide_against_actor(i, 0);
+      for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 )
+        _46DF1A_collide_against_actor(v80, 0);
       if ( _46F04E_collide_against_portals() )
         break;
       ++v73;
@@ -2809,31 +2789,31 @@
     if ( stru_721530.field_7C >= stru_721530.field_6C )
     {
       v39 = stru_721530.normal2.x;
-      v77 = stru_721530.normal2.y;
+      uSectorID = stru_721530.normal2.y;
       v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
     }
     else
     {
-      v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16) + v86;
-      v77 = v85 + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
-      v40 = v37 + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
-    }
-    v42 = _46ED1B_collide_against_floor(v39, v77, v40 + 40, &stru_721530.uSectorID, &v79);
-    if ( v42 == -30000 || v42 - v37 > 128 )
+      v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16) + new_party_x;
+      uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
+      v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
+    }
+    v42 = _46ED1B_collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
+    if ( v42 == -30000 || v42 - new_party_z > 128 )
       return;
     if ( stru_721530.field_7C >= stru_721530.field_6C )
     {
-      v86 = stru_721530.normal2.x;
-      v85 = stru_721530.normal2.y;
-      v37 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
+      new_party_x = stru_721530.normal2.x;
+      new_party_y = stru_721530.normal2.y;
+      new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
       break;
     }
-    v86 += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-    v85 += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
+    new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
+    new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
     v43 = stru_721530.uFaceID;
-    v77 = stru_721530.uSectorID;
+    uSectorID = stru_721530.uSectorID;
     stru_721530.field_70 += stru_721530.field_7C;
-    v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + v37;
+    auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z;
     if ( (stru_721530.uFaceID & 7) == 3 )
     {
       if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0
@@ -2845,13 +2825,13 @@
     if ( (stru_721530.uFaceID & 7) == 5 )
     {
       v53 = sub_452A9E(v2 * v2 + v1 * v1);
-      i = v53;
+      v80 = v53;
       v54 = stru_5C6E00->Atan2(
-              v86 - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x,
-              v85 - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y);
+              new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
+              new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y);
       v2 = (unsigned __int64)(stru_5C6E00->SinCos(v54) * (signed __int64)v53) >> 16;
       v55 = stru_5C6E00->SinCos(v54 - stru_5C6E00->uIntegerHalfPi);
-      v1 = (unsigned __int64)(v55 * (signed __int64)i) >> 16;
+      v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16;
     }
     else
     {
@@ -2878,43 +2858,43 @@
         v48 = v44->pFacePlane_old.vNormal.x;
         if ( !v47 )
         {
-          i = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
-          if ( stru_721530.field_64 >> 3 > i )
-            i = stru_721530.field_64 >> 3;
-          v50 = (unsigned __int64)(i * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
+          v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
+          if ( stru_721530.field_64 >> 3 > v80 )
+            v80 = stru_721530.field_64 >> 3;
+          v50 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
           v81 = v44->pFacePlane_old.vNormal.y;
-          v81 = (unsigned __int64)(i * (signed __int64)v81) >> 16;
+          v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
           v82 = v44->pFacePlane_old.vNormal.z;
-          v82 = (unsigned __int64)(i * (signed __int64)v82) >> 16;
+          v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
           v2 += v50;
           v89 += v82;
           v74 = v44->pFacePlane_old.vNormal.z;
           v51 = v44->pFacePlane_old.vNormal.y;
           v69 = v44->pFacePlane_old.vNormal.x;
-          i = v51;
+          v80 = v51;
           v1 += v81;
-          v52 = stru_721530.prolly_normal_d - ((v44->pFacePlane_old.dist + v87 * v74 + v85 * v51 + v86 * v69) >> 16);
+          v52 = stru_721530.prolly_normal_d - ((v44->pFacePlane_old.dist + v87 * v74 + new_party_y * v51 + new_party_x * v69) >> 16);
           if ( v52 > 0 )
           {
-            v86 += v52 * v69 >> 16;
-            v85 += v52 * i >> 16;
+            new_party_x += v52 * v69 >> 16;
+            new_party_y += v52 * v80 >> 16;
             v87 += v52 * v74 >> 16;
           }
 LABEL_142:
           v43 = stru_721530.uFaceID;
 LABEL_143:
           if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 )
-            v70 = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
+            uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
           goto LABEL_152;
         }
-        i = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
-        if ( stru_721530.field_64 >> 3 > i )
-          i = stru_721530.field_64 >> 3;
-        v49 = (unsigned __int64)(i * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
+        v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
+        if ( stru_721530.field_64 >> 3 > v80 )
+          v80 = stru_721530.field_64 >> 3;
+        v49 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
         v81 = v44->pFacePlane_old.vNormal.y;
-        v81 = (unsigned __int64)(i * (signed __int64)v81) >> 16;
+        v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
         v82 = v44->pFacePlane_old.vNormal.z;
-        v82 = (unsigned __int64)(i * (signed __int64)v82) >> 16;
+        v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
         v2 += v49;
         v1 += v81;
         v89 += v82;
@@ -2932,18 +2912,18 @@
     v89 = (unsigned __int64)(58500i64 * v89) >> 16;
     if ( v83 >= 100 )
     {
-      v37 = v87;
+      new_party_z = v87;
       break;
     }
   }
   if ( bWalkSound && pParty->field_6F8 <= 0 )
   {
-    if ( sub_452A9E((pParty->vPosition.x - v86) * (pParty->vPosition.x - v86) + (pParty->vPosition.z - v85)
-                                                                            * (pParty->vPosition.z - v85)
-                                                                            + (pParty->vPosition.y - v37)
-                                                                            * (pParty->vPosition.y - v37)) <= 16 )
+    if ( sub_452A9E((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y)
+                                                                            * (pParty->vPosition.y - new_party_y)
+                                                                            + (pParty->vPosition.z - new_party_z)
+                                                                            * (pParty->vPosition.z - new_party_z)) <= 16 )
       goto LABEL_188;
-    if ( v72 && (!bJumping || bFeatherFalla) )
+    if ( v72 && (!bJumping || bFeatherFall) )
     {
       v66 = 0;
       v64 = 0;
@@ -2955,7 +2935,7 @@
       if ( !v71 )
       {
         v56 = pAudioPlayer;
-        if ( BYTE2(pIndoor->pFaces[v79].uAttributes) & 0x20 )
+        if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
           v57 = (SoundID)50;
         else
           v57 = (SoundID)64;
@@ -2966,7 +2946,7 @@
       v56 = pAudioPlayer;
       goto LABEL_175;
     }
-    if ( v78 && (!bJumping || bFeatherFalla) )
+    if ( v78 && (!bJumping || bFeatherFall) )
     {
       v66 = 0;
       v64 = 0;
@@ -2981,7 +2961,7 @@
         goto LABEL_174;
       }
       v56 = pAudioPlayer;
-      if ( BYTE2(pIndoor->pFaces[v79].uAttributes) & 0x20 )
+      if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
         v57 = (SoundID)89;
       else
         v57 = (SoundID)103;
@@ -2995,19 +2975,19 @@
       pParty->field_6F8 = 64;
     }
   }
-  if ( !bJumping || bFeatherFalla )
+  if ( !bJumping || bFeatherFall )
     pParty->uFlags &= 0xFFFFFFF7u;
   else
     pParty->uFlags |= 8u;
   BYTE1(pParty->uFlags) &= 0xFDu;
-  pParty->vPosition.x = v86;
-  pParty->vPosition.y = v37;
-  pParty->vPosition.z = v85;
+  pParty->vPosition.x = new_party_x;
+  pParty->vPosition.z = new_party_z;
+  pParty->vPosition.y = new_party_y;
   pParty->uFallSpeed = v89;
-  if ( !bJumping && BYTE3(pIndoor->pFaces[v79].uAttributes) & 0x40 )
+  if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
     BYTE1(pParty->uFlags) |= 2u;
-  if ( v70 )
-    EventProcessor(v70, 0, 1);
+  if (uFaceEvent)
+    EventProcessor(uFaceEvent, 0, 1);
 }
 
 
@@ -3147,17 +3127,17 @@
   int v130; // [sp+90h] [bp-4h]@14
 
   v121 = pParty->uFallSpeed;
-  v123 = pParty->vPosition.y;
+  v123 = pParty->vPosition.z;
   _zero = 0;
   v1 = 0;
   v103 = 0;
   v2 = 0;
   *(float *)&v128 = 0.0;
   v116 = pParty->vPosition.x;
-  v117 = pParty->vPosition.z;
+  v117 = pParty->vPosition.y;
   v113 = pParty->field_6F0;
   bJumping = 0;
-  v118 = GetTerrainHeightsAroundParty(pParty->vPosition.x, pParty->vPosition.z);
+  v118 = GetTerrainHeightsAroundParty(pParty->vPosition.x, pParty->vPosition.y);
   v114 = 0;
   v124 = 0;
   v108 = 0;
@@ -3286,7 +3266,7 @@
             || pParty->pPartyBuffs[7].uFlags & 1
             || *(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
           {
-            if ( pParty->vPosition.y < 4000 || bJumping )
+            if ( pParty->vPosition.z < 4000 || bJumping )
             {
               v123 += 30;
               v113 += 30;
@@ -3306,7 +3286,7 @@
                 pParty->field_6E4 = 0;
                 pPartyActionQueue->uNumActions = 0;
                 BYTE1(pParty->uFlags) |= 1u;
-                pParty->vPosition.y = v109 - pParty->uPartyHeight - 31;
+                pParty->vPosition.z = v109 - pParty->uPartyHeight - 31;
                 pParty->field_6F0 = v123;
                 pParty->bFlying = 0;
                 v123 = v109 - pParty->uPartyHeight - 31;
@@ -3420,12 +3400,12 @@
         v126 = v19;
         *(float *)&v128 = v20;
         v124 = (unsigned __int64)(v19
-                                * (signed __int64)(signed int)(signed __int64)(v20 * fBackwardMovementSlowdownMultiplier)) >> 16;
+                                * (signed __int64)(signed int)(signed __int64)(v20 * fBackwardWalkSpeedMultiplier)) >> 16;
         v2 -= v124;
         v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
         v124 = (unsigned __int64)(v126
                                 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128
-                                                                             * fBackwardMovementSlowdownMultiplier)) >> 16;
+                                                                             * fBackwardWalkSpeedMultiplier)) >> 16;
 LABEL_90:
         v1 -= v124;
         goto LABEL_86;
@@ -3486,7 +3466,7 @@
         v28 = (double)_walk_speed;
         v126 = v27;
         *(float *)&v128 = v28;
-        v29 = (signed __int64)(v28 * fBackwardMovementSlowdownMultiplier);
+        v29 = (signed __int64)(v28 * fBackwardWalkSpeedMultiplier);
         if ( pParty->bFlying )
         {
           v129 = (unsigned __int64)(v126 * (signed __int64)(4 * (signed int)v29)) >> 16;
@@ -3495,7 +3475,7 @@
           v129 = (unsigned __int64)(v126
                                   * (signed __int64)(signed int)(4
                                                                * (unsigned __int64)(signed __int64)(*(float *)&v128
-                                                                                                  * fBackwardMovementSlowdownMultiplier))) >> 16;
+                                                                                                  * fBackwardWalkSpeedMultiplier))) >> 16;
           v1 -= v129;
 LABEL_93:
           v128 = v1;
@@ -3507,7 +3487,7 @@
           v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
           v129 = (unsigned __int64)(v126
                                   * (signed __int64)(signed int)(signed __int64)(*(float *)&v128
-                                                                               * fBackwardMovementSlowdownMultiplier)) >> 16;
+                                                                               * fBackwardWalkSpeedMultiplier)) >> 16;
           v1 -= v129;
 LABEL_86:
           v128 = v1;
@@ -3635,7 +3615,7 @@
   {
     if ( v34 < -500
       && !pParty->bFlying
-      && pParty->vPosition.y - v111 > 1000
+      && pParty->vPosition.z - v111 > 1000
       && SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0
       && (SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0 || !LODWORD(pParty->pPartyBuffs[5].uExpireTime)) )
     {
@@ -3683,7 +3663,7 @@
     if ( stru_721530._47050A(v36) )
       break;
     _46E889_collide_against_bmodels(1u);
-    v37 = WorldPosToGridCellZ(pParty->vPosition.z);
+    v37 = WorldPosToGridCellZ(pParty->vPosition.y);
     v38 = WorldPosToGridCellX(pParty->vPosition.x);
     _46E26D_collide_against_sprites(v38, v37);
     _46ED8A_collide_against_layingItems(4u);
@@ -3856,7 +3836,7 @@
 LABEL_220:
           v45 = stru_721530.uFaceID;
 LABEL_221:
-          if ( pParty->field_6F4_packedid != v45 && BYTE3(v47->uFaceAttributes) & 4 )
+          if ( pParty->field_6F4_packedid != v45 && BYTE3(v47->uAttributes) & 4 )
           {
             pParty->field_6F4_packedid = v45;
             v103 = v47->sCogTriggeredID;
@@ -3894,14 +3874,14 @@
   if ( bWalkSound && pParty->field_6F8 <= 0 )
   {
     v122 = abs(pParty->vPosition.x - v116);
-    v126 = abs(pParty->vPosition.z - v117);
-    v62 = abs(pParty->vPosition.y - v123);
+    v126 = abs(pParty->vPosition.y - v117);
+    v62 = abs(pParty->vPosition.z - v123);
     if ( sub_452A9E(v122 * v122 + v126 * v126 + v62 * v62) < 8 )
       goto LABEL_344;
     if ( v114 && (!bJumping || v101) )
     {
       if ( !v107
-        && !(BYTE1(pOutdoor->pBModels[pParty->field_6F4_packedid >> 9].pFaces[(pParty->field_6F4_packedid >> 3) & 0x3F].uFaceAttributes) & 0x20) )
+        && !(BYTE1(pOutdoor->pBModels[pParty->field_6F4_packedid >> 9].pFaces[(pParty->field_6F4_packedid >> 3) & 0x3F].uAttributes) & 0x20) )
       {
         v96 = 0;
         v94 = 0;
@@ -3922,7 +3902,7 @@
       v88 = 804;
       v86 = 1;
 LABEL_255:
-      v63 = WorldPosToGridCellZ(pParty->vPosition.z) - 1;
+      v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
       v64 = WorldPosToGridCellX(pParty->vPosition.x);
       v87 = pOutdoor->_47EE49(v64, v63, v86);
       goto LABEL_257;
@@ -3930,7 +3910,7 @@
     if ( v124 && (!bJumping || v101) )
     {
       if ( v107
-        || BYTE1(pOutdoor->pBModels[pParty->field_6F4_packedid >> 9].pFaces[(pParty->field_6F4_packedid >> 3) & 0x3F].uFaceAttributes) & 0x20 )
+        || BYTE1(pOutdoor->pBModels[pParty->field_6F4_packedid >> 9].pFaces[(pParty->field_6F4_packedid >> 3) & 0x3F].uAttributes) & 0x20 )
       {
         v96 = 0;
         v94 = 0;
@@ -3965,7 +3945,7 @@
   else
     pParty->uFlags |= 8u;
   v126 = WorldPosToGridCellX(pParty->vPosition.x);
-  v65 = WorldPosToGridCellZ(pParty->vPosition.z) - 1;
+  v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
   v114 = WorldPosToGridCellX(v116);
   v66 = WorldPosToGridCellZ(v117) - 1;
   v127 = (BSPModel *)(((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1);
@@ -3985,25 +3965,25 @@
     pParty->uFallSpeed = v121;
     v73 = v123;
     pParty->vPosition.x = v116;
-    pParty->vPosition.z = v117;
-    pParty->vPosition.y = v123;
+    pParty->vPosition.y = v117;
+    pParty->vPosition.z = v123;
     pParty->field_6F0 = v113;
     if ( v123 > 8160 )
     {
       v73 = 8160;
       pParty->uFallStartY = 8160;
-      pParty->vPosition.y = 8160;
+      pParty->vPosition.z = 8160;
     }
     if ( !v103
       || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v71)
-      && pParty->vPosition.z == v72
-      && (v73 = pParty->vPosition.y, pParty->vPosition.y == v70) )
+      && pParty->vPosition.y == v72
+      && (v73 = pParty->vPosition.z, pParty->vPosition.z == v70) )
     {
       if ( v73 < v111 )
       {
         pParty->uFallSpeed = 0;
         v73 = v105;
-        pParty->vPosition.y = v105;
+        pParty->vPosition.z = v105;
         if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater )
         {
           if ( pParty->uFlags & 0x100 )
@@ -4026,7 +4006,7 @@
               ++v74;
             }
             while ( (signed int)v74 <= (signed int)&pPlayers[4] );
-            v73 = pParty->vPosition.y;
+            v73 = pParty->vPosition.z;
           }
         }
         pParty->uFallStartY = v70;
@@ -4035,7 +4015,7 @@
       {
         if ( (signed int)(pParty->uPartyHeight + v73) >= v109 )
         {
-          pParty->vPosition.y = v109 - pParty->uPartyHeight - 1;
+          pParty->vPosition.z = v109 - pParty->uPartyHeight - 1;
           pParty->field_6F0 = v109 - pParty->uPartyHeight - 1;
         }
       }
@@ -4070,7 +4050,7 @@
   if ( v78 )
   {
 LABEL_312:
-    pParty->vPosition.z = v117;
+    pParty->vPosition.y = v117;
 LABEL_313:
     if ( bWaterWalk )
     {
@@ -4097,33 +4077,33 @@
 LABEL_318:
   v81 = v123;
   v82 = v123;
-  pParty->vPosition.y = v123;
+  pParty->vPosition.z = v123;
   if ( v123 > 8160 )
   {
     v82 = 8160;
     pParty->uFallStartY = 8160;
-    pParty->vPosition.y = 8160;
+    pParty->vPosition.z = 8160;
   }
   LOWORD(pParty->uFlags) &= 0xFDFBu;
   pParty->uFallSpeed = v121;
   pParty->field_6F0 = v113;
   if ( v114 )
   {
-    v83 = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.z, &v110, 1);
-    v82 = pParty->vPosition.y;
-    if ( pParty->vPosition.y <= v83 )
+    v83 = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1);
+    v82 = pParty->vPosition.z;
+    if ( pParty->vPosition.z <= v83 )
       pParty->uFlags |= 4u;
   }
   if ( !v103
     || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v116)
-    && pParty->vPosition.z == v117
-    && (v82 = pParty->vPosition.y, pParty->vPosition.y == v81) )
+    && pParty->vPosition.y == v117
+    && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) )
   {
     if ( v82 < v111 )
     {
       v82 = v105;
       pParty->uFallSpeed = 0;
-      pParty->vPosition.y = v105;
+      pParty->vPosition.z = v105;
       if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater )
       {
         if ( pParty->uFlags & 0x100 )
@@ -4145,14 +4125,14 @@
             ++v84;
           }
           while ( (signed int)v84 <= (signed int)&pPlayers[4] );
-          v82 = pParty->vPosition.y;
+          v82 = pParty->vPosition.z;
         }
       }
       pParty->uFallStartY = v81;
     }
     if ( v102 && v82 < v109 && (signed int)(pParty->uPartyHeight + v82) >= v109 )
     {
-      pParty->vPosition.y = v82 + pParty->uPartyHeight - v109 + 1;
+      pParty->vPosition.z = v82 + pParty->uPartyHeight - v109 + 1;
       pParty->field_6F0 = v82 + pParty->uPartyHeight - v109 + 1;
     }
   }
@@ -4733,6 +4713,7 @@
 }
 
 //----- (00476395) --------------------------------------------------------
+//0x26 Wizard eye at skill level 2
 bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession)
 {
   bool result; // eax@2
@@ -6796,7 +6777,7 @@
     }
     while ( 1 )
     {
-      if ( pFace->uFaceAttributes & 0x2000 )
+      if (pFace->Invisible())
         goto LABEL_85;
       v5 = (int)*(v2 - 1);
       v6 = pFace->pVertexIDs[0];
@@ -6806,7 +6787,7 @@
       *(int *)&v7->flags = 0;
       pLightmapBuilder = v8;
       v9 = pFace->uTextureID;
-      v10 = (BYTE1(pFace->uFaceAttributes) & 0x40) == 0;
+      v10 = (BYTE1(pFace->uAttributes) & 0x40) == 0;
       v48 = pFace->uTextureID;
       if ( !v10 )
       {
@@ -6818,14 +6799,14 @@
       v12 = (v9 != -1 ? pBitmaps_LOD->pTextures[v9].uTextureWidth : 24);
       v49 = v12;
       v49 = pFaceTexture->uTextureHeight;
-      v10 = (pFace->uFaceAttributes & 0x10) == 0;
+      v10 = (pFace->uAttributes & 0x10) == 0;
       v45 = 1.0 / (double)v12;
       v44 = 1.0 / (double)v49;
       if ( !v10 )
         *(int *)&v7->flags |= 2u;
-      if ( BYTE2(pFace->uFaceAttributes) & 0x40 )
+      if ( BYTE2(pFace->uAttributes) & 0x40 )
         HIBYTE(v7->flags) |= 4u;
-      v13 = pFace->uFaceAttributes;
+      v13 = pFace->uAttributes;
       if ( v13 & 4 )
       {
         HIBYTE(v7->flags) |= 4u;
@@ -6835,7 +6816,7 @@
         if ( v13 & 0x20 )
           HIBYTE(v7->flags) |= 8u;
       }
-      v14 = pFace->uFaceAttributes;
+      v14 = pFace->uAttributes;
       if ( BYTE1(v14) & 8 )
       {
         *(int *)&v7->flags |= 0x2000u;
@@ -6925,7 +6906,7 @@
           }
           else
           {
-            v47->_436BB7_project_and_stuff((RenderVertexSoft *)(v23 - 12), 1u, 0);
+            v47->Project((RenderVertexSoft *)(v23 - 12), 1u, 0);
           }
           v23 += 48;
           --v51;
@@ -7004,7 +6985,7 @@
         pDecalBuilder->ApplyDecals_OutdoorFace(pFace);
         v31->std__vector_000004_size = 0;
         LOBYTE(v31) = 0;
-        if ( stru_F8AD28.field_AC > 0 || pDecalBuilder->uNumDecals > 0 )
+        if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
         {
           v31 = (LightmapBuilder *)(v50 ? 3 : v49 != 0 ? 5 : 0);
           static_RenderBuildingsD3D_stru_73C834._49B04D(pFace, (BSPVertexBuffer *)v56 - 1);
@@ -7026,13 +7007,13 @@
               -1);
           }
         }
-        if ( stru_F8AD28.field_AC > 0 )
+        if ( stru_F8AD28.uNumLightsApplied > 0 )
           pLightmapBuilder->ApplyLights(
             &stru_F8AD28,
             &static_RenderBuildingsD3D_stru_73C834,
             uNumVertices,
             array_50AC10,
-            0.0,
+            0,
             (char)v31);
         if ( v50 )
         {
@@ -7240,7 +7221,7 @@
             }
             else
             {
-              pGame->pIndoorCameraD3D->_436BB7_project_and_stuff((RenderVertexSoft *)(v9 - 12), 1u, 0);
+              pGame->pIndoorCameraD3D->Project((RenderVertexSoft *)(v9 - 12), 1u, 0);
             }
             v81 += 2;
             v9 += 48;
@@ -7372,7 +7353,7 @@
         }*/
 
         pGame->pLightmapBuilder->ApplyLights_OutdoorFace((ODMFace *)v3);
-        if ( stru_F8AD28.field_AC <= 0 )
+        if ( stru_F8AD28.uNumLightsApplied <= 0 )
         {
           v12->field_108 = 0;
         }
@@ -7382,9 +7363,9 @@
           v12->field_108 = 1;
 
           static_sub_004789DE_stru_73C818._49B04D((ODMFace *)v3, v35);
-          v55 = static_sub_004789DE_stru_73C818.vNormal.x;
-          v56 = static_sub_004789DE_stru_73C818.vNormal.y;
-          v57 = static_sub_004789DE_stru_73C818.vNormal.z;
+          v55 = static_sub_004789DE_stru_73C818.face_plane.vNormal.x;
+          v56 = static_sub_004789DE_stru_73C818.face_plane.vNormal.y;
+          v57 = static_sub_004789DE_stru_73C818.face_plane.vNormal.z;
           pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, v26, (Vec3_float_ *)&v55);
         }
         if ( v74 )
@@ -7906,7 +7887,7 @@
 
 
 //----- (00479A53) --------------------------------------------------------
-void __fastcall sub_479A53(unsigned int uNumVertices, unsigned int uFaceID)
+void __fastcall _479A53_draw_some_blv_poly(unsigned int uNumVertices, unsigned int uFaceID)
 {
   BLVFace *pFace; // esi@1
   unsigned int v3; // edi@1
@@ -7989,6 +7970,8 @@
   float v80; // [sp+16Ch] [bp-8h]@3
   const void *v81; // [sp+170h] [bp-4h]@7
 
+  __debugbreak();
+
   pFace = &pIndoor->pFaces[uFaceID];
   v65 = uFaceID;
   v3 = uNumVertices;
@@ -8522,7 +8505,7 @@
       {
         v15 = 0;
       }
-      v17 = sub_43F55F(a1, v15);
+      v17 = _43F55F_get_billboard_light_level(a1, v15);
       if ( v17 > 27 )
         v17 = 27;
       if ( !a3 )
@@ -8539,7 +8522,7 @@
     a3a = (double)(signed int)(((unsigned __int64)(11 * v12 / (pOutdoorCamera->shading_dist_shade << 16)) >> 16) + 20)
         * pOutdoor->fFogDensity;
     v13 = a3a + 6.7553994e15;
-    v10 = sub_43F55F(a1, LODWORD(v13) + v11);
+    v10 = _43F55F_get_billboard_light_level(a1, LODWORD(v13) + v11);
     if ( v10 > 27 )
       v10 = 27;
     if ( v10 < a4 )
@@ -8567,7 +8550,7 @@
     {
       v6 = 27;
     }
-    v10 = sub_43F55F(a1, v6);
+    v10 = _43F55F_get_billboard_light_level(a1, v6);
     if ( v10 > 27 || !a3 )
       v10 = 27;
     return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1);
@@ -9080,7 +9063,7 @@
     {
 LABEL_20:
       if ( a5 )
-        v6 = 8 * sub_43F55F(a5, v6 >> 3);
+        v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3);
       if ( v6 > 216 )
         v6 = 216;
       return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8);
@@ -9120,7 +9103,7 @@
     }
     v6 = a4a + v12;
     if ( a5 )
-      v6 = 8 * sub_43F55F(a5, v6 >> 3);
+      v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3);
     if ( v6 > 216 )
       v6 = 216;
     if ( v6 < v12 )
@@ -9346,7 +9329,7 @@
   pOutdoorCamera->uNumEdges = 0;
   pOutdoorCamera->uNumSpans = 0;
   pOutdoorCamera->uNumSurfs = 0;
-  pOutdoorCamera->field_3C = 0;
+  pOutdoorCamera->uNumBillboards = 0;
   pOutdoorCamera->field_44 = 0;
 }
 
@@ -12901,27 +12884,27 @@
 
 
 //----- (0043F953) --------------------------------------------------------
-int __cdecl PrepareWallsRenderList_BLV()
+void PrepareWallsRenderList_BLV()
 {
   pStru170->uNumFaceIDs = 0;
-  if ( pBLVRenderParams->uRadius )
-  {
-    pStru170->field_FA8[0].uSectorID = LOWORD(pBLVRenderParams->uRadius);
-    pStru170->field_FA8[0].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
-    pStru170->field_FA8[0].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
-    pStru170->field_FA8[0].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
-    pStru170->field_FA8[0].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
+  if ( pBLVRenderParams->uPartySectorID )
+  {
+    pStru170->field_FA8[0].uSectorID = pBLVRenderParams->uPartySectorID;
+    pStru170->field_FA8[0].uViewportW = pBLVRenderParams->uViewportW;
+    pStru170->field_FA8[0].uViewportZ = pBLVRenderParams->uViewportZ;
+    pStru170->field_FA8[0].uViewportY = pBLVRenderParams->uViewportY;
+    pStru170->field_FA8[0].uViewportX = pBLVRenderParams->uViewportX;
     pStru170->field_FA8[0].field_C._43F9E1(
-      SLOWORD(pBLVRenderParams->uViewportX),
-      SLOWORD(pBLVRenderParams->uViewportY),
-      SLOWORD(pBLVRenderParams->uViewportZ),
-      SLOWORD(pBLVRenderParams->uViewportW));
+      pBLVRenderParams->uViewportX,
+      pBLVRenderParams->uViewportY,
+      pBLVRenderParams->uViewportZ,
+      pBLVRenderParams->uViewportW);
     pStru170->field_FA8[0].uFaceID = -1;
     pStru170->field_FA8[0].std__vector_0007A8 = -1;
     pStru170->std__vector_000FA8 = 1;
     sub_440639(0);
   }
-  return pStru170->RenderWalls();
+  pStru170->MakeVisibleSectorList();
 }
 
 //----- (0043F9E1) --------------------------------------------------------
@@ -13062,10 +13045,10 @@
               else
               {
                 v17 = &pGame->pIndoorCameraD3D;
-                v15->flt_8 = pGame->pIndoorCameraD3D->flt_D0;
-                v18 = (*v17)->flt_D4;
-                v19 = v15->flt_8;
-                v15->flt_C = v18;
+                v15->fov_x = pGame->pIndoorCameraD3D->fov_x;
+                v18 = (*v17)->fov_y;
+                v19 = v15->fov_x;
+                v15->fov_y = v18;
                 v31 = v19;
                 v25 = v19 + 6.7553994e15;
                 LODWORD(v20) = 0;
@@ -13074,7 +13057,7 @@
                 LODWORD(v31) = v12->scale;
                 v37 = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16;
                 v15->field_0 = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16;
-                v31 = v15->flt_C;
+                v31 = v15->fov_y;
                 v25 = v31 + 6.7553994e15;
                 LODWORD(v20) = 0;
                 HIDWORD(v20) = SLOWORD(v25);
@@ -13084,15 +13067,15 @@
               HIWORD(v22) = HIWORD(x);
               v15->field_4 = v37;
               v15->field_1E = v30;
-              v15->field_20 = a1;
-              v15->field_22 = a2;
-              v15->field_24 = a3;
-              v15->field_26 = a5;
-              v15->field_28 = a6;
+              v15->some_x = a1;
+              v15->some_y = a2;
+              v15->some_z = a3;
+              v15->uScreenSpaceX = a5;
+              v15->uScreenSpaceY = a6;
               v23 = 8 * v26;
               LOBYTE(v23) = 8 * v26 | 5;
               LOWORD(v22) = 0;
-              v15->field_2C_prolly_tint = 0;
+              v15->uTintColor = 0;
               v15->sZValue = v22 + v23;
               v15->pSpriteFrame = v12;
             }
@@ -13113,7 +13096,7 @@
       local_0.flt_14 = 0.0;
       local_0.flt_18 = 0.0;
       local_0.flt_28 = 1.0;
-      local_0.field_20 = (rand() & 0x80) + 128;
+      local_0.timeToLive = (rand() & 0x80) + 128;
       local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01");
       pGame->pParticleEngine->AddParticle(&local_0);
     }
@@ -13122,9 +13105,8 @@
 
 
 //----- (0044028F) --------------------------------------------------------
-void __cdecl PrepareItemsRenderList_BLV()
-{
-  char *v0; // edi@2
+void PrepareItemsRenderList_BLV()
+{
   ObjectDesc *v1; // ebx@4
   __int16 v2; // ax@5
   RenderBillboard *v3; // esi@12
@@ -13137,11 +13119,6 @@
   unsigned __int16 v10; // ax@12
   int *v11; // eax@20
   char v12; // zf@26
-  IndoorCameraD3D **v13; // eax@27
-  double v14; // st7@27
-  float v15; // eax@27
-  double v16; // ST30_8@27
-  signed __int64 v17; // qtt@27
   int v18; // ST5C_4@27
   signed __int64 v19; // qtt@28
   int v20; // ST5C_4@28
@@ -13149,14 +13126,12 @@
   __int16 v22; // ax@29
   int v23; // eax@29
   SpriteFrame *v24; // [sp+1Ch] [bp-40h]@12
-  ObjectDesc *v25; // [sp+20h] [bp-3Ch]@4
   __int16 a5; // [sp+28h] [bp-34h]@12
   int a6; // [sp+2Ch] [bp-30h]@12
   int a2; // [sp+30h] [bp-2Ch]@12
   int a1; // [sp+34h] [bp-28h]@12
   int v30; // [sp+38h] [bp-24h]@12
   int v31; // [sp+38h] [bp-24h]@27
-  signed int v32; // [sp+3Ch] [bp-20h]@1
   int a3; // [sp+40h] [bp-1Ch]@12
   signed __int16 v34; // [sp+44h] [bp-18h]@14
   int v35; // [sp+48h] [bp-14h]@25
@@ -13165,37 +13140,33 @@
   signed int y; // [sp+54h] [bp-8h]@24
   signed int x; // [sp+58h] [bp-4h]@24
 
-  v32 = 0;
-  if ( (signed int)uNumLayingItems > 0 )
-  {
-    v0 = (char *)&pLayingItems[0].uSectorID;
-    do
-    {
-      if ( *((short *)v0 - 13) )
-      {
-        v1 = &pObjectList->pObjects[*((short *)v0 - 13)];
-        v25 = v1;
+  for (uint i = 0; i < uNumLayingItems; ++i)
+  {
+    auto p = pLayingItems + i;
+    if (p->uObjectDescID)
+    {
+      v1 = &pObjectList->pObjects[p->uObjectDescID];
         if ( !(v1->uFlags & 1) )
-        {
-          if ( ((v2 = *((short *)v0 - 14), v2 < 1000) || v2 >= 10000)
+         {
+          if ( ((v2 = p->uItemType, v2 < 1000) || v2 >= 10000)
             && (v2 < 500 || v2 >= 600)
             && (v2 < 811 || v2 >= 815)
-            || pGame->pStru6Instance->_4A81CA((LayingItem *)(v0 - 28)) )
-          {
-            a5 = *(short *)v0;
-            a1 = *((int *)v0 - 6);
-            a2 = *((int *)v0 - 5);
-            a3 = *((int *)v0 - 4);
+            || pGame->pStru6Instance->_4A81CA(p))
+          {
+            a5 = p->uSectorID;
+            a1 = p->vPosition.x;
+            a2 = p->vPosition.y;
+            a3 = p->vPosition.z;
             v3 = &pBillboardRenderList[uNumBillboardsToDraw];
-            v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, *((short *)v0 + 1));
+            v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, p->uSpriteFrameID);
             v5 = v4;
             v24 = v4;
             v30 = v4->uFlags;
-            a6 = v4->uGlowRadius * *((short *)v0 + 3);
+            a6 = v4->uGlowRadius * p->field_22;
             v6 = stru_5C6E00->Atan2(
-                   *((int *)v0 - 6) - pBLVRenderParams->vPartyPos.x,
-                   *((int *)v0 - 5) - pBLVRenderParams->vPartyPos.y);
-            LOWORD(v7) = *((short *)v0 - 3);
+                   p->vPosition.x - pBLVRenderParams->vPartyPos.x,
+                   p->vPosition.y - pBLVRenderParams->vPartyPos.y);
+            LOWORD(v7) = p->uFacing;
             v8 = v30;
             v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7;
             v10 = v5->pHwSpriteIDs[v9];
@@ -13225,10 +13196,10 @@
                 a3,
                 a5,
                 a6,
-                v25->uParticleTrailColorR,
-                v25->uParticleTrailColorG,
-                v25->uParticleTrailColorB,
-                v11);
+                v1->uParticleTrailColorR,
+                v1->uParticleTrailColorG,
+                v1->uParticleTrailColorB,
+                byte_4E94D3);
             }
             if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(
                    a1,
@@ -13244,7 +13215,7 @@
                 return;
               ++uNumBillboardsToDraw;
               ++uNumSpritesDrawnThisFrame;
-              *(v0 - 2) |= 1u;
+              p->uAttributes |= 1u;
               v12 = pRenderer->pRenderD3D == 0;
               v3->uPalette = v24->uPaletteIndex;
               v3->uIndoorSectorID = a5;
@@ -13258,33 +13229,27 @@
               }
               else
               {
-                v13 = &pGame->pIndoorCameraD3D;
-                v3->flt_8 = pGame->pIndoorCameraD3D->flt_D0;
-                v14 = (*v13)->flt_D4;
-                v15 = v3->flt_8;
-                v3->flt_C = v14;
-                v16 = v15 + 6.7553994e15;
-                LODWORD(v17) = 0;
-                HIDWORD(v17) = SLOWORD(v16);
-                v18 = v17 / x;
-                v3->field_0 = (unsigned __int64)(v24->scale * v17 / x) >> 16;
-                v31 = (unsigned __int64)(v24->scale * (signed __int64)v18) >> 16;
+                v3->fov_x = pGame->pIndoorCameraD3D->fov_x;
+                v3->fov_y = pGame->pIndoorCameraD3D->fov_y;
+                v18 = (int)floorf(v3->fov_x + 0.5f) / x;
+                v3->field_0 = (unsigned __int64)(v24->scale * (__int64)v18) >> 16;
+                v31 = (unsigned __int64)(v24->scale * (__int64)v18) >> 16;
               }
               HIWORD(v21) = HIWORD(x);
               v3->field_4 = v31;
               v3->field_1E = v34;
-              v3->field_20 = a1;
-              v3->field_22 = a2;
-              v3->field_24 = a3;
-              v3->field_26 = v36;
+              v3->some_x = a1;
+              v3->some_y = a2;
+              v3->some_z = a3;
+              v3->uScreenSpaceX = v36;
               v22 = v35;
-              v3->field_2C_prolly_tint = 0;
-              v3->field_28 = v22;
+              v3->uTintColor = 0;
+              v3->uScreenSpaceY = v22;
               LOWORD(v21) = 0;
-              v23 = 8 * v32;
-              LOBYTE(v23) = 8 * v32 | 2;
+              v23 = 8 * i;
+              LOBYTE(v23) = 8 * i | 2;
               v3->pSpriteFrame = v24;
-              v12 = (*(v0 - 2) & 0x20) == 0;
+              v12 = (p->uAttributes & 0x20) == 0;
               v3->sZValue = v21 + v23;
               if ( !v12 )
               {
@@ -13295,10 +13260,6 @@
           }
         }
       }
-      ++v32;
-      v0 += 112;
-    }
-    while ( v32 < (signed int)uNumLayingItems );
   }
 }
 
@@ -13319,7 +13280,10 @@
     if ( v3->uNumNonBSPFaces > 0 )
     {
       do
-        pStru170->_4B0EA8(v1, v3->pFaceIDs[v2++]);
+      {
+        Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]);
+        pStru170->PrepareFaceRenderList_d3d(v1, v3->pFaceIDs[v2++]);
+      }
       while ( v2 < v3->uNumNonBSPFaces );
     }
   }
@@ -13328,7 +13292,7 @@
     if ( v3->uNumNonBSPFaces > 0 )
     {
       do
-        pStru170->_4AFB86(v1, v3->pFaceIDs[v2++]);
+        pStru170->PrepareFaceRenderList_sw(v1, v3->pFaceIDs[v2++]);
       while ( v2 < v3->uNumNonBSPFaces );
     }
   }
@@ -13351,6 +13315,8 @@
   bool v11; // [sp+14h] [bp-8h]@5
   stru170_stru0 *v12; // [sp+18h] [bp-4h]@1
 
+  Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode);
+
   v10 = a1;
   v12 = &pStru170->field_FA8[a1];
   while ( 1 )
@@ -13373,15 +13339,18 @@
       sub_4406BC(v10, v6);
     v7 = v3->uCoplanarOffset;
     v8 = v7 + v3->uCoplanarSize;
+
+    Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]);
+    
     if ( pRenderer->pRenderD3D )
     {
       while ( v7 < v8 )
-        pStru170->_4B0EA8(v10, v2->pFaceIDs[v7++]);
+        pStru170->PrepareFaceRenderList_d3d(v10, v2->pFaceIDs[v7++]);
     }
     else
     {
       while ( v7 < v8 )
-        pStru170->_4AFB86(v10, v2->pFaceIDs[v7++]);
+        pStru170->PrepareFaceRenderList_sw(v10, v2->pFaceIDs[v7++]);
     }
     v9 = v11 ? v3->uFront : v3->uBack;
     if ( v9 == -1 )
@@ -13393,20 +13362,18 @@
 //----- (00440DF5) --------------------------------------------------------
 int stru167_wrap::Push(__int16 a2, __int16 a3, __int16 a4, int a5, __int16 bgr)
 {
-  stru167_wrap *v6; // esi@1
   int result; // eax@1
 
-  v6 = this;
-  v6->pElements[v6->uNumElements].field_6 = a2;
-  this->pElements[this->uNumElements].field_8 = a3;
-  this->pElements[this->uNumElements].field_A = a4;
-  v6->pElements[v6->uNumElements].field_C = rand() % 64 + 256;
-  v6->pElements[v6->uNumElements].field_E = v6->pElements[v6->uNumElements].field_C;
-  result = 3 * v6->uNumElements;
-  v6->pElements[v6->uNumElements++].bgr16 = bgr;
-  if ( v6->uNumElements >= 100 )
-    v6->uNumElements = 0;
-  return result;
+  pElements[uNumElements].field_6_rnd_value = a2;
+  pElements[uNumElements].field_8_rnd_value = a3;
+  pElements[uNumElements].field_A_rnd_value = a4;
+  pElements[uNumElements].field_C_time_left = rand() % 64 + 256;
+  pElements[uNumElements].field_E_time_to_live = pElements[uNumElements].field_C_time_left;
+  result = 3 * uNumElements;
+  pElements[uNumElements++].bgr16 = bgr;
+  if (uNumElements >= 100 )
+    uNumElements = 0;
+   return result;
 }
 
 //----- (00440E91) --------------------------------------------------------
@@ -13431,38 +13398,30 @@
 //----- (00440F07) --------------------------------------------------------
 void stru167_wrap::_440F07()
 {
-  char *v1; // esi@1
-  signed int v2; // edi@1
-
-  v1 = (char *)&this->pElements[0].field_6;
-  v2 = 100;
-  do
-  {
-    if ( *((short *)v1 + 3) > 0 )
-    {
-      *((short *)v1 + 2) += rand() % 5 + 4;
-      *(short *)v1 += rand() % 5 - 2;
-      *((short *)v1 + 1) += rand() % 5 - 2;
-      *((short *)v1 + 3) -= LOWORD(pEventTimer->uTimeElapsed);
-    }
-    v1 += 24;
-    --v2;
-  }
-  while ( v2 );
+  for (uint i = 0; i < 100; ++i)
+  {
+    if (pElements[i].field_C_time_left > 0)
+    {
+      pElements[i].field_A_rnd_value += rand() % 5 + 4;
+      pElements[i].field_6_rnd_value += rand() % 5 - 2;
+      pElements[i].field_8_rnd_value += rand() % 5 - 2;
+      pElements[i].field_C_time_left -= (short)pEventTimer->uTimeElapsed;
+    }
+  }
 }
 
 //----- (0044100D) --------------------------------------------------------
 bool __cdecl sub_44100D()
 {
-  return uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 4
-      || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 7
-      || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions > 12
-      && (uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions <= 14
-       || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions > 16
-       && (uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions <= 18
-        || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 23));
-}
-// 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
+  return pCurrentScreen == 4
+      || pCurrentScreen == 7
+      || pCurrentScreen > 12
+      && (pCurrentScreen <= 14
+       || pCurrentScreen > 16
+       && (pCurrentScreen <= 18
+        || pCurrentScreen == 23));
+}
+// 4E28F8: using guessed type int pCurrentScreen;
 
 //----- (00441498) --------------------------------------------------------
 void __cdecl GameUI_DrawTorchlightAndWizardEye()
@@ -13472,17 +13431,17 @@
   unsigned int v2; // eax@19
   IconFrame *v3; // eax@19
 
-  if ( !uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 1
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 2
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 5
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 8
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 10
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 11
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 12
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 15
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 3
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 19 )
+  if ( !pCurrentScreen
+    || pCurrentScreen == 1
+    || pCurrentScreen == 2
+    || pCurrentScreen == 5
+    || pCurrentScreen == 8
+    || pCurrentScreen == 10
+    || pCurrentScreen == 11
+    || pCurrentScreen == 12
+    || pCurrentScreen == 15
+    || pCurrentScreen == 3
+    || pCurrentScreen == 19 )
   {
     if ( SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) >= 0
       && (SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[16].uExpireTime)) )
@@ -13506,19 +13465,18 @@
     }
   }
 }
-// 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
+// 4E28F8: using guessed type int pCurrentScreen;
 
 //----- (0044158F) --------------------------------------------------------
 void __cdecl GameUI_DrawCharacterSelectionFrame()
 {
   if ( uActiveCharacter )
     pRenderer->DrawTextureTransparent(
-      pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing__negindex[uActiveCharacter] - 9,
+      pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9,
       0x17Cu,
       &pIcons_LOD->pTextures[dword_50C98C]);
 }
-// 4ED746: using guessed type __int16 pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing__negindex[];
-// 50C98C: using guessed type int dword_50C98C;
+
 
 //----- (004415C5) --------------------------------------------------------
 void __cdecl Load_isn_spells_21_27()
@@ -13564,8 +13522,8 @@
       pRenderer->_4A65CC(
         pPartySpellbuffsUI_XYs[v1][0],
         pPartySpellbuffsUI_XYs[v1][1],
-        (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0),
-        (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0),
+        (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0),
+        (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0),
         v0 + 20 * pPartySpellbuffsUI_smthns[v1],
         0,
         63);
@@ -13573,8 +13531,8 @@
     ++v1;
   }
   while ( v1 < 14 );
-  if ( !uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions
-    || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 4 )
+  if ( !pCurrentScreen
+    || pCurrentScreen == 4 )
   {
     if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 )
     {
@@ -13687,17 +13645,17 @@
             v11 = *((int *)v3 + 1);
             v13 = v6->scale;
             v13 = (unsigned __int64)(v11 * (signed __int64)v13) >> 16;
-            v10.field_8 = *((short *)v3 - 2);
-            v10.field_C = *((short *)v3 - 1);
+            v10.uScreenSpaceX = *((short *)v3 - 2);
+            v10.uScreenSpaceY = *((short *)v3 - 1);
             v10.field_10 = v13;
             v10.field_14 = v13;
             v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v6->uPaletteIndex, 0, 1);
             v8 = *((short *)v3 - 5);
-            v10.field_28 = 0;
+            v10.sZValue = 0;
             v10.uFlags = 0;
             v9 = pOverlayList->pOverlays[v8].uOverlayType;
             if ( !v9 || v9 == 2 )
-              v10.field_C += pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]].uHeight >> 1;
+              v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]].uHeight >> 1;
             result = pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]]._4AD2D1(&v10, 0);
             ++v12;
             if ( v12 == 5 )
@@ -13715,28 +13673,23 @@
 
 
 //----- (00441D38) --------------------------------------------------------
-void __fastcall GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int flags)
-{
-  int v6; // ebx@6
-  BLVFace *v7; // eax@8
-  unsigned int *v8; // edi@9
-  unsigned int v9; // edx@9
-  unsigned int v10; // ebx@10
+void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int flags)
+{
+  int uHeight; // ebx@6
+  //unsigned int v9; // edx@9
+  //unsigned int v10; // ebx@10
   __int16 v11; // cx@11
-  int v12; // ecx@17
-  unsigned int v13; // ecx@21
+  //BLVFace *v12; // ecx@17
+  //unsigned int v13; // ecx@21
   unsigned int v14; // ebx@23
   int v15; // eax@23
-  unsigned int *v16; // ecx@28
+  //unsigned int *v16; // ecx@28
   __int16 v17; // di@30
   double v18; // st7@30
   float v19; // ST38_4@30
   double v20; // st7@30
   double v21; // st6@30
   double v22; // st5@33
-  float v23; // ST3C_4@37
-  double v24; // ST20_8@37
-  double v25; // ST20_8@37
   unsigned __int16 *v26; // edx@37
   signed int v27; // eax@37
   unsigned __int16 *v28; // ecx@37
@@ -13786,30 +13739,23 @@
   signed int uBluea; // [sp+28h] [bp-2Ch]@37
   int v73; // [sp+2Ch] [bp-28h]@30
   unsigned __int8 *v74; // [sp+30h] [bp-24h]@30
-  signed int v75; // [sp+34h] [bp-20h]@4
   int v76; // [sp+34h] [bp-20h]@91
   int v77; // [sp+34h] [bp-20h]@108
   signed int v78; // [sp+38h] [bp-1Ch]@37
   int v79; // [sp+38h] [bp-1Ch]@72
-  bool v80; // [sp+3Ch] [bp-18h]@2
-  unsigned int a2; // [sp+40h] [bp-14h]@1
-  int a2a; // [sp+40h] [bp-14h]@8
   signed int a2b; // [sp+40h] [bp-14h]@41
   char *a2c; // [sp+40h] [bp-14h]@68
-  unsigned int a3; // [sp+44h] [bp-10h]@1
   int a3a; // [sp+44h] [bp-10h]@40
-  signed int uHeight; // [sp+48h] [bp-Ch]@1
-  signed int uWidth; // [sp+4Ch] [bp-8h]@1
-  signed int uZa; // [sp+5Ch] [bp+8h]@7
-  signed int uZb; // [sp+5Ch] [bp+8h]@27
-  signed int uZc; // [sp+5Ch] [bp+8h]@30
+  signed int uCenterY; // [sp+48h] [bp-Ch]@1
+  signed int uCenterX; // [sp+4Ch] [bp-8h]@1
+  //signed int uZb; // [sp+5Ch] [bp+8h]@27
+  signed int uWidth; // [sp+5Ch] [bp+8h]@30
   signed int uZd; // [sp+5Ch] [bp+8h]@45
   signed int uZe; // [sp+5Ch] [bp+8h]@67
   signed int uZf; // [sp+5Ch] [bp+8h]@85
   signed int uZg; // [sp+5Ch] [bp+8h]@105
   unsigned int uWa; // [sp+60h] [bp+Ch]@23
   float uWb; // [sp+60h] [bp+Ch]@30
-  float uWe; // [sp+60h] [bp+Ch]@37
   unsigned __int16 *uWc; // [sp+60h] [bp+Ch]@37
   unsigned int uWd; // [sp+60h] [bp+Ch]@95
   float uZooma; // [sp+64h] [bp+10h]@117
@@ -13818,25 +13764,26 @@
   char *flagsc; // [sp+68h] [bp+14h]@86
   unsigned int flagsd; // [sp+68h] [bp+14h]@105
 
-  a3 = uY;
-  a2 = uX;
-  uWidth = (signed int)(uX + uZ) >> 1;
-  uHeight = (signed int)(uY + uW) >> 1;
+  //a3 = uY;
+  //a2 = uX;
+  uCenterX = (uX + uZ) / 2;
+  uCenterY = (uY + uW) / 2;
   lPitch = pRenderer->uTargetSurfacePitch;
   GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0);
   uBlue = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu);
-  v80 = (signed __int64)pParty->pPartyBuffs[19].uExpireTime > 0;
-  v75 = pParty->pPartyBuffs[19].uSkill;
-  if ( CheckHiredNPCSpeciality(0x26u) )
-  {
-    v80 = 1;
-    v75 = 2;
-  }
-  pRenderer->Clip_v2(a2, a3, uZ - 1, uW - 1);
-  v6 = uW - a3;
+  auto bWizardEyeActive = pParty->WizardEyeActive();
+  auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel();
+  if (CheckHiredNPCSpeciality(0x26u))
+  {
+    bWizardEyeActive = true;
+    uWizardEyeSkillLevel = 2;
+  }
+  pRenderer->Clip_v2(uX, uY, uZ - 1, uW - 1);
+  uHeight = uW - uY;
+  uWidth = uZ - uX;
+
   if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
   {
-    uZc = uZ - a2;
     v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2;
     v74 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0;
     v62 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
@@ -13844,58 +13791,58 @@
     v18 = (double)(1 << (16 - v17));
     v19 = v18;
     v20 = (double)(pParty->vPosition.x + 32768) / v18;
-    v21 = (double)(32768 - pParty->vPosition.z) / v19;
+    v21 = (double)(32768 - pParty->vPosition.y) / v19;
     uWb = v21;
     if ( uZoom == 512 )
     {
-      v20 = v20 - (double)(uZc / 2);
-      v22 = (double)(v6 / 2);
+      v20 = v20 - (double)(uWidth / 2);
+      v22 = (double)(uHeight / 2);
     }
     else
     {
       if ( uZoom == 1024 )
       {
-        v20 = v20 - (double)(uZc / 4);
-        v22 = (double)(v6 / 4);
+        v20 = v20 - (double)(uWidth / 4);
+        v22 = (double)(uHeight / 4);
       }
       else
       {
         if ( uZoom != 2048 )
           goto LABEL_37;
-        v20 = v20 - (double)(uZc / 8);
-        v22 = (double)(v6 / 8);
+        v20 = v20 - (double)(uWidth / 8);
+        v22 = (double)(uHeight / 8);
       }
     }
     uWb = v21 - v22;
 LABEL_37:
-    v23 = v20 * 65536.0;
-    v24 = v23 + 6.7553994e15;
-    v70 = LODWORD(v24);
-    uWe = uWb * 65536.0;
-    v25 = uWe + 6.7553994e15;
+    //v23 = v20 * 65536.0;
+    //v24 = v23 + 6.7553994e15;
+    v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24);
+    //uWe = uWb * 65536.0;
+    //v25 = uWe + 6.7553994e15;
     v78 = v70;
-    uBluea = LODWORD(v25);
+    uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25);
     v26 = (unsigned __int16 *)_56EFD8_minimap;
-    v27 = SLODWORD(v25) >> 16;
+    v27 = uBluea >> 16;
     uWc = (unsigned __int16 *)_56EFD8_minimap;
-    v28 = &pRenderer->pTargetSurface[a2 + a3 * lPitch];
+    v28 = &pRenderer->pTargetSurface[uX + uY * lPitch];
     if ( flags )
     {
       if ( v74 )
       {
         v64 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
-        if ( v6 > 0 )
-        {
-          a3a = v6;
+        if ( uHeight > 0 )
+        {
+          a3a = uHeight;
           v29 = v70 >> 16;
           do
           {
             a2b = 0;
-            if ( uZc > 0 )
+            if ( uWidth > 0 )
             {
               v30 = (int)&v74[v27 * v64];
-              flagsa = uZc;
-              a2b = uZc;
+              flagsa = uWidth;
+              a2b = uWidth;
               do
               {
                 v31 = uWc;
@@ -13935,102 +13882,89 @@
     }
     while ( uZd );
     uNumBlueFacesInBLVMinimap = 0;
-    goto LABEL_50;
-  }
-  pRenderer->FillRect2(v6, a2, a3, uZ - a2, v6, 0xFu);
-  uNumBlueFacesInBLVMinimap = 0;
-  uZa = 0;
-  if ( (signed int)pIndoor->pMapVertices->uNumVertices > 0 )
-  {
-    a2a = 0;
-    v7 = pIndoor->pFaces;
-    while ( 1 )
-    {
-      v8 = (uint *)&pIndoor->pMapVertices->pVertices[a2a];
-      v9 = v7[LOWORD(pIndoor->pMapVertices[a2a + 2])].uAttributes;
-      if ( !(BYTE1(v9) & 0x20) )
-      {
-        v10 = v7[HIWORD(pIndoor->pMapVertices[a2a + 2])].uAttributes;
-        if ( !(BYTE1(v10) & 0x20) )
-        {
-          v11 = HIWORD(pIndoor->pMapVertices[a2a + 3]);
-          if ( v11 & 1 )
-            goto LABEL_15;
-          if ( (v9 & 0x80u) != 0 || (v10 & 0x80u) != 0 )
-            break;
-        }
-      }
-LABEL_26:
-      ++uZa;
-      a2a += 3;
-      if ( uZa >= (signed int)pIndoor->pMapVertices->uNumVertices )
-        goto LABEL_27;
-    }
-    HIWORD(pIndoor->pMapVertices[a2a + 3]) = v11 | 1;
-    pIndoor->_visible_outlines[uZa >> 3] |= 1 << (7 - uZa % 8);
-    v7 = pIndoor->pFaces;
+  }
+  else
+  {
+    pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF);
+    uNumBlueFacesInBLVMinimap = 0;
+
+    for (uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i)
+    {
+      auto pOutline = &pIndoor->pMapOutlines->pOutlines[i];
+
+      auto pFace1 = pIndoor->pFaces + pOutline->uFace1ID;
+      auto pFace2 = pIndoor->pFaces + pOutline->uFace2ID;
+      //v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes;
+        //v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes;
+      if (pFace1->Visible() && pFace2->Visible())
+      {
+        v11 = pOutline->uFlags;
+        if ( v11 & 1 )
+          goto LABEL_15;
+        if (pFace1->uAttributes & 0x80 || pFace2->uAttributes & 0x80u != 0 )
+          goto LABEL_ABC;
+
+      }
+      continue;
+
+LABEL_ABC:
+    pOutline->uFlags = v11 | 1;
+    pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8);
+
 LABEL_15:
-    if ( v80
-      && v75 >= 3
-      && ((v12 = (int)&v7[*((short *)v8 + 2)], *(int *)(v12 + 44) & 0x2000000)
-       || v7[*((short *)v8 + 3)].uAttributes & 0x2000000)
-      && (pIndoor->pFaceExtras[*(short *)(v12 + 72)].uEventID
-       || pIndoor->pFaceExtras[v7[*((short *)v8 + 3)].uFaceExtraID].uEventID)
-      && (v13 = uNumBlueFacesInBLVMinimap, (signed int)uNumBlueFacesInBLVMinimap < 49) )
-    {
-      pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap] = uZa;
-      uNumBlueFacesInBLVMinimap = v13 + 1;
-    }
-    else
-    {
-      v69 = uWidth
-          + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
-                                                           * (signed __int64)pIndoor->pVertices[*(short *)v8].x) >> 16) << 16)
-                        - uZoom * pParty->vPosition.x) >> 16);
-      lPitcha = uHeight
-              - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
-                                                               * (signed __int64)pIndoor->pVertices[*(short *)v8].y) >> 16) << 16)
-                            - uZoom * pParty->vPosition.z) >> 16);
-      uWa = uWidth
-          + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
-                                                           * (signed __int64)pIndoor->pVertices[*((short *)v8 + 1)].x) >> 16) << 16)
-                        - uZoom * pParty->vPosition.x) >> 16);
-      v14 = uHeight
-          - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
-                                                           * (signed __int64)pIndoor->pVertices[*((short *)v8 + 1)].y) >> 16) << 16)
-                        - uZoom * pParty->vPosition.z) >> 16);
-      v15 = abs(*((short *)v8 + 4) - pParty->vPosition.y) / 8;
+    //v12 = &pIndoor->pFaces[pOutline->uFace1ID];
+    if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 &&
+        (pFace1->uAttributes & 0x2000000 || pFace2->uAttributes & 0x2000000) &&
+        (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID))
+    {
+      if (uNumBlueFacesInBLVMinimap < 49)
+        pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i;
+    }
+    else
+    {
+      auto _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x);
+      auto _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16);
+      auto _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16);
+      v69 =     uCenterX + _c;
+      v69 =     uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
+      lPitcha = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
+      uWa =     uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
+      v14 =     uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
+      v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8;
       if ( v15 > 100 )
         v15 = 100;
-      pRenderer->FillRect(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]);
-      v7 = pIndoor->pFaces;
-    }
-    goto LABEL_26;
-  }
-LABEL_27:
-  for ( uZb = 0; uZb < (signed int)uNumBlueFacesInBLVMinimap; ++uZb )
-  {
-    v16 = (uint *)&pIndoor->pMapVertices->pVertices[3 * pBlueFacesInBLVMinimapIDs[uZb]];
-    pRenderer->FillRect(
-      uWidth
+      pRenderer->Line2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]);
+    }
+  }
+
+
+  for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i)
+  {
+    //v16 = (uint *)&pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]];
+    auto pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]];
+    pRenderer->Line2D(
+      uCenterX
     + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
-                                                     * (signed __int64)pIndoor->pVertices[*(short *)v16].x) >> 16) << 16)
+                                                     * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16)
                   - uZoom * pParty->vPosition.x) >> 16),
-      uHeight
+      uCenterY
     - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
-                                                     * (signed __int64)pIndoor->pVertices[*(short *)v16].y) >> 16) << 16)
-                  - uZoom * pParty->vPosition.z) >> 16),
-      uWidth
+                                                     * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16)
+                  - uZoom * pParty->vPosition.y) >> 16),
+      uCenterX
     + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
-                                                     * (signed __int64)pIndoor->pVertices[HIWORD(pIndoor->pMapVertices[3 * pBlueFacesInBLVMinimapIDs[uZb] + 1])].x) >> 16) << 16)
+                                                     * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16)
                   - uZoom * pParty->vPosition.x) >> 16),
-      uHeight
+      uCenterY
     - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
-                                                     * (signed __int64)pIndoor->pVertices[HIWORD(pIndoor->pMapVertices[3 * pBlueFacesInBLVMinimapIDs[uZb] + 1])].y) >> 16) << 16)
-                  - uZoom * pParty->vPosition.z) >> 16),
+                                                     * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16)
+                  - uZoom * pParty->vPosition.y) >> 16),
       uBlue);
   }
-LABEL_50:
+  }
+
+
+//_draw_party_arrow:
   v33 = 0;
   v34 = pParty->sRotationY & stru_5C6E00->uDoublePiMask;
   v35 = 0;
@@ -14082,27 +14016,28 @@
   v35 = v57;
 LABEL_66:
   pRenderer->DrawTextureTransparent(
-    uWidth - 3,
-    uHeight - 3,
+    uCenterX - 3,
+    uCenterY - 3,
     (Texture *)(pTextureIDs_pMapDirs[v35] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v35]] : 0));
   v36 = 255;
   flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu);
   v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
-  if ( v80 )
+  if ( bWizardEyeActive )
   {
     uZe = 0;
-    if ( (signed int)uNumLayingItems > 0 )
+    //for (uint i = 0; i < uNumLayingItems; ++i)
+    if (uNumLayingItems > 0)
     {
       a2c = (char *)&pLayingItems[0].uObjectDescID;
       while ( 1 )
       {
         if ( !*((short *)a2c - 1)
           || !*(short *)a2c
-          || v75 == 1
+          || uWizardEyeSkillLevel == 1
           || (v37 = ((unsigned __int64)((*(int *)(a2c + 2) - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16)
-                  + uWidth,
-              v79 = (unsigned __int64)((*(int *)(a2c + 6) - pParty->vPosition.z) * (signed __int64)(signed int)uZoom) >> 16,
-              v38 = uHeight - v79,
+                  + uCenterX,
+              v79 = (unsigned __int64)((*(int *)(a2c + 6) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16,
+              v38 = uCenterY - v79,
               v37 < pRenderer->field_1C_clipx)
           || v37 > pRenderer->field_24_clipz
           || v38 < pRenderer->field_20_clipy
@@ -14112,22 +14047,22 @@
           break;
         if ( (signed int)uZoom > 512 )
         {
-          pRenderer->FillRect(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb);
-          pRenderer->FillRect(v37, v38 - 2, v37, v38 + 1, flagsb);
-          pRenderer->FillRect(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb);
-          pRenderer->FillRect(v37 - 2, v38, v37 - 2, v38 + 1, flagsb);
+          pRenderer->Line2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb);
+          pRenderer->Line2D(v37, v38 - 2, v37, v38 + 1, flagsb);
+          pRenderer->Line2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb);
+          pRenderer->Line2D(v37 - 2, v38, v37 - 2, v38 + 1, flagsb);
           v37 += 2;
           v58 = flagsb;
           v55 = v38 + 1;
           goto LABEL_81;
         }
-        pRenderer->FillRect(v37 - 1, v38 - 1, v37 - 1, uHeight - v79, flagsb);
+        pRenderer->Line2D(v37 - 1, v38 - 1, v37 - 1, uCenterY - v79, flagsb);
         v58 = flagsb;
-        v55 = uHeight - v79;
+        v55 = uCenterY - v79;
         v53 = v37;
         v51 = v38 - 1;
 LABEL_82:
-        pRenderer->FillRect(v37, v51, v53, v55, v58);
+        pRenderer->Line2D(v37, v51, v53, v55, v58);
 LABEL_83:
         ++uZe;
         a2c += 112;
@@ -14139,10 +14074,10 @@
         }
       }
       v58 = v60;
-      v55 = uHeight - v79;
+      v55 = uCenterY - v79;
 LABEL_81:
       v53 = v37;
-      v51 = uHeight - v79;
+      v51 = uCenterY - v79;
       goto LABEL_82;
     }
 LABEL_85:
@@ -14160,10 +14095,10 @@
         {
           v40 = ((unsigned __int64)(((signed int)*((short *)flagsc - 17) - pParty->vPosition.x)
                                   * (signed __int64)(signed int)uZoom) >> 16)
-              + uWidth;
-          v76 = (unsigned __int64)(((signed int)*((short *)flagsc - 16) - pParty->vPosition.z)
+              + uCenterX;
+          v76 = (unsigned __int64)(((signed int)*((short *)flagsc - 16) - pParty->vPosition.y)
                                  * (signed __int64)(signed int)uZoom) >> 16;
-          v41 = uHeight - v76;
+          v41 = uCenterY - v76;
           if ( v40 >= pRenderer->field_1C_clipx )
           {
             if ( v40 <= pRenderer->field_24_clipz && v41 >= pRenderer->field_20_clipy && v41 <= pRenderer->field_28_clipw )
@@ -14175,13 +14110,13 @@
                 uWd = v65;
               if ( (signed int)uZoom > 1024 )
               {
-                pRenderer->FillRect(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd);
-                pRenderer->FillRect(v40, v41 - 2, v40, v41 + 2, uWd);
-                pRenderer->FillRect(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd);
+                pRenderer->Line2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd);
+                pRenderer->Line2D(v40, v41 - 2, v40, v41 + 2, uWd);
+                pRenderer->Line2D(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd);
                 v42 = v41 + 1;
                 v43 = v41 - 1;
                 v44 = v42;
-                pRenderer->FillRect(v40 - 2, v43, v40 - 2, v42, uWd);
+                pRenderer->Line2D(v40 - 2, v43, v40 - 2, v42, uWd);
                 v40 += 2;
                 v59 = uWd;
                 v56 = v44;
@@ -14190,13 +14125,13 @@
               }
               else
               {
-                pRenderer->FillRect(v40 - 1, v41 - 1, v40 - 1, uHeight - v76, uWd);
+                pRenderer->Line2D(v40 - 1, v41 - 1, v40 - 1, uCenterY - v76, uWd);
                 v59 = uWd;
-                v56 = uHeight - v76;
+                v56 = uCenterY - v76;
                 v54 = v40;
                 v52 = v41 - 1;
               }
-              pRenderer->FillRect(v40, v52, v54, v56, v59);
+              pRenderer->Line2D(v40, v52, v54, v56, v59);
             }
           }
         }
@@ -14219,9 +14154,9 @@
       if ( *(v45 - 2) & 8 )
       {
         v46 = ((unsigned __int64)((*(int *)v45 - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16)
-            + uWidth;
-        v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.z) * (signed __int64)(signed int)uZoom) >> 16;
-        v47 = uHeight - v77;
+            + uCenterX;
+        v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16;
+        v47 = uCenterY - v77;
         if ( v46 >= pRenderer->field_1C_clipx )
         {
           if ( v46 <= pRenderer->field_24_clipz && v47 >= pRenderer->field_20_clipy && v47 <= pRenderer->field_28_clipw )
@@ -14230,14 +14165,14 @@
             {
               v48 = v47 + 1;
               v49 = v47 - 1;
-              pRenderer->FillRect(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd);
-              pRenderer->FillRect(v46, v49, v46, v48, flagsd);
-              pRenderer->FillRect(v46 + 1, v49, v46 + 1, v48, flagsd);
+              pRenderer->Line2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd);
+              pRenderer->Line2D(v46, v49, v46, v48, flagsd);
+              pRenderer->Line2D(v46 + 1, v49, v46 + 1, v48, flagsd);
               v45 = lPitchb;
             }
             else
             {
-              pRenderer->FillRect(v46, uHeight - v77, v46, uHeight - v77, flagsd);
+              pRenderer->Line2D(v46, uCenterY - v77, v46, uCenterY - v77, flagsd);
             }
           }
         }
@@ -14252,14 +14187,14 @@
   pRenderer->DrawTextureTransparent(
     0x1D4u,
     v33,
-    (Texture *)(dword_5079D8 != -1 ? (int)&pIcons_LOD->pTextures[dword_5079D8] : 0));
+    (Texture *)(dword_5079D8 != -1 ? &pIcons_LOD->pTextures[dword_5079D8] : 0));
   uZooma = (double)pParty->sRotationY * 0.1171875;
   v50 = uZooma + 6.7553994e15;
   pRenderer->Clip(0x21Du, v33, 0x237u, 0x1E0u);
   pRenderer->DrawTextureIndexed(
     LODWORD(v50) + 285,
     0x88u,
-    (Texture *)(dword_5079B4 != -1 ? (int)&pIcons_LOD->pTextures[dword_5079B4] : 0));
+    (Texture *)(dword_5079B4 != -1 ? &pIcons_LOD->pTextures[dword_5079B4] : 0));
   pRenderer->ResetClip();
 }
 
@@ -14481,10 +14416,10 @@
 LABEL_8:
   black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0);
   teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu);
-  v7 = (uint *)pIndoor->pMapVertices;
+  v7 = (uint *)pIndoor->pMapOutlines;
   uNumBlueFacesInBLVMinimap = 0;
-  v8 = pIndoor->pMapVertices->uNumVertices == 0;
-  v9 = (pIndoor->pMapVertices->uNumVertices & 0x80000000u) != 0;
+  v8 = pIndoor->pMapOutlines->uNumOutlines == 0;
+  v9 = (pIndoor->pMapOutlines->uNumOutlines & 0x80000000u) != 0;
   v94 = 0;
   if ( !(v9 | v8) )
   {
@@ -14521,13 +14456,13 @@
       v87 = (unsigned __int64)((signed int)v92 * (signed __int64)v5) >> 16;
       v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16);
       v92 = (unsigned __int64)(v20 * (signed __int64)v5) >> 16;
-      pRenderer->FillRect(
+      pRenderer->Line2D(
         v85 + v88,
         v90 - v87,
         v85 + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16),
         v90 - v92,
         black);
-      v7 = (uint *)pIndoor->pMapVertices;
+      v7 = (uint *)pIndoor->pMapOutlines;
 LABEL_17:
       ++v94;
       i += 12;
@@ -14555,7 +14490,7 @@
       v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16;
       i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16;
       v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16;
-      pRenderer->FillRect(
+      pRenderer->Line2D(
         v85 + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16),
         v90 - v88,
         v85 + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16),
@@ -14564,14 +14499,14 @@
       ++v21;
       if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap )
         break;
-      v7 = (uint *)pIndoor->pMapVertices;
+      v7 = (uint *)pIndoor->pMapOutlines;
     }
     v6 = v86;
   }
 LABEL_38:
   v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 3;
-  v81 = pParty->vPosition.z - v84;
-  v97 = (const void *)((unsigned __int64)((pParty->vPosition.z - v84) * (signed __int64)v5) >> 16);
+  v81 = pParty->vPosition.y - v84;
+  v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16);
   v48 = 1;
   v49 = v90 - (int)v97 - 3;
   if ( v47 >= (signed int)x_ )
@@ -14686,8 +14621,8 @@
             {
               v96 = v55 + 1;
               black = v55 - 1;
-              pRenderer->FillRect(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86);
-              pRenderer->FillRect(v54, black, v54, v96, v86);
+              pRenderer->Line2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86);
+              pRenderer->Line2D(v54, black, v54, v96, v86);
               ++v54;
               v74 = v86;
               v72 = v96;
@@ -14700,7 +14635,7 @@
               v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + v85;
               v70 = v90 - (int)v97;
             }
-            pRenderer->FillRect(v54, v70, v71, v72, v74);
+            pRenderer->Line2D(v54, v70, v71, v72, v74);
           }
         }
       }
@@ -14835,7 +14770,7 @@
   if ( v1 < 384 )
     this->field_2C = 384;
   this->sPartyPosX = pParty->vPosition.x;
-  this->sPartyPosZ = pParty->vPosition.z;
+  this->sPartyPosZ = pParty->vPosition.y;
   return _4432E7();
 }
 
@@ -14853,7 +14788,7 @@
   if ( v1 > v2 )
     this->field_2C = v2;
   this->sPartyPosX = pParty->vPosition.x;
-  this->sPartyPosZ = pParty->vPosition.z;
+  this->sPartyPosZ = pParty->vPosition.y;
   return _4432E7();
 }
 
@@ -14937,11 +14872,11 @@
     v14 = 0x40000000u;
     v17 = 0xC0000000u;
     v15 = 0xC0000000u;
-    if ( (signed int)pIndoor->pMapVertices->uNumVertices > 0 )
-    {
-      v2 = (__int16 *)(pIndoor->pMapVertices->pVertices);
-      v11 = pIndoor->pMapVertices->uNumVertices;
-      v12 = (uint *)pIndoor->pMapVertices->pVertices;
+    if ( (signed int)pIndoor->pMapOutlines->uNumOutlines > 0 )
+    {
+      v2 = (__int16 *)(pIndoor->pMapOutlines->pOutlines);
+      v11 = pIndoor->pMapOutlines->uNumOutlines;
+      v12 = (uint *)pIndoor->pMapOutlines->pOutlines;
       do
       {
         v3 = &pIndoor->pVertices[*v2];
@@ -15666,7 +15601,7 @@
   int pX; // [sp+28h] [bp-4h]@1
 
   v24 = pParty->vPosition.x;
-  v0 = pParty->vPosition.z;
+  v0 = pParty->vPosition.y;
   v1 = pOutdoor->uNumBModels;
   *(float *)&v23 = (double)(signed int)viewparams->uMinimapZoom * 0.000015258789;
   v2 = 0;
@@ -15711,13 +15646,13 @@
             v13 = v12->sCogTriggeredID;
             if ( v13 )
             {
-              if ( !(BYTE2(v12->uFaceAttributes) & 0x10) )
+              if ( !(BYTE2(v12->uAttributes) & 0x10) )
               {
                 v14 = _444732_GetEventHintString(v13);
                 v15 = v14;
                 if ( v14 )
                 {
-                  if ( _strcmpi(v14, nullstring) )
+                  if ( _strcmpi(v14, "") )
                     v21 = (char *)v15;
                 }
               }
@@ -15812,13 +15747,13 @@
             v12 = v11->sCogTriggeredID;
             if ( v12 )
             {
-              if ( !(BYTE2(v11->uFaceAttributes) & 0x10) )
+              if ( !(BYTE2(v11->uAttributes) & 0x10) )
               {
                 v13 = _444732_GetEventHintString(v12);
                 v14 = v13;
                 if ( v13 )
                 {
-                  if ( _strcmpi(v13, nullstring) )
+                  if ( _strcmpi(v13, "") )
                     v17 = v14;
                 }
               }
@@ -15910,12 +15845,12 @@
       v1 = pTmpBuf;
       goto LABEL_12;
     }
-    v1 = nullstring;
+    v1 = "";
   }
   if ( !v1 )
   {
     MessageBoxW(nullptr, L"No transition text found!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1410", 0);
-    v1 = nullstring;
+    v1 = "";
   }
 LABEL_12:
   v7 = 3;
@@ -16000,7 +15935,7 @@
 
   memcpy(&v7, pGUIWindow0, sizeof(v7));
   v9 = pMapStats->GetMapInfo(pCurrentMapName);
-  pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.z, pDestinationMapName, 20);
+  pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20);
   v0 = pMapStats->GetMapInfo(pDestinationMapName);
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
   pRenderer->DrawTextureTransparent(0x1D4u, 0,
@@ -16127,10 +16062,10 @@
     dword_5C341C = v3;
     _591094_decoration = _5C3420_pDecoration;
     pGUIWindow2 = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)19, a4, 0);
-    pGUIWindow2->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, nullstring, 0);
-    pGUIWindow2->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, nullstring, 0);
-    pGUIWindow2->CreateButton(292u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, nullstring, 0);
-    pGUIWindow2->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, nullstring, 0);
+    pGUIWindow2->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
+    pGUIWindow2->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
+    pGUIWindow2->CreateButton(292u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
+    pGUIWindow2->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
   }
 }
 
@@ -16383,8 +16318,8 @@
   v52.uFrameX = 483;
   v52.uFrameWidth = 148;
   v52.uFrameZ = 334;
-  for ( pOutString = (GUIFont *)v52.field_38;
-        (signed int)pOutString < v52.field_38 + v52.field_28;
+  for ( pOutString = (GUIFont *)v52.pStartingPosActiveItem;
+        (signed int)pOutString < v52.pStartingPosActiveItem + v52.pNumPresenceButton;
         pOutString = (GUIFont *)((char *)pOutString + 1) )
   {
     v14 = v52.GetControl((unsigned int)pOutString);
@@ -16454,7 +16389,7 @@
         v24 = (&dword_721660)[8 * v23];
         if ( !v24 )
         {
-          v24 = nullstring;
+          v24 = "";
           v15->uControlParam = 0;
         }
         goto LABEL_79;
@@ -16498,7 +16433,7 @@
           goto LABEL_63;
         }
 LABEL_71:
-        v24 = nullstring;
+        v24 = "";
         goto LABEL_79;
       }
       if ( v0->uFlags & 0x80 )
@@ -16511,7 +16446,7 @@
       pInString = 0;
       if ( (signed int)uNumActors > 0 )
       {
-        v55 = &pActors[0].uAIState;
+        v55 = (unsigned short *)&pActors[0].uAIState;
         *(int *)v54 = uNumActors;
         do
         {
@@ -16533,8 +16468,8 @@
   v33 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
   v34 = pDialogueWindow;
   *(int *)v54 = v33;
-  v35 = pDialogueWindow->field_38;
-  for ( i = v35 + pDialogueWindow->field_28; v35 < i; i = pDialogueWindow->field_28 + pDialogueWindow->field_38 )
+  v35 = pDialogueWindow->pStartingPosActiveItem;
+  for ( i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
   {
     v37 = v34->GetControl(v35);
     if ( !v37 )
@@ -16547,7 +16482,7 @@
     v32 += v38;
     ++v35;
   }
-  v39 = v34->field_28;
+  v39 = v34->pNumPresenceButton;
   if ( v39 )
   {
     pOutString = (GUIFont *)((174 - v32) / v39);
@@ -16555,7 +16490,7 @@
       pOutString = (GUIFont *)32;
     v55 = (unsigned __int16 *)1;
     v40 = 174 - (int)pOutString * v39 - v32;
-    v41 = v34->field_38;
+    v41 = v34->pStartingPosActiveItem;
     v42 = v40 / 2 - (signed int)pOutString / 2 + 138;
     if ( (signed int)v41 < (signed int)(v41 + v39) )
     {
@@ -16573,14 +16508,14 @@
         v42 = v45 + v44 - 1;
         v43->uW = v42;
         v47 = v54[0];
-        if ( (unsigned __int16 *)pDialogueWindow->field_2C_focus_id != v46 )
+        if ( (unsigned __int16 *)pDialogueWindow->pCurrentPosActiveItem != v46 )
           v47 = (unsigned __int16)pInString;
         v52.DrawText2(pFontArrus, 0, v45, v47, Str, 3u);
         v34 = pDialogueWindow;
         v55 = (unsigned __int16 *)((char *)v55 + 1);
         ++v41;
       }
-      while ( (signed int)v41 < pDialogueWindow->field_28 + pDialogueWindow->field_38 );
+      while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
     }
   }
   pRenderer->DrawTextureIndexed(
@@ -17208,7 +17143,7 @@
   {
     //v5 = pSomeEVT;
     //v6 = v123;
-    //v7 = nullstring;
+    //v7 = "";
     //while ( 1 )
     //{
       if ( dword_5B65C4 )
@@ -17238,7 +17173,7 @@
             pVideoPlayer->field_40 = 0;
             if (pAsyncMouse)
               pAsyncMouse->Suspend();
-            v128 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
+            v128 = pCurrentScreen;
             //v13 = &pSomeEVT[v9];
             //v14 = (unsigned __int8)v13[5];
             //v15 = (unsigned __int8)v13[6];
@@ -17271,7 +17206,7 @@
 LABEL_28:
             if ( !v15 || v128 == 3 )
             {
-              uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = v128;
+              pCurrentScreen = v128;
               if ( v128 == 3 )
                 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
               if ( v128 == 13 )
@@ -17573,7 +17508,7 @@
             //v4 = v124;
             //v5 = pSomeEVT;
             //v6 = v123;
-            //v7 = nullstring;
+            //v7 = "";
             break;
           case EVENT_CharacterAnimation:
             v54 = _evt->v5;
@@ -18140,8 +18075,8 @@
               if ( v100 )
               {
                 pParty->vPosition.x = v135;
-                pParty->vPosition.z = v132;
-                pParty->vPosition.y = v126;
+                pParty->vPosition.y = v132;
+                pParty->vPosition.z = v126;
                 pParty->uFallStartY = v126;
                 if ( _5B65B4_npcdata_loword_house_or_other != -1 )
                   pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
@@ -18171,7 +18106,7 @@
               pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1);
               sub_44987B(v99, 0);
               v133 = 1;
-              if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 13 )
+              if ( pCurrentScreen == 13 )
               {
                 if ( uGameState == 2 )
                 {
@@ -18184,7 +18119,7 @@
                   ptr_507BC0 = 0;
                   if ( pMessageQueue_50CBD0->uNumMessages )
                     pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-                  uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
+                  pCurrentScreen = 0;
                   viewparams->bRedrawGameUI = 1;
                   array_5913D8[6] = 0;
                   pDialogueWindow->Release();
@@ -18344,7 +18279,7 @@
                 v10 = (ODMFace *)(v8 + *((_DWORD *)v9 + 4));
                 if ( v10->sCogNumber == v14 )
                 {
-                  if ( BYTE1(v10->uFaceAttributes) & 0x40 )
+                  if ( BYTE1(v10->uAttributes) & 0x40 )
                   {
                     *(_WORD *)(*((_DWORD *)v9 + 4) + v8 + 272) = pTextureFrameTable->FindTextureByName(
                                                                    Str2);
@@ -18511,9 +18446,9 @@
               if ( v9->sCogNumber == v10 )
               {
                 if ( on )
-                  v9->uFaceAttributes |= bit;
+                  v9->uAttributes |= bit;
                 else
-                  v9->uFaceAttributes &= ~bit;
+                  v9->uAttributes &= ~bit;
               }
               ++v8;
               v6 += 308;
@@ -18549,8 +18484,6 @@
 //----- (00448A40) --------------------------------------------------------
 void Actor::ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle)
 {
-  unsigned __int16 *pState; // eax@6
-
   if ( uActorID >= 0 && uActorID <= (signed int)(uNumActors - 1) )
   {
     if ( bToggle )
@@ -18561,9 +18494,8 @@
     {
       if ( uFlag == 0x10000 )
       {
-        pState = &pActors[uActorID].uAIState;
-        if ( *pState == Disabled )
-          *pState = Standing;
+        if (pActors[uActorID].uAIState == Disabled )
+          pActors[uActorID].uAIState = Standing;
       }
       pActors[uActorID].uAttributes &= ~uFlag;
     }
@@ -18888,9 +18820,9 @@
   {
     v10 = (double)pParty->vPosition.x - (double)fromx;
     v53 = v10;
-    v11 = (double)pParty->vPosition.z - (double)fromy;
+    v11 = (double)pParty->vPosition.y - (double)fromy;
     v54 = v11;
-    v12 = (double)(pParty->vPosition.y + pParty->sEyelevel);
+    v12 = (double)(pParty->vPosition.z + pParty->sEyelevel);
   }
   a7a = v12 - (double)fromz;
   toza = v11 * v11;
@@ -19452,9 +19384,9 @@
       }
       v7 = v5;
       pParty->vPosition.x = pLevelDecorations[v7].vPosition.x;
-      pParty->vPosition.z = pLevelDecorations[v7].vPosition.y;
-      pParty->vPosition.y = pLevelDecorations[v7].vPosition.z;
-      pParty->uFallStartY = pParty->vPosition.y;
+      pParty->vPosition.y = pLevelDecorations[v7].vPosition.y;
+      pParty->vPosition.z = pLevelDecorations[v7].vPosition.z;
+      pParty->uFallStartY = pParty->vPosition.z;
       v8 = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[v7].field_1A) / 90;
       v9 = pLevelDecorations[v7].field_10_y_rot;
       pParty->sRotationY = v8;
@@ -19469,10 +19401,10 @@
       if ( _5B65A8_npcdata_uflags_or_other )
         pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other;
       if ( _5B65AC_npcdata_fame_or_other )
-        pParty->vPosition.z = _5B65AC_npcdata_fame_or_other;
+        pParty->vPosition.y = _5B65AC_npcdata_fame_or_other;
       if ( _5B65B0_npcdata_rep_or_other )
       {
-        pParty->vPosition.y = _5B65B0_npcdata_rep_or_other;
+        pParty->vPosition.z = _5B65B0_npcdata_rep_or_other;
         pParty->uFallStartY = _5B65B0_npcdata_rep_or_other;
       }
       if ( _5B65B4_npcdata_loword_house_or_other )
@@ -19688,7 +19620,7 @@
     dword_5B65C0 = 0;
     pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
     sub_44987B("nwc.blv", 0);
-    uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
+    pCurrentScreen = 0;
     result = 1;
   }
   return result;
@@ -20018,8 +19950,8 @@
       *(char *)(v0 + 1) &= 0xFBu;
       if ( ! ((Actor *)(v0 - offsetof(Actor, uAttributes)))->CanAct() )
         goto LABEL_37;
-      v22 = abs(pParty->vPosition.y - *(short *)(v0 + 110));
-      v21 = abs(pParty->vPosition.z - *(short *)(v0 + 108));
+      v22 = abs(pParty->vPosition.z - *(short *)(v0 + 110));
+      v21 = abs(pParty->vPosition.y - *(short *)(v0 + 108));
       v1 = abs(pParty->vPosition.x - *(short *)(v0 + 106));
       v2 = v21;
       v3 = v22;
@@ -20176,7 +20108,7 @@
   int v45; // [sp+20h] [bp-4h]@1
 
   pParty->uFlags &= 0xFFFFFFCFu;
-  v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y);
+  v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
   v45 = 0;
   v43 = 0;
   if ( (signed int)uNumActors > 0 )
@@ -20187,8 +20119,8 @@
       v0[1] &= 0xFBu;
       if ( ! ((Actor *)(v0 - 36))->CanAct() )
         goto LABEL_60;
-      v39 = abs(pParty->vPosition.y - *((short *)v0 + 55));
-      v38 = abs(pParty->vPosition.z - *((short *)v0 + 54));
+      v39 = abs(pParty->vPosition.z - *((short *)v0 + 55));
+      v38 = abs(pParty->vPosition.y - *((short *)v0 + 54));
       v1 = abs(pParty->vPosition.x - *((short *)v0 + 53));
       v2 = v38;
       v3 = v39;
@@ -20616,7 +20548,7 @@
           Actor::_403F58(uActorID, Dying, 256, 0);
           goto LABEL_78;
         }
-        pActor->uAIState = 0;
+        pActor->uAIState = Standing;
       }
       pActor->uCurrentActionTime = 0;
       pActor->uCurrentActionLength = 0;
@@ -20701,7 +20633,7 @@
         && (SHIDWORD(v21->pActorBuffs[2].uExpireTime) < (signed int)v24
          || LODWORD(v21->pActorBuffs[2].uExpireTime) <= v24) )
       {
-        v21->uAIState = 11;
+        v21->uAIState = Removed;
         goto LABEL_254;
       }
       if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime )
@@ -21101,19 +21033,19 @@
 //----- (00402CAE) --------------------------------------------------------
 int stru193_math::SinCos(int angle)
 {
-  unsigned int v2; // edx@1
-  unsigned int v3; // eax@1
-  int result; // eax@4
-
-  v2 = this->uIntegerPi;
-  v3 = this->uDoublePiMask & angle;
-  if ( (signed int)v3 > (signed int)v2 )
-    v3 = this->uIntegerDoublePi - v3;
-  if ( (signed int)v3 >= (signed int)this->uIntegerHalfPi )
-    result = -this->pCosTable[v2 - v3];
-  else
-    result = this->pCosTable[v3];
-  return result;
+  int v2; // eax@1
+
+  //a2: (angle - uIntegerHalfPi)    for  sin(angle)
+  //    (angle)                     for  cos(angle)
+
+  v2 = uDoublePiMask & angle;
+  
+  if ( v2 > uIntegerPi )
+    v2 = uIntegerDoublePi - v2;
+  if ( v2 >= uIntegerHalfPi )
+    return -pCosTable[uIntegerPi - v2];
+  else
+    return pCosTable[v2];
 }
 
 
@@ -21269,16 +21201,13 @@
 }
 
 //----- (0040471C) --------------------------------------------------------
-int stru262_TurnBased::_40471C()
-{
-  int result; // eax@3
-
+void stru262_TurnBased::_40471C()
+{
   if ( pParty->bTurnBasedModeOn == 1 )
   {
     if ( pTurnEngine->field_4 == 2 )
-      result = _406457(0);
-  }
-  return result;
+      _406457(0);
+  }
 }