changeset 728:9f596a163257

Merge
author Nomad
date Fri, 22 Mar 2013 00:06:50 +0200
parents da130dd3092a (current diff) 9d13d2ec35a6 (diff)
children 8323734d58c8
files Player.cpp Render.cpp Render.h UIHouses.cpp UIHouses.h mm7_2.cpp mm7_4.cpp mm7_data.cpp mm7_data.h
diffstat 27 files changed, 853 insertions(+), 1103 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/Actor.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -4083,7 +4083,7 @@
         v27 = v30->vPosition.z,
         result = pIndoor->GetSector(v15, v17, v21),
         result == v28)
-    && (result = _46CEC3_get_floor_level(v15, v17, v27, result, &uFaceID), result != -30000)
+    && (result = BLV_GetFloorLevel(v15, v17, v27, result, &uFaceID), result != -30000)
     && (result = abs(result - v27), result <= 1024) )
   {
     v23 = v30;
--- a/BSPModel.h	Fri Mar 22 00:02:31 2013 +0200
+++ b/BSPModel.h	Fri Mar 22 00:06:50 2013 +0200
@@ -3,7 +3,7 @@
 
 
 #pragma pack(push, 1)
-struct BSPNode
+struct BSPNode //8
 {
   __int16 uFront;
   __int16 uBack;
--- a/Indoor.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/Indoor.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -1720,69 +1720,32 @@
 }
 
 //----- (00498C45) --------------------------------------------------------
-int IndoorLocation::Alloc()
-{
-  IndoorLocation *v1; // esi@1
-  void *v2; // eax@1
-  const void *v3; // ST3C_4@1
-  void *v4; // eax@1
-  const void *v5; // ST3C_4@1
-  void *v6; // eax@1
-  const void *v7; // ST3C_4@1
-  void *v8; // eax@1
-  const void *v9; // ST3C_4@1
-  void *v10; // eax@1
-  const void *v11; // ST3C_4@1
-  void *v12; // eax@1
-  const void *v13; // ST3C_4@1
-  void *v14; // eax@1
-  const void *v15; // ST3C_4@1
-  void *v16; // eax@1
-  void *v17; // ecx@1
-  signed int result; // eax@9
-
-  v1 = this;
-  v2 = pAllocator->AllocNamedChunk(this->pVertices, 0x15F90u, "L.V");
-  v3 = v1->pFaces;
-  v1->pVertices = (Vec3_short_ *)v2;
-  v4 = pAllocator->AllocNamedChunk(v3, 0xEA600u, "L.F");
-  v5 = v1->pFaceExtras;
-  v1->pFaces = (BLVFace *)v4;
-  v6 = pAllocator->AllocNamedChunk(v5, 0x2BF20u, "L.FX");
-  v7 = v1->pSectors;
-  v1->pFaceExtras = (BLVFaceExtra *)v6;
-  v8 = pAllocator->AllocNamedChunk(v7, 0xE800u, "L.R");
-  v9 = v1->pLights;
-  v1->pSectors = (BLVSector *)v8;
-  v10 = pAllocator->AllocNamedChunk(v9, 0x1900u, "L.L");
-  v11 = v1->pDoors;
-  v1->pLights = (BLVLightMM7 *)v10;
-  v12 = pAllocator->AllocNamedChunk(v11, 0x3E80u, "L.D");
-  v13 = v1->pNodes;
-  v1->pDoors = (BLVDoor *)v12;
-  v14 = pAllocator->AllocNamedChunk(v13, 0x9C40u, "L.BSP");
-  v15 = v1->pMapOutlines;
-  v1->pNodes = (BSPNode *)v14;
-  v16 = pAllocator->AllocNamedChunk(v15, 0x14824u, "L.Map");
-  v17 = v1->pVertices;
-  v1->pMapOutlines = (BLVMapOutlines *)v16;
-  if ( v17 && v1->pFaces && v1->pFaceExtras && v1->pSectors && v1->pLights && v1->pDoors && v1->pNodes && v16 )
+bool IndoorLocation::Alloc()
+    {
+  pVertices   = (Vec3_short_ *)   pAllocator->AllocNamedChunk(pVertices, 15000*sizeof(Vec3_short_),  "L.V");//0x15F90u
+  pFaces      = (BLVFace *)       pAllocator->AllocNamedChunk(pFaces,    10000*sizeof(BLVFace),      "L.F");//0xEA600u
+  pFaceExtras = (BLVFaceExtra *)  pAllocator->AllocNamedChunk(pFaceExtras,5000*sizeof(BLVFaceExtra), "L.FX"); //0x2BF20u
+  pSectors =    (BLVSector *)     pAllocator->AllocNamedChunk(pSectors,    512*sizeof(BLVSector),     "L.R");//0xE800u
+  pLights =     (BLVLightMM7 *)   pAllocator->AllocNamedChunk(pLights,     400*sizeof(BLVLightMM7),   "L.L");//0x1900u
+  pDoors =      (BLVDoor *)       pAllocator->AllocNamedChunk(pDoors,      200*sizeof(BLVDoor),       "L.D");//0x3E80u
+  pNodes =      (BSPNode *)       pAllocator->AllocNamedChunk(pNodes,     5000*sizeof(BSPNode),       "L.BSP");//0x9C40u
+  pMapOutlines =(BLVMapOutlines *)pAllocator->AllocNamedChunk(pMapOutlines,   sizeof(BLVMapOutlines), "L.Map");//0x14824u
+  if (pVertices && pFaces && pFaceExtras && pSectors && pLights && pDoors && pNodes && pMapOutlines )
   {
-    memset(v17, 90000, 0);
-    memset(v1->pFaces, 960000, 0);
-    memset(v1->pFaceExtras, 180000, 0);
-    memset(v1->pSectors, 59392, 0);
-    memset(v1->pLights, 6400, 0);
-    memset(v1->pDoors, 16000, 0);
-    memset(v1->pNodes, 40000, 0);
-    memset(v1->pMapOutlines, 84004, 0);
-    result = 1;
+    memset(pVertices,  0, 15000*sizeof(Vec3_short_));
+    memset(pFaces,     0, 10000*sizeof(BLVFace));
+    memset(pFaceExtras,0,  5000*sizeof(BLVFaceExtra));
+    memset(pSectors,   0,   512*sizeof(BLVSector));
+    memset(pLights,    0,   400*sizeof(BLVLightMM7));
+    memset(pDoors,     0,   200*sizeof(BLVDoor));
+    memset(pNodes,     0,  5000*sizeof(BSPNode));
+    memset(pMapOutlines,0,  sizeof(BLVMapOutlines));
+    return true;
   }
   else
   {
-    result = 0;
+    return false;
   }
-  return result;
 }
 
 
@@ -1802,13 +1765,13 @@
 
 
 //----- (004488F7) --------------------------------------------------------
-void IndoorLocation::ToggleLight(unsigned int uLightID, unsigned int bToggle)
+void IndoorLocation::ToggleLight(signed int sLightID, unsigned int bToggle)
 {
   char *v2; // eax@4
 
-  if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (signed int)uLightID <= pIndoor->uNumLights - 1 && (uLightID & 0x80000000u) == 0 )
+  if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (sLightID <= pIndoor->uNumLights - 1) && (sLightID >= 0) )
   {
-    v2 = (char *)&pIndoor->pLights[uLightID].uAtributes;
+    v2 = (char *)&pIndoor->pLights[sLightID].uAtributes;
     if ( bToggle )
       *v2 &= 0xF7u;
     else
@@ -3163,10 +3126,10 @@
   //Vec3_short_ *v34; // edx@27
   int v35; // edx@32
   int v37; // edi@38
-  int v38; // ebx@40
+  int pSectorID; // ebx@40
   int v39; // eax@41
-  BLVFace *v40; // esi@42
-  PolygonType v41; // dl@42
+  BLVFace *pFace; // esi@42
+  PolygonType pPolygonType; // dl@42
   int v42; // edx@43
   int v43[50]; // [sp+Ch] [bp-108h]@1
   //int v44; // [sp+D4h] [bp-40h]@9
@@ -3239,10 +3202,10 @@
                //pVertexIDs = pFace->pVertexIDs;
                       //v19 = this->pVertices;
                //v20 = pVertices[pFace->pVertexIDs[0]].y;
-                      v54 = 0;
-                      //v57 = 0;
-                      //v5 = v16->uNumVertices == 0;
-                      v59 = pVertices[pFace->pVertexIDs[0]].y >= sY;
+               v54 = 0;
+               //v57 = 0;
+               //v5 = v16->uNumVertices == 0;
+               v59 = pVertices[pFace->pVertexIDs[0]].y >= sY;
 
                         //v21 = pFace->pVertexIDs + 1;
                for (uint k = 1; k < pFace->uNumVertices; ++k)
@@ -3300,24 +3263,24 @@
                           ++v54;
                       }
                     }
-                   }
-                 }
-
-                 v59 = v50;
-               }
-
-               if (pFace->uNumVertices)
-               {
-                 if (v54 == 1)
-                 {
-                   v35 = v55++;
-                   v43[v35] = uFaceID;
-                 }
-               }
-             }
+                  }
+                }
+
+                v59 = v50;
+              }
+
+              if (pFace->uNumVertices)
+              {
+                if (v54 == 1)
+                {
+                  v35 = v55++;
+                  v43[v35] = uFaceID;
+                }
+              }
             }
-            v4 = v43[0];
           }
+          v4 = v43[0];
+        }
   }
 
   if ( v55 == 1 )
@@ -3325,45 +3288,46 @@
   v37 = 0;
   if ( !v55 )
     return 0;
-  v38 = 0;
+  pSectorID = 0;
   v53 = 0xFFFFFFu;
   if ( v55 > 0 )
   {
     v39 = sY;
     while ( 1 )
     {
-      v40 = &this->pFaces[v43[v37]];
-      v41 = v40->uPolygonType;
-      if ( v41 == 3 )
-        break;
-      if ( v41 == 4 )
+      pFace = &this->pFaces[v43[v37]];
+      //pPolygonType = pFace->uPolygonType;
+      if ( pFace->uPolygonType == POLYGON_Floor )
       {
-        v51 = v40->zCalc1;
-        v57 = (unsigned __int64)(v51 * (signed __int64)(sX << 16)) >> 16;
-        v56 = sY << 16;
-        v51 = v40->zCalc2;
-        v56 = (unsigned __int64)(v51 * (signed __int64)(sY << 16)) >> 16;
-        v42 = (v56 + v40->zCalc3 + v57 + 32768) >> 16;
+        v42 = this->pVertices[*pFace->pVertexIDs].z;
+        v39 = sZ - v42;
+        //goto LABEL_47;
+      }
+      if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall )
+      {
+        //v51 = pFace->zCalc1;
+        v57 = (unsigned __int64)(pFace->zCalc1 * (signed __int64)(sX << 16)) >> 16;
+        //v56 = sY << 16;
+        //v51 = pFace->zCalc2;
+        v56 = (unsigned __int64)(pFace->zCalc2 * (signed __int64)(sY << 16)) >> 16;
+        v42 = (v56 + pFace->zCalc3 + v57 + 32768) >> 16;
         v39 = sZ - v42;
       }
-LABEL_47:
+//LABEL_47:
       if ( v39 >= 0 )
       {
         if ( v39 < v53 )
         {
-          v38 = v40->uSectorID;
+          pSectorID = pFace->uSectorID;
           v53 = v39;
         }
       }
       ++v37;
       if ( v37 >= v55 )
-        return v38;
+        return pSectorID;
     }
-    v42 = this->pVertices[*v40->pVertexIDs].z;
-    v39 = sZ - v42;
-    goto LABEL_47;
   }
-  return v38;
+  //return pSectorID;
 }
 // 49AC17: using guessed type int var_108[50];
 
@@ -3979,7 +3943,7 @@
         v5 = pIndoor->GetSector(v0->vPosition.x, v0->vPosition.y, v4);
         v0->uSectorID = v5;
         if ( !v5
-          || (v56 = _46CEC3_get_floor_level(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, v5, &uFaceID), v56 == -30000) )
+          || (v56 = BLV_GetFloorLevel(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, v5, &uFaceID), v56 == -30000) )
           goto LABEL_123;
       }
       if ( v0->uCurrentActionAnimation == ANIM_Walking)
--- a/Indoor.h	Fri Mar 22 00:02:31 2013 +0200
+++ b/Indoor.h	Fri Mar 22 00:06:50 2013 +0200
@@ -177,7 +177,7 @@
 
 /*   98 */
 #pragma pack(push, 1)
-struct BLVLightMM7
+struct BLVLightMM7 //10h
 {
   struct Vec3_short_ vPosition;
   __int16 uRadius;
@@ -202,7 +202,7 @@
 
 /*  100 */
 #pragma pack(push, 1)
-struct BLVDoor
+struct BLVDoor //50h
 {
   enum State: unsigned __int16
   {
@@ -238,7 +238,7 @@
 
 /*  101 */
 #pragma pack(push, 1)
-struct BLVMapOutline
+struct BLVMapOutline //0C
 {
   unsigned __int16 uVertex1ID;
   unsigned __int16 uVertex2ID;
@@ -264,7 +264,7 @@
 
 /*   93 */
 #pragma pack(push, 1)
-struct BLVFace
+struct BLVFace  //60h
 {
   //----- (0046ED02) --------------------------------------------------------
   inline BLVFace()
@@ -315,7 +315,7 @@
 
 /*   94 */
 #pragma pack(push, 1)
-struct BLVFaceExtra
+struct BLVFaceExtra  //24h
 {
 bool HasEventint();
 
@@ -342,7 +342,7 @@
 
 /*   95 */
 #pragma pack(push, 1)
-struct BLVSector
+struct BLVSector //0x74
 {
   int field_0;
   unsigned __int16 uNumFloors;
@@ -392,8 +392,8 @@
 #pragma pack(push, 1)
 struct BLVMapOutlines
 {
-  uint          uNumOutlines;
-  BLVMapOutline pOutlines[1];
+  int          uNumOutlines;
+  BLVMapOutline pOutlines[7000];
 };
 #pragma pack(pop)
 
@@ -435,10 +435,10 @@
 
   int GetSector(int sX, int sY, int sZ);
   void Release();
-  int Alloc();
+  bool Alloc();
   bool Load(char *pFilename, int a3, size_t i, char *pDest);
   void Draw();
-  void ToggleLight(unsigned int uLightID, unsigned int bToggle);
+  void ToggleLight(signed int uLightID, unsigned int bToggle);
 
   static unsigned int GetLocationIndex(const char *Str1);
   static void ExecDraw(bool bD3D);
@@ -503,10 +503,10 @@
   unsigned __int16 *pRenderTarget;
   unsigned int uTargetWidth;
   unsigned int uTargetHeight;
-  unsigned int uViewportX;
-  unsigned int uViewportY;
-  unsigned int uViewportZ;
-  unsigned int uViewportW;
+  signed int uViewportX;
+  signed int uViewportY;
+  signed int uViewportZ;
+  signed int uViewportW;
   int field_3C;
   int *pTargetZ;
 };
--- a/Monsters.h	Fri Mar 22 00:02:31 2013 +0200
+++ b/Monsters.h	Fri Mar 22 00:06:50 2013 +0200
@@ -142,7 +142,7 @@
   unsigned int uAC;
   unsigned int uExp;
   unsigned int uBaseSpeed;
-  unsigned int uRecoveryTime;
+  signed int uRecoveryTime;
   unsigned int uAttackPreference;
 };
 #pragma pack(pop)
--- a/Outdoor.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/Outdoor.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -516,7 +516,7 @@
   if ( pParty->uFlags & 8
     || (v15 = 0,
         v16 = 0,
-        sub_46D49E_prolly_get_world_y_under_party(x, y, z, pParty->uDefaultPartyHeight, &v15, &v16, 0),
+        ODM_GetFloorLevel(x, y, z, pParty->uDefaultPartyHeight, &v15, &v16, 0),
         v16)
     || v15 )
     return 2;
--- a/Player.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/Player.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -8981,7 +8981,7 @@
               goto LABEL_82;
             case VAR_FixedFood:
               Party::GiveFood(val);
-              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val);
+              sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val);
               ShowStatusBarString(pTmpBuf, 2u);
               if ( pParty->uNumFoodRations > 0xFFFF )
                 Party::SetFood(0xFFFFu);
--- a/Render.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/Render.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -7213,7 +7213,7 @@
       }
       ++v7;
     }
-LABEL_23:
+//LABEL_23:
     uNumBillboardsToDraw++;
     return v7;
   }
@@ -7231,7 +7231,9 @@
       }
       while ( v12 );
     }
-    goto LABEL_23;
+    //goto LABEL_23;
+    uNumBillboardsToDraw++;
+    return v7;
   }
   return v7;
 }
@@ -8075,19 +8077,19 @@
 
 
 //----- (004A43B1) --------------------------------------------------------
-void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *a3, int dimming_level)
-{
-  RenderBillboardTransform_local0 *v4; // ebx@2
-  double v5; // st7@2
-  float v6; // ST08_4@2
+void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level)
+{
+  //RenderBillboardTransform_local0 *v4; // ebx@2
+  //double v5; // st7@2
+  //float v6; // ST08_4@2
   unsigned int v7; // eax@2
-  int v8; // ecx@2
-  unsigned int v9; // esi@2
-  Sprite *v10; // edi@5
+  //int v8; // ecx@2
+  //unsigned int v9; // esi@2
+  //Sprite *v10; // edi@5
   signed int v11; // eax@9
   signed int v12; // eax@9
-  double v13; // st7@12
-  double v14; // st6@12
+  //double v13; // st7@12
+  //double v14; // st6@12
   double v15; // st5@12
   double v16; // st4@12
   double v17; // st3@12
@@ -8096,109 +8098,109 @@
   double v20; // st3@14
   int v21; // ecx@16
   double v22; // st3@16
-  IDirect3DTexture2 *v23; // eax@18
-  signed int v24; // [sp+18h] [bp-18h]@5
-  signed int v25; // [sp+1Ch] [bp-14h]@5
-  Render *v26; // [sp+20h] [bp-10h]@1
+  //IDirect3DTexture2 *v23; // eax@18
+  //signed int v24; // [sp+18h] [bp-18h]@5
+  //signed int v25; // [sp+1Ch] [bp-14h]@5
+  //Render *v26; // [sp+20h] [bp-10h]@1
   float v27; // [sp+24h] [bp-Ch]@5
   int v28; // [sp+28h] [bp-8h]@2
   float v29; // [sp+2Ch] [bp-4h]@5
-  float pSoftBillboarda; // [sp+38h] [bp+8h]@2
+  //float pSoftBillboarda; // [sp+38h] [bp+8h]@2
   float v31; // [sp+3Ch] [bp+Ch]@5
-  float v32; // [sp+3Ch] [bp+Ch]@12
+  //float v32; // [sp+3Ch] [bp+Ch]@12
   float a1; // [sp+40h] [bp+10h]@5
 
-  v26 = this;
+  //v26 = this;
   if ( this->uNumD3DSceneBegins )
   {
-    v4 = pSoftBillboard;
-    v5 = (double)pSoftBillboard->zbuffer_depth;
-    pSoftBillboarda = v5;
-    v6 = v5;
-    v7 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v6));
-    v8 = dimming_level;
-    v9 = v7;
+    //v4 = pSoftBillboard;
+    //v5 = (double)pSoftBillboard->zbuffer_depth;
+    //pSoftBillboarda = pSoftBillboard->zbuffer_depth;
+    //v6 = pSoftBillboard->zbuffer_depth;
+    v7 = Billboard_ProbablyAddToListAndSortByZOrder(pSoftBillboard->zbuffer_depth);
+    //v8 = dimming_level;
+    //v9 = v7;
     v28 = dimming_level & 0xFF000000;
     if ( dimming_level & 0xFF000000 )
-      pBillboardRenderListD3D[v9].uOpacity = RenderBillboardD3D::Opaque_3;
+      pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Opaque_3;
     else
-      pBillboardRenderListD3D[v9].uOpacity = RenderBillboardD3D::Transparent;
-    v10 = a3;
-    pBillboardRenderListD3D[v9].field_90 = v4->field_44;
-    pBillboardRenderListD3D[v9].sZValue = v4->sZValue;
-    pBillboardRenderListD3D[v9].uParentBillboardID = v4->uParentBillboardID;
-    v25 = v4->uScreenSpaceX;
-    v24 = v4->uScreenSpaceY;
-    a1 = (v4->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(v4->_screenspace_x_scaler_packedfloat);
-    v29 = (v4->_screenspace_y_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(v4->_screenspace_y_scaler_packedfloat);
-    v31 = (double)((v10->uBufferWidth >> 1) - v10->uAreaX);
-    v27 = (double)(v10->uBufferHeight - v10->uAreaY);
-    if ( v4->uFlags & 4 )
+      pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Transparent;
+    //v10 = a3;
+    pBillboardRenderListD3D[v7].field_90 = pSoftBillboard->field_44;
+    pBillboardRenderListD3D[v7].sZValue = pSoftBillboard->sZValue;
+    pBillboardRenderListD3D[v7].uParentBillboardID = pSoftBillboard->uParentBillboardID;
+    //v25 = pSoftBillboard->uScreenSpaceX;
+    //v24 = pSoftBillboard->uScreenSpaceY;
+    a1 = (pSoftBillboard->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_x_scaler_packedfloat);
+    v29 = (pSoftBillboard->_screenspace_y_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_y_scaler_packedfloat);
+    v31 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX);
+    v27 = (double)(pSprite->uBufferHeight - pSprite->uAreaY);
+    if ( pSoftBillboard->uFlags & 4 )
       v31 = v31 * -1.0;
-    if ( v4->uTintColor && v26->bTinting )
-    {
-      v11 = ::GetActorTintColor(dimming_level, 0, pSoftBillboarda, 0, 0);
-      v12 = sub_4A19D8(v4->uTintColor, v11);
+    if ( pSoftBillboard->uTintColor && this->bTinting )
+    {
+      v11 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0);
+      v12 = sub_4A19D8(pSoftBillboard->uTintColor, v11);
       if ( v28 )
         v12 = (unsigned int)((char *)&array_77EC08[1852].pEdgeList1[17] + 3) & ((unsigned int)v12 >> 1);
     }
     else
     {
-      v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboarda, 0, 0);
-    }
-    v13 = (double)v25;
-    pBillboardRenderListD3D[v9].pQuards[0].specular = 0;
-    pBillboardRenderListD3D[v9].pQuards[0].diffuse = v12;
-    pBillboardRenderListD3D[v9].pQuards[0].pos.x = v13 - v31 * a1;
-    v14 = (double)v24;
-    v32 = v14;
-    pBillboardRenderListD3D[v9].pQuards[0].pos.y = v14 - v27 * v29;
-    v15 = 1.0 - 1.0 / (pSoftBillboarda * 0.061758894);
-    pBillboardRenderListD3D[v9].pQuards[0].pos.z = v15;
-    v16 = 1.0 / pSoftBillboarda;
-    pBillboardRenderListD3D[v9].pQuards[0].rhw = 1.0 / pSoftBillboarda;
-    pBillboardRenderListD3D[v9].pQuards[0].texcoord.x = 0.0;
-    pBillboardRenderListD3D[v9].pQuards[0].texcoord.y = 0.0;
-    v17 = (double)((v10->uBufferWidth >> 1) - v10->uAreaX);
-    v18 = (double)(v10->uBufferHeight - v10->uAreaY - v10->uAreaHeight);
-    if ( v4->uFlags & 4 )
+      v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0);
+    }
+    //v13 = (double)v25;
+    pBillboardRenderListD3D[v7].pQuards[0].specular = 0;
+    pBillboardRenderListD3D[v7].pQuards[0].diffuse = v12;
+    pBillboardRenderListD3D[v7].pQuards[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1;
+    //v14 = (double)v24;
+    //v32 = v14;
+    pBillboardRenderListD3D[v7].pQuards[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29;
+    v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894);
+    pBillboardRenderListD3D[v7].pQuards[0].pos.z = v15;
+    v16 = 1.0 / pSoftBillboard->zbuffer_depth;
+    pBillboardRenderListD3D[v7].pQuards[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth;
+    pBillboardRenderListD3D[v7].pQuards[0].texcoord.x = 0.0;
+    pBillboardRenderListD3D[v7].pQuards[0].texcoord.y = 0.0;
+    v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX);
+    v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight);
+    if ( pSoftBillboard->uFlags & 4 )
       v17 = v17 * -1.0;
-    pBillboardRenderListD3D[v9].pQuards[1].specular = 0;
-    pBillboardRenderListD3D[v9].pQuards[1].diffuse = v12;
-    pBillboardRenderListD3D[v9].pQuards[1].pos.x = v13 - v17 * a1;
-    pBillboardRenderListD3D[v9].pQuards[1].pos.y = v32 - v18 * v29;
-    pBillboardRenderListD3D[v9].pQuards[1].pos.z = v15;
-    pBillboardRenderListD3D[v9].pQuards[1].rhw = v16;
-    pBillboardRenderListD3D[v9].pQuards[1].texcoord.x = 0.0;
-    pBillboardRenderListD3D[v9].pQuards[1].texcoord.y = 1.0;
-    v19 = v10->uBufferHeight - v10->uAreaY - v10->uAreaHeight;
-    v20 = (double)(v10->uAreaX + v10->uAreaWidth + (v10->uBufferWidth >> 1) - v10->uBufferWidth);
-    if ( v4->uFlags & 4 )
+    pBillboardRenderListD3D[v7].pQuards[1].specular = 0;
+    pBillboardRenderListD3D[v7].pQuards[1].diffuse = v12;
+    pBillboardRenderListD3D[v7].pQuards[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1;
+    pBillboardRenderListD3D[v7].pQuards[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29;
+    pBillboardRenderListD3D[v7].pQuards[1].pos.z = v15;
+    pBillboardRenderListD3D[v7].pQuards[1].rhw = v16;
+    pBillboardRenderListD3D[v7].pQuards[1].texcoord.x = 0.0;
+    pBillboardRenderListD3D[v7].pQuards[1].texcoord.y = 1.0;
+    v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight;
+    v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth);
+    if ( pSoftBillboard->uFlags & 4 )
       v20 = v20 * -1.0;
-    pBillboardRenderListD3D[v9].pQuards[2].specular = 0;
-    pBillboardRenderListD3D[v9].pQuards[2].diffuse = v12;
-    pBillboardRenderListD3D[v9].pQuards[2].pos.x = v20 * a1 + v13;
-    pBillboardRenderListD3D[v9].pQuards[2].pos.y = v32 - (double)v19 * v29;
-    pBillboardRenderListD3D[v9].pQuards[2].pos.z = v15;
-    pBillboardRenderListD3D[v9].pQuards[2].rhw = v16;
-    pBillboardRenderListD3D[v9].pQuards[2].texcoord.x = 1.0;
-    pBillboardRenderListD3D[v9].pQuards[2].texcoord.y = 1.0;
-    v21 = v10->uBufferHeight - v10->uAreaY;
-    v22 = (double)(v10->uAreaX + v10->uAreaWidth + (v10->uBufferWidth >> 1) - v10->uBufferWidth);
-    if ( v4->uFlags & 4 )
+    pBillboardRenderListD3D[v7].pQuards[2].specular = 0;
+    pBillboardRenderListD3D[v7].pQuards[2].diffuse = v12;
+    pBillboardRenderListD3D[v7].pQuards[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX;
+    pBillboardRenderListD3D[v7].pQuards[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29;
+    pBillboardRenderListD3D[v7].pQuards[2].pos.z = v15;
+    pBillboardRenderListD3D[v7].pQuards[2].rhw = v16;
+    pBillboardRenderListD3D[v7].pQuards[2].texcoord.x = 1.0;
+    pBillboardRenderListD3D[v7].pQuards[2].texcoord.y = 1.0;
+    v21 = pSprite->uBufferHeight - pSprite->uAreaY;
+    v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth);
+    if ( pSoftBillboard->uFlags & 4 )
       v22 = v22 * -1.0;
-    pBillboardRenderListD3D[v9].pQuards[3].specular = 0;
-    pBillboardRenderListD3D[v9].pQuards[3].diffuse = v12;
-    pBillboardRenderListD3D[v9].pQuards[3].pos.x = v22 * a1 + v13;
-    pBillboardRenderListD3D[v9].pQuards[3].pos.y = v32 - (double)v21 * v29;
-    pBillboardRenderListD3D[v9].pQuards[3].pos.z = v15;
-    pBillboardRenderListD3D[v9].pQuards[3].rhw = v16;
-    pBillboardRenderListD3D[v9].pQuards[3].texcoord.x = 1.0;
-    pBillboardRenderListD3D[v9].pQuards[3].texcoord.y = 0.0;
-    v23 = v10->pTexture;
-    pBillboardRenderListD3D[v9].uNumVertices = 4;
-    pBillboardRenderListD3D[v9].z_order = pSoftBillboarda;
-    pBillboardRenderListD3D[v9].pTexture = v23;
+    pBillboardRenderListD3D[v7].pQuards[3].specular = 0;
+    pBillboardRenderListD3D[v7].pQuards[3].diffuse = v12;
+    pBillboardRenderListD3D[v7].pQuards[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX;
+    pBillboardRenderListD3D[v7].pQuards[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29;
+    pBillboardRenderListD3D[v7].pQuards[3].pos.z = v15;
+    pBillboardRenderListD3D[v7].pQuards[3].rhw = v16;
+    pBillboardRenderListD3D[v7].pQuards[3].texcoord.x = 1.0;
+    pBillboardRenderListD3D[v7].pQuards[3].texcoord.y = 0.0;
+    //v23 = pSprite->pTexture;
+    pBillboardRenderListD3D[v7].uNumVertices = 4;
+    pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth;
+    pBillboardRenderListD3D[v7].pTexture = pSprite->pTexture;
   }
 }
 
--- a/Render.h	Fri Mar 22 00:02:31 2013 +0200
+++ b/Render.h	Fri Mar 22 00:06:50 2013 +0200
@@ -329,7 +329,7 @@
   void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
   void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
   void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard);
-  void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *a3, int dimming_level);
+  void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level);
   int MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6);
   void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9);
   void _4A4CC9(struct stru6_stru1_indoor_sw_billboard *a1, int a2);
--- a/SpriteObject.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/SpriteObject.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -240,7 +240,7 @@
   v4 = v1->vPosition.x;
   v5 = v2->uHeight;
   v55 = 0;
-  v6 = sub_46D49E_prolly_get_world_y_under_party(v4, v3, v1->vPosition.z, v5, &v59, &v55, 0);
+  v6 = ODM_GetFloorLevel(v4, v3, v1->vPosition.z, v5, &v59, &v55, 0);
   v7 = v6;
   v54 = v6;
   v8 = v6 + 1;
@@ -428,7 +428,7 @@
           _46DF1A_collide_against_actor(i, 0);
       }
       v26 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
-      v27 = sub_46D49E_prolly_get_world_y_under_party(
+      v27 = ODM_GetFloorLevel(
               stru_721530.normal2.x,
               stru_721530.normal2.y,
               stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
@@ -594,10 +594,10 @@
 //----- (0047136C) --------------------------------------------------------
 void SpriteObject::UpdateObject_fn0_BLV(unsigned int uLayingItemID)
 {
-  SpriteObject *v1; // esi@1
-  ObjectDesc *v2; // edi@1
-  int v3; // ST08_4@1
-  __int16 v4; // ax@5
+  SpriteObject *pSpriteObject; // esi@1
+  ObjectDesc *pObject; // edi@1
+  //int v3; // ST08_4@1
+  //__int16 v4; // ax@5
   __int16 v5; // ax@7
   BLVFace *v6; // ecx@11
   BLVFace *v7; // eax@11
@@ -629,8 +629,8 @@
   enum TEXTURE_TYPE v33; // [sp-4h] [bp-94h]@19
   enum TEXTURE_TYPE v34; // [sp-4h] [bp-94h]@68
   Particle_sw Dst; // [sp+Ch] [bp-84h]@18
-  unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1
-  ObjectDesc *v37; // [sp+78h] [bp-18h]@1
+  //unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1
+  //ObjectDesc *v37; // [sp+78h] [bp-18h]@1
   unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4
   int v39; // [sp+80h] [bp-10h]@33
   Actor *v39b;
@@ -638,24 +638,24 @@
   int v41; // [sp+88h] [bp-8h]@34
   int v42; // [sp+8Ch] [bp-4h]@4
 
-  uLayingItemID_ = uLayingItemID;
-  v1 = &pSpriteObjects[uLayingItemID];
-  v2 = &pObjectList->pObjects[v1->uObjectDescID];
-  v3 = v1->vPosition.x;
-  v37 = &pObjectList->pObjects[v1->uObjectDescID];
-  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, &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, &uFaceID), v42 == -30000)) )
+  //uLayingItemID_ = uLayingItemID;
+  pSpriteObject = &pSpriteObjects[uLayingItemID];
+  pObject = &pObjectList->pObjects[pSpriteObject->uObjectDescID];
+  //v3 = pSpriteObject->vPosition.x;
+  //v37 = &pObjectList->pObjects[pSpriteObject->uObjectDescID];
+  pSpriteObject->uSectorID = pIndoor->GetSector(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z);
+  v42 = BLV_GetFloorLevel(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, pSpriteObject->uSectorID, &uFaceID);
+  if ( abs(pSpriteObject->vPosition.x) > 32767
+    || abs(pSpriteObject->vPosition.y) > 32767
+    || abs(pSpriteObject->vPosition.z) > 20000
+    || v42 <= -30000
+    && (pSpriteObject->uSectorID == 0))
+//     || (v42 = _46CEC3_get_floor_level(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, v4, &uFaceID), v42 == -30000)) )
   {
-    SpriteObject::OnInteraction(uLayingItemID_);
+    SpriteObject::OnInteraction(uLayingItemID);
     return;
   }
-  v5 = v2->uFlags;
+  v5 = pObject->uFlags;
   if ( v5 & 0x20 )
   {
 LABEL_24:
@@ -663,24 +663,24 @@
 LABEL_25:
     stru_721530.field_0 = v8;
     uFaceID = v8;
-    stru_721530.prolly_normal_d = v2->uRadius;
-    v12 = v2->uHeight;
+    stru_721530.prolly_normal_d = pObject->uRadius;
+    v12 = pObject->uHeight;
     stru_721530.field_84 = -1;
     stru_721530.field_C = v12;
     stru_721530.field_8 = v8;
     stru_721530.field_70 = v8;
     while ( 1 )
     {
-      stru_721530.field_34.x = v1->vPosition.x;
+      stru_721530.field_34.x = pSpriteObject->vPosition.x;
       stru_721530.normal.x = stru_721530.field_34.x;
-      stru_721530.field_34.y = v1->vPosition.y;
+      stru_721530.field_34.y = pSpriteObject->vPosition.y;
       stru_721530.normal.y = stru_721530.field_34.y;
-      stru_721530.field_34.z = stru_721530.prolly_normal_d + v1->vPosition.z + 1;
+      stru_721530.field_34.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
       stru_721530.normal.z = stru_721530.field_34.z;
-      stru_721530.field_1C = v1->vVelocity.x;
-      stru_721530.field_20 = v1->vVelocity.y;
-      stru_721530.field_24 = v1->vVelocity.z;
-      stru_721530.uSectorID = v1->uSectorID;
+      stru_721530.field_1C = pSpriteObject->vVelocity.x;
+      stru_721530.field_20 = pSpriteObject->vVelocity.y;
+      stru_721530.field_24 = pSpriteObject->vVelocity.z;
+      stru_721530.uSectorID = pSpriteObject->uSectorID;
       if ( stru_721530._47050A(v8) )
         return;
       v40 = v8;
@@ -688,9 +688,9 @@
       {
         _46E44E_collide_against_faces_and_portals(0);
         _46E0B2_collide_against_decorations();
-        if ( (v1->field_58_pid & 7) != OBJECT_Player)
+        if ( (pSpriteObject->field_58_pid & 7) != OBJECT_Player)
           _46EF01_collision_chech_player(1);
-        v13 = v1->field_58_pid;
+        v13 = pSpriteObject->field_58_pid;
         v42 = v8;
         if ( (v13 & 7) == OBJECT_Actor)
         {
@@ -703,7 +703,7 @@
               //v14 = (signed __int64)((double)v41 * 0.3333333333333333);
               //v41 = *(short *)(v39 - 38) - 1;
               //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) )
-				if( pActors[v1->field_58_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID )
+				if( pActors[pSpriteObject->field_58_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID )
 					//not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius
 					_46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73));
               ++v42;
@@ -733,17 +733,17 @@
       while ( v40 < 100 );
       if ( stru_721530.field_7C >= stru_721530.field_6C )
       {
-        v1->vPosition.x = stru_721530.normal2.x;
-        v1->vPosition.y = stru_721530.normal2.y;
-        v1->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
-        v1->uSectorID = LOWORD(stru_721530.uSectorID);
-        if ( !(HIBYTE(v2->uFlags) & 1) )
+        pSpriteObject->vPosition.x = stru_721530.normal2.x;
+        pSpriteObject->vPosition.y = stru_721530.normal2.y;
+        pSpriteObject->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
+        pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID);
+        if ( !(HIBYTE(pObject->uFlags) & 1) )
           return;
         memset(&Dst, v8, 0x68u);
-        v29 = v2->uFlags;
-        Dst.x = (double)v1->vPosition.x;
-        Dst.y = (double)v1->vPosition.y;
-        Dst.z = (double)v1->vPosition.z;
+        v29 = pObject->uFlags;
+        Dst.x = (double)pSpriteObject->vPosition.x;
+        Dst.y = (double)pSpriteObject->vPosition.y;
+        Dst.z = (double)pSpriteObject->vPosition.z;
         Dst.flt_10 = 0.0;
         Dst.flt_14 = 0.0;
         Dst.flt_18 = 0.0;
@@ -758,7 +758,15 @@
         else
         {
           if ( v29 & 0x400 )
-            goto LABEL_70;
+          {
+            Dst.type = ParticleType_Line;
+            Dst.uDiffuse = rand();
+            Dst.timeToLive = 64;
+            Dst.uTextureID = v8;
+            Dst.flt_28 = 1.0;
+            pGame->pParticleEngine->AddParticle(&Dst);
+            return;
+          }
           Dst.type = ParticleType_Bitmap | ParticleType_8;
           Dst.uDiffuse = rand();
           v30 = rand();
@@ -767,34 +775,35 @@
         }
         Dst.timeToLive = (unsigned __int8)(v30 & 0x80) + 128;
         Dst.uTextureID = pBitmaps_LOD->LoadTexture(v32, v34);
-        goto LABEL_71;
+        Dst.flt_28 = 1.0;
+        pGame->pParticleEngine->AddParticle(&Dst);
+        return;
       }
       v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-      v1->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
+      pSpriteObject->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
       v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-      v1->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
+      pSpriteObject->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
       v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
-      v1->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
-      v1->uSectorID = LOWORD(stru_721530.uSectorID);
+      pSpriteObject->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
+      pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID);
       stru_721530.field_70 += stru_721530.field_7C;
-      if ( v2->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) )
+      if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) )
         return;
       v15 = (signed int)stru_721530.uFaceID >> 3;
       if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
       {
-        v40 = integer_sqrt(v1->vVelocity.x * v1->vVelocity.x + v1->vVelocity.y * v1->vVelocity.y);
-        v23 = stru_5C6E00->Atan2(
-                v1->vPosition.x - pLevelDecorations[v15].vPosition.x,
-                v1->vPosition.y - pLevelDecorations[v15].vPosition.y);
+        v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y);
+        v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x,
+                pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y);
         v42 = stru_5C6E00->Cos(v23);
         v41 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16;
         v24 = v23;
-        v1->vVelocity.x = (unsigned int)(v42 * v40) >> 16;
+        pSpriteObject->vVelocity.x = (unsigned int)(v42 * v40) >> 16;
         v25 = stru_5C6E00->Sin(v23);
         v42 = v25;
         v26 = v25 * (signed __int64)v40;
         v41 = v26 >> 16;
-        v1->vVelocity.y = WORD1(v26);
+        pSpriteObject->vVelocity.y = WORD1(v26);
       }
       else
       {
@@ -804,8 +813,8 @@
         v16 = &pIndoor->pFaces[v15];
         if ( v16->uPolygonType != 3 )
         {
-          v42 = abs(v16->pFacePlane_old.vNormal.x * v1->vVelocity.x + v16->pFacePlane_old.vNormal.z * v1->vVelocity.z
-                                                                    + v16->pFacePlane_old.vNormal.y * v1->vVelocity.y) >> 16;
+          v42 = abs(v16->pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x + v16->pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z
+                                                                    + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16;
           if ( stru_721530.field_64 >> 3 > v42 )
             v42 = stru_721530.field_64 >> 3;
           v40 = v16->pFacePlane_old.vNormal.x;
@@ -814,8 +823,8 @@
           v41 = (unsigned __int64)(v42 * (signed __int64)v41) >> 16;
           v39 = v16->pFacePlane_old.vNormal.z;
           v39 = (unsigned __int64)(v42 * (signed __int64)v39) >> 16;
-          v1->vVelocity.x += 2 * v40;
-          v1->vVelocity.y += 2 * v41;
+          pSpriteObject->vVelocity.x += 2 * v40;
+          pSpriteObject->vVelocity.y += 2 * v41;
           if ( v16->pFacePlane_old.vNormal.z <= 32000 )
           {
             v22 = 2 * v39;
@@ -824,102 +833,107 @@
           {
             v21 = v39;
             v40 = 32000;
-            v1->vVelocity.z += v39;
+            pSpriteObject->vVelocity.z += v39;
             v41 = (unsigned __int64)(v40 * (signed __int64)v21) >> 16;
             v22 = (unsigned int)(v40 * v21) >> 16;
           }
-          v1->vVelocity.z += v22;
-          goto LABEL_60;
+          pSpriteObject->vVelocity.z += v22;
+          if ( BYTE3(v16->uAttributes) & 0x10 )
+            EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1);
+          goto LABEL_63;
         }
-        if ( v37->uFlags & 0x80 )
+        if ( pObject->uFlags & 0x80 )
         {
-          v17 = -v1->vVelocity.z >> 1;
-          v1->vVelocity.z = v17;
+          v17 = -pSpriteObject->vVelocity.z >> 1;
+          pSpriteObject->vVelocity.z = v17;
           if ( (signed __int16)v17 < 10 )
-            v1->vVelocity.z = 0;
-LABEL_60:
+            pSpriteObject->vVelocity.z = 0;
           if ( BYTE3(v16->uAttributes) & 0x10 )
             EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1);
           goto LABEL_63;
         }
-        v18 = v1->vVelocity.y;
-        v19 = v1->vVelocity.x;
-        v1->vVelocity.z = 0;
+        v18 = pSpriteObject->vVelocity.y;
+        v19 = pSpriteObject->vVelocity.x;
+        pSpriteObject->vVelocity.z = 0;
         if ( v19 * v19 + v18 * v18 >= 400 )
-          goto LABEL_60;
+        {
+          if ( BYTE3(v16->uAttributes) & 0x10 )
+            EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1);
+          goto LABEL_63;
+        }
         v20 = pIndoor->pVertices;
-        v1->vVelocity.z = 0;
-        v1->vVelocity.y = 0;
-        v1->vVelocity.x = 0;
-        v1->vPosition.z = v20[*v16->pVertexIDs].z + 1;
+        pSpriteObject->vVelocity.z = 0;
+        pSpriteObject->vVelocity.y = 0;
+        pSpriteObject->vVelocity.x = 0;
+        pSpriteObject->vPosition.z = v20[*v16->pVertexIDs].z + 1;
       }
 LABEL_63:
-      v2 = v37;
+      //v2 = v37;
 LABEL_64:
-      v41 = v1->vVelocity.x;
+      v41 = pSpriteObject->vVelocity.x;
       v40 = 58500;
       v41 = (unsigned __int64)(58500i64 * v41) >> 16;
-      v1->vVelocity.x = v41;
-      v41 = v1->vVelocity.y;
+      pSpriteObject->vVelocity.x = v41;
+      v41 = pSpriteObject->vVelocity.y;
       v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16;
       v40 = 58500;
-      v1->vVelocity.y = v41;
-      v41 = v1->vVelocity.z;
+      pSpriteObject->vVelocity.y = v41;
+      v41 = pSpriteObject->vVelocity.z;
       v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16;
       ++uFaceID;
       v28 = __OFSUB__(uFaceID, 100);
       v27 = uFaceID - 100 < 0;
-      v1->vVelocity.z = v41;
+      pSpriteObject->vVelocity.z = v41;
       if ( !(v27 ^ v28) )
         return;
       v8 = 0;
     }
   }
-  if ( v42 <= v1->vPosition.z - 3 )
+  if ( v42 <= pSpriteObject->vPosition.z - 3 )
   {
-    v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
+    pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
     goto LABEL_24;
   }
-  if ( !(v5 & 0x40) || _46BFFA_check_object_intercept(uLayingItemID_, 0) )
+  if ( !(v5 & 0x40) || _46BFFA_check_object_intercept(uLayingItemID, 0) )
   {
     v6 = pIndoor->pFaces;
-    v1->vPosition.z = v42 + 1;
+    pSpriteObject->vPosition.z = v42 + 1;
     v7 = &v6[uFaceID];
     if ( v7->uPolygonType == 3 )
     {
       v8 = 0;
-      v1->vVelocity.z = 0;
+      pSpriteObject->vVelocity.z = 0;
     }
     else
     {
       if ( v7->pFacePlane_old.vNormal.z < 45000 )
-        v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
+        pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
       v8 = 0;
     }
-    v42 = v1->vVelocity.x;
+    v42 = pSpriteObject->vVelocity.x;
     uFaceID = 58500;
     v42 = (unsigned __int64)(58500i64 * v42) >> 16;
-    v1->vVelocity.x = v42;
-    v42 = v1->vVelocity.y;
+    pSpriteObject->vVelocity.x = v42;
+    v42 = pSpriteObject->vVelocity.y;
     v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16;
     uFaceID = 58500;
-    v1->vVelocity.y = v42;
-    v42 = v1->vVelocity.z;
+    pSpriteObject->vVelocity.y = v42;
+    v42 = pSpriteObject->vVelocity.z;
     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 )
+    v9 = pSpriteObject->vVelocity.x;
+    pSpriteObject->vVelocity.z = v42;
+    if ( v9 * v9 + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 )
     {
-      v1->vVelocity.z = v8;
-      v1->vVelocity.y = v8;
-      v1->vVelocity.x = v8;
-      if ( !(HIBYTE(v2->uFlags) & 1) )
+      pSpriteObject->vVelocity.z = v8;
+      pSpriteObject->vVelocity.y = v8;
+      pSpriteObject->vVelocity.x = v8;
+      if ( !(pObject->uFlags & 1) )
         return;
       memset(&Dst, v8, 0x68u);
-      v10 = v2->uFlags;
-      Dst.x = (double)v1->vPosition.x;
-      Dst.y = (double)v1->vPosition.y;
-      Dst.z = (double)v1->vPosition.z;
+      v10 = pObject->uFlags;
+      Dst.x = (double)pSpriteObject->vPosition.x;
+      Dst.y = (double)pSpriteObject->vPosition.y;
+      Dst.z = (double)pSpriteObject->vPosition.z;
       Dst.flt_10 = 0.0;
       Dst.flt_14 = 0.0;
       Dst.flt_18 = 0.0;
@@ -936,14 +950,13 @@
       {
         if ( v10 & 0x400 )
         {
-LABEL_70:
           Dst.type = ParticleType_Line;
           Dst.uDiffuse = rand();
           Dst.timeToLive = 64;
           Dst.uTextureID = v8;
-LABEL_71:
           Dst.flt_28 = 1.0;
-          goto LABEL_72;
+          pGame->pParticleEngine->AddParticle(&Dst);
+          return;
         }
         Dst.type = ParticleType_Bitmap | ParticleType_8;
         Dst.uDiffuse = rand();
@@ -954,7 +967,6 @@
       }
       Dst.timeToLive = (unsigned __int8)(v11 & 0x80) + 128;
       Dst.uTextureID = pBitmaps_LOD->LoadTexture(v31, v33);
-LABEL_72:
       pGame->pParticleEngine->AddParticle(&Dst);
       return;
     }
--- a/Texture.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/Texture.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -267,28 +267,26 @@
   if ( !v2 )
     Abortf("Unable to save dtft.bin!");
   fwrite(v1, 4u, 1u, v2);
-  fwrite(v1->pTextures, 0x14u, v1->uNumTextures, v3);
+  fwrite(v1->pTextures, 0x14u, v1->sNumTextures, v3);
   fclose(v3);
 }
 
 //----- (0044E0A0) --------------------------------------------------------
 void TextureFrameTable::FromFile(void *pSerialized)
 {
-  uNumTextures = *(int *)pSerialized;
-  pTextures = (TextureFrame *)pAllocator->AllocNamedChunk(pTextures, 20 * uNumTextures, "Txt Frames");
-  memcpy(pTextures, (char *)pSerialized + 4, 20 * uNumTextures);
+  sNumTextures = *(int *)pSerialized;
+  pTextures = (TextureFrame *)pAllocator->AllocNamedChunk(pTextures, 20 * sNumTextures, "Txt Frames");
+  memcpy(pTextures, (char *)pSerialized + 4, 20 * sNumTextures);
 }
 
 //----- (0044E0ED) --------------------------------------------------------
-unsigned int TextureFrameTable::LoadAnimationSequenceAndPalettes(unsigned int uIconID)
-{
-  unsigned int result; // eax@1
+void TextureFrameTable::LoadAnimationSequenceAndPalettes( signed int uIconID )
+    {
   TextureFrameTable *v3; // ebx@1
   unsigned int i; // edi@3
 
-  result = uIconID;
   v3 = this;
-  if ( (signed int)uIconID <= (signed int)this->uNumTextures && (uIconID & 0x80000000u) == 0 )
+  if ( (uIconID <= this->sNumTextures) && uIconID >= 0 )
   {
     for ( i = uIconID; ; ++i )
     {
@@ -296,12 +294,13 @@
       auto pTex = (v3->pTextures[i].uTextureID != -1 ? &pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID] : 0);
       if (pTex)
         pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1);
-      result = (unsigned int)v3->pTextures;
-      if ( !(*(char *)(result + i * 20 + 18) & 1) )
+      //result = (unsigned int)v3->pTextures;
+      //if ( !(*(char *)(result + i * 20 + 18) & 1) )
+      if( v3->pTextures[i].uFlags&1)
         break;
     }
   }
-  return result;
+  return;
 }
 
 //----- (0044E163) --------------------------------------------------------
@@ -315,7 +314,7 @@
   v2 = this;
   v3 = 0;
   uID = 0;
-  if ( (signed int)this->uNumTextures <= 0 )
+  if ( (signed int)this->sNumTextures <= 0 )
   {
 LABEL_4:
     result = -1;
@@ -326,7 +325,7 @@
     {
       ++uID;
       ++v3;
-      if ( (signed int)uID >= (signed int)v2->uNumTextures )
+      if ( (signed int)uID >= (signed int)v2->sNumTextures )
         goto LABEL_4;
     }
     result = uID;
--- a/Texture.h	Fri Mar 22 00:02:31 2013 +0200
+++ b/Texture.h	Fri Mar 22 00:06:50 2013 +0200
@@ -105,17 +105,17 @@
   inline TextureFrameTable()
   {
     pTextures = 0;
-    uNumTextures = 0;
+    sNumTextures = 0;
   }
   int FromFileTxt(const char *Args);
   void ToFile();
   void FromFile(void *pSerialized);
-  unsigned int LoadAnimationSequenceAndPalettes(unsigned int uIconID);
+  void LoadAnimationSequenceAndPalettes(signed int uIconID);
   unsigned int GetFrameTexture(int uFrameID, signed int a3);
   unsigned int FindTextureByName(const char *Str2);
 
 
-  unsigned int uNumTextures;
+  signed int sNumTextures;
   struct TextureFrame *pTextures;
 };
 #pragma pack(pop)
--- a/UIBooks.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/UIBooks.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -1146,9 +1146,9 @@
         }
     else
         {
-        v6 = viewparams->field_38;
-        v86 = viewparams->field_38;
-        v84 = viewparams->field_3A;
+        v6 = viewparams->indoor_center_x;
+        v86 = viewparams->indoor_center_x;
+        v84 = viewparams->indoor_center_y;
         if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
             v5 = viewparams->field_2C - 34;
         }
--- a/UIHouses.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/UIHouses.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -3828,7 +3828,7 @@
 //----- (004B4710) --------------------------------------------------------
 int __cdecl TrainingDialog()
 {
-  Player *v0; // ebx@1
+  //Player *v0; // ebx@1
   int color2; // eax@1
   //unsigned int v2; // ecx@1
   //int v3; // eax@1
@@ -3903,7 +3903,7 @@
   int v72; // [sp+7Ch] [bp-8h]@16
   int v73; // [sp+80h] [bp-4h]@14
 
-  v0 = pPlayers[uActiveCharacter];
+  //v0 = pPlayers[uActiveCharacter];
   memcpy(&v65, window_SpeakInHouse, sizeof(v65));
   v65.uFrameX = 483;
   v65.uFrameWidth = 148;
@@ -3917,22 +3917,22 @@
   //for ( i = v2; v4 < (signed int)v2; ++v4 )
   //  v3 += v4 + 1;
   //v5 = 1000 * v3;
-  v5 = 1000ui64 * v0->uLevel * (v0->uLevel + 1) / 2;  // E n = n(n + 1) / 2
+  v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2;  // E n = n(n + 1) / 2
   //v6 = HIDWORD(v0->uExperience);
   //v7 = window_SpeakInHouse->ptr_1C;
   v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89];
   //v66 = 1000 * v3;
-  if (v0->uExperience >= v5)
+  if (pPlayers[uActiveCharacter]->uExperience >= v5)
   {
-    v8 = v0->classType % 4 + 1;
+    v8 = pPlayers[uActiveCharacter]->classType % 4 + 1;
     if ( v8 == 4 )
       v8 = 3;
-    v9 = (double)v0->uLevel;
+    v9 = (double)pPlayers[uActiveCharacter]->uLevel;
     //i = 0;
     v69 = v8;
     //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8);
     v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8);
-    v11 = v10 * (100 - v0->GetMerchant()) / 100;
+    v11 = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
     if ( v11 < v10 / 3 )
       v11 = v10 / 3;
     //i = v11;
@@ -3955,7 +3955,7 @@
             v13 = pDialogueWindow;
             //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
             v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
-            v73 = v14 * (100 - v0->GetMerchant()) / 100;
+            v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
             if ( v73 < v14 / 3 )
               v73 = v14 / 3;
             v15 = v13->pStartingPosActiveItem;
@@ -3966,7 +3966,7 @@
             do
             {
               v17 = v13->GetControl(v15)->uControlParam - 36;
-              if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v17] && !v0->pActiveSkills[v17] )
+              if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] )
               {
                 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0);
                 _v0 += v18;
@@ -3994,7 +3994,7 @@
                   v20 = v13->GetControl(_v1);
                   v21 = v20;
                   v22 = v20->uControlParam - 36;
-                  if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v22] || v0->pActiveSkills[v22] )
+                  if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] )
                   {
                     v21->uW = 0;
                     v21->uHeight = 0;
@@ -4027,7 +4027,7 @@
             else
             {
 LABEL_76:
-              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]);// 
+              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 
                                                 // "Seek knowledge elsewhere %s the %s"
               strcat(pTmpBuf, "\n \n");
               strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
@@ -4044,24 +4044,24 @@
         v31 = pNPCTopics[122].pText;
         v32 = color2;
         v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0);
-        v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u);
+        v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3);
         result = (int)pDialogueWindow;
         pDialogueWindow->pNumPresenceButton = 0;
         return result;
       }
-      v34 = v0->uLevel;
+      v34 = pPlayers[uActiveCharacter]->uLevel;
       if ( v34 < v68 )
       {
-        if ( (signed __int64)v0->uExperience >= v5 )
+        if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
         {
           if ( pParty->uNumGold >= v11)
           {
             Party::TakeGold(v11);
             HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
-            ++v0->uLevel;
-            v0->uSkillPoints += v0->uLevel / 10 + 5;
-            v0->sHealth = v0->GetMaxHealth();
-            v0->sMana = v0->GetMaxMana();
+            ++pPlayers[uActiveCharacter]->uLevel;
+            pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5;
+            pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
+            pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana();
             v37 = 0;
             v38 = byte_F8B148;
             do
@@ -4084,17 +4084,18 @@
               if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
                 pOutdoor->SetFog();
             }
-            v0->PlaySound(SPEECH_87, 0);
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// 
+            pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0);
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// 
                                                 // "%s is now Level %lu and has earned %lu Skill Points!"
-            ShowStatusBarString(pTmpBuf, 2u);
-            goto LABEL_56;
+            ShowStatusBarString(pTmpBuf, 2);
+            pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
+            return true;
           }
-          ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
           v63 = 4;
 LABEL_55:
           HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63);
-LABEL_56:
+//LABEL_56:
           /*result = pMessageQueue_50CBD0->uNumMessages;
           if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
           {
@@ -4108,7 +4109,7 @@
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
           return 1; // void function actually
         }
-        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - v0->uExperience), v34 + 1);// 
+        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);// 
                                                 // "You need %d more experience to train to level %d"
         v35 = 0;
         v62 = 3;
@@ -4147,13 +4148,13 @@
         {
           if ( v43->GetControl(v73)->uControlParam == 17 )
           {
-            v46 = v0->uLevel;
+            v46 = pPlayers[uActiveCharacter]->uLevel;
             if ( v46 < v68 )
             {
-              if ( (signed __int64)v0->uExperience < v5 )
+              if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < v5 )
               {
                 v64 = (char *)(v46 + 1);
-                v61 = (char *)(v5 - LODWORD(v0->uExperience));
+                v61 = (char *)(v5 - LODWORD(pPlayers[uActiveCharacter]->uExperience));
                 v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d"
               }
               else
@@ -4185,7 +4186,7 @@
       v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138;
       v50 = -v43->pNumPresenceButton < 0;
       v73 = v43->pStartingPosActiveItem;
-      if ( v50 ^ __OFSUB__(result, v48) )
+      if ( v50 ^ result < v48 )
       {
         int _v3 = 2;
         v51 = pShopOptions;
--- a/UIHouses.h	Fri Mar 22 00:02:31 2013 +0200
+++ b/UIHouses.h	Fri Mar 22 00:06:50 2013 +0200
@@ -61,7 +61,7 @@
 char *__cdecl JailDialog();
 void  MagicShopDialog();
 void  GuildDialog();
-int __cdecl sub_4B6478();
+void  sub_4B6478();
 bool __fastcall IsTravelAvailable(int a1);
 void __cdecl TravelByTransport();
 void TempleDialog();
--- a/Viewport.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/Viewport.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -14,7 +14,6 @@
     unsigned int br_x; // esi@1
     unsigned int tl_y; // edi@3
     unsigned int br_y; // eax@3
-    int v10; // eax@7
 
     tl_x = sTL_X;
     br_x = sBR_X;
@@ -25,7 +24,7 @@
         }
     tl_y = sTL_Y;
     br_y = sBR_Y;
-    if ( (signed int)sTL_Y > (signed int)sBR_Y )
+    if ( sTL_Y > sBR_Y )
         {
         br_y = sBR_Y ^ sTL_Y ^ sBR_Y;                           // swap y's 
         tl_y = br_y ^ sBR_Y ^ sTL_Y;
@@ -150,13 +149,13 @@
 
 
     v1 = this;
-    v2 = this->field_3A;
+    v2 = this->indoor_center_y;
     v3 = 88 >> this->field_2C / 384;
     v4 = (44 - v3) << 9;
     if ( v1->sViewCenterY > v2 + v4 )
         v1->sViewCenterY = v2 + v4;
 
-    v5 = v1->field_38;
+    v5 = v1->indoor_center_x;
     v6 = (v3 - 44) << 9;
     if ( v1->sViewCenterX < v5 + v6 )
         v1->sViewCenterX = v5 + v6;
@@ -179,80 +178,60 @@
 //----- (00443365) --------------------------------------------------------
 void ViewingParams::_443365()
     {
-    ViewingParams *v1; // esi@1
-    __int16 *v2; // edi@3
+  
     Vec3_short_ *v3; // eax@4
-    unsigned int v4; // edx@4
-    signed int v5; // eax@8
     Vec3_short_ *v6; // eax@12
-    signed int v7; // edi@12
-    signed int v8; // eax@16
-    char v9; // zf@20
-    int result; // eax@21
-    unsigned int v11; // [sp+4h] [bp-1Ch]@3
-    unsigned int *v12; // [sp+8h] [bp-18h]@3
-    unsigned int v13; // [sp+Ch] [bp-14h]@8
-    unsigned int v14; // [sp+10h] [bp-10h]@2
-    unsigned int v15; // [sp+14h] [bp-Ch]@2
-    unsigned int v16; // [sp+18h] [bp-8h]@2
-    unsigned int v17; // [sp+1Ch] [bp-4h]@2
+    int minimum_y; // [sp+10h] [bp-10h]@2
+    int maximum_y; // [sp+14h] [bp-Ch]@2
+    int minimum_x; // [sp+18h] [bp-8h]@2
+     int maximum_x; // [sp+1Ch] [bp-4h]@2
 
-    v1 = this;
+ 
     InitGrayPalette();
     if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
         {
-        v16 = 0x40000000u;
-        v14 = 0x40000000u;
-        v17 = 0xC0000000u;
-        v15 = 0xC0000000u;
-        if ( (signed int)pIndoor->pMapOutlines->uNumOutlines > 0 )
+        minimum_x = 0x40000000;
+        minimum_y = 0x40000000;
+
+        maximum_x = -0x40000000;
+        maximum_y = -0x40000000;
+        for (int i=0; i<pIndoor->pMapOutlines->uNumOutlines; ++i)
             {
-            v2 = (__int16 *)(pIndoor->pMapOutlines->pOutlines);
-            v11 = pIndoor->pMapOutlines->uNumOutlines;
-            v12 = (uint *)pIndoor->pMapOutlines->pOutlines;
-            do
-                {
-                v3 = &pIndoor->pVertices[*v2];
-                v4 = v3->x;
-                if ( (signed int)v4 < (signed int)v16 )
-                    v16 = v3->x;
-                if ( (signed int)v4 > (signed int)v17 )
-                    v17 = v3->x;
-                v5 = v3->y;
-                v13 = v5;
-                if ( v5 < (signed int)v14 )
-                    v14 = v4;
-                if ( v5 > (signed int)v15 )
-                    v15 = v4;
-                v6 = &pIndoor->pVertices[v2[1]];
-                v7 = v6->x;
-                if ( v7 < (signed int)v16 )
-                    v16 = v4;
-                if ( v7 > (signed int)v17 )
-                    v17 = v4;
-                v8 = v6->y;
-                if ( v8 < (signed int)v14 )
-                    v14 = v13;
-                if ( v8 > (signed int)v15 )
-                    v15 = v13;
-                v2 = (__int16 *)(v12 + 3);
-                v9 = v11-- == 1;
-                v12 += 3;
-                }
-                while ( !v9 );
+            v3 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace1ID];
+
+            if ( v3->x < minimum_x )
+                minimum_x = v3->x;
+            if ( v3->x > maximum_x )
+                maximum_x = v3->x;
+            if ( v3->y < minimum_y )
+                minimum_y = v3->x;
+            if ( v3->y > maximum_y )
+                maximum_y = v3->x;
+
+            v6 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace2ID];
+
+            if ( v6->x < minimum_x )
+                minimum_x = v3->x;
+            if ( v6->x > maximum_x )
+                maximum_x = v3->x;
+ 
+            if ( v6->y < minimum_y )
+                minimum_y = v3->y;
+            if ( v6->y > maximum_y )
+                maximum_y = v3->y;
             }
-        v1->uMinimapZoom = 1024;
-        v1->field_38 = (signed int)(v16 + v17) / 2;
-        v1->field_28 = 10;
-        result = (signed int)(v14 + v15) / 2;
-        v1->field_3A = result;
+
+        uMinimapZoom = 1024;
+        indoor_center_x = (signed int)(minimum_x + maximum_x) / 2;
+        field_28 = 10;
+        indoor_center_y = (signed int)(minimum_y + maximum_y) / 2;
         }
     else
         {
-        v1->field_38 = 0;
-        v1->field_3A = 0;
-        v1->uMinimapZoom = dword_576E2C;
-        v1->field_28 = dword_576E28;
+        indoor_center_x = 0;
+        indoor_center_y = 0;
+        uMinimapZoom = dword_576E2C;
+        field_28 = dword_576E28;
         }
-    v1->field_2C = 384;
+    field_2C = 384;
     }
\ No newline at end of file
--- a/Viewport.h	Fri Mar 22 00:02:31 2013 +0200
+++ b/Viewport.h	Fri Mar 22 00:06:50 2013 +0200
@@ -67,8 +67,8 @@
   int field_2C;
   int sViewCenterX;
   int sViewCenterY;
-  __int16 field_38;
-  __int16 field_3A;
+  __int16 indoor_center_x;
+  __int16 indoor_center_y;
   int field_3C;
   unsigned int uTextureID_LocationMap;
   int bRedrawGameUI;
--- a/mm7_1.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/mm7_1.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -1144,7 +1144,7 @@
       }
       else
       {
-        sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName);
+        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName);
         ShowStatusBarString(pTmpBuf2, 2u);
         if ( v22->uItemID == 506 )
           _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
--- a/mm7_2.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/mm7_2.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -4776,13 +4776,13 @@
     v4 = v24;
   }
   v5 = v2->pTextures;
-  v2->uNumTextures = v4;
+  v2->sNumTextures = v4;
   v6 = pAllocator->AllocNamedChunk(v5, 20 * v4, "Txt Frames");
   v2->pTextures = (TextureFrame *)v6;
   if ( !v6 )
     Abortf("CTextureFrameTable::load - Out of Memory!");
   v7 = File;
-  v2->uNumTextures = 0;
+  v2->sNumTextures = 0;
   fseek(v7, 0, 0);
   for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
   {
@@ -4790,23 +4790,23 @@
     memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu);
     if ( v21 && *Str1 != 47 )
     {
-      strcpy(v2->pTextures[v2->uNumTextures].pTextureName, Str1);
-      v2->pTextures[v2->uNumTextures].uAnimTime = atoi(Str);
+      strcpy(v2->pTextures[v2->sNumTextures].pTextureName, Str1);
+      v2->pTextures[v2->sNumTextures].uAnimTime = atoi(Str);
       v9 = 2;
-      for ( v2->pTextures[v2->uNumTextures].uFlags = 0; v9 < v21; ++v9 )
+      for ( v2->pTextures[v2->sNumTextures].uFlags = 0; v9 < v21; ++v9 )
       {
         if ( !_strcmpi((&Str1)[4 * v9], "New") )
         {
-          v10 = (int)&v2->pTextures[v2->uNumTextures].uFlags;
+          v10 = (int)&v2->pTextures[v2->sNumTextures].uFlags;
           *(char *)v10 |= 2u;
         }
       }
-      ++v2->uNumTextures;
+      ++v2->sNumTextures;
     }
   }
   fclose(File);
   v11 = 0;
-  if ( (signed int)(v2->uNumTextures - 1) > 0 )
+  if ( (signed int)(v2->sNumTextures - 1) > 0 )
   {
     v12 = 0;
     do
@@ -4817,9 +4817,9 @@
       ++v11;
       ++v12;
     }
-    while ( v11 < (signed int)(v2->uNumTextures - 1) );
-  }
-  for ( j = 0; j < (signed int)v2->uNumTextures; *(short *)(Argsa + 16) = v16 )
+    while ( v11 < (signed int)(v2->sNumTextures - 1) );
+  }
+  for ( j = 0; j < (signed int)v2->sNumTextures; *(short *)(Argsa + 16) = v16 )
   {
     v15 = v2->pTextures;
     Argsa = (int)&v15[j];
@@ -5105,7 +5105,7 @@
       v37 = pIndoor->GetSector(pPosX, a4, v36);
       if ( v37 == pSector )
       {
-        v38 = _46CEC3_get_floor_level(pPosX, a4, a3, v37, &uFaceID);
+        v38 = BLV_GetFloorLevel(pPosX, a4, a3, v37, &uFaceID);
         v39 = v38;
         if ( v38 != -30000 )
         {
@@ -5236,7 +5236,7 @@
       || (v22 = pParty->vPosition.z,
           result = pIndoor->GetSector(v11, v14, pParty->vPosition.z),
           result == v21)
-      && (result = _46CEC3_get_floor_level(v11, v14, v22, result, &uFaceID), result != -30000)
+      && (result = BLV_GetFloorLevel(v11, v14, v22, result, &uFaceID), result != -30000)
       && (result = abs(result - v22), result <= 1024) )
     {
       if ( v20 == uNumActors )
@@ -5548,7 +5548,7 @@
       v19.vPosition.z = pParty->vPosition.z;
       v26 = 0;
       v27 = 0;
-      v19.vPosition.z = sub_46D49E_prolly_get_world_y_under_party(
+      v19.vPosition.z = ODM_GetFloorLevel(
                           v19.vPosition.x,
                           v23 + pParty->vPosition.y,
                           pParty->vPosition.z,
@@ -5606,7 +5606,7 @@
       v17 = pIndoor->GetSector(v19.vPosition.x, v23 + pParty->vPosition.y, pParty->vPosition.z);
       if ( v17 == v22 )
       {
-        v18 = _46CEC3_get_floor_level(v19.vPosition.x, v19.vPosition.y, v19.vPosition.z, v17, &uFaceID);
+        v18 = BLV_GetFloorLevel(v19.vPosition.x, v19.vPosition.y, v19.vPosition.z, v17, &uFaceID);
         v19.vPosition.z = v18;
         if ( v18 != -30000 )
         {
@@ -11929,7 +11929,7 @@
         if ( pParty->pPickedItem.uItemID )
           return 1;
         v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName;
-        sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24);
+        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24);
         ShowStatusBarString(pTmpBuf2, 2u);
         if ( v19->uItemID == 506 )
           _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
--- a/mm7_3.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/mm7_3.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -56,18 +56,18 @@
 //----- (0046E44E) --------------------------------------------------------
 int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1)
 {
-  BLVSector *v1; // edi@1
+  BLVSector *pSector; // edi@1
   signed int v2; // ebx@1
-  BLVFace *v3; // esi@2
-  __int16 v4; // si@10
-  int v5; // ecx@12
+  BLVFace *pFace; // esi@2
+  __int16 pNextSector; // si@10
+  int pArrayNum; // ecx@12
   unsigned __int8 v6; // sf@12
   unsigned __int8 v7; // of@12
   int result; // eax@14
-  BLVSector *v9; // ebx@15
+  //BLVSector *v9; // ebx@15
   int v10; // ecx@15
-  int v11; // eax@16
-  BLVFace *v12; // ebp@16
+  int pFloor; // eax@16
+  //BLVFace *v12; // ebp@16
   int v13; // eax@24
   int v14; // esi@24
   int v15; // eax@24
@@ -88,31 +88,31 @@
   int v30; // [sp+24h] [bp-34h]@35
   int v31; // [sp+28h] [bp-30h]@24
   int v32; // [sp+2Ch] [bp-2Ch]@15
-  int v33[10]; // [sp+30h] [bp-28h]@1
-
-  v1 = &pIndoor->pSectors[stru_721530.uSectorID];
+  int pSectorsArray[10]; // [sp+30h] [bp-28h]@1
+
+  pSector = &pIndoor->pSectors[stru_721530.uSectorID];
   v2 = 0;
   a10 = b1;
-  v33[0] = stru_721530.uSectorID;
-  for ( i = 1; v2 < v1->uNumPortals; ++v2 )
-  {
-    v3 = &pIndoor->pFaces[v1->pPortals[v2]];
-    if ( stru_721530.sMaxX <= v3->pBounding.x2
-      && stru_721530.sMinX >= v3->pBounding.x1
-      && stru_721530.sMaxY <= v3->pBounding.y2
-      && stru_721530.sMinY >= v3->pBounding.y1
-      && stru_721530.sMaxZ <= v3->pBounding.z2
-      && stru_721530.sMinZ >= v3->pBounding.z1
-      && abs((v3->pFacePlane_old.dist
-            + stru_721530.normal.x * v3->pFacePlane_old.vNormal.x
-            + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y
-            + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 )
-    {
-      v4 = v3->uSectorID == stru_721530.uSectorID ? v3->uBackSectorID : v3->uSectorID;
-      v5 = i++;
-      v7 = __OFSUB__(i, 10);
+  pSectorsArray[0] = stru_721530.uSectorID;
+  for ( i = 1; v2 < pSector->uNumPortals; ++v2 )
+  {
+    pFace = &pIndoor->pFaces[pSector->pPortals[v2]];
+    if ( stru_721530.sMaxX <= pFace->pBounding.x2
+      && stru_721530.sMinX >= pFace->pBounding.x1
+      && stru_721530.sMaxY <= pFace->pBounding.y2
+      && stru_721530.sMinY >= pFace->pBounding.y1
+      && stru_721530.sMaxZ <= pFace->pBounding.z2
+      && stru_721530.sMinZ >= pFace->pBounding.z1
+      && abs((pFace->pFacePlane_old.dist
+            + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x
+            + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y
+            + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 )
+    {
+      pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID
+      pArrayNum = i++;
+      v7 = i < 10;
       v6 = i - 10 < 0;
-      v33[v5] = v4;
+      pSectorsArray[pArrayNum] = pNextSector;
       if ( !(v6 ^ v7) )
         break;
     }
@@ -123,9 +123,9 @@
   {
     while ( 1 )
     {
-      v9 = &pIndoor->pSectors[v33[result]];
+      pSector = &pIndoor->pSectors[pSectorsArray[result]];
       v10 = 0;
-      v32 = v9->uNumFloors + v9->uNumWalls + v9->uNumCeilings;
+      v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings;
       v26 = 0;
       if ( v32 > 0 )
         break;
@@ -136,53 +136,40 @@
     }
     while ( 1 )
     {
-      v11 = v9->pFloors[v10];
-      v12 = &pIndoor->pFaces[v11];
-      if ( v12->Portal()
-        || stru_721530.sMaxX > v12->pBounding.x2
-        || stru_721530.sMinX < v12->pBounding.x1
-        || stru_721530.sMaxY > v12->pBounding.y2
-        || stru_721530.sMinY < v12->pBounding.y1
-        || stru_721530.sMaxZ > v12->pBounding.z2
-        || stru_721530.sMinZ < v12->pBounding.z1
-        || v11 == stru_721530.field_84 )
+      pFloor = pSector->pFloors[v10];
+      pFace = &pIndoor->pFaces[pFloor];
+      if ( pFace->Portal()
+        || stru_721530.sMaxX > pFace->pBounding.x2
+        || stru_721530.sMinX < pFace->pBounding.x1
+        || stru_721530.sMaxY > pFace->pBounding.y2
+        || stru_721530.sMinY < pFace->pBounding.y1
+        || stru_721530.sMaxZ > pFace->pBounding.z2
+        || stru_721530.sMinZ < pFace->pBounding.z1
+        || pFloor == stru_721530.field_84 )
         goto LABEL_45;
-      v13 = v12->pFacePlane_old.vNormal.y;
-      v14 = v12->pFacePlane_old.dist;
+      v13 = pFace->pFacePlane_old.vNormal.y;
+      v14 = pFace->pFacePlane_old.dist;
       v31 = v13;
-      v15 = (stru_721530.normal.x * v12->pFacePlane_old.vNormal.x
-           + v14
-           + stru_721530.normal.y * v13
-           + stru_721530.normal.z * v12->pFacePlane_old.vNormal.z) >> 16;
+      v15 = (stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + v14 + stru_721530.normal.y * v13
+           + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16;
       if ( v15 > 0 )
       {
-        v16 = (stru_721530.normal2.y * v31
-             + v12->pFacePlane_old.dist
-             + stru_721530.normal2.z * v12->pFacePlane_old.vNormal.z
-             + stru_721530.normal2.x * v12->pFacePlane_old.vNormal.x) >> 16;
+        v16 = (stru_721530.normal2.y * v31 + pFace->pFacePlane_old.dist + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z
+             + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x) >> 16;
         if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d )
         {
           if ( v16 <= v15 )
           {
             a3 = stru_721530.field_6C;
-            if ( sub_47531C(
-                   stru_721530.prolly_normal_d,
-                   &a3,
-                   stru_721530.normal.x,
-                   stru_721530.normal.y,
-                   stru_721530.normal.z,
-                   stru_721530.field_58.x,
-                   stru_721530.field_58.y,
-                   stru_721530.field_58.z,
-                   v12,
-                   a10) )
+            if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z,
+                   stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
             {
               v17 = a3;
             }
             else
             {
               a3 = stru_721530.field_6C + stru_721530.prolly_normal_d;
-              if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, v12) )
+              if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, pFace) )
                 goto LABEL_34;
               v17 = a3 - stru_721530.prolly_normal_d;
               a3 -= stru_721530.prolly_normal_d;
@@ -190,7 +177,7 @@
             if ( v17 < stru_721530.field_7C )
             {
               stru_721530.field_7C = v17;
-              v18 = 8 * v9->pFloors[v26];
+              v18 = 8 * pSector->pFloors[v26];
               LOBYTE(v18) = v18 | 6;
               stru_721530.uFaceID = v18;
             }
@@ -199,40 +186,27 @@
       }
 LABEL_34:
       if ( !(stru_721530.field_0 & 1)
-        || (v19 = v12->pFacePlane_old.vNormal.x,
-            v20 = v12->pFacePlane_old.vNormal.y,
+        || (v19 = pFace->pFacePlane_old.vNormal.x,
+            v20 = pFace->pFacePlane_old.vNormal.y,
             v30 = v19,
-            v21 = (stru_721530.field_34.x * v19
-                 + v12->pFacePlane_old.dist
-                 + stru_721530.field_34.y * v20
-                 + stru_721530.field_34.z * v12->pFacePlane_old.vNormal.z) >> 16,
+            v21 = (stru_721530.field_34.x * v19 + pFace->pFacePlane_old.dist + stru_721530.field_34.y * v20
+                 + stru_721530.field_34.z * pFace->pFacePlane_old.vNormal.z) >> 16,
             v21 <= 0)
-        || (v22 = (stru_721530.field_4C * v30
-                 + v12->pFacePlane_old.dist
-                 + stru_721530.field_50 * v20
-                 + stru_721530.field_54 * v12->pFacePlane_old.vNormal.z) >> 16,
+        || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20
+                 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16,
             v21 > stru_721530.prolly_normal_d)
         && v22 > stru_721530.prolly_normal_d
         || v22 > v21 )
         goto LABEL_45;
       a3 = stru_721530.field_6C;
-      if ( sub_47531C(
-             stru_721530.field_8,
-             &a3,
-             stru_721530.field_34.x,
-             stru_721530.field_34.y,
-             stru_721530.field_34.z,
-             stru_721530.field_58.x,
-             stru_721530.field_58.y,
-             stru_721530.field_58.z,
-             v12,
-             a10) )
+      if ( sub_47531C(stru_721530.field_8, &a3, stru_721530.field_34.x, stru_721530.field_34.y, stru_721530.field_34.z,
+             stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
       {
         v23 = a3;
         goto LABEL_43;
       }
       a3 = stru_721530.field_6C + stru_721530.field_8;
-      if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, v12) )
+      if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, pFace) )
       {
         v23 = a3 - stru_721530.prolly_normal_d;
         a3 -= stru_721530.prolly_normal_d;
@@ -240,7 +214,7 @@
         if ( v23 < stru_721530.field_7C )
         {
           stru_721530.field_7C = v23;
-          v24 = 8 * v9->pFloors[v26];
+          v24 = 8 * pSector->pFloors[v26];
           LOBYTE(v24) = v24 | 6;
           stru_721530.uFaceID = v24;
         }
@@ -524,7 +498,7 @@
 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);
+  int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID);
 
   if (floor_level != -30000 && floor_level <= z + 50)
   {
@@ -535,7 +509,7 @@
   uint uSectorID = pIndoor->GetSector(x, y, z);
   *pSectorID = uSectorID;
 
-  floor_level = _46CEC3_get_floor_level(x, y, z, uSectorID, &uFaceID);
+  floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID);
   if (uSectorID && floor_level != -30000)
     *pFaceID = uFaceID;
   else return -30000;
@@ -997,7 +971,7 @@
     if ( !v0->CanAct() )
       v74 = 0;
     v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y);
-    v5 = sub_46D49E_prolly_get_world_y_under_party(
+    v5 = ODM_GetFloorLevel(
            v0->vPosition.x,
            v0->vPosition.y,
            v0->vPosition.z,
@@ -1174,7 +1148,7 @@
         v70 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
       v34 = 0;
       v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
-      v36 = sub_46D49E_prolly_get_world_y_under_party(
+      v36 = ODM_GetFloorLevel(
               stru_721530.normal2.x,
               stru_721530.normal2.y,
               stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
@@ -1631,15 +1605,15 @@
   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 v89; // [sp+58h] [bp-8h]@1
   int angle; // [sp+5Ch] [bp-4h]@47
 
   uFaceEvent = 0;
-  v89 = pParty->uFallSpeed;
+  //v89 = pParty->uFallSpeed;
   v1 = 0;
-  new_party_y = pParty->vPosition.y;
   v2 = 0;
   new_party_x = pParty->vPosition.x;
+  new_party_y = pParty->vPosition.y;
   party_z = pParty->vPosition.z;
   uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
   v72 = 0;
@@ -1730,7 +1704,6 @@
     pParty->field_6F8 -= pEventTimer->uTimeElapsed;
   if ( party_z > v80 + 1 )
   {
-LABEL_43:
     if ( bJumping )
       goto LABEL_45;
     goto LABEL_44;
@@ -1745,7 +1718,9 @@
     if (pFace->uAttributes & 0x04000000 )
     {
       uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
-      goto LABEL_43;
+      if ( bJumping )
+        goto LABEL_45;
+      goto LABEL_44;
     }
   }
 LABEL_44:
@@ -1770,13 +1745,22 @@
         if ( uTurnSpeed )
           goto LABEL_58;
         v13 = (double)v82 * fTurnSpeedMultiplier;
-        goto LABEL_51;
+        v14 = angle + (unsigned __int64)(signed __int64)v13;
+        angle = stru_5C6E00->uDoublePiMask & v14;
+        goto LABEL_87;
       case PARTY_TurnRight:
         LODWORD(v15) = uTurnSpeed;
         if ( uTurnSpeed )
-          goto LABEL_56;
+        {
+          angle = stru_5C6E00->uDoublePiMask & (angle - v15);
+          goto LABEL_87;
+        }
         v16 = (double)v82 * fTurnSpeedMultiplier;
-        goto LABEL_55;
+        //{
+        v15 = (signed __int64)v16;
+        angle = stru_5C6E00->uDoublePiMask & (angle - v15);
+        goto LABEL_87;
+        //}
       case PARTY_FastTurnLeft:
         v12 = uTurnSpeed;
         if ( uTurnSpeed )
@@ -1787,7 +1771,6 @@
         else
         {
           v13 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
-LABEL_51:
           v14 = angle + (unsigned __int64)(signed __int64)v13;
         }
         angle = stru_5C6E00->uDoublePiMask & v14;
@@ -1797,13 +1780,11 @@
         if ( !uTurnSpeed )
         {
           v16 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
-LABEL_55:
           v15 = (signed __int64)v16;
         }
-LABEL_56:
         angle = stru_5C6E00->uDoublePiMask & (angle - v15);
         goto LABEL_87;
-      case PARTY_StrafeLeft:
+      case PARTY_StrafeLeft://Ctrl + <-
         __debugbreak();
         v17 = stru_5C6E00->Sin(angle);
         v18 = (double)v81;
@@ -1812,7 +1793,9 @@
         v2 -= v78;
         v19 = stru_5C6E00->Cos(angle);
         v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        goto LABEL_63;
+        v1 += v78;
+        v78 = 1;
+        goto LABEL_87;
       case PARTY_StrafeRight:
         __debugbreak();
         v20 = stru_5C6E00->Sin(angle);
@@ -1822,7 +1805,10 @@
         v2 += v78;
         v22 = stru_5C6E00->Cos(angle);
         v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        goto LABEL_68;
+        //goto LABEL_68;
+        v1 -= v78;
+        v78 = 1;
+        goto LABEL_87;
       case PARTY_WalkForward:
         __debugbreak();
         v23 = stru_5C6E00->Cos(angle);
@@ -1832,9 +1818,9 @@
         v2 += v78;
         v25 = stru_5C6E00->Sin(angle);
         v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16;
-LABEL_63:
         v1 += v78;
-        goto LABEL_64;
+        v78 = 1;
+        goto LABEL_87;
       case PARTY_WalkBackward:
         __debugbreak();
         v26 = stru_5C6E00->Cos(angle);
@@ -1844,9 +1830,7 @@
         v2 -= v78;
         v28 = stru_5C6E00->Sin(angle);
         v78 = (unsigned __int64)(v28 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16;
-LABEL_68:
         v1 -= v78;
-LABEL_64:
         v78 = 1;
         goto LABEL_87;
       case PARTY_RunForward:
@@ -1865,7 +1849,6 @@
         v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
         //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
         v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
-//LABEL_70:
         v72 = 1;
         goto LABEL_87;
       case PARTY_LookUp:
@@ -1875,30 +1858,24 @@
         v35 = uActiveCharacter;
         if ( !uActiveCharacter )
           goto LABEL_87;
-        v65 = 0;
-        v63 = SPEECH_63;
-        goto LABEL_76;
+        pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0);
+        break;
       case PARTY_LookDown:
         _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
         if ( _view_angle < -128 )
           _view_angle = -128;
         v35 = uActiveCharacter;
         if ( uActiveCharacter )
-        {
-          v65 = 0;
-          v63 = SPEECH_64;
-LABEL_76:
-          pPlayers[v35]->PlaySound((PlayerSpeech)v63, v65);
-        }
+          pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0);
         break;
       case PARTY_CenterView:
         _view_angle = 0;
         break;
       case PARTY_Jump:
-        if ( (!bJumping || party_z <= v80 + 6 && v89 <= 0) && pParty->field_24 )
+        if ( (!bJumping || party_z <= v80 + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
         {
           bJumping = 1;
-          v89 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v89);
+          pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
         }
         break;
       default:
@@ -1910,22 +1887,22 @@
   pParty->sRotationX = _view_angle;
   if ( bJumping )
   {
-    v89 += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
+    pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
   }
   else
   {
     if ( pIndoor->pFaces[v68].pFacePlane_old.vNormal.z < 32768 )
     {
-      v89 -= pEventTimer->uTimeElapsed * GetGravityStrength();
+      pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength();
       goto LABEL_92;
     }
     if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
       goto LABEL_92;
-    v89 = 0;
-  }
-  if ( bJumping != v36 && v89 <= v36 )
-  {
-    if ( v89 < -500 && !pParty->bFlying )
+    pParty->uFallSpeed = 0;
+  }
+  if ( bJumping != v36 && pParty->uFallSpeed <= v36 )
+  {
+    if ( pParty->uFallSpeed < -500 && !pParty->bFlying )
     {
       v41 = &pPlayers[1];
       do
@@ -1964,7 +1941,7 @@
     stru_721530.field_20 = v1;
     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.field_24 = pParty->uFallSpeed;
     stru_721530.uSectorID = uSectorID;
     v38 = 0;
     if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 )
@@ -2023,8 +2000,7 @@
     {
       v53 = integer_sqrt(v2 * v2 + v1 * v1);
       v80 = v53;
-      v54 = stru_5C6E00->Atan2(
-              new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
+      v54 = stru_5C6E00->Atan2(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->Cos(v54) * (signed __int64)v53) >> 16;
       v55 = stru_5C6E00->Sin(v54);
@@ -2038,8 +2014,8 @@
         v45 = v44->uPolygonType;
         if ( v45 == 3 )
         {
-          if ( v89 < 0 )
-            v89 = 0;
+          if ( pParty->uFallSpeed < 0 )
+            pParty->uFallSpeed = 0;
           v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1;
           if ( pParty->uFallStartY - v87 < 512 )
             pParty->uFallStartY = v87;
@@ -2048,9 +2024,11 @@
             v1 = 0;
             v2 = 0;
           }
-          goto LABEL_143;
-        }
-        v46 = v89 * v44->pFacePlane_old.vNormal.z;
+          if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 )
+            uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
+          goto LABEL_152;
+        }
+        v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z;
         v47 = v45 == 4;
         v48 = v44->pFacePlane_old.vNormal.x;
         if ( !v47 )
@@ -2064,7 +2042,7 @@
           v82 = v44->pFacePlane_old.vNormal.z;
           v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
           v2 += v50;
-          v89 += v82;
+          pParty->uFallSpeed += v82;
           v74 = v44->pFacePlane_old.vNormal.z;
           v51 = v44->pFacePlane_old.vNormal.y;
           v69 = v44->pFacePlane_old.vNormal.x;
@@ -2077,9 +2055,7 @@
             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 )
             uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
           goto LABEL_152;
@@ -2094,19 +2070,24 @@
         v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
         v2 += v49;
         v1 += v81;
-        v89 += v82;
+        pParty->uFallSpeed += v82;
         if ( v2 * v2 + v1 * v1 >= 400 )
-          goto LABEL_142;
+        {
+          v43 = stru_721530.uFaceID;
+          if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 )
+            uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
+          goto LABEL_152;
+        }
         v2 = 0;
         v1 = 0;
-        v89 = 0;
+        pParty->uFallSpeed = 0;
       }
     }
 LABEL_152:
     v2 = (unsigned __int64)(58500i64 * v2) >> 16;
     v1 = (unsigned __int64)(58500i64 * v1) >> 16;
     ++v83;
-    v89 = (unsigned __int64)(58500i64 * v89) >> 16;
+    pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
     if ( v83 >= 100 )
     {
       new_party_z = v87;
@@ -2116,9 +2097,8 @@
   if ( bWalkSound && pParty->field_6F8 <= 0 )
   {
     if ( integer_sqrt((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 )
+         * (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 || bFeatherFall) )
     {
@@ -2139,7 +2119,6 @@
         goto LABEL_175;
       }
       v57 = (SoundID)63;
-LABEL_174:
       v56 = pAudioPlayer;
       goto LABEL_175;
     }
@@ -2155,7 +2134,8 @@
       if ( v71 )
       {
         v57 = (SoundID)102;
-        goto LABEL_174;
+        v56 = pAudioPlayer;
+        goto LABEL_175;
       }
       v56 = pAudioPlayer;
       if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
@@ -2180,7 +2160,7 @@
   pParty->vPosition.x = new_party_x;
   pParty->vPosition.z = new_party_z;
   pParty->vPosition.y = new_party_y;
-  pParty->uFallSpeed = v89;
+  //pParty->uFallSpeed = v89;
   if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
     pParty->uFlags |= 0x200;
   if (uFaceEvent)
@@ -2308,14 +2288,14 @@
   int v113; // [sp+4Ch] [bp-48h]@1
   unsigned int v114; // [sp+50h] [bp-44h]@1
   int _walk_speed; // [sp+54h] [bp-40h]@48
-  int v116; // [sp+58h] [bp-3Ch]@1
-  int v117; // [sp+5Ch] [bp-38h]@1
+  int pX; // [sp+58h] [bp-3Ch]@1
+  int pY; // [sp+5Ch] [bp-38h]@1
   int v118; // [sp+60h] [bp-34h]@1
   //Player **v119; // [sp+64h] [bp-30h]@4
   int _angle_x; // [sp+68h] [bp-2Ch]@48
   int v121; // [sp+6Ch] [bp-28h]@1
   unsigned int v122; // [sp+70h] [bp-24h]@180
-  int v123; // [sp+74h] [bp-20h]@1
+  int pZ; // [sp+74h] [bp-20h]@1
   int v124; // [sp+78h] [bp-1Ch]@1
   int _angle_y; // [sp+7Ch] [bp-18h]@48
   int v126; // [sp+80h] [bp-14h]@48
@@ -2325,13 +2305,13 @@
   int v130; // [sp+90h] [bp-4h]@14
 
   v121 = pParty->uFallSpeed;
-  v123 = pParty->vPosition.z;
+  pZ = pParty->vPosition.z;
   v1 = 0;
   v103 = 0;
   v2 = 0;
   *(float *)&v128 = 0.0;
-  v116 = pParty->vPosition.x;
-  v117 = pParty->vPosition.y;
+  pX = pParty->vPosition.x;
+  pY = pParty->vPosition.y;
   v113 = pParty->field_6F0;
   bJumping = 0;
   auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y);
@@ -2373,13 +2353,13 @@
 		//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 )
       bWaterWalk = 0;
   }
-  v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk);
+  v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &v130, &v108, bWaterWalk);
   v111 = v3;
   if ( bFeatherFall )
     pParty->uFallStartY = v3;
   else
     v3 = pParty->uFallStartY;
-  if ( v3 - v123 > 512 && !bFeatherFall && v123 <= v111 + 1 )
+  if ( v3 - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 )
   {
     if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
     {
@@ -2392,7 +2372,7 @@
       if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) )
       {
         player->ReceiveDamage(
-            (signed int)((pParty->uFallStartY - v123) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256,
+            (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256,
             4);
         v105 = 20 - player->_48EA1B_get_static_effect(player->GetActualEndurance());
         player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
@@ -2403,10 +2383,10 @@
   }
   v109 = -1;
   if ( pParty->bFlying )
-    v109 = sub_46D8E3(v116, v117, v123 + pParty->uPartyHeight, (int)&v102);
+    v109 = sub_46D8E3(pX, pY, pZ + pParty->uPartyHeight, (int)&v102);
   v107 = v108 == 0;
   v105 = v111 + 1;
-  if ( v123 <= v111 + 1 )
+  if ( pZ <= v111 + 1 )
   {
     v109 = -1;
     pParty->bFlying = false;
@@ -2415,7 +2395,7 @@
   {
     bJumping = 1;
   }
-  v101 = v123 - v111 <= 32;
+  v101 = pZ - v111 <= 32;
   if ( bWalkSound && pParty->field_6F8 > 0 )
     pParty->field_6F8 -= pEventTimer->uTimeElapsed;
   if (!bUnderwater
@@ -2472,28 +2452,28 @@
           {
             if ( pParty->vPosition.z < 4000 || bJumping )
             {
-              v123 += 30;
+              pZ += 30;
               v113 += 30;
               pParty->bFlying = 1;
-              if ( v123 > 4000 )
+              if ( pZ > 4000 )
               {
-                v123 = 4000;
+                pZ = 4000;
                 v113 = 4000;
               }
               v1 = 0;
               v2 = 0;
               v121 = 0;
               *(float *)&v128 = 0.0;
-              if ( v102 && v123 < v109 && (signed int)(pParty->uPartyHeight + v123) >= v109 )
+              if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 )
               {
                 pParty->field_6E0 = 0;
                 pParty->field_6E4 = 0;
                 pPartyActionQueue->uNumActions = 0;
                 pParty->uFlags |= PARTY_FLAGS_1_LANDING;
                 pParty->vPosition.z = v109 - pParty->uPartyHeight - 31;
-                pParty->field_6F0 = v123;
+                pParty->field_6F0 = pZ;
                 pParty->bFlying = 0;
-                v123 = v109 - pParty->uPartyHeight - 31;
+                pZ = v109 - pParty->uPartyHeight - 31;
                 v113 = pParty->field_6F0;
               }
               pParty->uFallSpeed = 0;
@@ -2511,13 +2491,13 @@
             || pParty->pPartyBuffs[7].uFlags & 1
             || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
           {
-            v123 -= 30;
+            pZ -= 30;
             v113 -= 30;
             pParty->uFallSpeed = 0;
             v121 = 0;
             pParty->bFlying = 1;
             v127 = (BSPModel *)1;
-            if ( v123 <= v111 )
+            if ( pZ <= v111 )
             {
               pParty->bFlying = 0;
               pPartyActionQueue->uNumActions = 0;
@@ -2743,7 +2723,7 @@
 LABEL_123:
   pParty->sRotationY = _angle_y;
   pParty->sRotationX = _angle_x;
-  if ( v123 < v111 )
+  if ( pZ < v111 )
   {
     if ( pParty->bFlying )
     {
@@ -2751,23 +2731,23 @@
       v31 = GetTickCount();
       v126 = stru_5C6E00->Cos(v31);
       v129 = (unsigned __int64)(4i64 * v126) >> 16;
-      v123 = v113 + v129;
+      pZ = v113 + v129;
       if ( v127 )
-        v123 = v113;
+        pZ = v113;
       if (pParty->FlyActive())
         stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu;
-      pParty->uFallStartY = v123;
+      pParty->uFallStartY = pZ;
       goto LABEL_141;
     }
     if ( v130 && v121 )
-      sub_42F960_create_object(v116, v117, v111);
+      sub_42F960_create_object(pX, pY, v111);
     v121 = 0;
-    v123 = v111;
+    pZ = v111;
     pParty->uFallStartY = v111;
   }
   if ( pParty->bFlying )
     goto LABEL_130;
-  v113 = v123;
+  v113 = pZ;
   if (pParty->FlyActive())
     stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
 
@@ -2794,8 +2774,8 @@
     // rolling down the hill
     // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
     // and falling to the gravity, gradually sliding downwards. nice trick
-    v123 = v111;
-    ODM_GetTerrainNormalAt(v116, v117, &v98);
+    pZ = v111;
+    ODM_GetTerrainNormalAt(pX, pY, &v98);
     v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
     v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
     v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
@@ -2828,7 +2808,7 @@
   else
   {
 LABEL_150:
-  pParty->uFallStartY = v123;
+  pParty->uFallStartY = pZ;
   }
 
   if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
@@ -2845,13 +2825,13 @@
   stru_721530.field_C = pParty->uPartyHeight - 32;
   do
   {
-    stru_721530.field_34.x = v116;
-    stru_721530.normal.x = v116;
+    stru_721530.field_34.x = pX;
+    stru_721530.normal.x = pX;
     stru_721530.field_1C = v2;
-    stru_721530.field_34.y = v117;
-    stru_721530.normal.y = v117;
-    stru_721530.normal.z = stru_721530.prolly_normal_d + v123 + 1;
-    stru_721530.field_34.z = stru_721530.field_C + v123 + 1;
+    stru_721530.field_34.y = pY;
+    stru_721530.normal.y = pY;
+    stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1;
+    stru_721530.field_34.z = stru_721530.field_C + pZ + 1;
     stru_721530.field_20 = v128;
     stru_721530.field_24 = v121;
     v36 = 0;
@@ -2875,24 +2855,17 @@
     }
     else
     {
-      _angle_x = v116 + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16);
-      _angle_y = v117 + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
+      _angle_x = pX + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16);
+      _angle_y = pY + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
       v127 = (BSPModel *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
-      v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + v123;
+      v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + pZ;
     }
     v122 = v40;
-    sub_46D49E_prolly_get_world_y_under_party(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
-    v129 = sub_46D49E_prolly_get_world_y_under_party(_angle_x, v117, v40, pParty->uPartyHeight, &v130, &v97, 0);
-    auto v119 = sub_46D49E_prolly_get_world_y_under_party(
-                        v116,
-                        _angle_y,
-                        v40,
-                        pParty->uPartyHeight,
-                        &v130,
-                        &v110,
-                        0);
-    v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, v117);
-    v42 = IsTerrainSlopeTooHigh(v116, _angle_y);
+    ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
+    v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &v130, &v97, 0);
+    auto v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &v130, &v110, 0);
+    v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY);
+    v42 = IsTerrainSlopeTooHigh(pX, _angle_y);
     v107 = 0;
     v118 = v42;
     if ( !v97 && !v110 && !v108 )
@@ -2901,48 +2874,41 @@
     v44 = 1;
     if ( bUnderwater || !v107 )
       goto LABEL_197;
-    if ( v127 && v129 > v123 )
+    if ( v127 && v129 > pZ )
       v44 = 0;
-    if ( v118 && v119 > v123 )
+    if ( v118 && v119 > pZ )
       v43 = 0;
     if ( v44 )
       goto LABEL_197;
     if ( v43 )
       goto LABEL_198;
-    v127 = (BSPModel *)sub_46D49E_prolly_get_world_y_under_party(
-                         _angle_x,
-                         _angle_y,
-                         v40,
-                         pParty->uPartyHeight,
-                         &v130,
-                         &v108,
-                         0);
-    if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= v123 )
+    v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
+    if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ )
     {
       v43 = 1;
 LABEL_197:
-      v116 = _angle_x;
+      pX = _angle_x;
       if ( !v43 )
         goto LABEL_199;
 LABEL_198:
-      v117 = _angle_y;
+      pY = _angle_y;
     }
 LABEL_199:
     if ( stru_721530.field_7C >= stru_721530.field_6C )
     {
       if ( !v107 )
       {
-        v116 = stru_721530.normal2.x;
-        v117 = stru_721530.normal2.y;
-      }
-      v123 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
+        pX = stru_721530.normal2.x;
+        pY = stru_721530.normal2.y;
+      }
+      pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
       break;
     }
     stru_721530.field_70 += stru_721530.field_7C;
-    v116 = _angle_x;
-    v117 = _angle_y;
+    pX = _angle_x;
+    pY = _angle_y;
     v45 = stru_721530.uFaceID;
-    v123 = v40;
+    pZ = v40;
     if ( (stru_721530.uFaceID & 7) == OBJECT_Actor)
     {
       if (pParty->Invisible())
@@ -2992,7 +2958,7 @@
         {
           if ( v121 < 0 )
             v121 = 0;
-          v123 = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1;
+          pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1;
           if ( v2 * v2 + v128 * v128 < 400 )
           {
             v2 = 0;
@@ -3026,10 +2992,10 @@
                             + _angle_x * v47->pFacePlane.vNormal.x) >> 16);
           if ( v55 > 0 )
           {
-            v116 = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16);
-            v117 = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16);
+            pX = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16);
+            pY = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16);
             if ( !v119 )
-              v123 = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16);
+              pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16);
           }
 LABEL_220:
           v45 = stru_721530.uFaceID;
@@ -3071,9 +3037,9 @@
   while ( v126 < 100 );
   if ( bWalkSound && pParty->field_6F8 <= 0 )
   {
-    v122 = abs(pParty->vPosition.x - v116);
-    v126 = abs(pParty->vPosition.y - v117);
-    v62 = abs(pParty->vPosition.z - v123);
+    v122 = abs(pParty->vPosition.x - pX);
+    v126 = abs(pParty->vPosition.y - pY);
+    v62 = abs(pParty->vPosition.z - pZ);
     if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 )
       goto LABEL_344;
     if ( v114 && (!bJumping || v101) )
@@ -3144,8 +3110,8 @@
     pParty->uFlags |= PARTY_FLAGS_1_FALLING;
   v126 = WorldPosToGridCellX(pParty->vPosition.x);
   v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
-  v114 = WorldPosToGridCellX(v116);
-  v66 = WorldPosToGridCellZ(v117) - 1;
+  v114 = WorldPosToGridCellX(pX);
+  v66 = WorldPosToGridCellZ(pY) - 1;
   v127 = (BSPModel *)(((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1);
   v122 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1;
   v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66);
@@ -3157,16 +3123,16 @@
     v68 = 1;
   if ( v68 )
   {
-    v70 = v123;
-    v71 = v116;
-    v72 = v117;
+    v70 = pZ;
+    v71 = pX;
+    v72 = pY;
     pParty->uFallSpeed = v121;
-    v73 = v123;
-    pParty->vPosition.x = v116;
-    pParty->vPosition.y = v117;
-    pParty->vPosition.z = v123;
+    v73 = pZ;
+    pParty->vPosition.x = pX;
+    pParty->vPosition.y = pY;
+    pParty->vPosition.z = pZ;
     pParty->field_6F0 = v113;
-    if ( v123 > 8160 )
+    if ( pZ > 8160 )
     {
       v73 = 8160;
       pParty->uFallStartY = 8160;
@@ -3240,7 +3206,7 @@
 LABEL_306:
   if ( v77 )
   {
-    pParty->vPosition.x = v116;
+    pParty->vPosition.x = pX;
     if ( !v78 )
       goto LABEL_313;
     goto LABEL_312;
@@ -3248,7 +3214,7 @@
   if ( v78 )
   {
 LABEL_312:
-    pParty->vPosition.y = v117;
+    pParty->vPosition.y = pY;
 LABEL_313:
     if ( bWaterWalk )
     {
@@ -3275,10 +3241,10 @@
     pParty->field_6F8 = 64;
   }
 LABEL_318:
-  v81 = v123;
-  v82 = v123;
-  pParty->vPosition.z = v123;
-  if ( v123 > 8160 )
+  v81 = pZ;
+  v82 = pZ;
+  pParty->vPosition.z = pZ;
+  if ( pZ > 8160 )
   {
     v82 = 8160;
     pParty->uFallStartY = 8160;
@@ -3295,8 +3261,8 @@
       pParty->uFlags |= 4u;
   }
   if ( !v103
-    || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v116)
-    && pParty->vPosition.y == v117
+    || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX)
+    && pParty->vPosition.y == pY
     && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) )
   {
     if ( v82 < v111 )
@@ -12362,8 +12328,8 @@
   v19 = (double)viewparams->field_2C * 0.000015258789;
   if ( viewparams->field_2C == 384 )
   {
-    v20 = viewparams->field_38;
-    v21 = viewparams->field_3A;
+    v20 = viewparams->indoor_center_x;
+    v21 = viewparams->indoor_center_y;
   }
   v17 = 0;
   v16 = pOutdoor->uNumBModels;
@@ -13247,7 +13213,7 @@
   }
   if ( npcid >= 5000 )
     goto LABEL_7;
-  if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 )
+  if ( sDialogue_SpeakingActorNPC_ID >= 0 )
   {
     *(int *)a2 = 0;
     result = 0;
@@ -15792,7 +15758,7 @@
       v21->uCurrentActionTime += pMiscTimer->uTimeElapsed;
       if ( (signed int)v28 > 0 )
         v21->pMonsterInfo.uRecoveryTime = v28 - v27;
-      if ( (v21->pMonsterInfo.uRecoveryTime & 0x80000000u) != 0 )
+      if ( v21->pMonsterInfo.uRecoveryTime< 0 )
         v21->pMonsterInfo.uRecoveryTime = 0;
       v29 = v21->uAttributes;
       if ( !(v29 & 0x8000) )
--- a/mm7_4.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/mm7_4.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -238,16 +238,8 @@
 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
 
 //----- (0046CEC3) --------------------------------------------------------
-int _46CEC3_get_floor_level(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID)
+int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID)
 {
-  //BLVSector *v5; // edi@1
-  //int v6; // ecx@1
-  //Vec3_short_ *v7; // edx@1
-  //BLVFace *v8; // esi@2
-  //int v9; // eax@8
-  //int v10; // edi@8
-  //int v11; // eax@10
-  int v12; // ecx@10
   int v13; // ecx@13
   signed int v14; // ebx@14
   int v15; // eax@16
@@ -255,14 +247,8 @@
   int v17; // ST18_4@19
   signed int v18; // edx@19
   signed __int64 v19; // qtt@19
-  PolygonType v20; // al@25
   int v21; // eax@27
   int v22; // ecx@29
-  //BLVFace *v23; // eax@33
-  //int v24; // esi@39
-  //int v25; // edi@39
-  //int v26; // esi@41
-  int v27; // ecx@43
   signed int v28; // eax@45
   int v29; // ebx@47
   int v30; // edx@49
@@ -272,51 +258,22 @@
   signed int v34; // eax@54
   signed int v35; // esi@56
   int result; // eax@57
-  int v37; // edi@61
   int v38; // edx@62
-  //int v39; // [sp+Ch] [bp-34h]@1
-  //int v40; // [sp+10h] [bp-30h]@2
-  int v41; // [sp+14h] [bp-2Ch]@12
-  //unsigned __int16 *v42; // [sp+18h] [bp-28h]@1
-  //BLVSector *v43; // [sp+1Ch] [bp-24h]@1
   int v44; // [sp+20h] [bp-20h]@10
-  int v45; // [sp+24h] [bp-1Ch]@10
-  //signed int v46; // [sp+24h] [bp-1Ch]@38
   bool v47; // [sp+24h] [bp-1Ch]@43
   bool v48; // [sp+28h] [bp-18h]@10
   bool v49; // [sp+28h] [bp-18h]@41
   bool v50; // [sp+2Ch] [bp-14h]@12
-  int v51; // [sp+2Ch] [bp-14h]@41
-  //signed int v52; // [sp+30h] [bp-10h]@7
   signed int v53; // [sp+30h] [bp-10h]@10
   signed int v54; // [sp+30h] [bp-10h]@41
   signed int v55; // [sp+34h] [bp-Ch]@1
-  //signed int v56; // [sp+38h] [bp-8h]@1
-  //signed int v57; // [sp+3Ch] [bp-4h]@1
-  //int uSectorIDa; // [sp+4Ch] [bp+Ch]@1
-  //signed int uSectorIDb; // [sp+4Ch] [bp+Ch]@32
 
   LOG_DECOMPILATION_WARNING();
 
-  //auto a1 = x;
-  //auto a2 = y;
-  //auto a3 = z;
-
-  //v5 = &pIndoor->pSectors[uSectorID];
   auto pSector = &pIndoor->pSectors[uSectorID];
-  //v57 = y;
-  //v56 = x;
-  //v6 = 0;
-  v55 = 0;
-  //v43 = v5;
-  //v42 = v5->pFloors;
-  //v7 = pIndoor->pVertices;
-  //v39 = v5->uNumFloors;
-  //for ( uSectorIDa = 0; uSectorIDa < v39; ++uSectorIDa )
+  v55 = 1;
   for (uint i = 0; i < pSector->uNumFloors; ++i)
   {
-    //v40 = (int)&v42[v6];
-    //v8 = &pIndoor->pFaces[pSector->pFloors[i]];
     auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]];
     if (pFloor->Clickable())
       continue;
@@ -324,227 +281,164 @@
     if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 &&
         y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1)
     {
-      //v52 = 0;
       for (uint j = 0; j < pFloor->uNumVertices; ++j)
       {
-          //v9 = v52;
-          //v10 = 2 * v52;
         word_721460[2 * j] =     pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x;
         word_721460[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x;
         word_721390[2 * j] =     pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y;
         word_721390[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y;
-        //}
-        //while ( v52 < v8->uNumVertices );
-        //v5 = v43;
       }
       v44 = 2 * pFloor->uNumVertices;
-      //v11 = 2 * pFloor->uNumVertices;
       word_721460[2 * pFloor->uNumVertices] = word_721460[0];
       word_721390[2 * pFloor->uNumVertices] = word_721390[0];
 
       v48 = word_721390[0] >= y;
-      v12 = 0;
       v53 = 0;
-      v45 = 0;
       if ( pFloor->uNumVertices > 0 )
       {
-        do
+        for ( int i = 0; i < v44; i++ )
         {
           if ( v53 >= 2 )
             break;
-          v41 = word_721390[v12 + 1];
-          v50 = word_721390[v12 + 1] >= y;
+          v50 = word_721390[i + 1] >= y;
           if ( v48 == v50 )
           {
-            v13 = v45;
+            v13 = i;
           }
           else
           {
-            v13 = v45;
-            if ( word_721460[v45 + 1] >= x )
-              v14 = 0;
-            else
-              v14 = 2;
-            v15 = v14 | word_721460[v45] < x;
+            v13 = i;
+            v14 = word_721460[i + 1] >= x ? 0 : 2;
+            v15 = v14 | word_721460[i] < x;
             if ( v15 != 3 )
             {
-              if ( !v15
-                || (v16 = word_721390[v45],
-                    v17 = v41 - v16,
-                    v18 = y - v16,
-                    LODWORD(v19) = v18 << 16,
-                    HIDWORD(v19) = v18 >> 16,
-                    //v7 = pIndoor->pVertices,
-                    (signed int)(((unsigned __int64)(((signed int)word_721460[v45 + 1] - (signed int)word_721460[v45])
-                                                   * v19
-                                                   / v17) >> 16)
-                               + word_721460[v45]) >= x) )
-                ++v53;
+              if ( !v15 )
+              {
+                LODWORD(v19) = (y - word_721390[i]) << 16;
+                HIDWORD(v19) = (y - word_721390[i]) >> 16;
+                v16 = ((((word_721460[i + 1] - word_721460[i]) * v19 / (word_721390[i + 1] - word_721390[i])) >> 16) + word_721460[i]);
+                if ( v16 >= x)
+                  ++v53;
+              }
             }
           }
-          v12 = v13 + 1;
           v48 = v50;
-          v45 = v12;
-        }
-        while ( v12 < v44 );
-
+        }
         if ( v53 == 1 )
         {
           if ( v55 >= 50 )
             break;
-          v20 = pFloor->uPolygonType;
-          if ( v20 == 3 || v20 == 5 )
+          if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling )
           {
-            v21 = pIndoor->pVertices[*pFloor->pVertexIDs].z;
+            v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z;
           }
           else
           {
-            //v7 = pIndoor->pVertices;
-            v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16)
-                + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16)
+            v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16)
                 + HIWORD(pFloor->zCalc3);
           }
           v22 = v55++;
-          dword_7212C8[v22] = v21;
+          blv_floor_level[v22] = v21;
           dword_721200[v22] = pSector->pFloors[i];
         }
       }
     }
-    //v6 = uSectorIDa + 1;
   }
 
   if ( pSector->field_0 & 8 )
   {
     for (uint i = 0; i < pSector->uNumPortals; ++i)
     {
-      //v23 = &pIndoor->pFaces[v5->pPortals[uSectorIDb]];
       auto portal = &pIndoor->pFaces[pSector->pPortals[i]];
       if (portal->uPolygonType != POLYGON_Floor)
         continue;
 
-      if (x <= portal->pBounding.x2 &&
-          x >= portal->pBounding.x1 &&
-          y <= portal->pBounding.y2 &&
-          y >= portal->pBounding.y1 )
-      {
-        //v46 = 0;
+      if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 &&
+          y <= portal->pBounding.y2 && y >= portal->pBounding.y1 )
+      {
         for (uint j = 0; j < portal->uNumVertices; ++j)
         {
-            //v24 = v46;
-            //v25 = 2 * v46;
           word_721460[2 * j] =     portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x;
           word_721460[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x;
           word_721390[2 * j] =     portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y;
           word_721390[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y;
-          //}
-          //while ( v46 < v23->uNumVertices );
-          //v5 = v43;
-        }
-
-        //v26 = 2 * v23->uNumVertices;
+        }
         word_721460[2 * portal->uNumVertices] = word_721460[0];
         word_721390[2 * portal->uNumVertices] = word_721390[0];
         v54 = 0;
-        v51 = 0;
         v49 = word_721390[0] >= y;
         if ( portal->uNumVertices > 0 )
         {
-          do
+          for ( int i = 0; i < 2 * portal->uNumVertices; ++i )
           {
             if ( v54 >= 2 )
               break;
-            v27 = v51;
-            v47 = word_721390[v51 + 1] >= y;
+            v47 = word_721390[i + 1] >= y;
             if ( v49 != v47 )
             {
-              if ( word_721460[v27 + 1] >= x )
-                v28 = 0;
-              else
-                v28 = 2;
-              v29 = v28 | word_721460[v27] < x;
+              v28 = word_721460[i + 1] >= x ? 0 : 2;
+              v29 = v28 | word_721460[i] < x;
               if ( v29 != 3 )
               {
-                if ( !v29
-                  || (v30 = word_721390[v27],
-                      v31 = word_721390[v51 + 1] - v30,
-                      v32 = y - v30,
-                      LODWORD(v33) = v32 << 16,
-                      HIDWORD(v33) = v32 >> 16,
-                      //v7 = pIndoor->pVertices,
-                      (signed int)(((unsigned __int64)(((signed int)word_721460[v27 + 1] - (signed int)word_721460[v27])
-                                                     * v33
-                                                     / v31) >> 16)
-                                 + word_721460[v27]) >= x) )
-                  ++v54;
+                if ( !v29 )
+                  LODWORD(v33) = (y - word_721390[i]) << 16;
+                  HIDWORD(v33) = (y - word_721390[i]) >> 16;
+                  v30 = ((((word_721460[i + 1] - word_721460[i]) * v33 / (word_721390[i + 1] - word_721390[i])) >> 16) + word_721460[i]);
+                  if ( v30 >= x)
+                    ++v54;
               }
             }
-            ++v51;
             v49 = v47;
           }
-          while ( v51 < 2 * portal->uNumVertices );
-
           if ( v54 == 1 )
           {
             if ( v55 >= 50 )
               break;
             v34 = v55++;
-            dword_7212C8[v34] = -29000;
+            blv_floor_level[v34] = -29000;
             dword_721200[v34] = pSector->pPortals[i];
           }
         }
       }
     }
   }
-
-  v35 = 1;
   if ( v55 == 1 )
   {
     *pFaceID = dword_721200[0];
-    return dword_7212C8[0];
+    return blv_floor_level[0];
   }
   if ( !v55 )
     return -30000;
   *pFaceID = dword_721200[0];
-  result = dword_7212C8[0];
+  //result = blv_floor_level[0];
   if ( v55 > 1 )
   {
-    v37 = z + 5;
-    while ( 1 )
-    {
-      v38 = dword_7212C8[v35];
-      if ( result <= v37 )
-        break;
-      if ( v38 < result )
-        goto LABEL_67;
-LABEL_68:
-      ++v35;
-      if ( v35 >= v55 )
-        return result;
-    }
-    if ( v38 <= result || v38 > v37 )
-      goto LABEL_68;
-LABEL_67:
-    result = dword_7212C8[v35];
-    *pFaceID = dword_721200[v35];
-    goto LABEL_68;
-  }
-  return result;
+    for ( v35 = 1; v35 < v55; ++v35 )
+    {
+      if ( blv_floor_level[0] <= z + 5 )
+      {
+        if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 )
+          continue;
+        blv_floor_level[0] = blv_floor_level[v35];
+        *pFaceID = dword_721200[v35];
+        continue;
+      }
+      if ( blv_floor_level[v35] < blv_floor_level[0] )
+      {
+        blv_floor_level[0] = blv_floor_level[v35];
+        *pFaceID = dword_721200[v35];
+      }
+    }
+  }
+  return blv_floor_level[0];
 }
 
 //----- (0046D49E) --------------------------------------------------------
-int __fastcall sub_46D49E_prolly_get_world_y_under_party(int a1, signed int a2, int a3, int a4, int *a5, int *a6, int a7)
+int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int a4, int *a5, int *a6, int a7)
 {
-  signed int v7; // edi@1
-  int v8; // ebx@1
-  int v9; // eax@1
-  BSPModel *v10; // esi@4
-  ODMFace *v11; // ecx@11
-  unsigned __int8 v12; // al@11
-  char *v13; // eax@19
+  BSPModel *pBModel; // esi@4
+  ODMFace *pFace; // ecx@11
   int v14; // edx@20
-  int v15; // eax@22
-  int v16; // edx@22
-  int v17; // edi@24
   signed int v18; // edx@26
   int v19; // eax@28
   int v20; // edx@30
@@ -561,201 +455,146 @@
   int v31; // eax@45
   ODMFace *v32; // eax@57
   int v33; // ecx@59
-  int v34; // [sp+Ch] [bp-34h]@8
-  int v35; // [sp+10h] [bp-30h]@22
   int v36; // [sp+14h] [bp-2Ch]@24
-  int v37; // [sp+18h] [bp-28h]@22
   int v38; // [sp+1Ch] [bp-24h]@2
   int v39; // [sp+20h] [bp-20h]@9
-  int v40; // [sp+24h] [bp-1Ch]@1
-  signed int v41; // [sp+28h] [bp-18h]@1
-  int v42; // [sp+2Ch] [bp-14h]@8
+  signed int pBModelNum; // [sp+28h] [bp-18h]@1
+  int pFaceNum; // [sp+2Ch] [bp-14h]@8
   bool v43; // [sp+30h] [bp-10h]@22
   bool v44; // [sp+34h] [bp-Ch]@24
-  signed int v45; // [sp+38h] [bp-8h]@1
   signed int v46; // [sp+3Ch] [bp-4h]@1
-  signed int v47; // [sp+58h] [bp+18h]@18
   signed int v48; // [sp+58h] [bp+18h]@22
   signed int v49; // [sp+58h] [bp+18h]@43
 
-  v7 = a2;
-  v8 = a1;
-  v45 = a2;
-  v40 = a1;
   v46 = 1;
-  v9 = GetTerrainHeightsAroundParty2(a1, a2, a5, a7);
   dword_721160[0] = -1;
   dword_721110[0] = -1;
-  dword_7211B0[0] = v9;
-  v41 = 0;
+  odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, a5, a7);
   if ( (signed int)pOutdoor->uNumBModels <= 0 )
-    goto LABEL_63;
+  {
+    *a6 = 0;
+    return odm_floor_level[0];
+  }
   v38 = 0;
-  while ( 1 )
-  {
-    v10 = &pOutdoor->pBModels[v38];
-    if ( v8 <= pOutdoor->pBModels[v38].sMaxX )
-    {
-      if ( v8 >= v10->sMinX )
-      {
-        if ( v7 <= v10->sMaxY )
-        {
-          if ( v7 >= v10->sMinY )
+  for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum )
+  {
+    pBModel = &pOutdoor->pBModels[v38];
+    if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY )
+    {
+      if ( (signed int)pBModel->uNumFaces > 0 )
+      {
+        v39 = 0;
+        for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum )
+        {
+          pFace = &pBModel->pFaces[v39];
+          if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall)
+            && !(pFace->uAttributes & 0x20000000)
+            && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1
+            && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 )
           {
-            v42 = 0;
-            v34 = v10->uNumFaces;
-            if ( (signed int)v10->uNumFaces > 0 )
+            if ( pFace->uNumVertices )
             {
-              v39 = 0;
-              while ( 1 )
+              for ( uint i = 0; i < pFace->uNumVertices; ++i)
               {
-                v11 = &v10->pFaces[v39];
-                v12 = v11->uPolygonType;
-                if ( (v12 == 3 || v12 == 4)
-                  && !(v11->uAttributes & 0x20000000)
-                  && v8 <= v11->pBoundingBox.x2
-                  && v8 >= v11->pBoundingBox.x1
-                  && v7 <= v11->pBoundingBox.y2
-                  && v7 >= v11->pBoundingBox.y1 )
+                word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x;
+                word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y;
+                word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x;
+                word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y;
+              }
+            }
+            word_721040[2 * pFace->uNumVertices] = word_721040[0];
+            word_720F70[2 * pFace->uNumVertices] = word_720F70[0];
+            v43 = word_720F70[0] >= Y;
+            v48 = 0;
+            if ( 2 * pFace->uNumVertices > 0 )
+            {
+              for ( int i = 0; i < 2 * pFace->uNumVertices; ++i )
+              {
+                if ( v48 >= 2 )
+                  break;
+                v36 = word_720F70[i + 1];
+                v44 = word_720F70[i + 1] >= Y;
+                if ( v43 != v44 )
                 {
-                  v47 = 0;
-                  if ( v11->uNumVertices )
+                  v18 = word_721040[i + 1] >= X ? 0 : 2;
+                  v19 = v18 | word_721040[i] < X;
+                  if ( v19 != 3 )
                   {
-                    v13 = (char *)v11->pXInterceptDisplacements;
-                    do
+                    if ( !v19 )
                     {
-                      v14 = 2 * v47;
-                      word_721040[2 * v47] = *(short *)v13 + LOWORD(v10->pVertices.pVertices[*((short *)v13 - 60)].x);
-                      word_720F70[2 * v47] = *((short *)v13 + 20)
-                                           + LOWORD(v10->pVertices.pVertices[*((short *)v13 - 60)].y);
-                      word_721040[2 * v47++ + 1] = *(short *)v13
-                                                 + LOWORD(v10->pVertices.pVertices[*((short *)v13 - 59)].x);
-                      word_720F70[v14 + 1] = *((short *)v13 + 20)
-                                           + LOWORD(v10->pVertices.pVertices[*((short *)v13 - 59)].y);
-                      v13 += 2;
-                    }
-                    while ( v47 < v11->uNumVertices );
-                    v8 = v40;
-                  }
-                  v15 = 2 * v11->uNumVertices;
-                  word_721040[2 * v11->uNumVertices] = word_721040[0];
-                  word_720F70[v15] = word_720F70[0];
-                  v35 = v15;
-                  v16 = 0;
-                  v43 = word_720F70[0] >= v45;
-                  v48 = 0;
-                  v37 = 0;
-                  if ( v15 > 0 )
-                  {
-                    do
-                    {
-                      if ( v48 >= 2 )
-                        break;
-                      v17 = v16;
-                      v8 = v40;
-                      v36 = word_720F70[v16 + 1];
-                      v44 = word_720F70[v16 + 1] >= v45;
-                      if ( v43 != v44 )
-                      {
-                        v18 = word_721040[v17 + 1] >= v40 ? 0 : 2;
-                        v19 = v18 | word_721040[v17] < v40;
-                        if ( v19 != 3 )
-                        {
-                          if ( !v19
-                            || (v20 = word_720F70[v17],
-                                v21 = v36 - v20,
-                                v22 = v45 - v20,
-                                LODWORD(v23) = v22 << 16,
-                                HIDWORD(v23) = v22 >> 16,
-                                (signed int)(((unsigned __int64)(((signed int)word_721040[v17 + 1]
-                                                                - (signed int)word_721040[v17])
-                                                               * v23
-                                                               / v21) >> 16)
-                                           + word_721040[v17]) >= v40) )
-                            ++v48;
-                        }
-                      }
-                      v16 = v37 + 1;
-                      v43 = v44;
-                      ++v37;
-                    }
-                    while ( v37 < v35 );
-                    if ( v48 == 1 )
-                    {
-                      if ( v46 >= 20 )
-                        break;
-                      if ( v11->uPolygonType == 3 )
-                        v24 = v10->pVertices.pVertices[v11->pVertexIDs[0]].z;
-                      else
-                        v24 = ((unsigned __int64)(v11->zCalc1 * (signed __int64)v8) >> 16)
-                            + ((unsigned __int64)(v11->zCalc2 * (signed __int64)v45) >> 16)
-                            + HIWORD(v11->zCalc3);
-                      v25 = v46++;
-                      dword_7211B0[v25] = v24;
-                      dword_721160[v25] = v41;
-                      dword_721110[v25] = v42;
+                      LODWORD(v23) = (Y - word_720F70[i]) << 16;
+                      HIDWORD(v23) = (Y - word_720F70[i]) >> 16;
+                      v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]);
+                      if ( v22 >= X) 
+                        ++v48;
                     }
                   }
                 }
-                ++v42;
-                ++v39;
-                if ( v42 >= v34 )
+                v43 = v44;
+              }
+              if ( v48 == 1 )
+              {
+                if ( v46 >= 20 )
                   break;
-                v7 = v45;
+                if ( pFace->uPolygonType == POLYGON_Floor )
+                  v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z;
+                else
+                  v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16)
+                + HIWORD(pFace->zCalc3);
+                v25 = v46++;
+                odm_floor_level[v25] = v24;
+                dword_721160[v25] = pBModelNum;
+                dword_721110[v25] = pFaceNum;
               }
             }
           }
-        }
-      }
-    }
-    ++v41;
+          ++v39;
+        }
+      }
+    }
     ++v38;
-    if ( v41 >= (signed int)pOutdoor->uNumBModels )
-      break;
-    v7 = v45;
   }
   if ( v46 == 1 )
   {
-LABEL_63:
     *a6 = 0;
-    return dword_7211B0[0];
+    return odm_floor_level[0];
   }
   v27 = 0;
-  v49 = 1;
   if ( v46 <= 1 )
-  {
-LABEL_55:
     *a6 = 0;
-    goto LABEL_56;
-  }
-  v28 = 0;
-  v29 = 1;
-  do
-  {
-    v30 = dword_7211B0[v29];
-    v31 = *(int *)((char *)dword_7211B0 + v28);
-    if ( v30 == v31 )
-      goto LABEL_51;
-    if ( v31 > a3 + 5 )
-    {
-      if ( v30 >= v31 )
-        goto LABEL_52;
-LABEL_51:
-      v27 = v49;
-      v28 = v29 * 4;
-      goto LABEL_52;
-    }
-    if ( v30 > v31 && v30 <= a3 + 5 )
-      goto LABEL_51;
-LABEL_52:
-    ++v49;
-    ++v29;
-  }
-  while ( v49 < v46 );
-  if ( !v27 )
-    goto LABEL_55;
-  *a6 = dword_721110[v27] | (dword_721160[v27] << 6);
-LABEL_56:
+  else
+  {
+    //v29 = 1;
+    for ( v49 = 1; v49 < v46; ++v49 )
+    {
+      if ( odm_floor_level[v49] == odm_floor_level[0] )
+      {
+        v27 = v49;
+        //++v29;
+        break;
+      }
+      if ( odm_floor_level[0] > Z + 5 )
+      {
+        if ( odm_floor_level[v49] >= odm_floor_level[0] )
+        {
+          //++v29;
+          break;
+        }
+        v27 = v49;
+        //++v29;
+        break;
+      }
+      if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 )
+      {
+        v27 = v49;
+        //++v29;
+      }
+    }
+    if ( !v27 )
+      *a6 = 0;
+    else
+      *a6 = dword_721110[v27] | (dword_721160[v27] << 6);
+  }
   if ( v27 )
   {
     v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]];
@@ -763,11 +602,9 @@
     if ( v32->uAttributes & 0x10 )
       *a5 = 1;
   }
-  v33 = dword_7211B0[v27];
-  result = dword_7211B0[0];
-  if ( v33 >= dword_7211B0[0] )
-    result = v33;
-  return result;
+  if ( odm_floor_level[v27] >= odm_floor_level[0] )
+    odm_floor_level[0] = odm_floor_level[v27];
+  return odm_floor_level[0];
 }
 
 //----- (0046D8E3) --------------------------------------------------------
@@ -5921,10 +5758,10 @@
 
 
 //----- (004AD504) --------------------------------------------------------
-int __fastcall sub_4AD504(unsigned int uFaceID)
+int __fastcall sub_4AD504(signed int sFaceID)
 {
   int result; // eax@1
-  unsigned int v2; // ebx@1
+  signed int v2; // ebx@1
   BLVFace *v3; // esi@3
   Texture *v4; // edi@6
   int v5; // eax@7
@@ -6048,17 +5885,17 @@
   unsigned int v123; // [sp+A0h] [bp-4h]@13
 
   result = pRenderer->uTargetSurfacePitch;
-  v2 = uFaceID;
+  v2 = sFaceID;
   v95 = pRenderer->uTargetSurfacePitch;
-  if ( (uFaceID & 0x80000000u) == 0 )
-  {
-    if ( (signed int)uFaceID < (signed int)pIndoor->uNumFaces )
-    {
-      v3 = &pIndoor->pFaces[uFaceID];
-      v91 = &pIndoor->pFaces[uFaceID];
+  if ( sFaceID >= 0 )
+  {
+    if ( sFaceID < (signed int)pIndoor->uNumFaces )
+    {
+      v3 = &pIndoor->pFaces[sFaceID];
+      v91 = &pIndoor->pFaces[sFaceID];
       if ( !pRenderer->pRenderD3D )
       {
-        result = sub_423B5D(uFaceID);
+        result = sub_423B5D(sFaceID);
         if ( result )
         {
           result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2);
@@ -8763,7 +8600,7 @@
     v2 = pTransitionStrings[uHouse_ExitPic];
     if ( !v2 )
     {
-      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0);
+      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0);
       v2 = pTmpBuf;
     }
     v3 = v2;
@@ -9621,7 +9458,7 @@
 
 			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
 
-			if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 )
+			if ( sDialogue_SpeakingActorNPC_ID >= 0 )
 				pDialogue_SpeakingActor->uAIState = Removed;
 			if ( uActiveCharacter )
 				pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
@@ -9842,8 +9679,8 @@
 
 
 //----- (004B6478) --------------------------------------------------------
-int __cdecl sub_4B6478()
-{
+void sub_4B6478()
+    {
   GUIWindow *v0; // ebx@1
   Player *v1; // edi@1
   unsigned int v2; // eax@1
@@ -9950,7 +9787,7 @@
       ++pMessageQueue_50CBD0->uNumMessages;
     }*/
     pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
-    return result; // void func
+    return; // void func
   }
   if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
   {
@@ -9958,13 +9795,12 @@
     v25 = v31;
     v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
     v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
-    result = (int)pDialogueWindow;
     pDialogueWindow->pNumPresenceButton = 0;
-    return result;
-  }
-  result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
-  if ( !result )
-    return result;
+    return ;
+  }
+
+  if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+    return;
   v8 = pDialogueWindow;
   v33 = 0;
   v34 = 0;
@@ -9995,17 +9831,18 @@
     strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
     v22 = v31;
     v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0);
-    return (int)v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
+    v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
+    return; 
   }
   sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32);
   v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
   v32 = (149 - v33) / v34;
   if ( (149 - v33) / v34 > 32 )
     v32 = 32;
-  result = v8->pStartingPosActiveItem;
-  v35 = result;
+
+  v35 = v8->pStartingPosActiveItem;
   v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
-  if ( result < result + v8->pNumPresenceButton )
+  if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
   {
     v33 = 2;
     do
@@ -10043,11 +9880,10 @@
       v8 = v29;
       ++v35;
       ++v33;
-      result = v29->pNumPresenceButton + v29->pStartingPosActiveItem;
-    }
-    while ( v35 < result );
-  }
-  return result;
+    }
+    while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
+  }
+  return;
 }
 
 
@@ -10973,10 +10809,7 @@
       v14 = pMapStats->GetMapInfo(pCurrentMapName);
       if ( v14 )
       {
-        v20 = pMapStats->pInfos[v14].pName;
-        v18 = pGlobalTXT_LocalizationStrings[410];
-LABEL_10:
-        sprintf(sHouseName, v18, v20);
+        sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName);
         goto LABEL_20;
       }
       v21 = pGlobalTXT_LocalizationStrings[79];
@@ -10989,9 +10822,8 @@
   v16 = pMapStats->GetMapInfo(v15);
   if ( v16 )
   {
-    v20 = pMapStats->pInfos[v16].pName;
-    v18 = pGlobalTXT_LocalizationStrings[411];
-    goto LABEL_10;
+    sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName);
+    goto LABEL_20;
   }
   v21 = pGlobalTXT_LocalizationStrings[73];
 LABEL_19:
--- a/mm7_5.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/mm7_5.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -6625,7 +6625,7 @@
 
   v1 = uPlayerID - 1;
   v8 = uPlayerID;
-  if ( ((uPlayerID - 1) & 0x80000000u) == 0 )
+  if ( (uPlayerID - 1) >= 0 )
   {
     v2 = &pPlayers[uPlayerID];
     v3 = (*v2)->GetRace();
--- a/mm7_6.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/mm7_6.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -1416,9 +1416,9 @@
     Dst.uItemID = pActor->uCarriedItemID;
     v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
     if ( v14 )
-      sprintf(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9);
+      sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9);
     else
-      sprintf(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9);
+      sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9);
     ShowStatusBarString(pTmpBuf2, 2u);
     v4 = Dst.uItemID;
     v5 = Dst.uItemID;
@@ -1466,9 +1466,9 @@
       pActor->array_000234[3].Reset();
       v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
       if ( v14 )
-        sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11);
+        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11);
       else
-        sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11);
+        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11);
       ShowStatusBarString(pTmpBuf2, 2u);
       if ( !pParty->AddItem(&Dst) )
         pParty->SetHoldingItem(&Dst);
@@ -1485,9 +1485,9 @@
   pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst);
   v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
   if ( v14 )
-    sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10);
+    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10);
   else
-    sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10);
+    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10);
   ShowStatusBarString(pTmpBuf2, 2u);
   v8 = pParty;
   if ( !pParty->AddItem(&Dst) )
@@ -6377,7 +6377,7 @@
           }
           else
           {
-            sprintf(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
+            sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
             ShowStatusBarString(pTmpBuf2, 2u);
             if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
               pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
--- a/mm7_data.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/mm7_data.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -2100,9 +2100,9 @@
 __int16 word_721040[777]; // idb
 int dword_721110[777]; // idb
 int dword_721160[777]; // idb
-int dword_7211B0[777]; // idb
+int odm_floor_level[20]; // idb
 int dword_721200[777]; // idb
-int dword_7212C8[777]; // idb
+int blv_floor_level[50]; // idb dword_7212C8
 __int16 word_721390[104]; // idb
 __int16 word_721460[104]; // idb
 int blv_prev_party_x; // weak
--- a/mm7_data.h	Fri Mar 22 00:02:31 2013 +0200
+++ b/mm7_data.h	Fri Mar 22 00:06:50 2013 +0200
@@ -1559,9 +1559,9 @@
 extern __int16 word_721040[]; // idb
 extern int dword_721110[]; // idb
 extern int dword_721160[]; // idb
-extern int dword_7211B0[]; // idb
+extern int odm_floor_level[20]; // idb dword_7211B0
 extern int dword_721200[]; // idb
-extern int dword_7212C8[]; // idb
+extern int blv_floor_level[50]; // idb
 extern __int16 word_721390[]; // idb
 extern __int16 word_721460[]; // idb
 extern int blv_prev_party_x; // weak
@@ -2151,8 +2151,8 @@
 void __cdecl ODM_UpdateUserInputAndOther();
 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2);
 void __cdecl _46CC4B_check_event_triggers();
-int _46CEC3_get_floor_level(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID);
-int __fastcall sub_46D49E_prolly_get_world_y_under_party(int a1, signed int a2, int a3, int a4, int *a5, int *a6, int a7);
+int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID);
+int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int a4, int *a5, int *a6, int a7);
 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4);
 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out);
 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID);
@@ -2278,7 +2278,7 @@
 struct Vec4_int_ *__thiscall sub_4AC277(unsigned int _this, Vec4_int_ *a2);
 struct Vec4_int_ *__thiscall sub_4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1);
 struct Vec4_int_ *__thiscall sub_4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1);
-int __fastcall sub_4AD504(unsigned int uFaceID);
+int __fastcall sub_4AD504(signed int uFaceID);
 void __fastcall sub_4ADD1D(int uFaceID);
 int __fastcall sub_4AE1E7(int a1, int a2, int a3);
 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, struct stru337_stru0 *p);
--- a/stru6.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/stru6.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -1503,12 +1503,8 @@
       pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE);
       pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE);
       pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS);
-      pRenderer->pRenderD3D->pDevice->DrawPrimitive(
-        D3DPT_TRIANGLEFAN,
-        D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-        vd3d,
-        4,
-        28);
+      pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
+        D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, vd3d, 4, 28);
       ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
       ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));
       pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
--- a/stru9.cpp	Fri Mar 22 00:02:31 2013 +0200
+++ b/stru9.cpp	Fri Mar 22 00:06:50 2013 +0200
@@ -30,7 +30,6 @@
   //int a3b; // [sp+38h] [bp+10h]@25
 
   //__debugbreak();
-
   //thisa = this;
 
   static RenderVertexSoft static_AE3FB4;