changeset 2166:00bd098f6435

fixpoint_mul in different functions and others
author Ritor1
date Fri, 17 Jan 2014 17:58:48 +0600
parents 47ac9e87690c
children 7cd99cb12911 919ca19c5466
files Indoor.cpp Indoor.h Outdoor.cpp Render.cpp SpriteObject.cpp TileFrameTable.h UI/Books/UIMapBook.cpp UI/UiGame.cpp Viewport.cpp mm7_2.cpp mm7_3.cpp mm7_5.cpp
diffstat 12 files changed, 479 insertions(+), 793 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/Indoor.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -4016,21 +4016,13 @@
 //----- (0043FDED) --------------------------------------------------------
 void PrepareActorRenderList_BLV()
 {
-  RenderBillboard *v0; // esi@0
   unsigned __int16 v3; // ax@3
   unsigned int v4; // eax@5
-  unsigned __int16 v5; // cx@5
   int v6; // esi@5
   unsigned int v7; // eax@7
   int v8; // eax@10
   SpriteFrame *v9; // eax@16
-  SpriteFrame *v10; // ebx@18
-  //int *v11; // eax@18
   int v12; // ecx@28
-  //IndoorCameraD3D **v14; // eax@36
-  double v15; // st7@36
-  float v16; // eax@36
-  //double v17; // ST30_8@36
   signed __int64 v18; // qtt@36
   int v19; // ST5C_4@36
   signed __int64 v20; // qtt@37
@@ -4040,16 +4032,8 @@
   signed int v24; // ecx@40
   int v25; // edx@44
   __int16 v26; // ax@44
-  //MonsterDesc *v27; // edx@44
-  //int v28; // ecx@44
-  unsigned __int8 v29; // zf@44
   unsigned __int8 v30; // sf@44
-  unsigned int v31; // [sp-8h] [bp-5Ch]@15
-  int v32; // [sp+1Ch] [bp-38h]@5
   int a3; // [sp+20h] [bp-34h]@5
-  int a2; // [sp+24h] [bp-30h]@5
-  int a1a; // [sp+28h] [bp-2Ch]@5
-  __int16 a5; // [sp+2Ch] [bp-28h]@5
   int a5a; // [sp+2Ch] [bp-28h]@36
   int a5b; // [sp+2Ch] [bp-28h]@40
   __int16 v41; // [sp+3Ch] [bp-18h]@18
@@ -4061,200 +4045,130 @@
 
   for (uint i = 0; i < uNumActors; ++i)
   {
-    Actor* p = &pActors[i];
-
-    if (p->uAIState == Removed ||
-        p->uAIState == Disabled)
+    if (pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled)
       continue;
 
-    a5 = p->uSectorID;
-    a2 = p->vPosition.y;
-    a1a = p->vPosition.x;
-    a3 = p->vPosition.z;
-    v4 = stru_5C6E00->Atan2(a1a - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y);
-    LOWORD(v0) = p->uYawAngle;
-    v5 = p->uCurrentActionAnimation;
-    v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7;
-    v32 = v6;
+    v4 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, pActors[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
+    v6 = ((signed int)(pActors[i].uYawAngle + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7;
+    v8 = pActors[i].uCurrentActionTime;
     if ( pParty->bTurnBasedModeOn )
     {
-      if ( v5 == 1 )
-      {
-        v7 = pMiscTimer->uTotalGameTimeElapsed;
-        goto LABEL_10;
-      }
+      if ( pActors[i].uCurrentActionAnimation == 1 )
+        v8 = i * 32 + pMiscTimer->uTotalGameTimeElapsed;
     }
     else
     {
-      if ( v5 == 1 )
-      {
-        v7 = pBLVRenderParams->field_0_timer_;
-LABEL_10:
-        v8 = i * 32 + v7;
-        goto LABEL_12;
-      }
+      if ( pActors[i].uCurrentActionAnimation == 1 )
+        v8 = i * 32 + pBLVRenderParams->field_0_timer_;
     }
-    v8 = p->uCurrentActionTime;
-LABEL_12:
-    if (p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0i64 || p->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0i64 )
+    if (pActors[i].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0 || pActors[i].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 )
       v8 = 0;
-    v31 = p->pSpriteIDs[v5];
-    if (p->uAIState == Resurrected)
-      v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8);
+
+    if (pActors[i].uAIState == Resurrected)
+      v9 = pSpriteFrameTable->GetFrameBy_x(pActors[i].pSpriteIDs[pActors[i].uCurrentActionAnimation], v8);
     else
-      v9 = pSpriteFrameTable->GetFrame(v31, v8);
+      v9 = pSpriteFrameTable->GetFrame(pActors[i].pSpriteIDs[pActors[i].uCurrentActionAnimation], v8);
+
     v41 = 0;
-    v10 = v9;
-    //v11 = (int *)v9->uFlags;
     if (v9->uFlags & 2)
       v41 = 2;
     if (v9->uFlags & 0x40000)
       v41 |= 0x40u;
     if (v9->uFlags & 0x20000)
       LOBYTE(v41) = v41 | 0x80;
-    v0 = (RenderBillboard *)(256 << v6);
-    if ( (unsigned int)v0 & v9->uFlags)
-      v41 |= 4u;
-    if ( v10->uGlowRadius )
+    if ( (256 << v6) & v9->uFlags)
+      v41 |= 4;
+    if ( v9->uGlowRadius )
     {
       //LOBYTE(v11) = _4E94D3_light_type;
-      pMobileLightsStack->AddLight(
-        a1a,
-        a2,
-        a3,
-        a5,
-        v10->uGlowRadius,
-        0xFFu,
-        0xFFu,
-        0xFFu,
-        _4E94D3_light_type);
-    }
-    v12 = 0;
-    if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 )
-      continue;
-    while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID)
-    {
-      ++v12;
-      if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors )
-        goto _continue;
+      pMobileLightsStack->AddLight(pActors[i].vPosition.x, pActors[i].vPosition.y, pActors[i].vPosition.z, pActors[i].uSectorID, v9->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type);
     }
-    if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1a, a2, a3, &x, &y, &z, 1)
-      || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) )
-      continue;
-    pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6);
-    v0 = &pBillboardRenderList[uNumBillboardsToDraw];
-    if (uNumBillboardsToDraw >= 500)
-      break;
-    ++uNumBillboardsToDraw;
-    ++uNumSpritesDrawnThisFrame;
-    p->uAttributes |= 8u;
-    //v29 = pRenderer->pRenderD3D == 0;
-    v0->uHwSpriteID = v10->pHwSpriteIDs[v32];
-    v0->uPalette = v10->uPaletteIndex;
-    v0->uIndoorSectorID = a5;
-    /*if ( v29 )
+    for ( v12 = 0; v12 < pBspRenderer->uNumVisibleNotEmptySectors; ++v12 )
     {
-      LODWORD(v20) = pBLVRenderParams->fov_rad_fixpoint << 16;
-      HIDWORD(v20) = pBLVRenderParams->fov_rad_fixpoint >> 16;
-      v21 = v20 / x;
-      v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16;
-      a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16;
-    }
-    else*/
-    {
-      //v14 = &pGame->pIndoorCameraD3D;
-      v0->fov_x = pGame->pIndoorCameraD3D->fov_x;
-      v15 = pGame->pIndoorCameraD3D->fov_y;
-      v16 = v0->fov_x;
-      v0->fov_y = v15;
-      //v17 = v16 + 6.7553994e15;
-      LODWORD(v18) = 0;
-      HIDWORD(v18) = floorf(v16 + 0.5f);
-      v19 = v18 / x;
-      v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16;
-      a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16;
-    }
-    v0->_screenspace_y_scaler_packedfloat = a5a;
-    if ( (signed __int64)p->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <= 0 )
-    {
-      if ( (signed __int64)p->pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime > 0 )
+      if ( pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] == pActors[i].uSectorID )
       {
-        a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16;
-        goto LABEL_43;
+        if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pActors[i].vPosition.x, pActors[i].vPosition.y, pActors[i].vPosition.z, &x, &y, &z, 1)
+          || abs(x) < abs(y) )
+          continue;
+        pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6);
+        if (uNumBillboardsToDraw >= 500)
+          break;
+        ++uNumBillboardsToDraw;
+        ++uNumSpritesDrawnThisFrame;
+        pActors[i].uAttributes |= 8;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uHwSpriteID = v9->pHwSpriteIDs[v6];
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v9->uPaletteIndex;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = pActors[i].uSectorID;
+        /*if ( !pRenderer->pRenderD3D )
+        {
+          LODWORD(v20) = pBLVRenderParams->fov_rad_fixpoint << 16;
+          HIDWORD(v20) = pBLVRenderParams->fov_rad_fixpoint >> 16;
+          v0->_screenspace_x_scaler_packedfloat = fixpoint_mul(v10->scale, v20 / x);
+          a5a = fixpoint_mul(v10->scale, v20 / x);
+        }
+        else
+        {*/
+          pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x = pGame->pIndoorCameraD3D->fov_x;
+          pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y = pGame->pIndoorCameraD3D->fov_y;
+          LODWORD(v18) = 0;
+          HIDWORD(v18) = floorf(pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x + 0.5f);
+          pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v9->scale, v18 / x);
+          a5a = fixpoint_mul(v9->scale, v18 / x);
+        //}
+        pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = a5a;
+        if ( pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <= 0 )
+        {
+          if ( pActors[i].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime > 0 )
+            pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = fixpoint_mul(pGame->pStru6Instance->_4A806F(&pActors[i]),
+                       pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat);
+        }
+        else
+        {
+          if ( pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower > 0 )
+            pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(65536 / pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower, pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat);
+        }
+        HIWORD(v25) = HIWORD(x);
+        pBillboardRenderList[uNumBillboardsToDraw - 1].world_x = pActors[i].vPosition.x;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].world_y = pActors[i].vPosition.y;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].world_z = pActors[i].vPosition.z;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceX = v43;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceY = a6;
+        LOWORD(v25) = 0;
+        LOBYTE(v26) = v41;
+
+        //v0->sZValue = v25 + (PID(OBJECT_Actor,i));
+        pBillboardRenderList[uNumBillboardsToDraw - 1].actual_z = HIWORD(x);
+        pBillboardRenderList[uNumBillboardsToDraw - 1].object_pid = PID(OBJECT_Actor,i);
+
+        //v29 = HIDWORD(p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) == 0;
+        //v30 = HIDWORD(p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) < 0;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].field_1E = v41;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].pSpriteFrame = v9;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].sTintColor = pMonsterList->pMonsters[pActors[i].pMonsterInfo.uID - 1].sTintColor;
+        if ( pActors[i].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0 )
+        {
+          HIBYTE(v26) = HIBYTE(v41) | 1;
+          pBillboardRenderList[uNumBillboardsToDraw - 1].field_1E = v26;
+        }
       }
     }
-    else
-    {
-      v22 = p->pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
-      if ( v22 )
-      {
-        v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16;
-        v24 = p->pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
-        v0->_screenspace_x_scaler_packedfloat = v23;
-        a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16;
-LABEL_43:
-        v0->_screenspace_y_scaler_packedfloat = a5b;
-        goto LABEL_44;
-      }
-    }
-LABEL_44:
-    HIWORD(v25) = HIWORD(x);
-    v0->world_x = a1a;
-    v0->world_y = a2;
-    v0->world_z = a3;
-    v0->uScreenSpaceX = v43;
-    v0->uScreenSpaceY = a6;
-    LOWORD(v25) = 0;
-    LOBYTE(v26) = v41;
-
-    //v0->sZValue = v25 + (PID(OBJECT_Actor,i));
-    v0->actual_z = HIWORD(x);
-    v0->object_pid = PID(OBJECT_Actor,i);
-
-    v29 = HIDWORD(p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) == 0;
-    v30 = HIDWORD(p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) < 0;
-    v0->field_1E = v41;
-    v0->pSpriteFrame = v10;
-    v0->sTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].sTintColor;
-    if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime)) )
-    {
-      HIBYTE(v26) = HIBYTE(v41) | 1;
-      v0->field_1E = v26;
-    }
-    
-_continue:
-    ;
   }
 }
 //----- (0044028F) --------------------------------------------------------
 void PrepareItemsRenderList_BLV()
 {
-  ObjectDesc *v1; // ebx@4
-  __int16 v2; // ax@5
-  RenderBillboard *v3; // esi@12
   SpriteFrame *v4; // eax@12
-  SpriteFrame *v5; // ebx@12
   unsigned int v6; // eax@12
   int v7; // ecx@12
-  int v8; // edx@12
   int v9; // ecx@12
   unsigned __int16 v10; // ax@12
-  int *v11; // eax@20
-  //char v12; // zf@26
+  //int *v11; // eax@20
   __int64 v18; // ST5C_4@27
   signed __int64 v19; // qtt@28
   int v20; // ST5C_4@28
-  //int v21; // edx@29
   __int16 v22; // ax@29
-  //int v23; // eax@29
-  SpriteFrame *v24; // [sp+1Ch] [bp-40h]@12
-  //__int16 a5; // [sp+28h] [bp-34h]@12
   int a6; // [sp+2Ch] [bp-30h]@12
-  int a2; // [sp+30h] [bp-2Ch]@12
-  int a1; // [sp+34h] [bp-28h]@12
-  int v30; // [sp+38h] [bp-24h]@12
   int v31; // [sp+38h] [bp-24h]@27
-  int a3; // [sp+40h] [bp-1Ch]@12
   signed __int16 v34; // [sp+44h] [bp-18h]@14
   int v35; // [sp+48h] [bp-14h]@25
   int v36; // [sp+4Ch] [bp-10h]@25
@@ -4264,71 +4178,45 @@
 
   for (uint i = 0; i < uNumSpriteObjects; ++i)
   {
-    SpriteObject* p = &pSpriteObjects[i];
-    if (p->uObjectDescID)
+    if (pSpriteObjects[i].uObjectDescID)
     {
-      v1 = &pObjectList->pObjects[p->uObjectDescID];
-        if ( !(v1->uFlags & 1) )
+        if ( !(pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & 1) )
          {
-          if ( ((v2 = p->uType, v2 < 1000) || v2 >= 10000)
-            && (v2 < 500 || v2 >= 600)
-            && (v2 < 811 || v2 >= 815)
-            || pGame->pStru6Instance->_4A81CA(p))
+          if ( ( pSpriteObjects[i].uType < 1000 || pSpriteObjects[i].uType >= 10000)
+            && (pSpriteObjects[i].uType < 500 || pSpriteObjects[i].uType >= 600)
+            && (pSpriteObjects[i].uType < 811 || pSpriteObjects[i].uType >= 815)
+            || pGame->pStru6Instance->_4A81CA(&pSpriteObjects[i]))
           {
-            //a5 = p->uSectorID;
-            a1 = p->vPosition.x;
-            a2 = p->vPosition.y;
-            a3 = p->vPosition.z;
-            v3 = &pBillboardRenderList[uNumBillboardsToDraw];
-            v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, p->uSpriteFrameID);
-            v5 = v4;
-            v24 = v4;
-            v30 = v4->uFlags;
-            a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier;
-            v6 = stru_5C6E00->Atan2(p->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x,
-                                    p->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
-            LOWORD(v7) = p->uFacing;
-            v8 = v30;
+            v4 = pSpriteFrameTable->GetFrame(pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uSpriteID, pSpriteObjects[i].uSpriteFrameID);
+            a6 = v4->uGlowRadius * pSpriteObjects[i].field_22_glow_radius_multiplier;
+            v6 = stru_5C6E00->Atan2(pSpriteObjects[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x,
+                                    pSpriteObjects[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
+            LOWORD(v7) = pSpriteObjects[i].uFacing;
             v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7;
-            v10 = v5->pHwSpriteIDs[v9];
-            v3->uHwSpriteID = v10;
-            if ( v30 & 0x20 )
-            {
-              v8 = v30;
-              a3 -= (signed int)((unsigned __int64)(v5->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1;
-            }
+            pBillboardRenderList[uNumBillboardsToDraw].uHwSpriteID = v4->pHwSpriteIDs[v9];
+            if ( v4->uFlags & 0x20 )
+              pSpriteObjects[i].vPosition.z -= (signed int)(fixpoint_mul(v4->scale, pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) / 2);
+
             v34 = 0;
-            if ( v8 & 2 )
+            if ( v4->uFlags & 2 )
               v34 = 2;
-            if ( v8 & 0x40000 )
+            if ( v4->uFlags & 0x40000 )
               v34 |= 0x40u;
-            if ( v8 & 0x20000 )
+            if ( v4->uFlags & 0x20000 )
               LOBYTE(v34) = v34 | 0x80;
-            v11 = (int *)(256 << v9);
-            if ( (256 << v9) & v8 )
-              v34 |= 4u;
+            //v11 = (int *)(256 << v9);
+            if ( (256 << v9) & v4->uFlags )
+              v34 |= 4;
             if ( a6 )
             {
-              LOBYTE(v11) = _4E94D3_light_type;
-              pMobileLightsStack->AddLight(
-                a1,
-                a2,
-                a3,
-                p->uSectorID,
-                a6,
-                v1->uParticleTrailColorR,
-                v1->uParticleTrailColorG,
-                v1->uParticleTrailColorB,
-                _4E94D3_light_type);
+              //LOBYTE(v11) = _4E94D3_light_type;
+              pMobileLightsStack->AddLight(pSpriteObjects[i].vPosition.x, pSpriteObjects[i].vPosition.y, pSpriteObjects[i].vPosition.z,
+                   pSpriteObjects[i].uSectorID, a6, pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uParticleTrailColorR,
+                                                    pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uParticleTrailColorG,
+                                                    pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uParticleTrailColorB, _4E94D3_light_type);
             }
-            if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(
-                   a1,
-                   a2,
-                   a3,
-                   &x,
-                   &y,
-                   &z,
-                   1) )
+            if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pSpriteObjects[i].vPosition.x, pSpriteObjects[i].vPosition.y,
+                                                                                    pSpriteObjects[i].vPosition.z, &x, &y, &z, 1) )
             {
               pGame->pIndoorCameraD3D->Project(x, y, z, &v36, &v35);
 
@@ -4337,19 +4225,17 @@
               //  return;
               ++uNumBillboardsToDraw;
               ++uNumSpritesDrawnThisFrame;
-              p->uAttributes |= 1u;
-              //v12 = pRenderer->pRenderD3D == 0;
-              v3->uPalette = v24->uPaletteIndex;
-              v3->uIndoorSectorID = p->uSectorID;
+              pSpriteObjects[i].uAttributes |= 1;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v4->uPaletteIndex;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = pSpriteObjects[i].uSectorID;
               //if ( pRenderer->pRenderD3D )
               {
-                v3->fov_x = pGame->pIndoorCameraD3D->fov_x;
-                v3->fov_y = pGame->pIndoorCameraD3D->fov_y;
+                pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x = pGame->pIndoorCameraD3D->fov_x;
+                pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y = pGame->pIndoorCameraD3D->fov_y;
                 LODWORD(v18) = 0;
-                HIDWORD(v18) = (int)floorf(v3->fov_x + 0.5f);
-                v18 = v18 / x;
-                v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v18) >> 16;
-                v31 = (unsigned __int64)(v24->scale * v18) >> 16;
+                HIDWORD(v18) = (int)floorf(pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x + 0.5f);
+                pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v4->scale, v18 / x);
+                v31 = fixpoint_mul(v4->scale, v18 / x);
               }
               /*else
               {
@@ -4357,31 +4243,30 @@
                 LODWORD(v19) = pBLVRenderParams->field_40 << 16;
                 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16;
                 v20 = v19 / x;
-                v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16;
-                v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16;
+                pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v24->scale, v19 / x);
+                v31 = fixpoint_mul(v24->scale, v20);
               }*/
               //HIWORD(v21) = HIWORD(x);
               //LOWORD(v21) = 0;
-              v3->_screenspace_y_scaler_packedfloat = v31;
-              v3->field_1E = v34;
-              v3->world_x = a1;
-              v3->world_y = a2;
-              v3->world_z = a3;
-              v3->uScreenSpaceX = v36;
-              v22 = v35;
-              v3->sTintColor = 0;
-              v3->uScreenSpaceY = v22;
+              pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = v31;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].field_1E = v34;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].world_x = pSpriteObjects[i].vPosition.x;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].world_y = pSpriteObjects[i].vPosition.y;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].world_z = pSpriteObjects[i].vPosition.z;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceX = v36;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].sTintColor = 0;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceY = v35;
               //v23 = 8 * i;
               //LOBYTE(v23) = PID(OBJECT_Item,i);
-              v3->pSpriteFrame = v24;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].pSpriteFrame = v4;
               //v12 = (p->uAttributes & 0x20) == 0;
-              //v3->sZValue = v21 + v23;
-              v3->actual_z = HIWORD(x);
-              v3->object_pid = PID(OBJECT_Item,i);
-              /*if (p->uAttributes & 0x20)
+              //pBillboardRenderList[uNumBillboardsToDraw - 1].sZValue = v21 + v23;
+              pBillboardRenderList[uNumBillboardsToDraw - 1].actual_z = HIWORD(x);
+              pBillboardRenderList[uNumBillboardsToDraw - 1].object_pid = PID(OBJECT_Item,i);
+              /*if (pSpriteObjects[i].uAttributes & 0x20)
               {
                 if ( !pRenderer->pRenderD3D )
-                  v3->sZValue = 0;
+                  pBillboardRenderList[uNumBillboardsToDraw - 1].sZValue = 0;
               }*/
             }
           }
@@ -4472,36 +4357,15 @@
 //----- (0043FA33) --------------------------------------------------------
 void PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID)
 {
-  LevelDecoration *v2; // esi@1
-  DecorationDesc *v3; // ebx@2
-  __int16 v4; // ax@2
-  double v5; // st7@3
-  int v6; // eax@5
-  int v7; // edx@5
   unsigned int v8; // edi@5
   int v9; // edi@5
   int v10; // eax@7
   SpriteFrame *v11; // eax@7
-  SpriteFrame *v12; // esi@7
-  int v13; // eax@7
-  int v14; // ebx@16
-  RenderBillboard *v15; // ecx@17
   char v16; // zf@18
-  IndoorCameraD3D **v17; // eax@19
-  double v18; // st7@19
-  //float v19; // eax@19
   signed __int64 v20; // qtt@19
   signed __int64 v21; // qtt@20
-  //int v22; // edx@21
-  //int v23; // eax@21
-  Particle_sw local_0; // [sp+Ch] [bp-A0h]@3
-  //double v25; // [sp+74h] [bp-38h]@19
-  //unsigned int v26; // [sp+7Ch] [bp-30h]@1
-  int a2; // [sp+80h] [bp-2Ch]@5
-  int a3; // [sp+84h] [bp-28h]@5
-  int a1; // [sp+88h] [bp-24h]@5
+  Particle_sw particle; // [sp+Ch] [bp-A0h]@3
   int v30; // [sp+8Ch] [bp-20h]@7
-  //float v31; // [sp+90h] [bp-1Ch]@1
   int a5; // [sp+94h] [bp-18h]@17
   int z; // [sp+98h] [bp-14h]@15
   int a6; // [sp+9Ch] [bp-10h]@17
@@ -4509,132 +4373,103 @@
   int x; // [sp+A4h] [bp-8h]@15
   int v37; // [sp+A8h] [bp-4h]@5
 
-  //v26 = uDecorationID;
-  //LODWORD(v31) = uSectorID;
-  v2 = &pLevelDecorations[uDecorationID];
-  if (v2->uFlags & LEVEL_DECORATION_INVISIBLE)
+  if (pLevelDecorations[uDecorationID].uFlags & LEVEL_DECORATION_INVISIBLE)
+    return;
+
+  if (pDecorationList->pDecorations[pLevelDecorations[uDecorationID].uDecorationDescID].uFlags & DECORATION_DESC_EMITS_FIRE)
+  {
+    memset(&particle, 0, sizeof(particle));               // fire,  like at the Pit's tavern
+    particle.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
+    particle.uDiffuse = 0xFF3C1E;
+    particle.x = (double)pLevelDecorations[uDecorationID].vPosition.x;
+    particle.y = (double)pLevelDecorations[uDecorationID].vPosition.y;
+    particle.z = (double)pLevelDecorations[uDecorationID].vPosition.z;
+    particle.r = 0.0;
+    particle.g = 0.0;
+    particle.b = 0.0;
+    particle.flt_28 = 1.0;
+    particle.timeToLive = (rand() & 0x80) + 128;
+    particle.uTextureID = pBitmaps_LOD->LoadTexture("effpar01");
+    pGame->pParticleEngine->AddParticle(&particle);
+    return;
+  }
+
+
+  if (pDecorationList->pDecorations[pLevelDecorations[uDecorationID].uDecorationDescID].uFlags & DECORATION_DESC_DONT_DRAW)
     return;
 
-    v3 = &pDecorationList->pDecorations[v2->uDecorationDescID];
-    v4 = v3->uFlags;
-    if (v3->uFlags & DECORATION_DESC_EMITS_FIRE)
+  v8 = pLevelDecorations[uDecorationID].field_10_y_rot + ((signed int)stru_5C6E00->uIntegerPi >> 3)
+     - stru_5C6E00->Atan2(pLevelDecorations[uDecorationID].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x,
+                          pLevelDecorations[uDecorationID].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
+  v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7;
+  v37 = pBLVRenderParams->field_0_timer_;
+  if (pParty->bTurnBasedModeOn)
+    v37 = pMiscTimer->uTotalGameTimeElapsed;
+  v10 = abs(pLevelDecorations[uDecorationID].vPosition.x + pLevelDecorations[uDecorationID].vPosition.y);
+  v11 = pSpriteFrameTable->GetFrame(pDecorationList->pDecorations[pLevelDecorations[uDecorationID].uDecorationDescID].uSpriteID, v37 + v10);
+  v30 = 0;
+  if ( v11->uFlags & 2 )
+    v30 = 2;
+  if ( v11->uFlags & 0x40000 )
+    v30 |= 0x40u;
+  if ( v11->uFlags & 0x20000 )
+    LOBYTE(v30) = v30 | 0x80;
+  if ( (256 << v9) & v11->uFlags )
+    v30 |= 4;
+  if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pLevelDecorations[uDecorationID].vPosition.x,
+                                                                          pLevelDecorations[uDecorationID].vPosition.y,
+                                                                          pLevelDecorations[uDecorationID].vPosition.z, &x, &y, &z, 1) )
+  {
+    if ( abs(x) >= abs(y) )
     {
-      memset(&local_0, 0, 0x68u);               // fire,  like at the Pit's tavern
-      v5 = (double)v2->vPosition.x;
-      local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
-      local_0.uDiffuse = 0xFF3C1E;
-      local_0.x = v5;
-      local_0.y = (double)v2->vPosition.y;
-      local_0.z = (double)v2->vPosition.z;
-      local_0.r = 0.0;
-      local_0.g = 0.0;
-      local_0.b = 0.0;
-      local_0.flt_28 = 1.0;
-      local_0.timeToLive = (rand() & 0x80) + 128;
-      local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01");
-      pGame->pParticleEngine->AddParticle(&local_0);
-      return;
+      pGame->pIndoorCameraD3D->Project(x, y, z, &a5, &a6);
+
+      assert(uNumBillboardsToDraw < 500);
+
+      ++uNumBillboardsToDraw;
+      ++uNumDecorationsDrawnThisFrame;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].uHwSpriteID = v11->pHwSpriteIDs[v9];
+      pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v11->uPaletteIndex;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = uSectorID;
+      /*if ( !pRenderer->pRenderD3D )
+      {
+        LODWORD(v21) = pBLVRenderParams->fov_rad_fixpoint << 16;
+        HIDWORD(v21) = pBLVRenderParams->fov_rad_fixpoint >> 16;
+        //LODWORD(v31) = v12->scale;
+        pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v12->scale, v21 / x);
+        v37 = fixpoint_mul(v12->scale, v21 / x);
+      }
+      else
+      {*/
+        pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x = pGame->pIndoorCameraD3D->fov_x;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y = pGame->pIndoorCameraD3D->fov_y;
+        LODWORD(v20) = 0;
+        HIDWORD(v20) = floorf(pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x + 0.5f);
+        pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v11->scale, v20 / x);
+        LODWORD(v20) = 0;
+        HIDWORD(v20) = floorf(pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y + 0.5f);
+        v37 = fixpoint_mul(v11->scale, v20 / x);
+      //}
+      //HIWORD(v22) = HIWORD(x);
+      //LOWORD(v22) = 0;
+      pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = v37;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].field_1E = v30;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].world_x = pLevelDecorations[uDecorationID].vPosition.x;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].world_y = pLevelDecorations[uDecorationID].vPosition.y;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].world_z = pLevelDecorations[uDecorationID].vPosition.z;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceX = a5;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceY = a6;
+      //v23 = 8 * uDecorationID;
+      //LOBYTE(v23) = PID(OBJECT_Decoration,uDecorationID);
+
+      //pBillboardRenderList[uNumBillboardsToDraw - 1].sZValue = v22 + v23;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].actual_z = HIWORD(x);
+      pBillboardRenderList[uNumBillboardsToDraw - 1].object_pid = PID(OBJECT_Decoration,uDecorationID);
+
+      pBillboardRenderList[uNumBillboardsToDraw - 1].sTintColor = 0;
+      pBillboardRenderList[uNumBillboardsToDraw - 1].pSpriteFrame = v11;
     }
-
-
-      if (v4 & DECORATION_DESC_DONT_DRAW)
-        return;
-
-        v6 = v2->vPosition.x;
-        v7 = v2->vPosition.z;
-        a2 = v2->vPosition.y;
-        a1 = v6;
-        a3 = v7;
-        v8 = v2->field_10_y_rot
-           + ((signed int)stru_5C6E00->uIntegerPi >> 3)
-           - stru_5C6E00->Atan2(v6 - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y);
-        v37 = pBLVRenderParams->field_0_timer_;
-        v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7;
-        if (pParty->bTurnBasedModeOn)
-          v37 = pMiscTimer->uTotalGameTimeElapsed;
-        v10 = abs(v2->vPosition.x + v2->vPosition.y);
-        v11 = pSpriteFrameTable->GetFrame(v3->uSpriteID, v37 + v10);
-        v30 = 0;
-        v12 = v11;
-        v13 = v11->uFlags;
-        if ( v13 & 2 )
-          v30 = 2;
-        if ( v13 & 0x40000 )
-          v30 |= 0x40u;
-        if ( v13 & 0x20000 )
-          LOBYTE(v30) = v30 | 0x80;
-        if ( (256 << v9) & v13 )
-          v30 |= 4u;
-        if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1, a2, a3, &x, &y, &z, 1) )
-        {
-          v14 = abs(x);
-          if ( v14 >= abs(y) )
-          {
-            pGame->pIndoorCameraD3D->Project(x, y, z, &a5, &a6);
-
-            v15 = &pBillboardRenderList[uNumBillboardsToDraw];
-            assert(uNumBillboardsToDraw < 500);
-
-              ++uNumBillboardsToDraw;
-              ++uNumDecorationsDrawnThisFrame;
-              //v16 = pRenderer->pRenderD3D == 0;
-              v15->uHwSpriteID = v12->pHwSpriteIDs[v9];
-              v15->uPalette = v12->uPaletteIndex;
-              v15->uIndoorSectorID = uSectorID;
-              /*if ( v16 )
-              {
-                LODWORD(v21) = pBLVRenderParams->fov_rad_fixpoint << 16;
-                HIDWORD(v21) = pBLVRenderParams->fov_rad_fixpoint >> 16;
-                v37 = v21 / x;
-                //LODWORD(v31) = v12->scale;
-                v37 = v21 / x;
-                v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v21 / x) >> 16;
-                v37 = (unsigned __int64)(v12->scale * (signed __int64)v37) >> 16;
-              }
-              else*/
-              {
-                v17 = &pGame->pIndoorCameraD3D;
-                v15->fov_x = pGame->pIndoorCameraD3D->fov_x;
-                v18 = (*v17)->fov_y;
-                //v19 = v15->fov_x;
-                v15->fov_y = v18;
-                //v31 = v19;
-                //v25 = v19 + 6.7553994e15;
-                //v25 = floorf(v15->fov_x + 0.5f);
-                LODWORD(v20) = 0;
-                HIDWORD(v20) = floorf(v15->fov_x + 0.5f);
-                v37 = v20 / x;
-                //LODWORD(v31) = v12->scale;
-                v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16;
-                v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v20 / x) >> 16;
-                //v31 = v15->fov_y;
-                //v25 = v31 + 6.7553994e15;
-                //v25 = floorf(v15->fov_y + 0.5f);
-                LODWORD(v20) = 0;
-                HIDWORD(v20) = floorf(v15->fov_y + 0.5f);
-                v37 = v20 / x;
-                v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16;
-              }
-              //HIWORD(v22) = HIWORD(x);
-              //LOWORD(v22) = 0;
-              v15->_screenspace_y_scaler_packedfloat = v37;
-              v15->field_1E = v30;
-              v15->world_x = a1;
-              v15->world_y = a2;
-              v15->world_z = a3;
-              v15->uScreenSpaceX = a5;
-              v15->uScreenSpaceY = a6;
-              //v23 = 8 * uDecorationID;
-              //LOBYTE(v23) = PID(OBJECT_Decoration,uDecorationID);
-
-              //v15->sZValue = v22 + v23;
-              v15->actual_z = HIWORD(x);
-              v15->object_pid = PID(OBJECT_Decoration,uDecorationID);
-
-              v15->sTintColor = 0;
-              v15->pSpriteFrame = v12;
-          }
-        }
+  }
 }
 //----- (0043F953) --------------------------------------------------------
 void PrepareBspRenderList_BLV()
@@ -6114,12 +5949,12 @@
   PortalFace._view_transformed_z[pFace->uNumVertices + 3] = PortalFace._view_transformed_z[3];
   PortalFace._view_transformed_x[pFace->uNumVertices + 3] = PortalFace._view_transformed_x[3];
   PortalFace._view_transformed_y[pFace->uNumVertices + 3] = PortalFace._view_transformed_y[3];
-  current_vertices_flag = PortalFace._view_transformed_z[3] >= 524288;// 8.0(0x80000)
+  current_vertices_flag = PortalFace._view_transformed_z[3] >= 0x80000; //524288
   if ( pFace->uNumVertices >= 1 )
   {
     for ( uint i = 1; i <= pFace->uNumVertices; ++i)
     {
-      next_vertices_flag = PortalFace._view_transformed_z[i + 3] >= 524288;// 8.0(0x80000)
+      next_vertices_flag = PortalFace._view_transformed_z[i + 3] >= 0x80000; //524288;// 8.0
       if ( current_vertices_flag ^ next_vertices_flag )//èëè òåêóùàÿ èëè ñëåäóþùàÿ âåðøèíà çà áëèæíåé ãðàíèöåé
       {
         if ( next_vertices_flag )//ñëåäóþùàÿ âåðøèíà çà áëèæíåé ãðàíèöåé
@@ -6127,26 +5962,26 @@
           //t = near_clip - v0.z / v1.z - v0.z
           t = fixpoint_div(524288 - PortalFace._view_transformed_z[i + 2], PortalFace._view_transformed_z[i + 3] - PortalFace._view_transformed_z[i + 2]);
           //New_x = (v1.x - v0.x)*t + v0.x
-          PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 3]
-                                                           - PortalFace._view_transformed_x[i + 2]) * t) >> 16) + PortalFace._view_transformed_x[i + 2];
+          PortalFace._view_transformed_x[depth_num_vertices] = fixpoint_mul((PortalFace._view_transformed_x[i + 3] - PortalFace._view_transformed_x[i + 2]), t) 
+                                                               + PortalFace._view_transformed_x[i + 2];
           //New_y = (v1.y - v0.y)*t + v0.y
-          PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 3] - PortalFace._view_transformed_y[i + 2])
-                                   * t) >> 16) + PortalFace._view_transformed_y[i + 2];
+          PortalFace._view_transformed_y[depth_num_vertices] = fixpoint_mul((PortalFace._view_transformed_y[i + 3] - PortalFace._view_transformed_y[i + 2]), t)
+                                                               + PortalFace._view_transformed_y[i + 2];
           //New_z = 8.0(0x80000)
-          PortalFace._view_transformed_z[depth_num_vertices] = 524288;
+          PortalFace._view_transformed_z[depth_num_vertices] = 0x80000; //524288
         }
         else// òåêóùàÿ âåðøèíà çà áëèæíåé ãðàíèöåé
         {
           //t = near_clip - v1.z / v0.z - v1.z
           t = fixpoint_div(524288 - PortalFace._view_transformed_z[i + 3], PortalFace._view_transformed_z[i + 2] - PortalFace._view_transformed_z[i + 3]);
           //New_x = (v0.x - v1.x)*t + v1.x
-          PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 2]
-                                                   - PortalFace._view_transformed_x[i + 3]) * t) >> 16) + PortalFace._view_transformed_x[i + 3];
+          PortalFace._view_transformed_x[depth_num_vertices] = fixpoint_mul((PortalFace._view_transformed_x[i + 2] - PortalFace._view_transformed_x[i + 3]), t)
+                                                               + PortalFace._view_transformed_x[i + 3];
           //New_y = (v0.x - v1.y)*t + v1.y
-          PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 2] - PortalFace._view_transformed_y[i + 3])
-                                   * t) >> 16) + PortalFace._view_transformed_y[i + 3];
+          PortalFace._view_transformed_y[depth_num_vertices] = fixpoint_mul((PortalFace._view_transformed_y[i + 2] - PortalFace._view_transformed_y[i + 3]), t)
+                                                               + PortalFace._view_transformed_y[i + 3];
           //New_z = 8.0(0x80000)
-          PortalFace._view_transformed_z[depth_num_vertices] = 524288;
+          PortalFace._view_transformed_z[depth_num_vertices] = 0x80000; //524288
         }
         depth_num_vertices++;
       }
@@ -6207,8 +6042,8 @@
           pScreenY = 0x400000;  // 64.0
       }
     }
-    PortalFace._screen_space_x[i + 12] = pBLVRenderParams->uViewportCenterX - ((unsigned __int64)(SHIWORD(pBLVRenderParams->fov_rad_fixpoint) * (signed __int64)pScreenX) >> 16);
-    PortalFace._screen_space_y[i + 12] = pBLVRenderParams->uViewportCenterY - ((unsigned __int64)(SHIWORD(pBLVRenderParams->fov_rad_fixpoint) * (signed __int64)pScreenY) >> 16);
+    PortalFace._screen_space_x[i + 12] = pBLVRenderParams->uViewportCenterX - fixpoint_mul(SHIWORD(pBLVRenderParams->fov_rad_fixpoint), pScreenX);
+    PortalFace._screen_space_y[i + 12] = pBLVRenderParams->uViewportCenterY - fixpoint_mul(SHIWORD(pBLVRenderParams->fov_rad_fixpoint), pScreenY);
   }
   // ðåçóëüòàò: ïðè ïîâîðîòå êàìåðû, êîãäà ãðàíèöà ïîðòàëà ñäâèãàåòñÿ ê êðàþ ýêðàíà, ïîðòàë îñòàåòñÿ ïðîçðà÷íûì(âèäèìûì)
   //******************************************************************************************************************************************
@@ -6232,8 +6067,8 @@
         //t = left_clip - v0.x / v1.x - v0.x
         t = fixpoint_div(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 11], PortalFace._screen_space_x[i + 12] - PortalFace._screen_space_x[i + 11]);
         //New_y = (v1.y - v0.y)*t + v0.y
-        PortalFace._screen_space_y[left_num_vertices + 9] = ((signed int)((PortalFace._screen_space_y[i + 12]- PortalFace._screen_space_y[i + 11])
-                                                            * t) >> 16) + PortalFace._screen_space_y[i + 11];
+        PortalFace._screen_space_y[left_num_vertices + 9] = fixpoint_mul((PortalFace._screen_space_y[i + 12]- PortalFace._screen_space_y[i + 11]), t)
+                                                            + PortalFace._screen_space_y[i + 11];
         //New_x = left_clip
         PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX;
       }
@@ -6242,8 +6077,8 @@
         //t = left_clip - v1.x / v0.x - v1.x
         t = fixpoint_div(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 12], PortalFace._screen_space_x[i + 11] - PortalFace._screen_space_x[i + 12]);
         //New_y = (v0.y - v1.y)*t + v1.y
-        PortalFace._screen_space_y[left_num_vertices + 9] = ((signed int)(( PortalFace._screen_space_y[i + 11] - PortalFace._screen_space_y[i + 12])
-                                                            * t) >> 16) + PortalFace._screen_space_y[i + 12];
+        PortalFace._screen_space_y[left_num_vertices + 9] = fixpoint_mul((PortalFace._screen_space_y[i + 11] - PortalFace._screen_space_y[i + 12]), t)
+                                                            + PortalFace._screen_space_y[i + 12];
         //New_x = left_clip
         PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX;
       }
@@ -6275,8 +6110,8 @@
         //t = right_clip - v1.x / v0.x - v1.x
         t = fixpoint_div(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 8], PortalFace._screen_space_x[i + 9] - PortalFace._screen_space_x[i + 8]);
         //New_y = (v0.y - v1.y)*t + v1.y
-        PortalFace._screen_space_y[right_num_vertices + 6] = ((signed int)((PortalFace._screen_space_y[i + 9] - PortalFace._screen_space_y[i + 8])
-                                                           * t) >> 16) + PortalFace._screen_space_y[i + 8];
+        PortalFace._screen_space_y[right_num_vertices + 6] = fixpoint_mul((PortalFace._screen_space_y[i + 9] - PortalFace._screen_space_y[i + 8]), t)
+                                                             + PortalFace._screen_space_y[i + 8];
         //New_x = right_clip
         PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ;
       }
@@ -6285,8 +6120,8 @@
         //t = right_clip - v0.x / v1.x - v0.x
         t = fixpoint_div(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 9], PortalFace._screen_space_x[i + 8] - PortalFace._screen_space_x[i + 9]);
         //New_y = (v1.y - v0.y)*t + v0.y
-        PortalFace._screen_space_y[right_num_vertices + 6] = ((signed int)((PortalFace._screen_space_y[i + 8] - PortalFace._screen_space_y[i + 9])
-                                                           * t) >> 16) + PortalFace._screen_space_y[i + 9];
+        PortalFace._screen_space_y[right_num_vertices + 6] = fixpoint_mul((PortalFace._screen_space_y[i + 8] - PortalFace._screen_space_y[i + 9]), t)
+                                                             + PortalFace._screen_space_y[i + 9];
         //New_x = right_clip
         PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ;
       }
@@ -6324,8 +6159,8 @@
       else
       {
         t = fixpoint_div(pBLVRenderParams->uViewportY - PortalFace._screen_space_y[i + 6], PortalFace._screen_space_y[i + 5] - PortalFace._screen_space_y[i + 6]);
-        PortalFace._screen_space_x[top_num_vertices + 3] = ((signed int)((PortalFace._screen_space_x[i + 5]- PortalFace._screen_space_x[i + 6])
-            * t) >> 16) + PortalFace._screen_space_x[i + 6];
+        PortalFace._screen_space_x[top_num_vertices + 3] = fixpoint_mul((PortalFace._screen_space_x[i + 5]- PortalFace._screen_space_x[i + 6]), t)
+                                                           + PortalFace._screen_space_x[i + 6];
         PortalFace._screen_space_y[top_num_vertices + 3] = pBLVRenderParams->uViewportY;
       }
       top_num_vertices++;
@@ -6354,15 +6189,15 @@
       if ( next_vertices_flag )
       {
         t = fixpoint_div(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 2], PortalFace._screen_space_y[i + 3] - PortalFace._screen_space_y[i + 2]);
-        PortalFace._screen_space_x[bottom_num_vertices] = ((signed int)((PortalFace._screen_space_x[i + 3] - PortalFace._screen_space_x[i + 2])
-            * t) >> 16) + PortalFace._screen_space_x[i + 2];
+        PortalFace._screen_space_x[bottom_num_vertices] = fixpoint_mul((PortalFace._screen_space_x[i + 3] - PortalFace._screen_space_x[i + 2]), t)
+                                                          + PortalFace._screen_space_x[i + 2];
         PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW;
       }
       else
       {
         t = fixpoint_div(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 3], PortalFace._screen_space_y[i + 2] - PortalFace._screen_space_y[i + 3]);
-        PortalFace._screen_space_x[bottom_num_vertices] = ((signed int)((PortalFace._screen_space_x[i + 2] - PortalFace._screen_space_x[i + 3])
-            * t) >> 16) + PortalFace._screen_space_x[i + 3];
+        PortalFace._screen_space_x[bottom_num_vertices] = fixpoint_mul((PortalFace._screen_space_x[i + 2] - PortalFace._screen_space_x[i + 3]), t) 
+                                                          + PortalFace._screen_space_x[i + 3];
         PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW;
       }
       bottom_num_vertices++;
@@ -6868,83 +6703,74 @@
       v2 = fixpoint_mul(stru_5C6E00->Cos(v54), integer_sqrt(v2 * v2 + v1 * v1));
       v1 = fixpoint_mul(stru_5C6E00->Sin(v54), integer_sqrt(v2 * v2 + v1 * v1));
     }
-    //else
-    //{
-      else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
+    else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
+    {
+      pFace = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
+      if ( pFace->uPolygonType == POLYGON_Floor )
       {
-        pFace = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
-        if ( pFace->uPolygonType == POLYGON_Floor )
+        if ( pParty->uFallSpeed < 0 )
+          pParty->uFallSpeed = 0;
+        v87 = pIndoor->pVertices[*pFace->pVertexIDs].z + 1;
+        if ( pParty->uFallStartY - v87 < 512 )
+          pParty->uFallStartY = v87;
+        if ( v2 * v2 + v1 * v1 < 400 )
         {
-          if ( pParty->uFallSpeed < 0 )
-            pParty->uFallSpeed = 0;
-          v87 = pIndoor->pVertices[*pFace->pVertexIDs].z + 1;
-          if ( pParty->uFallStartY - v87 < 512 )
-            pParty->uFallStartY = v87;
-          if ( v2 * v2 + v1 * v1 < 400 )
+          v1 = 0;
+          v2 = 0;
+        }
+        if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && pFace->Pressure_Plate() )
+          uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
+      }
+      else
+      {
+        v46 = pParty->uFallSpeed * pFace->pFacePlane_old.vNormal.z;
+        if ( pFace->uPolygonType != POLYGON_InBetweenFloorAndWall )
+        {
+          v80 = abs(v1 * pFace->pFacePlane_old.vNormal.y + v46 + v2 * pFace->pFacePlane_old.vNormal.x) >> 16;
+          if ((stru_721530.speed >> 3) > v80 )
+          v80 = stru_721530.speed >> 3;
+          v2 += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.x);
+          v1 += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.y);
+          pParty->uFallSpeed += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.z);
+          //v80 = pFace->pFacePlane_old.vNormal.y;
+          v52 = stru_721530.prolly_normal_d - ((pFace->pFacePlane_old.dist
+                + v87 * pFace->pFacePlane_old.vNormal.z
+                + new_party_y * pFace->pFacePlane_old.vNormal.y
+                + new_party_x * pFace->pFacePlane_old.vNormal.x) >> 16);
+          if ( v52 > 0 )
           {
-            v1 = 0;
-            v2 = 0;
+            new_party_x += fixpoint_mul(v52, pFace->pFacePlane_old.vNormal.x);
+            new_party_y += fixpoint_mul(v52, pFace->pFacePlane_old.vNormal.y);
+            v87 += fixpoint_mul(v52, pFace->pFacePlane_old.vNormal.z);
           }
           if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && pFace->Pressure_Plate() )
             uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
         }
-        else
+        if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall )
         {
-          v46 = pParty->uFallSpeed * pFace->pFacePlane_old.vNormal.z;
-          if ( pFace->uPolygonType != POLYGON_InBetweenFloorAndWall )
+          v80 = abs(v1 * pFace->pFacePlane_old.vNormal.y + v46 + v2 * pFace->pFacePlane_old.vNormal.x) >> 16;
+          if ((stru_721530.speed >> 3) > v80 )
+            v80 = stru_721530.speed >> 3;
+          v2 += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.x);
+          v1 += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.y);
+          pParty->uFallSpeed += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.z);
+          if ( v2 * v2 + v1 * v1 >= 400 )
           {
-            v80 = abs(v1 * pFace->pFacePlane_old.vNormal.y + v46 + v2 * pFace->pFacePlane_old.vNormal.x) >> 16;
-            if ((stru_721530.speed >> 3) > v80 )
-              v80 = stru_721530.speed >> 3;
-            v2 += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.x);
-            v1 += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.y);
-            pParty->uFallSpeed += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.z);
-            //v80 = pFace->pFacePlane_old.vNormal.y;
-            v52 = stru_721530.prolly_normal_d - ((pFace->pFacePlane_old.dist
-                  + v87 * pFace->pFacePlane_old.vNormal.z
-                  + new_party_y * pFace->pFacePlane_old.vNormal.y
-                  + new_party_x * pFace->pFacePlane_old.vNormal.x) >> 16);
-            if ( v52 > 0 )
-            {
-              new_party_x += fixpoint_mul(v52, pFace->pFacePlane_old.vNormal.x);
-              new_party_y += fixpoint_mul(v52, pFace->pFacePlane_old.vNormal.y);
-              v87 += fixpoint_mul(v52, pFace->pFacePlane_old.vNormal.z);
-            }
             if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && pFace->Pressure_Plate() )
               uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
           }
-          if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall )
+          else
           {
-            v80 = abs(v1 * pFace->pFacePlane_old.vNormal.y + v46 + v2 * pFace->pFacePlane_old.vNormal.x) >> 16;
-            if ((stru_721530.speed >> 3) > v80 )
-              v80 = stru_721530.speed >> 3;
-            v2 += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.x);
-            v1 += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.y);
-            pParty->uFallSpeed += fixpoint_mul(v80, pFace->pFacePlane_old.vNormal.z);
-            if ( v2 * v2 + v1 * v1 >= 400 )
-            {
-              if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && pFace->Pressure_Plate() )
-                uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
-            }
-            else
-            {
-              v2 = 0;
-              v1 = 0;
-              pParty->uFallSpeed = 0;
-            }
+            v2 = 0;
+            v1 = 0;
+            pParty->uFallSpeed = 0;
           }
         }
       }
-    //}
+    }
     v2 = fixpoint_mul(58500, v2);
     v1 = fixpoint_mul(58500, v1);
-    //++v83;
     pParty->uFallSpeed = fixpoint_mul(58500, pParty->uFallSpeed);
-    //if ( v83 >= 100 )
-    //{
-      //new_party_z = v87;
-      //break;
-    //}
   }
 
   //  //Âîñïðîèçâåäåíèå çâóêîâ õîäüáû/áåãà-------------------------
@@ -6960,7 +6786,7 @@
       {
         if ( on_water )
           pAudioPlayer->PlaySound(SOUND_RunAlongWater, 804, 1, -1, 0, 0, 0, 0);
-        else if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
+        else if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_UNKNOW6 )//ïî êîâðó
           pAudioPlayer->PlaySound((SoundID)50, 804, 1, -1, 0, 0, 0, 0);
         else
           pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);
@@ -6973,7 +6799,7 @@
       {
         if ( on_water )
           pAudioPlayer->PlaySound(SOUND_WalkAlongWater, 804, 1, -1, 0, 0, 0, 0);
-        else if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
+        else if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_UNKNOW6 )//ïî êîâðó
           pAudioPlayer->PlaySound((SoundID)89, 804, 1, -1, 0, 0, 0, 0);
         else
           pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);
@@ -6993,7 +6819,7 @@
   pParty->vPosition.z = new_party_z;
   pParty->vPosition.y = new_party_y;
   //pParty->uFallSpeed = v89;
-  if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
+  if ( !bJumping && pIndoor->pFaces[uFaceID].uAttributes & FACE_UNKNOW5 )
     pParty->uFlags |= 0x200;
   if (uFaceEvent)
     EventProcessor(uFaceEvent, 0, 1);
--- a/Indoor.h	Thu Jan 16 17:34:48 2014 +0600
+++ b/Indoor.h	Fri Jan 17 17:58:48 2014 +0600
@@ -226,24 +226,30 @@
 
 #define FACE_PORTAL             0x00000001 // portal/two-sided
 #define FACE_CAN_SATURATE_COLOR 0x00000002
+#define FACE_UNKNOW8            0x00000004
 #define FACE_FLUID              0x00000010 // wavy animated water or lava
+#define FACE_UNKNOW9            0x00000020
 #define FACE_DONT_CACHE_TEXTURE 0x00000040 // do not load face texture if it isn't loaded already
 #define FACE_UNKNOW4            0x00000080
 #define FACE_XY_PLANE           0x00000100
 #define FACE_XZ_PLANE           0x00000200
 #define FACE_YZ_PLANE           0x00000400
+#define FACE_UNKNOW10           0x00000800
 #define FACE_UNKNOW3            0x00001000
 #define FACE_INVISIBLE          0x00002000
 #define FACE_TEXTURE_FRAME      0x00004000 // Texture ID is a frameset from TextureFrameTable, otherwise BitmapID
 #define FACE_OUTLINED           0x00010000 // outline face edges
+#define FACE_UNKNOW7            0x00020000
 #define FACE_TEXTURE_FLOW       0x00040000 // The texture moves slowly. For horizontal facets only.
 #define FACE_UNKNOW             0x00100000
+#define FACE_UNKNOW6            0x00200000
 #define FACE_INDOOR_SKY         0x00400000
 #define FACE_CLICKABLE          0x02000000 // Event can be triggered by clicking on the facet.
 #define FACE_PRESSURE_PLATE     0x04000000 // Event can be triggered by stepping on the facet.
 #define FACE_INDICATE           0x06000000 // Event can be triggered by indicating on the facet.
 #define FACE_UNKNOW2            0x10000000
 #define FACE_ETHEREAL           0x20000000 // Untouchable. You can pass through it.
+#define FACE_UNKNOW5            0x40000000
 #define FACE_PICKED             0x80000000
 
 /*   93 */
--- a/Outdoor.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/Outdoor.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -80,10 +80,6 @@
 //----- (0047A59E) --------------------------------------------------------
 void OutdoorLocation::ExecDraw(unsigned int bRedraw)
 {
-  //unsigned int v2; // ebx@1
-  int v3; // ST18_4@3
-  int v4; // ST04_4@19
-  int v5; // eax@19
 
   pGame->pIndoorCameraD3D->debug_flags = 0;
   if (viewparams->draw_d3d_outlines)
@@ -138,14 +134,10 @@
   pGame->PushStationaryLights(-1);
   pGame->PrepareBloodsplats();
   if (bRedraw)
-  {
-    v4 = WorldPosToGridCellZ(pParty->vPosition.y);
-    v5 = WorldPosToGridCellX(pParty->vPosition.x);
-    pOutdoor->UpdateDiscoveredArea(v5, v4, 1);
-  }
+    pOutdoor->UpdateDiscoveredArea(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y), 1);
   pGame->uFlags2 &= 0xFFFFFFFEu;
   if (/*pRenderer->pRenderD3D*/true && pRenderer->bUsingSpecular)
-    pGame->pLightmapBuilder->uFlags |= 1u;
+    pGame->pLightmapBuilder->uFlags |= 1;
   else
     pGame->pLightmapBuilder->uFlags &= 0xFFFFFFFEu;
 
@@ -178,35 +170,31 @@
 //----- (00488E23) --------------------------------------------------------
 double OutdoorLocation::GetFogDensityByTime()
 {
-  int v1; // eax@3
-  double v2; // st7@3
-
-  if ( pParty->uCurrentHour < 5 )
-    goto LABEL_9;
-  if ( pParty->uCurrentHour >= 6 )
+  if ( pParty->uCurrentHour < 5 )//íî÷ü
+  {
+    pWeather->bNight = true;
+    return 60.0 * 0.016666668;
+  }
+  else if ( pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 6 )//ðàññâåò
+  {
+    pWeather->bNight = false;
+    return (60.0 - (double)(60 * pParty->uCurrentHour + pParty->uCurrentMinute - 300)) * 0.016666668;
+  }
+  else if ( pParty->uCurrentHour >= 6 && pParty->uCurrentHour < 20 )//äåíü
   {
-    if ( pParty->uCurrentHour < 0x14 )
-    {
-      pWeather->bNight = 0;
-      v2 = 0.0;
-      return v2 * 0.016666668;
-    }
-    if ( pParty->uCurrentHour < 0x15 )
-    {
-      v1 = 0;
-      v2 = (double)(pParty->uCurrentHour - 20) * 60.0 + (double)(signed int)pParty->uCurrentMinute;
-      goto LABEL_4;
-    }
-LABEL_9:
-    v2 = 60.0;
-    pWeather->bNight = 1;
-    return v2 * 0.016666668;
+    pWeather->bNight = false;
+     return 0.0;
   }
-  v1 = 0;
-  v2 = 60.0 - (double)(60 * pParty->uCurrentHour + pParty->uCurrentMinute - 300);
-LABEL_4:
-  pWeather->bNight = v1;
-  return v2 * 0.016666668;
+  else if ( pParty->uCurrentHour >= 20 && pParty->uCurrentHour < 21 )//ñóìåðêè
+  {
+    pWeather->bNight = false;
+    return ((double)(pParty->uCurrentHour - 20) * 60.0 + (double)(signed int)pParty->uCurrentMinute) * 0.016666668;
+  }
+  else//íî÷ü
+  {
+    pWeather->bNight = true;
+    return 60.0 * 0.016666668;
+  }
 }
 
 //----- (00488EB1) --------------------------------------------------------
@@ -573,49 +561,34 @@
 //----- (004893CF) --------------------------------------------------------
 int OutdoorLocation::GetNumFoodRequiredToRestInCurrentPos(int x, signed int y, int z)
 {
-  OutdoorLocation *v4; // ebx@1
-  signed int v5; // edi@4
-  int v6; // eax@4
   int v7; // eax@4
-  int v8; // eax@4
-  int v9; // eax@5
-  int v10; // eax@6
-  int v11; // eax@7
-  int v12; // eax@8
-  int v15; // [sp+8h] [bp-8h]@2
-  int v16; // [sp+Ch] [bp-4h]@2
-
-  v4 = this;
-  if ( pParty->uFlags & 8
-    || (v15 = 0,
-        v16 = 0,
-        ODM_GetFloorLevel(x, y, z, pParty->uDefaultPartyHeight, &v15, &v16, 0),
-        v16)
-    || v15 )
+  int is_on_water; // [sp+8h] [bp-8h]@2
+  int bmodel_standing_on_pid; // [sp+Ch] [bp-4h]@2
+
+  is_on_water = 0;
+  bmodel_standing_on_pid = 0;
+  ODM_GetFloorLevel(x, y, z, pParty->uDefaultPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
+  if ( pParty->uFlags & 8 || bmodel_standing_on_pid || is_on_water )//íà bmodel,è èëè íà âîäå
     return 2;
-  v5 = WorldPosToGridCellX(pParty->vPosition.x);
-  v6 = WorldPosToGridCellZ(pParty->vPosition.y);
-  v7 = _47ED83(v5, v6 - 1);
-  v8 = pTileTable->pTiles[GetTileIdByTileMapId(v7)].tileset;
-  if ( v8 )
+  v7 = _47ED83(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1);
+  switch ( pTileTable->pTiles[GetTileIdByTileMapId(v7)].tileset )
   {
-    v9 = v8 - 1;
-    if ( !v9 )
+    case Tileset_Grass://íà òðàâå
+      return 1;
+    case Tileset_Snow://íà ñíåãó
       return 3;
-    v10 = v9 - 1;
-    if ( !v10 )
+    case Tilset_Desert://íà ïåñêå
       return 5;
-    v11 = v10 - 1;
-    if ( !v11 || (v12 = v11 - 3) == 0 )
+    case Tileset_3:
+    case Tileset_Dirt:// íà ãðÿçè
       return 4;
-    if ( v12 == 1 )
-      return 3;
-    return 2;
+    case Tileset_Water:// on water(íà âîäå)
+      return 3;//åäåíèöû åäû
+    default:
+      return 2;
   }
-  return 1;
 }
 
-
 //----- (00489487) --------------------------------------------------------
 void OutdoorLocation::SetFog()
 {
@@ -769,7 +742,6 @@
   return result;
 }
 
-
 //----- (0047C7A9) --------------------------------------------------------
 void OutdoorLocationTerrain::_47C7A9()
 {
@@ -1083,20 +1055,17 @@
 //----- (0047CCE2) --------------------------------------------------------
 bool OutdoorLocationTerrain::ZeroLandscape()
 {
-  OutdoorLocationTerrain *v1; // esi@1
-
-  v1 = this;
   memset(this->pHeightmap, 0, 0x4000u);
-  memset(v1->pTilemap, 90, 0x4000u);
-  memset(v1->pAttributemap, 0, 0x4000u);
-  memset(v1->pDmap, 0, 0x8000u);
-  v1->field_12 = 128;
-  v1->field_10 = 128;
-  v1->field_16 = 7;
-  v1->field_14 = 7;
-  v1->field_1C = 127;
-  v1->field_18 = 127;
-  return 1;
+  memset(this->pTilemap, 90, 0x4000u);
+  memset(this->pAttributemap, 0, 0x4000u);
+  memset(this->pDmap, 0, 0x8000u);
+  this->field_12 = 128;
+  this->field_10 = 128;
+  this->field_16 = 7;
+  this->field_14 = 7;
+  this->field_1C = 127;
+  this->field_18 = 127;
+  return true;
 }
 
 //----- (0047CD44) --------------------------------------------------------
@@ -1172,19 +1141,9 @@
     Error("Invalid Ground Tex Handle");
 }
 
-
-
 //----- (0047CF9C) --------------------------------------------------------
 void OutdoorLocation::Release()
 {
-  //OutdoorLocation *v1; // esi@1
-  //signed int v2; // edi@1
-  //int v3; // ebx@2
-  //void *v4; // ST24_4@4
-  //char *v5; // ebx@4
-  //void **v6; // esi@4
-
-  //v1 = this;
   strcpy(pLevelFilename, "blank");
   strcpy(pLocationFileName, "default.odm");
   strcpy(pLocationFileDescription, "MM6 Outdoor v1.00");
@@ -1926,9 +1885,9 @@
       if (pBModels[i].pFaces[j].sCogTriggeredID)
       {
         if (pBModels[i].pFaces[j].HasEventHint())
-          pBModels[i].pFaces[j].uAttributes |= 0x100000;
+          pBModels[i].pFaces[j].uAttributes |= FACE_UNKNOW;
         else
-          pBModels[i].pFaces[j].uAttributes &= ~0x100000;
+          pBModels[i].pFaces[j].uAttributes &= ~FACE_UNKNOW;
       }
       //++v144;
       //v60 = pBModels;
@@ -2039,7 +1998,7 @@
   strcpy(Str + strlen(Str) - 4, ".ddm");
   //strcpy((char *)v141 + v73, (const char *)v108);
   v39 = pNew_LOD->FindContainer(Str, 1);//error
-  fread(&header, 0x10u, 1u, v39);
+  fread(&header, 0x10u, 1, v39);
   Str2 = 0;
   if (header.uVersion != 91969 ||
       header.pMagic[0] != 'm' ||
@@ -2079,8 +2038,6 @@
     pSrc += sizeof(DDM_DLV_Header);
     //v74 = (int)((char *)v75 + 40);
   }
-  //v76 = uNumBModels;
-  //v77 = actualNumFacesInLevel = 0;
   uint actualNumFacesInLevel = 0;
   for (uint i = 0; i < uNumBModels; ++i)
     actualNumFacesInLevel += pBModels[i].uNumFaces;
@@ -2166,89 +2123,40 @@
     memcpy(uDicovered_area, Src, 0x3C8u);
   }
 
-  //v25 = uNumBModels == 0;
-  //v26 = (uNumBModels & 0x80000000u) != 0;
-  //v151 = 0;
   for (uint i = 0; i < uNumBModels; ++i)
   {
     BSPModel model = pBModels[i];
-    //pNumItems = 0;
-    //do
-    //{
-      //v86 = pBModels;
-      //thisa = 0;
-      //v87 = (unsigned int)((char *)v86 + pNumItems);
     for (uint j = 0; j < model.uNumFaces; ++j)
     {
       ODMFace face = model.pFaces[j];
-
-      //if ( *(int *)(v87 + 76) > 0 )
-      //{
-        //File = 0;
-        //do
-        //{
-          //v106 = (char *)&File->uAttributes + *(int *)(v87 + 84);
       memcpy(&face.uAttributes, pSrc, 4);
       pSrc += 4;
-          //v88 = pBModels;
-          //++File;
-          //v85 = (char *)v85 + 4;
-          //++thisa;
-          //v87 = (unsigned int)((char *)v88 + pNumItems);
-        //}
-        //while ( thisa < *(int *)(v87 + 76) );
     }
 
-      //v89 = pBModels;
-      //thisa = 0;
     for (uint j = 0; j < model.uNumFaces; ++j)
     {
       ODMFace face = model.pFaces[j];
-        //pFilename = 0;
-        //do
-        //{
-          //v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)];
-          //File = v90;
       if (face.sCogTriggeredID)
       {
         if (face.HasEventHint())
-          face.uAttributes |= 0x1000u;
+          face.uAttributes |= FACE_UNKNOW3;
         else
           face.uAttributes &= 0xFFFFEFFFu;
       }
-          //++thisa;
-          //v89 = pBModels;
-          //pFilename += 308;
-        //}
-        //while ( thisa < *(signed int *)((char *)&v89->uNumFaces + pNumItems) );
     }
-      //++v151;
-      //pNumItems += 188;
-    //}
-    //while ( v151 < (signed int)uNumBModels );
   }
 
   pGameLoadingUI_ProgressBar->Progress();
 
-  //v151 = 0;
   for (uint i = 0; i < uNumLevelDecorations; ++i)
   {
-    //thisa = (int)&pLevelDecorations[0].field_2;
-    //do
-    //{
     memcpy(&pLevelDecorations[i].uFlags, pSrc, 2);
     pSrc += 2;
-      //thisa += 32;
-      //v85 = (char *)v85 + 2;
-      //++v151;
-    //}
-    //while ( v151 < (signed int)uNumLevelDecorations );
   }
 
   pGameLoadingUI_ProgressBar->Progress();
 
   memcpy(&uNumActors, pSrc, 4);
-  //v91 = (char *)v85 + 4;
   if (uNumActors > 500)
     MessageBoxW(nullptr, L"Can't load file!",
                 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:939", 0);
@@ -2300,19 +2208,12 @@
 
   pTileTable->InitializeTileset(Tileset_Dirt);
   pTileTable->InitializeTileset(Tileset_Snow);
-  //v108 = pTileTypes[0].uTileGroup;
   pTileTable->InitializeTileset(pTileTypes[0].tileset);
-  //v108 = pTileTypes[1].uTileGroup;
   pTileTable->InitializeTileset(pTileTypes[1].tileset);
-  //v108 = pTileTypes[2].uTileGroup;
   pTileTable->InitializeTileset(pTileTypes[2].tileset);
-  //v108 = pTileTypes[3].uTileGroup;
   pTileTable->InitializeTileset(pTileTypes[3].tileset);
   strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data());
-  //v97 = pTileTypes[0].uTileID;
-  //v108 = 0;
   TileDesc* v98 = pTileTable->GetTileById(pTileTypes[0].uTileID);
-  //v99 = pBitmaps_LOD->LoadTexture(v98->pTileName, TEXTURE_DEFAULT);
   sMainTile_BitmapID = pBitmaps_LOD->LoadTexture(v98->pTileName, TEXTURE_DEFAULT);
   if (sMainTile_BitmapID != -1)
     pBitmaps_LOD->pTextures[sMainTile_BitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[sMainTile_BitmapID].palette_id1);
@@ -2320,10 +2221,7 @@
   _47F0E2();
 
 LABEL_150:
-  //v100 = HIDWORD(uLastVisitDay);
-  //LODWORD(v142) = LODWORD(uLastVisitDay);
-  //HIDWORD(v142) = v100;
-  if ( pWeather->bRenderSnow ) //Ritor1: it's include
+  if ( pWeather->bRenderSnow ) //Ritor1: it's include for snow
     strcpy(loc_time.sky_texture_name, "sky19");
   else if (loc_time.uLastVisitDay)
   {
@@ -2363,7 +2261,7 @@
         pSoundList->LoadSound(58, 0);
         pSoundList->LoadSound(97, 0);
         break;
-      case Tileset_2:
+      case Tilset_Desert:
         pSoundList->LoadSound(52, 0);
          pSoundList->LoadSound(91, 0);
         break;
@@ -2399,20 +2297,16 @@
     v3 = (a2 - 90) / 36;
     if ( v3 && v3 != 1 && v3 != 2 )
     {
-      if ( v3 == 3 )
+      if ( v3 == Tileset_3 )
         result = this->pTileTypes[3].uTileID;
       else
         result = a2;
     }
     else
-    {
       result = this->pTileTypes[v3].uTileID;
-    }
   }
   else
-  {
     result = 0;
-  }
   return result;
 }
 
@@ -2859,15 +2753,15 @@
   signed __int64 v25; // qtt@45
   int v26; // ST54_4@45
   int v27; // ecx@45
-  RenderBillboard *v28; // esi@45
+  //RenderBillboard *v28; // esi@45
   //__int16 v29; // ax@46
   unsigned __int8 v30; // zf@46
   unsigned __int8 v31; // sf@46
   signed __int16 v32; // ax@49
   signed int v33; // ecx@50
   int v34; // ecx@54
-  MonsterDesc *v35; // edx@54
-  int v36; // ecx@54
+  //MonsterDesc *v35; // edx@54
+  //int v36; // ecx@54
   //unsigned __int8 v37; // zf@54
   //unsigned __int8 v38; // sf@54
   //unsigned int v39; // [sp-8h] [bp-68h]@23
@@ -2976,34 +2870,29 @@
       if (pGame->pIndoorCameraD3D->sRotationX)
       {
         v18 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16;
-        v47 = ((unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16)
-            + ((unsigned __int64)(v18 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16);
-        v50 = (unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16;
-        v53 = (unsigned __int64)(v18 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16;
+        v47 = (fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_sine_y));
+        v50 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_sine_y);
+        v53 = fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_cosine_y);
         v44 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
-        v19 = ((unsigned __int64)(v44 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16)
-            + ((unsigned __int64)(v47 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16);
-        X = ((unsigned __int64)(v44 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16)
-          + ((unsigned __int64)(v47 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16);
+        v19 = (fixpoint_mul(v44, pGame->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pGame->pIndoorCameraD3D->int_cosine_x));
+        X = fixpoint_mul(v44, pGame->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pGame->pIndoorCameraD3D->int_cosine_x);
         if ( v19 < 262144 || v19 > pODMRenderParams->shading_dist_mist << 16 )
           continue;
         v20 = v53 - v50;
         v42 = v53 - v50;
-        v21 = ((unsigned __int64)(v44 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16)
-            - ((unsigned __int64)(v47 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16);
+        v21 = (fixpoint_mul(v44, pGame->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v47, pGame->pIndoorCameraD3D->int_sine_x));
       }
       else
       {
         v48 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16;
-        v51 = (unsigned __int64)(v17 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16;
-        v22 = (unsigned __int64)(v48 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16;
+        v51 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y);
+        v22 = fixpoint_mul(v48, pGame->pIndoorCameraD3D->int_sine_y);
         X = v22 + v51;
         if ( v22 + v51 < 262144 || v22 + v51 > pODMRenderParams->shading_dist_mist << 16 )
           continue;
-        v23 = (unsigned __int64)(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16)
-                               * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16;
-        v20 = ((unsigned __int64)(v48 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v23;
-        v42 = ((unsigned __int64)(v48 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v23;
+        v23 = fixpoint_mul(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16), pGame->pIndoorCameraD3D->int_sine_y);
+        v20 = fixpoint_mul(v48, pGame->pIndoorCameraD3D->int_cosine_y) - v23;
+        v42 = fixpoint_mul(v48, pGame->pIndoorCameraD3D->int_cosine_y) - v23;
         v21 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
       }
       v45 = v21;
@@ -3017,64 +2906,56 @@
         LODWORD(v25) = 0;
         HIDWORD(v25) = SLOWORD(pODMRenderParams->int_fov_rad);
         v57 = v25 / X;
-        v27 = pViewport->uScreenCenterX
-            - ((signed int)(((unsigned __int64)(v26 * (signed __int64)v42) >> 16) + 32768) >> 16);
-        v43 = pViewport->uScreenCenterX
-            - ((signed int)(((unsigned __int64)(v26 * (signed __int64)v42) >> 16) + 32768) >> 16);
-        v46 = pViewport->uScreenCenterY - ((signed int)(((unsigned __int64)(v25 / X * v45) >> 16) + 32768) >> 16);
+        v27 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v26, v42) + 32768) >> 16);
+        v43 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v26, v42) + 32768) >> 16);
+        v46 = pViewport->uScreenCenterY - ((signed int)(fixpoint_mul(v25 / X, v45) + 32768) >> 16);
         result = uNumBillboardsToDraw;
-        v28 = &pBillboardRenderList[uNumBillboardsToDraw];
+        //v28 = &pBillboardRenderList[uNumBillboardsToDraw];
         if (uNumBillboardsToDraw >= 500)
           return;
         ++uNumBillboardsToDraw;
         ++uNumSpritesDrawnThisFrame;
-        pActors[i].uAttributes |= 8u;
-        v28->uHwSpriteID = v15->pHwSpriteIDs[v41];
-        v28->uIndoorSectorID = 0;
-        v28->uPalette = v15->uPaletteIndex;
-        v28->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v15->scale * (signed __int64)v58) >> 16;
-        v30 = HIDWORD(pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) == 0;
-        v31 = SHIDWORD(pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) < 0;
-        v28->_screenspace_y_scaler_packedfloat = (unsigned __int64)(v15->scale * (signed __int64)v57) >> 16;
-        if ( v31 || v31 | v30 && LODWORD(pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) <= 0u )
+        pActors[i].uAttributes |= 8;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uHwSpriteID = v15->pHwSpriteIDs[v41];
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = 0;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v15->uPaletteIndex;
+        pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v15->scale, v58);
+        pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = fixpoint_mul(v15->scale, v57);
+        if ( pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <= 0 )
         {
-          if ( (signed __int64)pActors[i].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime > 0i64 )
+          if ( pActors[i].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime > 0 )
           {
-            v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F(&pActors[i])
-                                   * (signed __int64)v28->_screenspace_y_scaler_packedfloat) >> 16;
-LABEL_53:
+            pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = fixpoint_mul(pGame->pStru6Instance->_4A806F(&pActors[i]),
+                   pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat);
             LOWORD(v27) = v43;
-            v28->_screenspace_y_scaler_packedfloat = v52;
           }
         }
         else
         {
-          v32 = pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
-          if ( v32 )
+          if ( pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower )
           {
-            v33 = pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
-            v28->_screenspace_x_scaler_packedfloat = (unsigned __int64)(65536 / (unsigned __int16)v32 * (signed __int64)v28->_screenspace_x_scaler_packedfloat) >> 16;
-            v52 = (unsigned __int64)(65536 / v33 * (signed __int64)v28->_screenspace_y_scaler_packedfloat) >> 16;
-            goto LABEL_53;
+            pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = fixpoint_mul(65536 / pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower,
+                     pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat);
+            LOWORD(v27) = v43;
           }
         }
-        v28->uScreenSpaceX = v27;
-        v28->uScreenSpaceY = v46;
-        v28->world_x = x;
-        v28->world_y = y;
-        v28->world_z = z;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceX = v27;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceY = v46;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].world_x = x;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].world_y = y;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].world_z = z;
         HIWORD(v34) = HIWORD(X);
         LOWORD(v34) = 0;
-        v28->dimming_level = 0;
-        v28->sZValue = v34 + PID(OBJECT_Actor, i);
-        v28->field_14_actor_id = i;
-        v35 = pMonsterList->pMonsters;
-		v36 = pActors[i].pMonsterInfo.uID;
-        v28->field_1E = v62 | 0x200;
-        v28->pSpriteFrame = v15;
-        v28->sTintColor = pMonsterList->pMonsters[pActors[i].pMonsterInfo.uID-1].sTintColor;//*((int *)&v35[v36] - 36);
+        pBillboardRenderList[uNumBillboardsToDraw - 1].dimming_level = 0;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].sZValue = v34 + PID(OBJECT_Actor, i);
+        pBillboardRenderList[uNumBillboardsToDraw - 1].field_14_actor_id = i;
+        //v35 = pMonsterList->pMonsters;
+        //v36 = pActors[i].pMonsterInfo.uID;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].field_1E = v62 | 0x200;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].pSpriteFrame = v15;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].sTintColor = pMonsterList->pMonsters[pActors[i].pMonsterInfo.uID - 1].sTintColor;//*((int *)&v35[v36] - 36);
         if (pActors[i].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime)
-          v28->field_1E = v62 | 0x200;
+          pBillboardRenderList[uNumBillboardsToDraw - 1].field_1E = v62 | 0x200;
       }
 //LABEL_58:
       //++v59;
@@ -4430,8 +4311,7 @@
     {
       if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) >= 16 )
       {
-        if ( !is_not_on_bmodel
-           && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) )
+        if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() )
           pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);//áåã íà 3D Modelè
         else
         {
@@ -4445,14 +4325,13 @@
     {
       if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) >= 8 )
       {
-        if ( is_not_on_bmodel
-          || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 )
+        if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() )
+          pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);// õîæäåíèå íà 3D Modelè
+        else
         {
           v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0);
           pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);// õîæäåíèå ïî çåìëå
         }
-        else
-          pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);// õîæäåíèå íà 3D Modelè
         pParty->walk_sound_timer = 144;//òàéìåð äëÿ õîäüáû
       }
     }
@@ -4675,7 +4554,7 @@
       {
         if ( (pOutdoor->pBModels[i].pFaces[j].uPolygonType == POLYGON_Ceiling
            || pOutdoor->pBModels[i].pFaces[j].uPolygonType == POLYGON_InBetweenCeilingAndWall)
-           && !(BYTE3(pOutdoor->pBModels[i].pFaces[j].uAttributes) & 0x20)
+           && !pOutdoor->pBModels[i].pFaces[j].Ethereal()
            && Party_X <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x2 && Party_X >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x1
            && Party_Y <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y2 && Party_Y >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y1 )
         {
--- a/Render.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/Render.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -4323,18 +4323,8 @@
 //----- (004A1B22) --------------------------------------------------------
 unsigned int Render::Billboard_ProbablyAddToListAndSortByZOrder(float z)
 {
-  //unsigned int v2; // ebx@1
-  //double v4; // st7@5
-  //unsigned int v5; // esi@5
-  //int v6; // ecx@5
   unsigned int v7; // edx@6
-  char *v8; // ecx@12
-  void *v9; // edi@16
-  unsigned int v10; // eax@16
-  void *v11; // edi@21
-  unsigned int v12; // eax@21
-
-  //v2 = uNumBillboardsToDraw;
+
   if (uNumBillboardsToDraw >= 999 )
     return 0;
   if (!uNumBillboardsToDraw)
@@ -4343,9 +4333,6 @@
     return 0;
   }
 
-  //v4 = *(float *)&a1;
-  //v5 = pRenderer->uNumBillboardsToDraw;
-  //v6 = 0;
   for (int left = 0, right = uNumBillboardsToDraw; left < right; ) // binsearch
   {
     v7 = left + (right - left) / 2;
@@ -4355,48 +4342,37 @@
       left = v7 + 1;
   }
 
-  v8 = (char *)&pRenderer->pBillboardRenderListD3D[v7].z_order;
-  if (z > *(float *)v8 )
+  if (z > pRenderer->pBillboardRenderListD3D[v7].z_order )
   {
     if ( v7 == pRenderer->uNumBillboardsToDraw - 1 )
-    {
       v7 = pRenderer->uNumBillboardsToDraw;
-    }
     else
     {
       if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 )
       {
-        v9 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw];
-        v10 = pRenderer->uNumBillboardsToDraw - v7;
-        do
+        for ( uint i = 0; i < pRenderer->uNumBillboardsToDraw - v7; i++ )
         {
-          memcpy(v9, (char *)v9 - 156, 0x9Cu);
-          v9 = (char *)v9 - 156;
-          --v10;
+          memcpy(&pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - i],
+                 &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - (i + 1)],
+           sizeof(pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - i]));
         }
-        while ( v10 );
       }
       ++v7;
     }
-//LABEL_23:
     uNumBillboardsToDraw++;
     return v7;
   }
-  if (z <= *(float *)v8 )
+  if (z <= pRenderer->pBillboardRenderListD3D[v7].z_order )
   {
     if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 )
     {
-      v11 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw];
-      v12 = pRenderer->uNumBillboardsToDraw - v7;
-      do
-      {
-        memcpy(v11, (char *)v11 - 156, 0x9Cu);
-        v11 = (char *)v11 - 156;
-        --v12;
-      }
-      while ( v12 );
-    }
-    //goto LABEL_23;
+      for ( uint i = 0; i < pRenderer->uNumBillboardsToDraw - v7; i++ )
+      {
+        memcpy(&pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - i],
+               &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw -(i + 1)],
+        sizeof(pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - i]));
+      }
+    }
     uNumBillboardsToDraw++;
     return v7;
   }
@@ -8587,7 +8563,6 @@
   {
     if (pBillboardRenderListD3D[i].opacity != RenderBillboardD3D::NoBlend)
       SetBillboardBlendOptions(pBillboardRenderListD3D[i].opacity);
-    
 
     pRenderD3D->pDevice->SetTexture(0, pBillboardRenderListD3D[i].pTexture);
     ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
@@ -8817,14 +8792,14 @@
               array_77EC08[pODMRenderParams->uNumPolygons].flags |= 2;
             if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_INDOOR_SKY )
               HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4;
-            if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & 4 )
+            if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_UNKNOW8 )
               HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4;
             else
             {
-              if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & 0x20 )
+              if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_UNKNOW9 )
                 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 8;
             }
-            if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & 0x0800)
+            if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_UNKNOW10)
               array_77EC08[pODMRenderParams->uNumPolygons].flags |= 0x2000;
             else
             {
--- a/SpriteObject.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/SpriteObject.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -717,7 +717,7 @@
             v22 = fixpoint_mul(32000, v39);
           }
           pSpriteObject->vVelocity.z += v22;
-          if ( BYTE3(pIndoor->pFaces[v15].uAttributes) & 0x10 )
+          if ( pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2 )
             EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
           pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
           pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
@@ -730,7 +730,7 @@
           pSpriteObject->vVelocity.z = v17;
           if ( (signed __int16)v17 < 10 )
             pSpriteObject->vVelocity.z = 0;
-          if ( BYTE3(pIndoor->pFaces[v15].uAttributes) & 0x10 )
+          if ( pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2 )
             EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
           pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
           pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
@@ -740,7 +740,7 @@
         pSpriteObject->vVelocity.z = 0;
         if ( pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y >= 400 )
         {
-          if ( BYTE3(pIndoor->pFaces[v15].uAttributes) & 0x10 )
+          if ( pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2 )
             EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
           pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
           pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
--- a/TileFrameTable.h	Thu Jan 16 17:34:48 2014 +0600
+++ b/TileFrameTable.h	Fri Jan 17 17:58:48 2014 +0600
@@ -26,7 +26,7 @@
 {
   Tileset_Grass = 0,
   Tileset_Snow = 1,
-  Tileset_2 = 2,
+  Tilset_Desert = 2,
   Tileset_3 = 3,
   Tileset_Dirt = 4,
   Tileset_Water = 5,
--- a/UI/Books/UIMapBook.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/UI/Books/UIMapBook.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -416,16 +416,16 @@
         {
           if ( !(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) )
           {
-            if ( !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & 0x80)
-                && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & 0x80) ))
+            if ( !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4)
+                && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) ))
             {
               pIndoor->pMapOutlines->pOutlines[i].uFlags = pIndoor->pMapOutlines->pOutlines[i].uFlags | 1;
               pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8);
             }
           }
           if ( (!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) 
-            && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & 0x80)
-            && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & 0x80) ))
+            && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4)
+            && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) ))
             || pIndoor->pMapOutlines->pOutlines[i].uFlags & 1)
           {
             v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX);
@@ -687,7 +687,7 @@
           {
             if ( pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID )
             {
-              if ( !(pOutdoor->pBModels[i].pFaces[j].uAttributes & 0x100000) )
+              if ( !(pOutdoor->pBModels[i].pFaces[j].uAttributes & FACE_UNKNOW) )
               {
                 if ( GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID) )
                 {
--- a/UI/UiGame.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/UI/UiGame.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -1985,10 +1985,10 @@
         long long _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x);
         uint _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16);
         int _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16);
-        pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
-        pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
-        pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
-        pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
+        pX = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x) << 16) - uZoom, pParty->vPosition.x);
+        pY = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y) << 16) - uZoom, pParty->vPosition.y);
+        pZ = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x) << 16) - uZoom, pParty->vPosition.x);
+        pW = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y) << 16) - uZoom, pParty->vPosition.y);
         v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8;
         if ( v15 > 100 )
           v15 = 100;
@@ -2001,10 +2001,10 @@
     for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i)
     {
       BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]];
-      pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
-      pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
-      pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
-      pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
+      pX = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].x) << 16) - uZoom, pParty->vPosition.x);
+      pY = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].y) << 16) - uZoom, pParty->vPosition.y);
+      pZ = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].x) << 16) - uZoom, pParty->vPosition.x);
+      pW = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].y) << 16) - uZoom, pParty->vPosition.y);
       pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color);
     }
   }
@@ -2040,8 +2040,8 @@
         if ( !pSpriteObjects[i].uType || !pSpriteObjects[i].uObjectDescID )
           continue;
         //if (uWizardEyeSkillLevel == 1
-        pPoint_X = uCenterX + ((unsigned __int64)((pSpriteObjects[i].vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16);
-        pPoint_Y = uCenterY - ((signed __int64)((pSpriteObjects[i].vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16);
+        pPoint_X = uCenterX + fixpoint_mul((pSpriteObjects[i].vPosition.x - pParty->vPosition.x), uZoom);
+        pPoint_Y = uCenterY - fixpoint_mul((pSpriteObjects[i].vPosition.y - pParty->vPosition.y), uZoom);
         //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z &&
         //     pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w)
         {
@@ -2068,15 +2068,15 @@
     for ( uint i = 0; i < uNumActors; ++i )//draw actors(îòðèñîâêà ìîíñòðîâ è íïñ)
     {
       if ( pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled
-       && (pActors[i].uAIState == Dead || BYTE1(pActors[i].uAttributes) & 0x80) )
+       && (pActors[i].uAIState == Dead || pActors[i].uAttributes & 0x8000) )
       {
-        pPoint_X = uCenterX + ((unsigned __int64)(( pActors[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16);
-        pPoint_Y = uCenterY - ((unsigned __int64)(( pActors[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16);
+        pPoint_X = uCenterX + (fixpoint_mul((pActors[i].vPosition.x - pParty->vPosition.x), uZoom));
+        pPoint_Y = uCenterY - (fixpoint_mul((pActors[i].vPosition.y - pParty->vPosition.y), uZoom));
         //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z
         //  && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w )
         {
           pColor = ui_game_minimap_actor_friendly_color;
-          if ( BYTE3(pActors[i].uAttributes) & 1 )
+          if ( pActors[i].uAttributes & 0x1000000 )
             pColor = ui_game_minimap_actor_hostile_color;
           if ( pActors[i].uAIState == Dead)
             pColor = ui_game_minimap_actor_corpse_color;
@@ -2100,8 +2100,8 @@
     {
       if ( pLevelDecorations[i].uFlags & 8 )
       {
-        pPoint_X = uCenterX + ((unsigned __int64)((pLevelDecorations[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16);
-        pPoint_Y = uCenterY - ((unsigned __int64)((pLevelDecorations[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16);
+        pPoint_X = uCenterX + (fixpoint_mul((pLevelDecorations[i].vPosition.x - pParty->vPosition.x), uZoom));
+        pPoint_Y = uCenterY - (fixpoint_mul((pLevelDecorations[i].vPosition.y - pParty->vPosition.y), uZoom));
         //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z
         //  && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w )
         {
--- a/Viewport.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/Viewport.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -406,7 +406,7 @@
     }
     if ( GetAsyncKeyState(VK_SHIFT) >= 0 )
     {
-      if ( !pActors[v16].GetActorsRelation(0) && !(BYTE2(pActors[v16].uAttributes) & 8) )
+      if ( !pActors[v16].GetActorsRelation(0) && !(pActors[v16].uAttributes & 0x80000) )
       {
         if ( HIWORD(v0) >= clickable_distance)
         {
@@ -558,7 +558,7 @@
   {
     if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
     {
-      if ( !(pIndoor->pFaces[PID_ID(v0)].uAttributes & 0x2000000) )
+      if ( !pIndoor->pFaces[PID_ID(v0)].Clickable() )
       {
         if ( !pParty->pPickedItem.uItemID )
         {
--- a/mm7_2.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/mm7_2.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -4791,7 +4791,7 @@
   if ( PID_TYPE(a2) == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player)
       {
       if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500)  //bugfix  PID_ID(v2->spell_caster_pid)==1000
-         BYTE2(pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes) |= 4;
+         pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes |= 0x40000;
       }
 
   //v6 = v2->uType;
@@ -4936,7 +4936,7 @@
             if ( v152 >= 3 )
               v150 = 4;
           }
-          BYTE2(pActors[v139].uAttributes) |= 8u;
+          pActors[v139].uAttributes |= 0x80000;
         }
         if ( pSpriteObjects[uLayingItemID].uType == 6040 )
         {
--- a/mm7_3.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/mm7_3.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -4087,7 +4087,7 @@
           {
             if ( pIndoor->pFaceExtras[i].sCogNumber == uFaceCog )
             {
-              if ( BYTE1(pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes) & 0x40 )
+              if ( pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes & FACE_TEXTURE_FRAME )
               {
                 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = pTextureFrameTable->FindTextureByName(pFilename);
                 if ( pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID)
@@ -4097,7 +4097,7 @@
                 else
                 {
                   pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = texture;
-                  BYTE1(pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes) &= 0xBFu;
+                  pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes &= 0xBF00;
                 }
               }
               else
@@ -4117,7 +4117,7 @@
           {
             if ( pOutdoor->pBModels[j].pFaces[i].sCogNumber == uFaceCog )
             {
-              if ( BYTE1(pOutdoor->pBModels[j].pFaces[i].uAttributes) & 0x40 )
+              if ( pOutdoor->pBModels[j].pFaces[i].uAttributes & FACE_TEXTURE_FRAME )
               {
                 pOutdoor->pBModels[j].pFaces[i].uTextureID = pTextureFrameTable->FindTextureByName(pFilename);
                 if ( pOutdoor->pBModels[j].pFaces[i].uTextureID )
@@ -4125,7 +4125,7 @@
                 else
                 {
                   pOutdoor->pBModels[j].pFaces[i].uTextureID = texture;
-                  BYTE1(pOutdoor->pBModels[j].pFaces[i].uAttributes) &= 0xBFu;
+                  pOutdoor->pBModels[j].pFaces[i].uAttributes &= 0xBF00;
                 }
               }
               else
--- a/mm7_5.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/mm7_5.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -328,7 +328,7 @@
     {
       pActors[actor_id].uLastCharacterIDToHit = v17;
       if ( pActors[actor_id].uAIState == Fleeing )
-        BYTE2(pActors[actor_id].uAttributes) |= 2;
+        pActors[actor_id].uAttributes |= FACE_UNKNOW7;
       if ( pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0) )
       {
         v10 = (unsigned int)pActors[PID_ID(v17)]._43B3E0_CalcDamage(a4);