diff Engine/Graphics/Outdoor.cpp @ 2534:1bcadc6dd203

enum SOUND_
author Ritor1
date Mon, 09 Feb 2015 19:17:12 +0600
parents 491f0babd563
children a902abdfc7f2
line wrap: on
line diff
--- a/Engine/Graphics/Outdoor.cpp	Mon Jan 19 23:10:30 2015 +0600
+++ b/Engine/Graphics/Outdoor.cpp	Mon Feb 09 19:17:12 2015 +0600
@@ -520,7 +520,7 @@
       return 3;
     case Tilset_Desert://на песке
       return 5;
-    case Tileset_3:
+    case Tileset_CooledLava:
     case Tileset_Dirt:// на грязи
       return 4;
     case Tileset_Water:// on water(на воде)
@@ -962,10 +962,10 @@
 //----- (0047CD44) --------------------------------------------------------
 bool OutdoorLocationTerrain::Initialize()
 {
-  pHeightmap = (unsigned __int8 *)malloc(0x4000u);//height map
-  pTilemap = (unsigned __int8 *)malloc(0x4000u);//tile map
-  pAttributemap = (unsigned __int8 *)malloc(0x4000u);//карта атрибутов
-  pDmap = (struct DMap *)malloc(0x8000u);
+  pHeightmap = (unsigned __int8 *)malloc(0x4000);//height map
+  pTilemap = (unsigned __int8 *)malloc(0x4000);//tile map
+  pAttributemap = (unsigned __int8 *)malloc(0x4000);//карта атрибутов
+  pDmap = (struct DMap *)malloc(0x8000);
   if (pHeightmap && pTilemap && pAttributemap && pDmap )
     return true;
   else
@@ -991,7 +991,7 @@
   this->uNumBModels = 0;
   this->pTileTypes[0].tileset = Tileset_Grass;
   this->pTileTypes[1].tileset = Tileset_Water;
-  this->pTileTypes[2].tileset = Tileset_6;
+  this->pTileTypes[2].tileset = Tileset_Badlands;
   this->pTileTypes[3].tileset = Tileset_RoadGrassCobble;
   this->LoadTileGroupIds();
   this->LoadRoadTileset();
@@ -1070,154 +1070,14 @@
 //----- (0047D0A6) --------------------------------------------------------
 bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int *thisa)//загрузка локации
 {
-  //OutdoorLocation *pOutdoorLocation; // esi@1
-  /*bool result; // eax@9
-  bool v7; // ebx@9
-  size_t v8; // eax@10
-  void *v9; // eax@10
-  void *v10; // eax@10
-  void *v11; // eax@10
-  int v12; // ebx@11
-  BSPModel *v13; // eax@12
-  void *v14; // eax@12
-  BSPModel *v15; // ecx@12
-  void *v16; // eax@12
-  BSPModel *v17; // ecx@12
-  BSPModel *v18; // eax@12
-  __int16 v19; // ax@15
-  __int16 v20; // ax@16
-  int v21; // ecx@16
-  ODMFace *v22; // ebx@26
-  SpriteObject *pItems; // ecx@27
-  unsigned int v24; // eax@28
-  //unsigned __int8 v25; // zf@28
-  //unsigned __int8 v26; // sf@28
-  ODMFace *v27; // eax@28
-  const char *i; // edx@29
-  unsigned __int16 v29; // ax@33
-  unsigned __int16 v30; // ax@37
-  int v31; // ecx@37
-  int v32; // eax@38
-  void *v33; // eax@38
-  TileDesc *v34; // eax@43
-  unsigned int v35; // eax@43
-  unsigned int v36; // edi@43
-  unsigned int v37; // edi@45*/
-  //size_t v38; // eax@50
-  FILE *v39; // eax@50
-  //unsigned int v40; // edi@56
-  //void *v41; // eax@56
-  //void *v42; // ebx@56
-  //const void *v43; // ebx@59
-  //const void *v44; // ebx@59
-  //unsigned int v45; // eax@59
-  //BSPModel *v46; // eax@59
-  //unsigned int v47; // ecx@59
-  //int v48; // ebx@60
-  //BSPModel *v49; // eax@61
-  //BSPModel *v50; // eax@61
-  //BSPModel *v51; // eax@61
-  //BSPModel *v52; // eax@61
-  //BSPModel *v53; // eax@61
-  //BSPModel *v54; // ecx@61
-  //BSPModel *v55; // ecx@61
-  //BSPModel *v56; // ecx@61
-  //void *v57; // ST24_4@61
-  //BSPModel *v58; // ecx@61
-  //void *v59; // ST18_4@61
-  //BSPModel *v60; // eax@61
-  //__int16 v61; // ax@64
+  FILE *pFile; // eax@50
   unsigned __int16 v62; // ax@65
-  //ODMFace *v63; // ecx@65
-  //unsigned __int16 v64; // ax@80
-  //const char *v65; // ecx@80
-  //int v66; // eax@81
-  //void *v67; // eax@81
-  //int v68; // ecx@81
-  //void *v69; // eax@81
-  //unsigned int v70; // eax@81
-  //SpawnPointMM7 *v71; // eax@81
-  //unsigned int v72; // ecx@81
-  //size_t v73; // eax@81
-  //int v74; // edi@87
-  //void *v75; // edi@88
-  //unsigned int v76; // edx@94
-  //int v77; // ecx@94
-  //char *v78; // eax@95
-  //unsigned int v79; // edx@97
-  //unsigned int v80; // eax@99
-  //int v81; // eax@107
-  //void *v82; // edi@114
-  //size_t v83; // eax@120
-  //const void *v84; // edi@120
-  //const void *v85; // edi@120
-  //BSPModel *v86; // eax@124
-  //unsigned int v87; // eax@124
-  //BSPModel *v88; // eax@126
-  //BSPModel *v89; // eax@127
-  //ODMFace *v90; // eax@129
-  //const void *v91; // edi@138
-  //const void *v92; // edi@141
-  //const void *v93; // edi@141
-  //const void *v94; // edi@144
-  //const void *v95; // edi@144
-  //const char *v96; // edi@147
-  //unsigned int v97; // eax@147
-  //TileDesc *v98; // eax@147
-  //unsigned int v99; // eax@147
-  //int v100; // ecx@150
-  //unsigned int v101; // eax@157
-//  int v102; // edi@159
-  //void *v103; // [sp-14h] [bp-B94h]@55
-  //void *v104; // [sp-10h] [bp-B90h]@59
-  //size_t v105; // [sp-Ch] [bp-B8Ch]@59
-  //char *v106; // [sp-8h] [bp-B88h]@59
-//  int v107; // [sp-4h] [bp-B84h]@12
   int v108; // [sp+0h] [bp-B80h]@10
   char Src[968]; // [sp+10h] [bp-B70h]@110
   char Dst[968]; // [sp+3D8h] [bp-7A8h]@50
   char Str[256]; // [sp+7A0h] [bp-3E0h]@50
-  /*char DstBuf; // [sp+8A0h] [bp-2E0h]@10
-  __int32 Offset; // [sp+8A4h] [bp-2DCh]@10
-  __int32 v114; // [sp+8B0h] [bp-2D0h]@10
-  __int32 v115; // [sp+8BCh] [bp-2C4h]@10
-  __int32 v116; // [sp+8C8h] [bp-2B8h]@10
-  __int32 v117; // [sp+8D4h] [bp-2ACh]@10
-  __int32 v118; // [sp+8E0h] [bp-2A0h]@10
-  __int32 v119; // [sp+8ECh] [bp-294h]@10
-  __int32 v120; // [sp+8F8h] [bp-288h]@10
-  __int32 v121; // [sp+904h] [bp-27Ch]@10
-  __int32 v122; // [sp+910h] [bp-270h]@10
-  __int32 v123; // [sp+91Ch] [bp-264h]@10
-  __int32 v124; // [sp+928h] [bp-258h]@26
-  __int32 v125; // [sp+934h] [bp-24Ch]@35
-  __int32 v126; // [sp+940h] [bp-240h]@38
-  __int32 v127; // [sp+94Ch] [bp-234h]@38
-  __int32 v128; // [sp+958h] [bp-228h]@38
-  __int32 v129; // [sp+964h] [bp-21Ch]@38
-  __int32 v130; // [sp+970h] [bp-210h]@38
-  __int32 v131; // [sp+97Ch] [bp-204h]@38
-  __int32 v132; // [sp+988h] [bp-1F8h]@38
-  __int32 v133; // [sp+994h] [bp-1ECh]@38
-  __int32 v134; // [sp+9A0h] [bp-1E0h]@38
-  __int32 v135; // [sp+9ACh] [bp-1D4h]@38
-  __int32 v136; // [sp+9D0h] [bp-1B0h]@10*/
-  //char FileName[8]; // [sp+A20h] [bp-160h]@8
-  //char v138; // [sp+A28h] [bp-158h]@12
-  //int v139; // [sp+B1Ch] [bp-64h]@10
-  //char pContainer[32]; // [sp+B20h] [bp-60h]@1
-  //int *v141; // [sp+B40h] [bp-40h]@50
-  //__int64 v142; // [sp+B44h] [bp-3Ch]@55
-  //size_t pSource; // [sp+B4Ch] [bp-34h]@56
-  //int v144; // [sp+B50h] [bp-30h]@61
-  //int v145; // [sp+B54h] [bp-2Ch]@68
   ODMHeader header; // [sp+B58h] [bp-28h]@50
-  //unsigned int pDestLen; // [sp+B68h] [bp-18h]@13
-  //FILE *ptr; // [sp+B6Ch] [bp-14h]@12
-  //void *v149; // [sp+B70h] [bp-10h]@19
   char *Str2; // [sp+B74h] [bp-Ch]@12
-  //int v151; // [sp+B78h] [bp-8h]@59
-  //void *uSourceLen; // [sp+B7Ch] [bp-4h]@59
 
   //pOutdoorLocation = this;
   //strcpy(pContainer, pFilename);
@@ -1528,7 +1388,7 @@
   //v141 = &v139;
   //v38 = strlen(pFilename);
   //strcpy((char *)&v139 + v38, ".odm");
-  v39 = pGames_LOD->FindContainer(Str, 1);
+  pFile = pGames_LOD->FindContainer(Str, true);
   //Str[strlen(Str) - 4] = 0;
 
   header.uCompressedSize = 0;
@@ -1539,7 +1399,7 @@
   header.pMagic[1] = 'v';
   header.pMagic[2] = 'i';
   header.pMagic[3] = 'i';
-  fread(&header, 0x10u, 1u, v39);
+  fread(&header, 0x10, 1, pFile);
   if (header.uVersion != 91969 ||
       header.pMagic[0] != 'm' ||
       header.pMagic[1] != 'v' ||
@@ -1559,7 +1419,7 @@
   if (header.uCompressedSize < header.uDecompressedSize)
   {
     char* pComressedSrc = (char *)malloc(header.uCompressedSize);
-    fread(pComressedSrc, header.uCompressedSize, 1, v39);
+    fread(pComressedSrc, header.uCompressedSize, 1, pFile);
 
     uint actualDecompressedSize = header.uDecompressedSize;
     zlib::MemUnzip(pSrc, &actualDecompressedSize, pComressedSrc, header.uCompressedSize);
@@ -1567,7 +1427,7 @@
   }
   else
   {
-    fread(pSrc, header.uDecompressedSize, 1, v39);
+    fread(pSrc, header.uDecompressedSize, 1, pFile);
   }
 
   memcpy(pLevelFilename, pSrc, 0x20);
@@ -1582,43 +1442,38 @@
   LoadTileGroupIds();
   LoadRoadTileset();
   strcpy(pGroundTileset, "grastyl");
-  pGameLoadingUI_ProgressBar->Progress();
+
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
+
+  //*******************Terrain**************************//
   pTerrain.Initialize();
-  //v108 = 16384;
-  //v107 = (int)v43;
-  //v106 = (char *)pTerrain.pHeightmap;
-  memcpy(pTerrain.pHeightmap, pSrc, 0x4000);
+  memcpy(pTerrain.pHeightmap, pSrc, 0x4000);				//карта высот
   pSrc += 0x4000;
 
-  //v43 = (char *)v43 + 16384;
-  //v105 = 16384;
-  //v104 = (void *)v43;
-  //v103 = pTerrain.pTilemap;
-  memcpy(pTerrain.pTilemap, pSrc, 0x4000);
+  memcpy(pTerrain.pTilemap, pSrc, 0x4000);					//карта тайлов
   pSrc += 0x4000;
 
-  //v43 = (char *)v43 + 16384;
-  memcpy(pTerrain.pAttributemap, pSrc, 0x4000);
+  memcpy(pTerrain.pAttributemap, pSrc, 0x4000);				// карта аттрибутов
   pSrc += 0x4000;
 
   //v43 = (char *)v43 + 16384;
   //v108 = (int)ptr_D4;
   free(pCmap);
   pCmap = malloc(0x8000);
-  pTerrain.FillDMap(0, 0, 128, 128);
-
-  pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&uNumTerrainNormals, pSrc, 4);
-  //v43 = (char *)v43 + 4;
+  pTerrain.FillDMap(0, 0, 128, 128);						//
+
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
+
+  memcpy(&uNumTerrainNormals, pSrc, 4);						// количество нормалей
   memcpy(pTerrainSomeOtherData.data(), pSrc + 4, 0x20000);
   pSrc += 4 + 0x20000;
   //v43 = (char *)v43 + 131072;
-  memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000);
+  memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000);		//индексы нормалей
   pSrc += 0x10000;
   //v43 = (char *)v43 + 65536;
 
   //pFilename = (char *)(12 * uNumTerrainNormals);
-  pTerrainNormals = (Vec3_float_ *)malloc(sizeof(Vec3_float_) * uNumTerrainNormals);
+  pTerrainNormals = (Vec3_float_ *)malloc(sizeof(Vec3_float_) * uNumTerrainNormals);//карта нормалей
   memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals);
   pSrc += 12 * uNumTerrainNormals;
   //v44 = (char *)v43 + (int)pFilename;
@@ -1626,19 +1481,19 @@
   //v45 = uNumBModels;
   //v108 = (int)"BDdata";
 
-  pGameLoadingUI_ProgressBar->Progress();
-
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
+  
+  //************BModels************************//
   //v107 = 188 * v45;
   //v106 = (char *)pBModels;
   //v46 = (BSPModel *)malloc(v106, 188 * v45, "BDdata");
   //v47 = uNumBModels;
-  memcpy(&uNumBModels, pSrc, 4);
+  memcpy(&uNumBModels, pSrc, 4);							//количество BModel'ей
   pBModels = (BSPModel *)malloc(188 * uNumBModels);
-  //pFilename = (char *)(188 * v47);
-  memcpy(pBModels, pSrc + 4, 188 * uNumBModels);
+  memcpy(pBModels, pSrc + 4, 188 * uNumBModels);			//BModel'и
   pSrc += 4 + 188 * uNumBModels;
   
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   //uSourceLen = (char *)v44 + (int)pFilename;
   //v151 = 0;
@@ -1787,8 +1642,9 @@
 //        goto LABEL_75;
   }
 //LABEL_75:
-  pGameLoadingUI_ProgressBar->Progress();
-
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
+
+  //******************Decorations**********************//
   memcpy(&uNumLevelDecorations, pSrc, 4);
   //uSourceLen = (char *)uSourceLen + 4;
   if (uNumLevelDecorations > 3000)
@@ -1813,7 +1669,7 @@
     pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(name);
   }
 
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   memcpy(&numFaceIDListElems, pSrc, 4);
 
@@ -1833,7 +1689,7 @@
   pSrc += 4 + faceIDListSize;
 
   //uSourceLen = (char *)uSourceLen + (int)pFilename;
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   //v108 = (int)pOMAP;
   //free((void *)v108);
@@ -1851,7 +1707,7 @@
 
   memcpy(&uNumSpawnPoints, pSrc, 4);
   //uSourceLen = (char *)uSourceLen + 4;
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
   //v70 = uNumSpawnPoints;
   //v108 = (int)"Spawn";
   //v107 = 24 * v70;
@@ -1864,16 +1720,13 @@
   memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize);
   pSrc += 4 + spawnPointsSize;
 
-  pGameLoadingUI_ProgressBar->Progress();
-
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
+
+  //****************.ddm file*********************//
   free(pSrcMem);
-
-  //v108 = (int)".ddm";
-  //v73 = strlen(pContainer);
   strcpy(Str + strlen(Str) - 4, ".ddm");
-  //strcpy((char *)v141 + v73, (const char *)v108);
-  v39 = pNew_LOD->FindContainer(Str, 1);//error
-  fread(&header, 0x10u, 1, v39);
+  pFile = pNew_LOD->FindContainer(Str, 1);
+  fread(&header, 0x10, 1, pFile);
   Str2 = 0;
   if (header.uVersion != 91969 ||
       header.pMagic[0] != 'm' ||
@@ -1894,19 +1747,18 @@
     pSrc = pSrcMem;
     //v149 = v75;
     if (header.uCompressedSize == header.uDecompressedSize)
-      fread(pSrc, header.uDecompressedSize, 1u, v39);
+      fread(pSrc, header.uDecompressedSize, 1, pFile);
     else if (header.uCompressedSize < header.uDecompressedSize)
     {
       void* compressedMem = malloc(header.uCompressedSize);
-      fread(compressedMem, header.uCompressedSize, 1, v39);
+      fread(compressedMem, header.uCompressedSize, 1, pFile);
 
       uint actualDecompressedSize = header.uDecompressedSize;
       zlib::MemUnzip(pSrc, &actualDecompressedSize, compressedMem, header.uCompressedSize);
       free(compressedMem);
     }
     else
-      MessageBoxW(nullptr, L"Can't load file!",
-                  L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0);
+      MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0);
 
     assert(sizeof(DDM_DLV_Header) == 0x28);
     memcpy(&ddm, pSrc, sizeof(DDM_DLV_Header));
@@ -1917,12 +1769,10 @@
   for (uint i = 0; i < uNumBModels; ++i)
     actualNumFacesInLevel += pBModels[i].uNumFaces;
 
-  //v79 = ddm.uNumFacesInBModels;
   if (ddm.uNumFacesInBModels)
   {
     if ( ddm.uNumBModels )
     {
-      //v80 = ddm.uNumDecorations;
       if (ddm.uNumDecorations)
       {
         if (ddm.uNumFacesInBModels != actualNumFacesInLevel ||
@@ -1941,17 +1791,14 @@
 
 	  if (Str2)
 	  {
-		  memset(Dst, 0, 0x3C8u);
-		  memset(Src, 0, 0x3C8u);
-		  //goto LABEL_112;
+		  memset(Dst, 0, 0x3C8);
+		  memset(Src, 0, 0x3C8);
 	  }
-	  //v81 = ddm.uLastRepawnDay;
 	  if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay)
 	  {
-		  memcpy(Dst, pSrc, 0x3C8u);
-		  memcpy(Src, pSrc + 968, 0x3C8u);
+		  memcpy(Dst, pSrc, 968);
+		  memcpy(Src, pSrc + 968, 968);
 	  }
-	  //LABEL_112:
 		  free(pSrcMem);
 
 		  ddm.uLastRepawnDay = (int)File;
@@ -1959,19 +1806,19 @@
 			  ++ddm.uNumRespawns;
 		  v108 = 0;
 		  *thisa = 1;
-		  v39 = pGames_LOD->FindContainer(Str, 0);
-		  fread(&header, 0x10, 1u, v39);
+		  pFile = pGames_LOD->FindContainer(Str, 0);
+		  fread(&header, 0x10, 1, pFile);
 		  //pFilename = (char *)header.uCompressedSize;
 		  //pDestLen = header.uDecompressedSize;
 		  //v82 = malloc(header.uDecompressedSize);
 		  pSrcMem = (unsigned char *)malloc(header.uDecompressedSize);
 		  //v149 = v82;
 		  if (header.uCompressedSize == header.uDecompressedSize)
-			  fread(pSrcMem, header.uDecompressedSize, 1, v39);
+			  fread(pSrcMem, header.uDecompressedSize, 1, pFile);
 		  else if (header.uCompressedSize < header.uDecompressedSize)
 		  {
 			  void* compressedMem = malloc(header.uCompressedSize);
-			  fread(compressedMem, header.uCompressedSize, 1u, v39);
+			  fread(compressedMem, header.uCompressedSize, 1, pFile);
 
 			  uint actualDecompressedSize = header.uDecompressedSize;
 			  zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize);
@@ -1981,26 +1828,19 @@
 			  MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0);
 
 		  pSrc = pSrcMem + 40;
-		  //goto LABEL_120;
   }
   else
 	*thisa = 0;
-//LABEL_120:
-  //v108 = (int)".odm";
-  //v83 = strlen(pContainer);
-  //strcpy((char *)v141 + v83, (const char *)v108);
-  memcpy(uFullyRevealedCellOnMap, pSrc, 0x3C8);
-  //v84 = (const void *)(v74 + 968);
-  memcpy(uPartiallyRevealedCellOnMap, pSrc + 0x3C8, 0x3C8);
-  pSrc += 2 * 0x3C8;
-  //v85 = (char *)v84 + 968;
-
-  pGameLoadingUI_ProgressBar->Progress();
+  memcpy(uFullyRevealedCellOnMap, pSrc, 968);
+  memcpy(uPartiallyRevealedCellOnMap, pSrc + 968, 968);
+  pSrc += 2 * 968;
+
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   if ( *thisa )
   {
-    memcpy(uFullyRevealedCellOnMap, Dst, 0x3C8u);
-    memcpy(uPartiallyRevealedCellOnMap, Src, 0x3C8u);
+    memcpy(uFullyRevealedCellOnMap, Dst, 968);
+    memcpy(uPartiallyRevealedCellOnMap, Src, 968);
   }
 
   for (uint i = 0; i < uNumBModels; ++i)
@@ -2026,7 +1866,7 @@
     }
   }
 
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   for (uint i = 0; i < uNumLevelDecorations; ++i)
   {
@@ -2034,34 +1874,33 @@
     pSrc += 2;
   }
 
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   memcpy(&uNumActors, pSrc, 4);
   if (uNumActors > 500)
-    MessageBoxW(nullptr, L"Can't load file!",
-                L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:939", 0);
-
-  pGameLoadingUI_ProgressBar->Progress();
+    MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:939", 0);
+
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   assert(sizeof(Actor) == 836);
   //pFilename = (char *)(836 * uNumActors);
   memcpy(pActors.data(), pSrc + 4, uNumActors * sizeof(Actor));
   pSrc += 4 + uNumActors * sizeof(Actor);
   //v92 = (char *)v91 + (int)pFilename;
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   memcpy(&uNumSpriteObjects, pSrc, 4);
   assert(uNumSpriteObjects <= 1000 && "Too many objects");
   assert(sizeof(SpriteObject) == 112);
 
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   //pFilename = (char *)(112 * uNumSpriteObjects);
   memcpy(pSpriteObjects.data(), pSrc + 4, uNumSpriteObjects * sizeof(SpriteObject));
   pSrc += 4 + uNumSpriteObjects * sizeof(SpriteObject);
 
   //v94 = (char *)v93 + (int)pFilename;
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   memcpy(&uNumChests, pSrc, 4);
   //v95 = (char *)v94 + 4;
@@ -2069,19 +1908,19 @@
     MessageBoxW(nullptr, L"Can't load file!",
                 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:968", 0);
 
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   assert(sizeof(Chest) == 5324);
   //pFilename = (char *)(5324 * uNumChests);
   memcpy(pChests.data(), pSrc + 4 , uNumChests * sizeof(Chest));
   pSrc += 4 + uNumChests * sizeof(Chest);
   //v96 = (char *)v95 + (int)pFilename;
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
 
   memcpy(&stru_5E4C90_MapPersistVars, pSrc, 0xC8);
   pSrc += 0xC8;
 
-  pGameLoadingUI_ProgressBar->Progress();
+  pGameLoadingUI_ProgressBar->Progress();					//прогресс загрузки
   memcpy(&loc_time, pSrc, 0x38u);
 
   free(pSrcMem);
@@ -2117,49 +1956,53 @@
   else
     strcpy(loc_time.sky_texture_name, "plansky3");
 
+  //New_SKY_NIGHT_ID = pBitmaps_LOD->LoadTexture("SKY13");
+  //if (New_SKY_NIGHT_ID != -1)
+   // pBitmaps_LOD->pTextures[New_SKY_NIGHT_ID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[New_SKY_NIGHT_ID].palette_id1);
+
   //v101 = pBitmaps_LOD->LoadTexture(field_4F8);
   sSky_TextureID = pBitmaps_LOD->LoadTexture(loc_time.sky_texture_name);
   if (sSky_TextureID != -1)
     pBitmaps_LOD->pTextures[sSky_TextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[sSky_TextureID].palette_id1);
 
   pPaletteManager->RecalculateAll();
-  pSoundList->LoadSound(53, 0);
-  pSoundList->LoadSound(92, 0);
-  pSoundList->LoadSound(57, 0);
-  pSoundList->LoadSound(96, 0);
-  pSoundList->LoadSound(64, 0);
-  pSoundList->LoadSound(103, 0);
+  pSoundList->LoadSound(SOUND_RunDirt, 0);			//For Dirt tyle(для звука хождения по грязи)
+  pSoundList->LoadSound(SOUND_WalkDirt, 0);			//для бега
+  pSoundList->LoadSound(SOUND_RunRoad, 0);			//для звука хождения по дороге
+  pSoundList->LoadSound(SOUND_WalkRoad, 0);
+  pSoundList->LoadSound(SOUND_RunWood, 0);			//для звука хождения по дереву
+  pSoundList->LoadSound(SOUND_WalkWood, 0);
   for (int i=0; i < 3;++i) 
   {
     switch ( pTileTypes[i].tileset )
     {
       case Tileset_Grass:
-        pSoundList->LoadSound(54, 0);
-        pSoundList->LoadSound(93, 0);
+        pSoundList->LoadSound(SOUND_RunGrass, 0);	//для звука хождения по траве
+        pSoundList->LoadSound(SOUND_WalkGrass, 0);
         break;
       case Tileset_Snow:
-        pSoundList->LoadSound(58, 0);
-        pSoundList->LoadSound(97, 0);
+        pSoundList->LoadSound(SOUND_RunSnow, 0);	//по снегу
+        pSoundList->LoadSound(SOUND_WalkSnow, 0);
         break;
       case Tilset_Desert:
-        pSoundList->LoadSound(52, 0);
-         pSoundList->LoadSound(91, 0);
+        pSoundList->LoadSound(SOUND_RunDesert, 0);	//по пустыне
+         pSoundList->LoadSound(SOUND_WalkDesert, 0);
         break;
-      case Tileset_3:
-        pSoundList->LoadSound(51, 0);
-        pSoundList->LoadSound(90, 0);
+      case Tileset_CooledLava:
+        pSoundList->LoadSound(SOUND_RunCooledLava, 0);//по лаве
+        pSoundList->LoadSound(SOUND_WalkCooledLava, 0);
         break;
       case Tileset_Water:
-        pSoundList->LoadSound(62, 0);
-        pSoundList->LoadSound(101, 0);
+        pSoundList->LoadSound(SOUND_RunWater, 0);		//по воде
+        pSoundList->LoadSound(SOUND_WalkWater, 0);
         break;
-      case Tileset_6:
-        pSoundList->LoadSound(49, 0);
-        pSoundList->LoadSound(88, 0);
+      case Tileset_Badlands:
+        pSoundList->LoadSound(SOUND_RunBadlands, 0);	//для звука ходьбы по бесплодным землям
+        pSoundList->LoadSound(SOUND_WalkBadlands, 0);
         break;
       case Tileset_Swamp:
-        pSoundList->LoadSound(61, 0);
-        pSoundList->LoadSound(100, 0);
+        pSoundList->LoadSound(SOUND_RunSwamp, 0);		//по болоту
+        pSoundList->LoadSound(SOUND_WalkSwamp, 0);
         break;
     }
   }
@@ -2177,7 +2020,7 @@
     v3 = (a2 - 90) / 36;
     if ( v3 && v3 != 1 && v3 != 2 )
     {
-      if ( v3 == Tileset_3 )
+      if ( v3 == Tileset_CooledLava )
         result = this->pTileTypes[3].uTileID;
       else
         result = a2;
@@ -3121,15 +2964,10 @@
   int v1; // edi@1
   int v2; // ebx@1
   int floor_level; // eax@14
-  int v6; // esi@45
   ODMFace *face; // ecx@45
-  //signed int v33; // eax@143
   int v34; // esi@143
   int v35; // esi@147
   int v36; // eax@155
-//  signed int v37; // esi@159
-//  signed int v38; // eax@159
-//  signed int i; // esi@159
   int v40; // esi@162
   bool v42; // eax@180
   signed int v43; // ecx@184
@@ -3144,15 +2982,11 @@
   unsigned int v66; // esi@263
   signed int v68; // ecx@263
   int v69; // eax@263
-//  unsigned int v76; // edi@293
   bool v77; // edx@297
   bool v78; // ecx@303
   int v79; // ecx@314
   __int16 v80; // dx@317
-  //int v81; // ebx@318
-  //int v82; // ecx@318
   int pTerrainHeight; // eax@321
-//  int v86; // [sp-20h] [bp-B4h]@246
   int v87; // [sp-20h] [bp-B4h]@248
   int v97; // [sp+Ch] [bp-88h]@180
   Vec3_int_ v98;
@@ -3172,10 +3006,11 @@
   int _walk_speed; // [sp+54h] [bp-40h]@48
   int pX; // [sp+58h] [bp-3Ch]@1
   int pY; // [sp+5Ch] [bp-38h]@1
+  int party_new_Z; // [sp+74h] [bp-20h]@1
   int v118; // [sp+60h] [bp-34h]@1
   int _angle_x; // [sp+68h] [bp-2Ch]@48
   unsigned int v122; // [sp+70h] [bp-24h]@180
-  int pZ; // [sp+74h] [bp-20h]@1
+
   bool party_walking_flag; // [sp+78h] [bp-1Ch]@1
   int _angle_y; // [sp+7Ch] [bp-18h]@48
   int v128; // [sp+88h] [bp-Ch]@1
@@ -3188,9 +3023,11 @@
   int fall_speed = pParty->uFallSpeed;
   v128 = 0;
   v129 = 0;
+
   pX = pParty->vPosition.x;
   pY = pParty->vPosition.y;
-  pZ = pParty->vPosition.z;
+  party_new_Z = pParty->vPosition.z;
+
   v113 = pParty->field_6F0;
   hovering = false;
   bool partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y);
@@ -3199,8 +3036,9 @@
   v102 = 0;
   pModel_ = false;
   bWaterWalk = false;
-
-  if (!pParty->FeatherFallActive())//Проверка падение пера
+  //************************************
+  //Проверка падение пера
+  if (!pParty->FeatherFallActive())
   {
     bFeatherFall = false;
     for (int i = 0; i < 4; ++i)
@@ -3212,9 +3050,10 @@
   }
   else
     bFeatherFall = true;
-
+  //************************************
+  //Проверка хождения по воде
   pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
-  if (pParty->WaterWalkActive())//Проверка хождения по воде
+  if (pParty->WaterWalkActive())
   {
     //LOBYTE(pParty->uFlags) &= 0x7Fu;
     bWaterWalk = true;
@@ -3223,19 +3062,23 @@
           pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 )
       bWaterWalk = false;
   }
-
-  int bmodel_standing_on_pid;
-  int is_on_water = false;
-  floor_level = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk);
-  int is_not_on_bmodel = bmodel_standing_on_pid == 0;
-
-  v111 = floor_level;
-  if ( bFeatherFall )
+  //*************************************
+  //определение уровня пола
+  int bmodel_standing_on_pid;                           //данные 3D model'и
+  int is_on_water = false;                              //на воду
+  floor_level = ODM_GetFloorLevel(pX, pY, party_new_Z, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk);
+  int is_not_on_bmodel = bmodel_standing_on_pid == 0;   //не на 3D model
+
+  v111 = floor_level;                 //???
+  //************************************
+  //определение высоты падения
+  if ( bFeatherFall )                 //падение пера
     pParty->uFallStartY = floor_level;
   else
     floor_level = pParty->uFallStartY;
-
-  if ( floor_level - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 )//падение на 3D Model
+  //*************************************
+  //падение на 3D Model
+  if ( floor_level - party_new_Z > 512 && !bFeatherFall && party_new_Z <= v111 + 1 )
   {
     if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
       pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
@@ -3244,64 +3087,71 @@
       if ( !pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) )
       {
         pParty->pPlayers[i].ReceiveDamage(
-            (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(pParty->pPlayers[i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL);
+            (signed int)((pParty->uFallStartY - party_new_Z) * (unsigned __int64)(pParty->pPlayers[i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL);
         bonus = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance());
         pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)bonus * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
       }
     }
   }
-
+  //*********************************
+  //определение высоты потолка
   ceiling_height = -1;
-  if ( pParty->bFlying )
-    ceiling_height = GetCeilingHeight(pX, pY, pZ + pParty->uPartyHeight, (int)&v102);//высота потолка
+  if ( pParty->bFlying )    //в полёте
+    ceiling_height = GetCeilingHeight(pX, pY, party_new_Z + pParty->uPartyHeight, (int)&v102);//высота потолка
   //v107 = bmodel_standing_on_pid == 0;
-  on_ground = v111 + 1;
-  if ( pZ <= on_ground )//полёт: посадка
+  on_ground = v111 + 1;     //на земле
+  //**************************************
+
+  if ( party_new_Z <= on_ground )//полёт: посадка
   {
     ceiling_height = -1;
     pParty->bFlying = false;
   }
   else
     hovering = true;
-  not_high_fall = pZ - v111 <= 32;
-
-  if ( bWalkSound && pParty->walk_sound_timer)//timer update
+  not_high_fall = party_new_Z - v111 <= 32;
+  //****************************************
+  //timer update(обновить таймер звука ходьбы)
+  if ( bWalkSound && pParty->walk_sound_timer)
   {
     if (pParty->walk_sound_timer >= pEventTimer->uTimeElapsed)
       pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
     else
       pParty->walk_sound_timer = 0;
   }
-
-  if (!bUnderwater && pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime <= 0)// конец действия полёта
+  //****************************************
+  // конец действия полёта
+  if (!bUnderwater && pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime <= 0)//не под водой и время закла полёта закончилось
     pParty->bFlying = false;
-
-  if (!hovering)//
+  //*****************************************
+  // установить на чём стоит группа
+  if (!hovering)//не в воздухе
   {
     if ( pParty->floor_face_pid != PID(OBJECT_BModel, bmodel_standing_on_pid) )
     {
       if (bmodel_standing_on_pid)
       {
-        if ( (bmodel_standing_on_pid >> 6) < pOutdoor->uNumBModels )
+	    int BModel_id = bmodel_standing_on_pid >> 6;
+        if ( BModel_id < pOutdoor->uNumBModels )
         {
-          face = pOutdoor->pBModels[bmodel_standing_on_pid >> 6].pFaces;
-          v6 = bmodel_standing_on_pid & 0x3F;
+          face = pOutdoor->pBModels[BModel_id].pFaces;
+          int face_id = bmodel_standing_on_pid & 0x3F;
           /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 )
           {
             pParty->field_6F4_packedid = PID(OBJECT_BModel,v108);
             v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
           }*/
-          if ( face[v6].uAttributes & FACE_PRESSURE_PLATE )
+          if ( face[face_id].uAttributes & FACE_PRESSURE_PLATE )
           {
             pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);
-            trigger_id = face[v6].sCogTriggeredID; //
+            trigger_id = face[face_id].sCogTriggeredID; //EVT, панель имеет событие
           }
         }
       }
     }
-    pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);
+    pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);//6 - на земле
   }
-
+  //***********************************************
   _walk_speed = pParty->uWalkSpeed;
   _angle_y = pParty->sRotationY;
   _angle_x = pParty->sRotationX;
@@ -3328,28 +3178,28 @@
           extern int max_flight_height;
           if ( pParty->vPosition.z < max_flight_height || hovering )
           {
-            pZ += 30;
+            party_new_Z += 30;
             v113 += 30;
             pParty->bFlying = true;
-            if ( pZ > max_flight_height )
+            if ( party_new_Z > max_flight_height )
             {
-              pZ = max_flight_height;
+              party_new_Z = max_flight_height;
               v113 = max_flight_height;
             }
             v1 = 0;
             v2 = 0;
             fall_speed = 0;
             *(float *)&v128 = 0.0;
-            if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//столкновение с потолком
+            if ( v102 && party_new_Z < ceiling_height && (signed int)(pParty->uPartyHeight + party_new_Z) >= ceiling_height )//столкновение с потолком
             {
               pParty->field_6E0 = 0;
               pParty->field_6E4 = 0;
               pPartyActionQueue->uNumActions = 0;
               pParty->uFlags |= PARTY_FLAGS_1_LANDING;
               pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31;
-              pParty->field_6F0 = pZ;
+              pParty->field_6F0 = party_new_Z;
               pParty->bFlying = false;
-              pZ = ceiling_height - pParty->uPartyHeight - 31;
+              party_new_Z = ceiling_height - pParty->uPartyHeight - 31;
               v113 = pParty->field_6F0;
             }
             pParty->uFallSpeed = 0;
@@ -3367,13 +3217,13 @@
             || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1
             || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 )
           {
-            pZ -= 30;
+            party_new_Z -= 30;
             v113 -= 30;
             pParty->uFallSpeed = 0;
             fall_speed = 0;
             pParty->bFlying = true;
             pModel_ = true;
-            if ( pZ <= v111 )
+            if ( party_new_Z <= v111 )
             {
               pParty->bFlying = false;
               pPartyActionQueue->uNumActions = 0;
@@ -3382,7 +3232,7 @@
         }
         break;
 
-      case PARTY_TurnLeft:
+      case PARTY_TurnLeft://поворот влево
         if (uTurnSpeed)
           _angle_y += uTurnSpeed;   //descrete turn
         else
@@ -3391,7 +3241,7 @@
         _angle_y &= stru_5C6E00->uDoublePiMask;
       break;
 
-      case PARTY_TurnRight:
+      case PARTY_TurnRight://поворот вправо
         if (uTurnSpeed)
           _angle_y -= uTurnSpeed;
         else
@@ -3400,7 +3250,7 @@
         _angle_y &= stru_5C6E00->uDoublePiMask;
       break;
 
-      case PARTY_FastTurnLeft:
+      case PARTY_FastTurnLeft://быстрый поворот влево
         if (uTurnSpeed)
           _angle_y += uTurnSpeed;
         else
@@ -3409,7 +3259,7 @@
         _angle_y &= stru_5C6E00->uDoublePiMask;
       break;
 
-      case PARTY_FastTurnRight:
+      case PARTY_FastTurnRight://быстрый поворот вправо
         if (!uTurnSpeed)
           _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn;
         else
@@ -3422,11 +3272,11 @@
       {
         *(float *)&v128 = pParty->uWalkSpeed;
 
-        float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
+        float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
         int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
         v2 -= 3 * dx / 4;
         
-        float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
+        float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
         int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
         v1 += 3 * dy / 4;
 
@@ -3439,11 +3289,11 @@
       {
         *(float *)&v128 = pParty->uWalkSpeed;
 
-        float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
+        float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
         int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
         v2 += 3 * dx / 4;
         
-        float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
+        float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
         int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
         v1 -= 3 * dy / 4;
 
@@ -3456,8 +3306,8 @@
       {
         *(float *)&v128 = _walk_speed;
 
-        float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
-              cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
+        float sin_y = sinf(2 * pi_double * _angle_y / 2048.0),
+              cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
 
         int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
         int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
@@ -3482,8 +3332,8 @@
       {
         *(float *)&v128 = _walk_speed;
 
-        float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
-        float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
+        float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
+        float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
 
         int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
         int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
@@ -3616,27 +3466,27 @@
   if ( pParty->bFlying )
   {
     v129 = fixpoint_mul(4, stru_5C6E00->Cos(GetTickCount()));
-    pZ = v113 + v129;
+    party_new_Z = v113 + v129;
     if ( pModel_ )
-      pZ = v113;
+      party_new_Z = v113;
     if (pParty->FlyActive())
       stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFE;
-    pParty->uFallStartY = pZ;
+    pParty->uFallStartY = party_new_Z;
   }
-  else if ( pZ < v111 )
+  else if ( party_new_Z < v111 )
   {
     if ( is_on_water && fall_speed )
       SpriteObject::sub_42F960_create_object(pX, pY, v111);
     fall_speed = 0;
-    pZ = v111;
+    party_new_Z = v111;
     pParty->uFallStartY = v111;
-    v113 = pZ;
+    v113 = party_new_Z;
     if (pParty->FlyActive())
       stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1;
   }
   else
   {
-    v113 = pZ;
+    v113 = party_new_Z;
     if (pParty->FlyActive())
       stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1;
   }
@@ -3656,7 +3506,7 @@
       // rolling down the hill
       // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
       // and falling to the gravity, gradually sliding downwards. nice trick
-      pZ = v111;
+      party_new_Z = v111;
       ODM_GetTerrainNormalAt(pX, pY, &v98);
       v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength()));
       v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16;
@@ -3687,7 +3537,7 @@
     }
   }
   else
-    pParty->uFallStartY = pZ;
+    pParty->uFallStartY = party_new_Z;
 
   if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
   {
@@ -3705,11 +3555,11 @@
   {
     stru_721530.position.x = pX;
     stru_721530.position.y = pY;
-    stru_721530.position.z = stru_721530.height + pZ + 1;
+    stru_721530.position.z = stru_721530.height + party_new_Z + 1;
 
     stru_721530.normal.x = pX;
     stru_721530.normal.y = pY;
-    stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1;
+    stru_721530.normal.z = stru_721530.prolly_normal_d + party_new_Z + 1;
 
     stru_721530.velocity.x = v2;
     stru_721530.velocity.y = v128;
@@ -3739,7 +3589,7 @@
       _angle_x = pX + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
       _angle_y = pY + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
       //pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
-      v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + pZ;
+      v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + party_new_Z;
     }
     v122 = v40;
     ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
@@ -3761,9 +3611,9 @@
     }
     else
     {
-      if ( v42_ && v129 > pZ )
+      if ( v42_ && v129 > party_new_Z )
         v44 = 0;
-      if ( v42 && v119 > pZ )
+      if ( v42 && v119 > party_new_Z )
         v43 = 0;
       if ( v44 )
       {
@@ -3776,7 +3626,7 @@
       else
       {
         int new_ = ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
-        if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && new_ <= pZ )
+        if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && new_ <= party_new_Z )
         {
           v43 = 1;
           pX = _angle_x;
@@ -3792,14 +3642,14 @@
         pX = stru_721530.normal2.x;
         pY = stru_721530.normal2.y;
       }
-      pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
+      party_new_Z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
       break;
     }
     stru_721530.field_70 += stru_721530.field_7C;
     pX = _angle_x;
     pY = _angle_y;
     v45 = stru_721530.uFaceID;
-    pZ = v40;
+    party_new_Z = v40;
 
     if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
     {
@@ -3831,7 +3681,7 @@
       {
         if ( fall_speed < 0 )
           fall_speed = 0;
-        pZ = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1;
+        party_new_Z = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1;
         if ( v2 * v2 + v128 * v128 < 400 )
         {
           v2 = 0;
@@ -3862,7 +3712,7 @@
           pX = _angle_x + fixpoint_mul(pODMFace->pFacePlane.vNormal.x, v55);
           pY = _angle_y + fixpoint_mul(pODMFace->pFacePlane.vNormal.y, v55);
           if ( !v119 )
-            pZ = v122 + fixpoint_mul(pODMFace->pFacePlane.vNormal.z, v55);
+            party_new_Z = v122 + fixpoint_mul(pODMFace->pFacePlane.vNormal.z, v55);
         }
         if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() )
         {
@@ -3904,7 +3754,7 @@
   //Воспроизведение звуков ходьбы/бега------------------------
   uint pX_ = abs(pParty->vPosition.x - pX);
   uint pY_ = abs(pParty->vPosition.y - pY);
-  uint pZ_ = abs(pParty->vPosition.z - pZ);
+  uint pZ_ = abs(pParty->vPosition.z - party_new_Z);
   if ( bWalkSound && pParty->walk_sound_timer <= 0 )
   {
     pAudioPlayer->_4AA258(804);//stop sound
@@ -3913,7 +3763,7 @@
       if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16 )
       {
         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и
+          pAudioPlayer->PlaySound(SOUND_RunWood, 804, 1, -1, 0, 0, 0, 0);//бег на 3D Modelи
         else
         {
           v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1);
@@ -3927,7 +3777,7 @@
       if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8 )
       {
         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и
+          pAudioPlayer->PlaySound(SOUND_WalkWood, 804, 1, -1, 0, 0, 0, 0);// хождение на 3D Modelи
         else
         {
           v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0);
@@ -3962,12 +3812,12 @@
   {
     pParty->vPosition.x = pX;
     pParty->vPosition.y = pY;
-    pParty->vPosition.z = pZ;
+    pParty->vPosition.z = party_new_Z;
     pParty->field_6F0 = v113;
     pParty->uFallSpeed = fall_speed;
-    if ( pZ > 8160 ) //ограничение высоты
+    if ( party_new_Z > 8160 ) //ограничение высоты
     {
-      pZ = 8160;
+      party_new_Z = 8160;
       pParty->uFallStartY = 8160;
       pParty->vPosition.z = 8160;
     }
@@ -3976,14 +3826,15 @@
       || (EventProcessor(trigger_id, 0, 1),
          pParty->vPosition.x == pX)
       && pParty->vPosition.y == pY
-      && pParty->vPosition.z == pZ )
+      && pParty->vPosition.z == party_new_Z )
     {
       if ( pParty->vPosition.z < v111 )
       {
         pParty->uFallSpeed = 0;
         //v73 = v105;
         pParty->vPosition.z = on_ground;
-        if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the ground(падение на землю с высоты)
+        if ( pParty->uFallStartY - party_new_Z > 512 && !bFeatherFall
+			&& party_new_Z <= on_ground && !bUnderwater )//Fall to the ground(падение на землю с высоты)
         {
           if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
             pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
@@ -3991,7 +3842,7 @@
           {
             for ( uint i = 1; i <= 4; ++i )
             {
-              pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)pPlayers[i]->GetMaxHealth() * 0.1)) / 256,
+              pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - party_new_Z) * (unsigned __int64)(signed __int64)((double)pPlayers[i]->GetMaxHealth() * 0.1)) / 256,
                 DMGT_PHISYCAL);
               v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
               pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
@@ -3999,7 +3850,7 @@
             //v73 = pParty->vPosition.z;
           }
         }
-        pParty->uFallStartY = pZ;
+        pParty->uFallStartY = party_new_Z;
       }
       if ( v102 && pParty->vPosition.z < ceiling_height )
       {
@@ -4066,8 +3917,8 @@
 
   //v81 = pZ;
   //v82 = pZ;
-  pParty->vPosition.z = pZ;
-  if ( pZ > 8160 )//опять ограничение высоты
+  pParty->vPosition.z = party_new_Z;
+  if ( party_new_Z > 8160 )//опять ограничение высоты
   {
     //v82 = 8160;
     pParty->uFallStartY = 8160;
@@ -4087,14 +3938,15 @@
     || (EventProcessor(trigger_id, 0, 1),
        pParty->vPosition.x == pX)
     && pParty->vPosition.y == pY
-    && pParty->vPosition.z == pZ )
+    && pParty->vPosition.z == party_new_Z )
   {
     if ( pParty->vPosition.z < v111 )
     {
       //v82 = on_ground;
       pParty->uFallSpeed = 0;
       pParty->vPosition.z = on_ground;
-      if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the water(падение на воду с высоты)
+      if ( pParty->uFallStartY - party_new_Z > 512
+		  && !bFeatherFall && party_new_Z <= on_ground && !bUnderwater )//Fall to the water(падение на воду с высоты)
       {
         if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
           pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
@@ -4103,7 +3955,7 @@
           for ( uint i = 1; i <= 4; ++i )
           {
             v110 = pPlayers[i]->GetMaxHealth();
-            pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
+            pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - party_new_Z) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
               DMGT_PHISYCAL);
             v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
             pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
@@ -4111,7 +3963,7 @@
           //v82 = pParty->vPosition.z;
         }
       }
-      pParty->uFallStartY = pZ;
+      pParty->uFallStartY = party_new_Z;
     }
     if ( v102 && pParty->vPosition.z < ceiling_height && (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height )
     {