diff Outdoor.cpp @ 2166:00bd098f6435

fixpoint_mul in different functions and others
author Ritor1
date Fri, 17 Jan 2014 17:58:48 +0600
parents 47ac9e87690c
children 7cd99cb12911
line wrap: on
line diff
--- 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 )
         {