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

enum SOUND_
author Ritor1
date Mon, 09 Feb 2015 19:17:12 +0600
parents 491f0babd563
children a902abdfc7f2
comparison
equal deleted inserted replaced
2533:2baaac65d5bf 2534:1bcadc6dd203
518 return 1; 518 return 1;
519 case Tileset_Snow://на снегу 519 case Tileset_Snow://на снегу
520 return 3; 520 return 3;
521 case Tilset_Desert://на песке 521 case Tilset_Desert://на песке
522 return 5; 522 return 5;
523 case Tileset_3: 523 case Tileset_CooledLava:
524 case Tileset_Dirt:// на грязи 524 case Tileset_Dirt:// на грязи
525 return 4; 525 return 4;
526 case Tileset_Water:// on water(на воде) 526 case Tileset_Water:// on water(на воде)
527 return 3;//еденицы еды 527 return 3;//еденицы еды
528 default: 528 default:
960 } 960 }
961 961
962 //----- (0047CD44) -------------------------------------------------------- 962 //----- (0047CD44) --------------------------------------------------------
963 bool OutdoorLocationTerrain::Initialize() 963 bool OutdoorLocationTerrain::Initialize()
964 { 964 {
965 pHeightmap = (unsigned __int8 *)malloc(0x4000u);//height map 965 pHeightmap = (unsigned __int8 *)malloc(0x4000);//height map
966 pTilemap = (unsigned __int8 *)malloc(0x4000u);//tile map 966 pTilemap = (unsigned __int8 *)malloc(0x4000);//tile map
967 pAttributemap = (unsigned __int8 *)malloc(0x4000u);//карта атрибутов 967 pAttributemap = (unsigned __int8 *)malloc(0x4000);//карта атрибутов
968 pDmap = (struct DMap *)malloc(0x8000u); 968 pDmap = (struct DMap *)malloc(0x8000);
969 if (pHeightmap && pTilemap && pAttributemap && pDmap ) 969 if (pHeightmap && pTilemap && pAttributemap && pDmap )
970 return true; 970 return true;
971 else 971 else
972 return false; 972 return false;
973 } 973 }
989 strcpy(this->pLocationFileName, "i6.odm"); 989 strcpy(this->pLocationFileName, "i6.odm");
990 strcpy(this->pLocationFileDescription, "MM6 Outdoor v1.00"); 990 strcpy(this->pLocationFileDescription, "MM6 Outdoor v1.00");
991 this->uNumBModels = 0; 991 this->uNumBModels = 0;
992 this->pTileTypes[0].tileset = Tileset_Grass; 992 this->pTileTypes[0].tileset = Tileset_Grass;
993 this->pTileTypes[1].tileset = Tileset_Water; 993 this->pTileTypes[1].tileset = Tileset_Water;
994 this->pTileTypes[2].tileset = Tileset_6; 994 this->pTileTypes[2].tileset = Tileset_Badlands;
995 this->pTileTypes[3].tileset = Tileset_RoadGrassCobble; 995 this->pTileTypes[3].tileset = Tileset_RoadGrassCobble;
996 this->LoadTileGroupIds(); 996 this->LoadTileGroupIds();
997 this->LoadRoadTileset(); 997 this->LoadRoadTileset();
998 free(this->pBModels); 998 free(this->pBModels);
999 free(this->pSpawnPoints); 999 free(this->pSpawnPoints);
1068 } 1068 }
1069 1069
1070 //----- (0047D0A6) -------------------------------------------------------- 1070 //----- (0047D0A6) --------------------------------------------------------
1071 bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int *thisa)//загрузка локации 1071 bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int *thisa)//загрузка локации
1072 { 1072 {
1073 //OutdoorLocation *pOutdoorLocation; // esi@1 1073 FILE *pFile; // eax@50
1074 /*bool result; // eax@9
1075 bool v7; // ebx@9
1076 size_t v8; // eax@10
1077 void *v9; // eax@10
1078 void *v10; // eax@10
1079 void *v11; // eax@10
1080 int v12; // ebx@11
1081 BSPModel *v13; // eax@12
1082 void *v14; // eax@12
1083 BSPModel *v15; // ecx@12
1084 void *v16; // eax@12
1085 BSPModel *v17; // ecx@12
1086 BSPModel *v18; // eax@12
1087 __int16 v19; // ax@15
1088 __int16 v20; // ax@16
1089 int v21; // ecx@16
1090 ODMFace *v22; // ebx@26
1091 SpriteObject *pItems; // ecx@27
1092 unsigned int v24; // eax@28
1093 //unsigned __int8 v25; // zf@28
1094 //unsigned __int8 v26; // sf@28
1095 ODMFace *v27; // eax@28
1096 const char *i; // edx@29
1097 unsigned __int16 v29; // ax@33
1098 unsigned __int16 v30; // ax@37
1099 int v31; // ecx@37
1100 int v32; // eax@38
1101 void *v33; // eax@38
1102 TileDesc *v34; // eax@43
1103 unsigned int v35; // eax@43
1104 unsigned int v36; // edi@43
1105 unsigned int v37; // edi@45*/
1106 //size_t v38; // eax@50
1107 FILE *v39; // eax@50
1108 //unsigned int v40; // edi@56
1109 //void *v41; // eax@56
1110 //void *v42; // ebx@56
1111 //const void *v43; // ebx@59
1112 //const void *v44; // ebx@59
1113 //unsigned int v45; // eax@59
1114 //BSPModel *v46; // eax@59
1115 //unsigned int v47; // ecx@59
1116 //int v48; // ebx@60
1117 //BSPModel *v49; // eax@61
1118 //BSPModel *v50; // eax@61
1119 //BSPModel *v51; // eax@61
1120 //BSPModel *v52; // eax@61
1121 //BSPModel *v53; // eax@61
1122 //BSPModel *v54; // ecx@61
1123 //BSPModel *v55; // ecx@61
1124 //BSPModel *v56; // ecx@61
1125 //void *v57; // ST24_4@61
1126 //BSPModel *v58; // ecx@61
1127 //void *v59; // ST18_4@61
1128 //BSPModel *v60; // eax@61
1129 //__int16 v61; // ax@64
1130 unsigned __int16 v62; // ax@65 1074 unsigned __int16 v62; // ax@65
1131 //ODMFace *v63; // ecx@65
1132 //unsigned __int16 v64; // ax@80
1133 //const char *v65; // ecx@80
1134 //int v66; // eax@81
1135 //void *v67; // eax@81
1136 //int v68; // ecx@81
1137 //void *v69; // eax@81
1138 //unsigned int v70; // eax@81
1139 //SpawnPointMM7 *v71; // eax@81
1140 //unsigned int v72; // ecx@81
1141 //size_t v73; // eax@81
1142 //int v74; // edi@87
1143 //void *v75; // edi@88
1144 //unsigned int v76; // edx@94
1145 //int v77; // ecx@94
1146 //char *v78; // eax@95
1147 //unsigned int v79; // edx@97
1148 //unsigned int v80; // eax@99
1149 //int v81; // eax@107
1150 //void *v82; // edi@114
1151 //size_t v83; // eax@120
1152 //const void *v84; // edi@120
1153 //const void *v85; // edi@120
1154 //BSPModel *v86; // eax@124
1155 //unsigned int v87; // eax@124
1156 //BSPModel *v88; // eax@126
1157 //BSPModel *v89; // eax@127
1158 //ODMFace *v90; // eax@129
1159 //const void *v91; // edi@138
1160 //const void *v92; // edi@141
1161 //const void *v93; // edi@141
1162 //const void *v94; // edi@144
1163 //const void *v95; // edi@144
1164 //const char *v96; // edi@147
1165 //unsigned int v97; // eax@147
1166 //TileDesc *v98; // eax@147
1167 //unsigned int v99; // eax@147
1168 //int v100; // ecx@150
1169 //unsigned int v101; // eax@157
1170 // int v102; // edi@159
1171 //void *v103; // [sp-14h] [bp-B94h]@55
1172 //void *v104; // [sp-10h] [bp-B90h]@59
1173 //size_t v105; // [sp-Ch] [bp-B8Ch]@59
1174 //char *v106; // [sp-8h] [bp-B88h]@59
1175 // int v107; // [sp-4h] [bp-B84h]@12
1176 int v108; // [sp+0h] [bp-B80h]@10 1075 int v108; // [sp+0h] [bp-B80h]@10
1177 char Src[968]; // [sp+10h] [bp-B70h]@110 1076 char Src[968]; // [sp+10h] [bp-B70h]@110
1178 char Dst[968]; // [sp+3D8h] [bp-7A8h]@50 1077 char Dst[968]; // [sp+3D8h] [bp-7A8h]@50
1179 char Str[256]; // [sp+7A0h] [bp-3E0h]@50 1078 char Str[256]; // [sp+7A0h] [bp-3E0h]@50
1180 /*char DstBuf; // [sp+8A0h] [bp-2E0h]@10
1181 __int32 Offset; // [sp+8A4h] [bp-2DCh]@10
1182 __int32 v114; // [sp+8B0h] [bp-2D0h]@10
1183 __int32 v115; // [sp+8BCh] [bp-2C4h]@10
1184 __int32 v116; // [sp+8C8h] [bp-2B8h]@10
1185 __int32 v117; // [sp+8D4h] [bp-2ACh]@10
1186 __int32 v118; // [sp+8E0h] [bp-2A0h]@10
1187 __int32 v119; // [sp+8ECh] [bp-294h]@10
1188 __int32 v120; // [sp+8F8h] [bp-288h]@10
1189 __int32 v121; // [sp+904h] [bp-27Ch]@10
1190 __int32 v122; // [sp+910h] [bp-270h]@10
1191 __int32 v123; // [sp+91Ch] [bp-264h]@10
1192 __int32 v124; // [sp+928h] [bp-258h]@26
1193 __int32 v125; // [sp+934h] [bp-24Ch]@35
1194 __int32 v126; // [sp+940h] [bp-240h]@38
1195 __int32 v127; // [sp+94Ch] [bp-234h]@38
1196 __int32 v128; // [sp+958h] [bp-228h]@38
1197 __int32 v129; // [sp+964h] [bp-21Ch]@38
1198 __int32 v130; // [sp+970h] [bp-210h]@38
1199 __int32 v131; // [sp+97Ch] [bp-204h]@38
1200 __int32 v132; // [sp+988h] [bp-1F8h]@38
1201 __int32 v133; // [sp+994h] [bp-1ECh]@38
1202 __int32 v134; // [sp+9A0h] [bp-1E0h]@38
1203 __int32 v135; // [sp+9ACh] [bp-1D4h]@38
1204 __int32 v136; // [sp+9D0h] [bp-1B0h]@10*/
1205 //char FileName[8]; // [sp+A20h] [bp-160h]@8
1206 //char v138; // [sp+A28h] [bp-158h]@12
1207 //int v139; // [sp+B1Ch] [bp-64h]@10
1208 //char pContainer[32]; // [sp+B20h] [bp-60h]@1
1209 //int *v141; // [sp+B40h] [bp-40h]@50
1210 //__int64 v142; // [sp+B44h] [bp-3Ch]@55
1211 //size_t pSource; // [sp+B4Ch] [bp-34h]@56
1212 //int v144; // [sp+B50h] [bp-30h]@61
1213 //int v145; // [sp+B54h] [bp-2Ch]@68
1214 ODMHeader header; // [sp+B58h] [bp-28h]@50 1079 ODMHeader header; // [sp+B58h] [bp-28h]@50
1215 //unsigned int pDestLen; // [sp+B68h] [bp-18h]@13
1216 //FILE *ptr; // [sp+B6Ch] [bp-14h]@12
1217 //void *v149; // [sp+B70h] [bp-10h]@19
1218 char *Str2; // [sp+B74h] [bp-Ch]@12 1080 char *Str2; // [sp+B74h] [bp-Ch]@12
1219 //int v151; // [sp+B78h] [bp-8h]@59
1220 //void *uSourceLen; // [sp+B7Ch] [bp-4h]@59
1221 1081
1222 //pOutdoorLocation = this; 1082 //pOutdoorLocation = this;
1223 //strcpy(pContainer, pFilename); 1083 //strcpy(pContainer, pFilename);
1224 1084
1225 if (bUnderwater) 1085 if (bUnderwater)
1526 strcpy(Str, pFilename); 1386 strcpy(Str, pFilename);
1527 strcpy(Str + strlen(Str) - 4, ".odm"); 1387 strcpy(Str + strlen(Str) - 4, ".odm");
1528 //v141 = &v139; 1388 //v141 = &v139;
1529 //v38 = strlen(pFilename); 1389 //v38 = strlen(pFilename);
1530 //strcpy((char *)&v139 + v38, ".odm"); 1390 //strcpy((char *)&v139 + v38, ".odm");
1531 v39 = pGames_LOD->FindContainer(Str, 1); 1391 pFile = pGames_LOD->FindContainer(Str, true);
1532 //Str[strlen(Str) - 4] = 0; 1392 //Str[strlen(Str) - 4] = 0;
1533 1393
1534 header.uCompressedSize = 0; 1394 header.uCompressedSize = 0;
1535 header.uDecompressedSize = 0; 1395 header.uDecompressedSize = 0;
1536 //ptr = v39; 1396 //ptr = v39;
1537 header.uVersion = 91969; 1397 header.uVersion = 91969;
1538 header.pMagic[0] = 'm'; 1398 header.pMagic[0] = 'm';
1539 header.pMagic[1] = 'v'; 1399 header.pMagic[1] = 'v';
1540 header.pMagic[2] = 'i'; 1400 header.pMagic[2] = 'i';
1541 header.pMagic[3] = 'i'; 1401 header.pMagic[3] = 'i';
1542 fread(&header, 0x10u, 1u, v39); 1402 fread(&header, 0x10, 1, pFile);
1543 if (header.uVersion != 91969 || 1403 if (header.uVersion != 91969 ||
1544 header.pMagic[0] != 'm' || 1404 header.pMagic[0] != 'm' ||
1545 header.pMagic[1] != 'v' || 1405 header.pMagic[1] != 'v' ||
1546 header.pMagic[2] != 'i' || 1406 header.pMagic[2] != 'i' ||
1547 header.pMagic[3] != 'i') 1407 header.pMagic[3] != 'i')
1557 //v42 = v41; 1417 //v42 = v41;
1558 //HIDWORD(v142) = (uint32)pSrc; 1418 //HIDWORD(v142) = (uint32)pSrc;
1559 if (header.uCompressedSize < header.uDecompressedSize) 1419 if (header.uCompressedSize < header.uDecompressedSize)
1560 { 1420 {
1561 char* pComressedSrc = (char *)malloc(header.uCompressedSize); 1421 char* pComressedSrc = (char *)malloc(header.uCompressedSize);
1562 fread(pComressedSrc, header.uCompressedSize, 1, v39); 1422 fread(pComressedSrc, header.uCompressedSize, 1, pFile);
1563 1423
1564 uint actualDecompressedSize = header.uDecompressedSize; 1424 uint actualDecompressedSize = header.uDecompressedSize;
1565 zlib::MemUnzip(pSrc, &actualDecompressedSize, pComressedSrc, header.uCompressedSize); 1425 zlib::MemUnzip(pSrc, &actualDecompressedSize, pComressedSrc, header.uCompressedSize);
1566 free(pComressedSrc); 1426 free(pComressedSrc);
1567 } 1427 }
1568 else 1428 else
1569 { 1429 {
1570 fread(pSrc, header.uDecompressedSize, 1, v39); 1430 fread(pSrc, header.uDecompressedSize, 1, pFile);
1571 } 1431 }
1572 1432
1573 memcpy(pLevelFilename, pSrc, 0x20); 1433 memcpy(pLevelFilename, pSrc, 0x20);
1574 memcpy(pLocationFileName, pSrc + 0x20, 0x20); 1434 memcpy(pLocationFileName, pSrc + 0x20, 0x20);
1575 memcpy(pLocationFileDescription, pSrc + 0x40, 0x20); 1435 memcpy(pLocationFileDescription, pSrc + 0x40, 0x20);
1580 1440
1581 //v43 = (char *)pSrc + 176; 1441 //v43 = (char *)pSrc + 176;
1582 LoadTileGroupIds(); 1442 LoadTileGroupIds();
1583 LoadRoadTileset(); 1443 LoadRoadTileset();
1584 strcpy(pGroundTileset, "grastyl"); 1444 strcpy(pGroundTileset, "grastyl");
1585 pGameLoadingUI_ProgressBar->Progress(); 1445
1446 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1447
1448 //*******************Terrain**************************//
1586 pTerrain.Initialize(); 1449 pTerrain.Initialize();
1587 //v108 = 16384; 1450 memcpy(pTerrain.pHeightmap, pSrc, 0x4000); //карта высот
1588 //v107 = (int)v43;
1589 //v106 = (char *)pTerrain.pHeightmap;
1590 memcpy(pTerrain.pHeightmap, pSrc, 0x4000);
1591 pSrc += 0x4000; 1451 pSrc += 0x4000;
1592 1452
1593 //v43 = (char *)v43 + 16384; 1453 memcpy(pTerrain.pTilemap, pSrc, 0x4000); //карта тайлов
1594 //v105 = 16384;
1595 //v104 = (void *)v43;
1596 //v103 = pTerrain.pTilemap;
1597 memcpy(pTerrain.pTilemap, pSrc, 0x4000);
1598 pSrc += 0x4000; 1454 pSrc += 0x4000;
1599 1455
1600 //v43 = (char *)v43 + 16384; 1456 memcpy(pTerrain.pAttributemap, pSrc, 0x4000); // карта аттрибутов
1601 memcpy(pTerrain.pAttributemap, pSrc, 0x4000);
1602 pSrc += 0x4000; 1457 pSrc += 0x4000;
1603 1458
1604 //v43 = (char *)v43 + 16384; 1459 //v43 = (char *)v43 + 16384;
1605 //v108 = (int)ptr_D4; 1460 //v108 = (int)ptr_D4;
1606 free(pCmap); 1461 free(pCmap);
1607 pCmap = malloc(0x8000); 1462 pCmap = malloc(0x8000);
1608 pTerrain.FillDMap(0, 0, 128, 128); 1463 pTerrain.FillDMap(0, 0, 128, 128); //
1609 1464
1610 pGameLoadingUI_ProgressBar->Progress(); 1465 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1611 memcpy(&uNumTerrainNormals, pSrc, 4); 1466
1612 //v43 = (char *)v43 + 4; 1467 memcpy(&uNumTerrainNormals, pSrc, 4); // количество нормалей
1613 memcpy(pTerrainSomeOtherData.data(), pSrc + 4, 0x20000); 1468 memcpy(pTerrainSomeOtherData.data(), pSrc + 4, 0x20000);
1614 pSrc += 4 + 0x20000; 1469 pSrc += 4 + 0x20000;
1615 //v43 = (char *)v43 + 131072; 1470 //v43 = (char *)v43 + 131072;
1616 memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000); 1471 memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000); //индексы нормалей
1617 pSrc += 0x10000; 1472 pSrc += 0x10000;
1618 //v43 = (char *)v43 + 65536; 1473 //v43 = (char *)v43 + 65536;
1619 1474
1620 //pFilename = (char *)(12 * uNumTerrainNormals); 1475 //pFilename = (char *)(12 * uNumTerrainNormals);
1621 pTerrainNormals = (Vec3_float_ *)malloc(sizeof(Vec3_float_) * uNumTerrainNormals); 1476 pTerrainNormals = (Vec3_float_ *)malloc(sizeof(Vec3_float_) * uNumTerrainNormals);//карта нормалей
1622 memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals); 1477 memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals);
1623 pSrc += 12 * uNumTerrainNormals; 1478 pSrc += 12 * uNumTerrainNormals;
1624 //v44 = (char *)v43 + (int)pFilename; 1479 //v44 = (char *)v43 + (int)pFilename;
1625 //v44 = (char *)v44 + 4; 1480 //v44 = (char *)v44 + 4;
1626 //v45 = uNumBModels; 1481 //v45 = uNumBModels;
1627 //v108 = (int)"BDdata"; 1482 //v108 = (int)"BDdata";
1628 1483
1629 pGameLoadingUI_ProgressBar->Progress(); 1484 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1630 1485
1486 //************BModels************************//
1631 //v107 = 188 * v45; 1487 //v107 = 188 * v45;
1632 //v106 = (char *)pBModels; 1488 //v106 = (char *)pBModels;
1633 //v46 = (BSPModel *)malloc(v106, 188 * v45, "BDdata"); 1489 //v46 = (BSPModel *)malloc(v106, 188 * v45, "BDdata");
1634 //v47 = uNumBModels; 1490 //v47 = uNumBModels;
1635 memcpy(&uNumBModels, pSrc, 4); 1491 memcpy(&uNumBModels, pSrc, 4); //количество BModel'ей
1636 pBModels = (BSPModel *)malloc(188 * uNumBModels); 1492 pBModels = (BSPModel *)malloc(188 * uNumBModels);
1637 //pFilename = (char *)(188 * v47); 1493 memcpy(pBModels, pSrc + 4, 188 * uNumBModels); //BModel'и
1638 memcpy(pBModels, pSrc + 4, 188 * uNumBModels);
1639 pSrc += 4 + 188 * uNumBModels; 1494 pSrc += 4 + 188 * uNumBModels;
1640 1495
1641 pGameLoadingUI_ProgressBar->Progress(); 1496 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1642 1497
1643 //uSourceLen = (char *)v44 + (int)pFilename; 1498 //uSourceLen = (char *)v44 + (int)pFilename;
1644 //v151 = 0; 1499 //v151 = 0;
1645 for (uint i = 0; i < uNumBModels; ++i) 1500 for (uint i = 0; i < uNumBModels; ++i)
1646 { 1501 {
1785 // ++v48; 1640 // ++v48;
1786 // if ( v151 >= (signed int)uNumBModels ) 1641 // if ( v151 >= (signed int)uNumBModels )
1787 // goto LABEL_75; 1642 // goto LABEL_75;
1788 } 1643 }
1789 //LABEL_75: 1644 //LABEL_75:
1790 pGameLoadingUI_ProgressBar->Progress(); 1645 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1791 1646
1647 //******************Decorations**********************//
1792 memcpy(&uNumLevelDecorations, pSrc, 4); 1648 memcpy(&uNumLevelDecorations, pSrc, 4);
1793 //uSourceLen = (char *)uSourceLen + 4; 1649 //uSourceLen = (char *)uSourceLen + 4;
1794 if (uNumLevelDecorations > 3000) 1650 if (uNumLevelDecorations > 3000)
1795 MessageBoxW(nullptr, L"Can't load file!", 1651 MessageBoxW(nullptr, L"Can't load file!",
1796 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:678", 0); 1652 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:678", 0);
1811 pSrc += sizeof(LevelDecoration); 1667 pSrc += sizeof(LevelDecoration);
1812 1668
1813 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(name); 1669 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(name);
1814 } 1670 }
1815 1671
1816 pGameLoadingUI_ProgressBar->Progress(); 1672 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1817 1673
1818 memcpy(&numFaceIDListElems, pSrc, 4); 1674 memcpy(&numFaceIDListElems, pSrc, 4);
1819 1675
1820 //uSourceLen = (char *)uSourceLen + 4; 1676 //uSourceLen = (char *)uSourceLen + 4;
1821 //v108 = (int)pFaceIDLIST; 1677 //v108 = (int)pFaceIDLIST;
1831 //pFilename = (char *)(2 * v68); 1687 //pFilename = (char *)(2 * v68);
1832 memcpy(pFaceIDLIST, pSrc + 4, faceIDListSize); 1688 memcpy(pFaceIDLIST, pSrc + 4, faceIDListSize);
1833 pSrc += 4 + faceIDListSize; 1689 pSrc += 4 + faceIDListSize;
1834 1690
1835 //uSourceLen = (char *)uSourceLen + (int)pFilename; 1691 //uSourceLen = (char *)uSourceLen + (int)pFilename;
1836 pGameLoadingUI_ProgressBar->Progress(); 1692 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1837 1693
1838 //v108 = (int)pOMAP; 1694 //v108 = (int)pOMAP;
1839 //free((void *)v108); 1695 //free((void *)v108);
1840 //pOMAP = 0; 1696 //pOMAP = 0;
1841 free(pOMAP); 1697 free(pOMAP);
1849 //uSourceLen = (char *)uSourceLen + 65536; 1705 //uSourceLen = (char *)uSourceLen + 65536;
1850 pGameLoadingUI_ProgressBar->Progress(); 1706 pGameLoadingUI_ProgressBar->Progress();
1851 1707
1852 memcpy(&uNumSpawnPoints, pSrc, 4); 1708 memcpy(&uNumSpawnPoints, pSrc, 4);
1853 //uSourceLen = (char *)uSourceLen + 4; 1709 //uSourceLen = (char *)uSourceLen + 4;
1854 pGameLoadingUI_ProgressBar->Progress(); 1710 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1855 //v70 = uNumSpawnPoints; 1711 //v70 = uNumSpawnPoints;
1856 //v108 = (int)"Spawn"; 1712 //v108 = (int)"Spawn";
1857 //v107 = 24 * v70; 1713 //v107 = 24 * v70;
1858 //v106 = (char *)pSpawnPoints; 1714 //v106 = (char *)pSpawnPoints;
1859 assert(sizeof(SpawnPointMM7) == 24); 1715 assert(sizeof(SpawnPointMM7) == 24);
1862 //v72 = uNumSpawnPoints; 1718 //v72 = uNumSpawnPoints;
1863 //pSpawnPoints = v71; 1719 //pSpawnPoints = v71;
1864 memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize); 1720 memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize);
1865 pSrc += 4 + spawnPointsSize; 1721 pSrc += 4 + spawnPointsSize;
1866 1722
1867 pGameLoadingUI_ProgressBar->Progress(); 1723 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1868 1724
1725 //****************.ddm file*********************//
1869 free(pSrcMem); 1726 free(pSrcMem);
1870
1871 //v108 = (int)".ddm";
1872 //v73 = strlen(pContainer);
1873 strcpy(Str + strlen(Str) - 4, ".ddm"); 1727 strcpy(Str + strlen(Str) - 4, ".ddm");
1874 //strcpy((char *)v141 + v73, (const char *)v108); 1728 pFile = pNew_LOD->FindContainer(Str, 1);
1875 v39 = pNew_LOD->FindContainer(Str, 1);//error 1729 fread(&header, 0x10, 1, pFile);
1876 fread(&header, 0x10u, 1, v39);
1877 Str2 = 0; 1730 Str2 = 0;
1878 if (header.uVersion != 91969 || 1731 if (header.uVersion != 91969 ||
1879 header.pMagic[0] != 'm' || 1732 header.pMagic[0] != 'm' ||
1880 header.pMagic[1] != 'v' || 1733 header.pMagic[1] != 'v' ||
1881 header.pMagic[2] != 'i' || 1734 header.pMagic[2] != 'i' ||
1892 { 1745 {
1893 pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); 1746 pSrcMem = (unsigned char *)malloc(header.uDecompressedSize);
1894 pSrc = pSrcMem; 1747 pSrc = pSrcMem;
1895 //v149 = v75; 1748 //v149 = v75;
1896 if (header.uCompressedSize == header.uDecompressedSize) 1749 if (header.uCompressedSize == header.uDecompressedSize)
1897 fread(pSrc, header.uDecompressedSize, 1u, v39); 1750 fread(pSrc, header.uDecompressedSize, 1, pFile);
1898 else if (header.uCompressedSize < header.uDecompressedSize) 1751 else if (header.uCompressedSize < header.uDecompressedSize)
1899 { 1752 {
1900 void* compressedMem = malloc(header.uCompressedSize); 1753 void* compressedMem = malloc(header.uCompressedSize);
1901 fread(compressedMem, header.uCompressedSize, 1, v39); 1754 fread(compressedMem, header.uCompressedSize, 1, pFile);
1902 1755
1903 uint actualDecompressedSize = header.uDecompressedSize; 1756 uint actualDecompressedSize = header.uDecompressedSize;
1904 zlib::MemUnzip(pSrc, &actualDecompressedSize, compressedMem, header.uCompressedSize); 1757 zlib::MemUnzip(pSrc, &actualDecompressedSize, compressedMem, header.uCompressedSize);
1905 free(compressedMem); 1758 free(compressedMem);
1906 } 1759 }
1907 else 1760 else
1908 MessageBoxW(nullptr, L"Can't load file!", 1761 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0);
1909 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0);
1910 1762
1911 assert(sizeof(DDM_DLV_Header) == 0x28); 1763 assert(sizeof(DDM_DLV_Header) == 0x28);
1912 memcpy(&ddm, pSrc, sizeof(DDM_DLV_Header)); 1764 memcpy(&ddm, pSrc, sizeof(DDM_DLV_Header));
1913 pSrc += sizeof(DDM_DLV_Header); 1765 pSrc += sizeof(DDM_DLV_Header);
1914 //v74 = (int)((char *)v75 + 40); 1766 //v74 = (int)((char *)v75 + 40);
1915 } 1767 }
1916 uint actualNumFacesInLevel = 0; 1768 uint actualNumFacesInLevel = 0;
1917 for (uint i = 0; i < uNumBModels; ++i) 1769 for (uint i = 0; i < uNumBModels; ++i)
1918 actualNumFacesInLevel += pBModels[i].uNumFaces; 1770 actualNumFacesInLevel += pBModels[i].uNumFaces;
1919 1771
1920 //v79 = ddm.uNumFacesInBModels;
1921 if (ddm.uNumFacesInBModels) 1772 if (ddm.uNumFacesInBModels)
1922 { 1773 {
1923 if ( ddm.uNumBModels ) 1774 if ( ddm.uNumBModels )
1924 { 1775 {
1925 //v80 = ddm.uNumDecorations;
1926 if (ddm.uNumDecorations) 1776 if (ddm.uNumDecorations)
1927 { 1777 {
1928 if (ddm.uNumFacesInBModels != actualNumFacesInLevel || 1778 if (ddm.uNumFacesInBModels != actualNumFacesInLevel ||
1929 ddm.uNumBModels != uNumBModels || 1779 ddm.uNumBModels != uNumBModels ||
1930 ddm.uNumDecorations != uNumLevelDecorations ) 1780 ddm.uNumDecorations != uNumLevelDecorations )
1939 if (Str2 || ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay)) 1789 if (Str2 || ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay))
1940 { 1790 {
1941 1791
1942 if (Str2) 1792 if (Str2)
1943 { 1793 {
1944 memset(Dst, 0, 0x3C8u); 1794 memset(Dst, 0, 0x3C8);
1945 memset(Src, 0, 0x3C8u); 1795 memset(Src, 0, 0x3C8);
1946 //goto LABEL_112;
1947 } 1796 }
1948 //v81 = ddm.uLastRepawnDay;
1949 if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay) 1797 if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay)
1950 { 1798 {
1951 memcpy(Dst, pSrc, 0x3C8u); 1799 memcpy(Dst, pSrc, 968);
1952 memcpy(Src, pSrc + 968, 0x3C8u); 1800 memcpy(Src, pSrc + 968, 968);
1953 } 1801 }
1954 //LABEL_112:
1955 free(pSrcMem); 1802 free(pSrcMem);
1956 1803
1957 ddm.uLastRepawnDay = (int)File; 1804 ddm.uLastRepawnDay = (int)File;
1958 if (Str2 == 0) 1805 if (Str2 == 0)
1959 ++ddm.uNumRespawns; 1806 ++ddm.uNumRespawns;
1960 v108 = 0; 1807 v108 = 0;
1961 *thisa = 1; 1808 *thisa = 1;
1962 v39 = pGames_LOD->FindContainer(Str, 0); 1809 pFile = pGames_LOD->FindContainer(Str, 0);
1963 fread(&header, 0x10, 1u, v39); 1810 fread(&header, 0x10, 1, pFile);
1964 //pFilename = (char *)header.uCompressedSize; 1811 //pFilename = (char *)header.uCompressedSize;
1965 //pDestLen = header.uDecompressedSize; 1812 //pDestLen = header.uDecompressedSize;
1966 //v82 = malloc(header.uDecompressedSize); 1813 //v82 = malloc(header.uDecompressedSize);
1967 pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); 1814 pSrcMem = (unsigned char *)malloc(header.uDecompressedSize);
1968 //v149 = v82; 1815 //v149 = v82;
1969 if (header.uCompressedSize == header.uDecompressedSize) 1816 if (header.uCompressedSize == header.uDecompressedSize)
1970 fread(pSrcMem, header.uDecompressedSize, 1, v39); 1817 fread(pSrcMem, header.uDecompressedSize, 1, pFile);
1971 else if (header.uCompressedSize < header.uDecompressedSize) 1818 else if (header.uCompressedSize < header.uDecompressedSize)
1972 { 1819 {
1973 void* compressedMem = malloc(header.uCompressedSize); 1820 void* compressedMem = malloc(header.uCompressedSize);
1974 fread(compressedMem, header.uCompressedSize, 1u, v39); 1821 fread(compressedMem, header.uCompressedSize, 1, pFile);
1975 1822
1976 uint actualDecompressedSize = header.uDecompressedSize; 1823 uint actualDecompressedSize = header.uDecompressedSize;
1977 zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize); 1824 zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize);
1978 free(compressedMem); 1825 free(compressedMem);
1979 } 1826 }
1980 else 1827 else
1981 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0); 1828 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0);
1982 1829
1983 pSrc = pSrcMem + 40; 1830 pSrc = pSrcMem + 40;
1984 //goto LABEL_120;
1985 } 1831 }
1986 else 1832 else
1987 *thisa = 0; 1833 *thisa = 0;
1988 //LABEL_120: 1834 memcpy(uFullyRevealedCellOnMap, pSrc, 968);
1989 //v108 = (int)".odm"; 1835 memcpy(uPartiallyRevealedCellOnMap, pSrc + 968, 968);
1990 //v83 = strlen(pContainer); 1836 pSrc += 2 * 968;
1991 //strcpy((char *)v141 + v83, (const char *)v108); 1837
1992 memcpy(uFullyRevealedCellOnMap, pSrc, 0x3C8); 1838 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1993 //v84 = (const void *)(v74 + 968);
1994 memcpy(uPartiallyRevealedCellOnMap, pSrc + 0x3C8, 0x3C8);
1995 pSrc += 2 * 0x3C8;
1996 //v85 = (char *)v84 + 968;
1997
1998 pGameLoadingUI_ProgressBar->Progress();
1999 1839
2000 if ( *thisa ) 1840 if ( *thisa )
2001 { 1841 {
2002 memcpy(uFullyRevealedCellOnMap, Dst, 0x3C8u); 1842 memcpy(uFullyRevealedCellOnMap, Dst, 968);
2003 memcpy(uPartiallyRevealedCellOnMap, Src, 0x3C8u); 1843 memcpy(uPartiallyRevealedCellOnMap, Src, 968);
2004 } 1844 }
2005 1845
2006 for (uint i = 0; i < uNumBModels; ++i) 1846 for (uint i = 0; i < uNumBModels; ++i)
2007 { 1847 {
2008 BSPModel model = pBModels[i]; 1848 BSPModel model = pBModels[i];
2024 face.uAttributes &= ~FACE_HAS_EVENT_HINT;//~0x00001000 1864 face.uAttributes &= ~FACE_HAS_EVENT_HINT;//~0x00001000
2025 } 1865 }
2026 } 1866 }
2027 } 1867 }
2028 1868
2029 pGameLoadingUI_ProgressBar->Progress(); 1869 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
2030 1870
2031 for (uint i = 0; i < uNumLevelDecorations; ++i) 1871 for (uint i = 0; i < uNumLevelDecorations; ++i)
2032 { 1872 {
2033 memcpy(&pLevelDecorations[i].uFlags, pSrc, 2); 1873 memcpy(&pLevelDecorations[i].uFlags, pSrc, 2);
2034 pSrc += 2; 1874 pSrc += 2;
2035 } 1875 }
2036 1876
2037 pGameLoadingUI_ProgressBar->Progress(); 1877 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
2038 1878
2039 memcpy(&uNumActors, pSrc, 4); 1879 memcpy(&uNumActors, pSrc, 4);
2040 if (uNumActors > 500) 1880 if (uNumActors > 500)
2041 MessageBoxW(nullptr, L"Can't load file!", 1881 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:939", 0);
2042 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:939", 0); 1882
2043 1883 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
2044 pGameLoadingUI_ProgressBar->Progress();
2045 1884
2046 assert(sizeof(Actor) == 836); 1885 assert(sizeof(Actor) == 836);
2047 //pFilename = (char *)(836 * uNumActors); 1886 //pFilename = (char *)(836 * uNumActors);
2048 memcpy(pActors.data(), pSrc + 4, uNumActors * sizeof(Actor)); 1887 memcpy(pActors.data(), pSrc + 4, uNumActors * sizeof(Actor));
2049 pSrc += 4 + uNumActors * sizeof(Actor); 1888 pSrc += 4 + uNumActors * sizeof(Actor);
2050 //v92 = (char *)v91 + (int)pFilename; 1889 //v92 = (char *)v91 + (int)pFilename;
2051 pGameLoadingUI_ProgressBar->Progress(); 1890 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
2052 1891
2053 memcpy(&uNumSpriteObjects, pSrc, 4); 1892 memcpy(&uNumSpriteObjects, pSrc, 4);
2054 assert(uNumSpriteObjects <= 1000 && "Too many objects"); 1893 assert(uNumSpriteObjects <= 1000 && "Too many objects");
2055 assert(sizeof(SpriteObject) == 112); 1894 assert(sizeof(SpriteObject) == 112);
2056 1895
2057 pGameLoadingUI_ProgressBar->Progress(); 1896 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
2058 1897
2059 //pFilename = (char *)(112 * uNumSpriteObjects); 1898 //pFilename = (char *)(112 * uNumSpriteObjects);
2060 memcpy(pSpriteObjects.data(), pSrc + 4, uNumSpriteObjects * sizeof(SpriteObject)); 1899 memcpy(pSpriteObjects.data(), pSrc + 4, uNumSpriteObjects * sizeof(SpriteObject));
2061 pSrc += 4 + uNumSpriteObjects * sizeof(SpriteObject); 1900 pSrc += 4 + uNumSpriteObjects * sizeof(SpriteObject);
2062 1901
2063 //v94 = (char *)v93 + (int)pFilename; 1902 //v94 = (char *)v93 + (int)pFilename;
2064 pGameLoadingUI_ProgressBar->Progress(); 1903 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
2065 1904
2066 memcpy(&uNumChests, pSrc, 4); 1905 memcpy(&uNumChests, pSrc, 4);
2067 //v95 = (char *)v94 + 4; 1906 //v95 = (char *)v94 + 4;
2068 if (uNumChests > 20) 1907 if (uNumChests > 20)
2069 MessageBoxW(nullptr, L"Can't load file!", 1908 MessageBoxW(nullptr, L"Can't load file!",
2070 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:968", 0); 1909 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:968", 0);
2071 1910
2072 pGameLoadingUI_ProgressBar->Progress(); 1911 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
2073 1912
2074 assert(sizeof(Chest) == 5324); 1913 assert(sizeof(Chest) == 5324);
2075 //pFilename = (char *)(5324 * uNumChests); 1914 //pFilename = (char *)(5324 * uNumChests);
2076 memcpy(pChests.data(), pSrc + 4 , uNumChests * sizeof(Chest)); 1915 memcpy(pChests.data(), pSrc + 4 , uNumChests * sizeof(Chest));
2077 pSrc += 4 + uNumChests * sizeof(Chest); 1916 pSrc += 4 + uNumChests * sizeof(Chest);
2078 //v96 = (char *)v95 + (int)pFilename; 1917 //v96 = (char *)v95 + (int)pFilename;
2079 pGameLoadingUI_ProgressBar->Progress(); 1918 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
2080 1919
2081 memcpy(&stru_5E4C90_MapPersistVars, pSrc, 0xC8); 1920 memcpy(&stru_5E4C90_MapPersistVars, pSrc, 0xC8);
2082 pSrc += 0xC8; 1921 pSrc += 0xC8;
2083 1922
2084 pGameLoadingUI_ProgressBar->Progress(); 1923 pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
2085 memcpy(&loc_time, pSrc, 0x38u); 1924 memcpy(&loc_time, pSrc, 0x38u);
2086 1925
2087 free(pSrcMem); 1926 free(pSrcMem);
2088 1927
2089 pTileTable->InitializeTileset(Tileset_Dirt); 1928 pTileTable->InitializeTileset(Tileset_Dirt);
2115 } 1954 }
2116 } 1955 }
2117 else 1956 else
2118 strcpy(loc_time.sky_texture_name, "plansky3"); 1957 strcpy(loc_time.sky_texture_name, "plansky3");
2119 1958
1959 //New_SKY_NIGHT_ID = pBitmaps_LOD->LoadTexture("SKY13");
1960 //if (New_SKY_NIGHT_ID != -1)
1961 // pBitmaps_LOD->pTextures[New_SKY_NIGHT_ID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[New_SKY_NIGHT_ID].palette_id1);
1962
2120 //v101 = pBitmaps_LOD->LoadTexture(field_4F8); 1963 //v101 = pBitmaps_LOD->LoadTexture(field_4F8);
2121 sSky_TextureID = pBitmaps_LOD->LoadTexture(loc_time.sky_texture_name); 1964 sSky_TextureID = pBitmaps_LOD->LoadTexture(loc_time.sky_texture_name);
2122 if (sSky_TextureID != -1) 1965 if (sSky_TextureID != -1)
2123 pBitmaps_LOD->pTextures[sSky_TextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[sSky_TextureID].palette_id1); 1966 pBitmaps_LOD->pTextures[sSky_TextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[sSky_TextureID].palette_id1);
2124 1967
2125 pPaletteManager->RecalculateAll(); 1968 pPaletteManager->RecalculateAll();
2126 pSoundList->LoadSound(53, 0); 1969 pSoundList->LoadSound(SOUND_RunDirt, 0); //For Dirt tyle(для звука хождения по грязи)
2127 pSoundList->LoadSound(92, 0); 1970 pSoundList->LoadSound(SOUND_WalkDirt, 0); //для бега
2128 pSoundList->LoadSound(57, 0); 1971 pSoundList->LoadSound(SOUND_RunRoad, 0); //для звука хождения по дороге
2129 pSoundList->LoadSound(96, 0); 1972 pSoundList->LoadSound(SOUND_WalkRoad, 0);
2130 pSoundList->LoadSound(64, 0); 1973 pSoundList->LoadSound(SOUND_RunWood, 0); //для звука хождения по дереву
2131 pSoundList->LoadSound(103, 0); 1974 pSoundList->LoadSound(SOUND_WalkWood, 0);
2132 for (int i=0; i < 3;++i) 1975 for (int i=0; i < 3;++i)
2133 { 1976 {
2134 switch ( pTileTypes[i].tileset ) 1977 switch ( pTileTypes[i].tileset )
2135 { 1978 {
2136 case Tileset_Grass: 1979 case Tileset_Grass:
2137 pSoundList->LoadSound(54, 0); 1980 pSoundList->LoadSound(SOUND_RunGrass, 0); //для звука хождения по траве
2138 pSoundList->LoadSound(93, 0); 1981 pSoundList->LoadSound(SOUND_WalkGrass, 0);
2139 break; 1982 break;
2140 case Tileset_Snow: 1983 case Tileset_Snow:
2141 pSoundList->LoadSound(58, 0); 1984 pSoundList->LoadSound(SOUND_RunSnow, 0); //по снегу
2142 pSoundList->LoadSound(97, 0); 1985 pSoundList->LoadSound(SOUND_WalkSnow, 0);
2143 break; 1986 break;
2144 case Tilset_Desert: 1987 case Tilset_Desert:
2145 pSoundList->LoadSound(52, 0); 1988 pSoundList->LoadSound(SOUND_RunDesert, 0); //по пустыне
2146 pSoundList->LoadSound(91, 0); 1989 pSoundList->LoadSound(SOUND_WalkDesert, 0);
2147 break; 1990 break;
2148 case Tileset_3: 1991 case Tileset_CooledLava:
2149 pSoundList->LoadSound(51, 0); 1992 pSoundList->LoadSound(SOUND_RunCooledLava, 0);//по лаве
2150 pSoundList->LoadSound(90, 0); 1993 pSoundList->LoadSound(SOUND_WalkCooledLava, 0);
2151 break; 1994 break;
2152 case Tileset_Water: 1995 case Tileset_Water:
2153 pSoundList->LoadSound(62, 0); 1996 pSoundList->LoadSound(SOUND_RunWater, 0); //по воде
2154 pSoundList->LoadSound(101, 0); 1997 pSoundList->LoadSound(SOUND_WalkWater, 0);
2155 break; 1998 break;
2156 case Tileset_6: 1999 case Tileset_Badlands:
2157 pSoundList->LoadSound(49, 0); 2000 pSoundList->LoadSound(SOUND_RunBadlands, 0); //для звука ходьбы по бесплодным землям
2158 pSoundList->LoadSound(88, 0); 2001 pSoundList->LoadSound(SOUND_WalkBadlands, 0);
2159 break; 2002 break;
2160 case Tileset_Swamp: 2003 case Tileset_Swamp:
2161 pSoundList->LoadSound(61, 0); 2004 pSoundList->LoadSound(SOUND_RunSwamp, 0); //по болоту
2162 pSoundList->LoadSound(100, 0); 2005 pSoundList->LoadSound(SOUND_WalkSwamp, 0);
2163 break; 2006 break;
2164 } 2007 }
2165 } 2008 }
2166 return true; 2009 return true;
2167 } 2010 }
2175 if ( a2 >= 90 ) 2018 if ( a2 >= 90 )
2176 { 2019 {
2177 v3 = (a2 - 90) / 36; 2020 v3 = (a2 - 90) / 36;
2178 if ( v3 && v3 != 1 && v3 != 2 ) 2021 if ( v3 && v3 != 1 && v3 != 2 )
2179 { 2022 {
2180 if ( v3 == Tileset_3 ) 2023 if ( v3 == Tileset_CooledLava )
2181 result = this->pTileTypes[3].uTileID; 2024 result = this->pTileTypes[3].uTileID;
2182 else 2025 else
2183 result = a2; 2026 result = a2;
2184 } 2027 }
2185 else 2028 else
3119 void ODM_ProcessPartyActions() 2962 void ODM_ProcessPartyActions()
3120 { 2963 {
3121 int v1; // edi@1 2964 int v1; // edi@1
3122 int v2; // ebx@1 2965 int v2; // ebx@1
3123 int floor_level; // eax@14 2966 int floor_level; // eax@14
3124 int v6; // esi@45
3125 ODMFace *face; // ecx@45 2967 ODMFace *face; // ecx@45
3126 //signed int v33; // eax@143
3127 int v34; // esi@143 2968 int v34; // esi@143
3128 int v35; // esi@147 2969 int v35; // esi@147
3129 int v36; // eax@155 2970 int v36; // eax@155
3130 // signed int v37; // esi@159
3131 // signed int v38; // eax@159
3132 // signed int i; // esi@159
3133 int v40; // esi@162 2971 int v40; // esi@162
3134 bool v42; // eax@180 2972 bool v42; // eax@180
3135 signed int v43; // ecx@184 2973 signed int v43; // ecx@184
3136 signed int v44; // edx@184 2974 signed int v44; // edx@184
3137 int v45; // ecx@200 2975 int v45; // ecx@200
3142 int v54; // eax@215 2980 int v54; // eax@215
3143 int v55; // eax@217 2981 int v55; // eax@217
3144 unsigned int v66; // esi@263 2982 unsigned int v66; // esi@263
3145 signed int v68; // ecx@263 2983 signed int v68; // ecx@263
3146 int v69; // eax@263 2984 int v69; // eax@263
3147 // unsigned int v76; // edi@293
3148 bool v77; // edx@297 2985 bool v77; // edx@297
3149 bool v78; // ecx@303 2986 bool v78; // ecx@303
3150 int v79; // ecx@314 2987 int v79; // ecx@314
3151 __int16 v80; // dx@317 2988 __int16 v80; // dx@317
3152 //int v81; // ebx@318
3153 //int v82; // ecx@318
3154 int pTerrainHeight; // eax@321 2989 int pTerrainHeight; // eax@321
3155 // int v86; // [sp-20h] [bp-B4h]@246
3156 int v87; // [sp-20h] [bp-B4h]@248 2990 int v87; // [sp-20h] [bp-B4h]@248
3157 int v97; // [sp+Ch] [bp-88h]@180 2991 int v97; // [sp+Ch] [bp-88h]@180
3158 Vec3_int_ v98; 2992 Vec3_int_ v98;
3159 bool not_high_fall; // [sp+1Ch] [bp-78h]@33 2993 bool not_high_fall; // [sp+1Ch] [bp-78h]@33
3160 int v102; // [sp+20h] [bp-74h]@1 2994 int v102; // [sp+20h] [bp-74h]@1
3170 int v113; // [sp+4Ch] [bp-48h]@1 3004 int v113; // [sp+4Ch] [bp-48h]@1
3171 bool party_running_flag; // [sp+50h] [bp-44h]@1 3005 bool party_running_flag; // [sp+50h] [bp-44h]@1
3172 int _walk_speed; // [sp+54h] [bp-40h]@48 3006 int _walk_speed; // [sp+54h] [bp-40h]@48
3173 int pX; // [sp+58h] [bp-3Ch]@1 3007 int pX; // [sp+58h] [bp-3Ch]@1
3174 int pY; // [sp+5Ch] [bp-38h]@1 3008 int pY; // [sp+5Ch] [bp-38h]@1
3009 int party_new_Z; // [sp+74h] [bp-20h]@1
3175 int v118; // [sp+60h] [bp-34h]@1 3010 int v118; // [sp+60h] [bp-34h]@1
3176 int _angle_x; // [sp+68h] [bp-2Ch]@48 3011 int _angle_x; // [sp+68h] [bp-2Ch]@48
3177 unsigned int v122; // [sp+70h] [bp-24h]@180 3012 unsigned int v122; // [sp+70h] [bp-24h]@180
3178 int pZ; // [sp+74h] [bp-20h]@1 3013
3179 bool party_walking_flag; // [sp+78h] [bp-1Ch]@1 3014 bool party_walking_flag; // [sp+78h] [bp-1Ch]@1
3180 int _angle_y; // [sp+7Ch] [bp-18h]@48 3015 int _angle_y; // [sp+7Ch] [bp-18h]@48
3181 int v128; // [sp+88h] [bp-Ch]@1 3016 int v128; // [sp+88h] [bp-Ch]@1
3182 int v129; // [sp+8Ch] [bp-8h]@92 3017 int v129; // [sp+8Ch] [bp-8h]@92
3183 3018
3186 v2 = 0; 3021 v2 = 0;
3187 //*(float *)&v128 = 0.0; 3022 //*(float *)&v128 = 0.0;
3188 int fall_speed = pParty->uFallSpeed; 3023 int fall_speed = pParty->uFallSpeed;
3189 v128 = 0; 3024 v128 = 0;
3190 v129 = 0; 3025 v129 = 0;
3026
3191 pX = pParty->vPosition.x; 3027 pX = pParty->vPosition.x;
3192 pY = pParty->vPosition.y; 3028 pY = pParty->vPosition.y;
3193 pZ = pParty->vPosition.z; 3029 party_new_Z = pParty->vPosition.z;
3030
3194 v113 = pParty->field_6F0; 3031 v113 = pParty->field_6F0;
3195 hovering = false; 3032 hovering = false;
3196 bool partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y); 3033 bool partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y);
3197 party_running_flag = false; 3034 party_running_flag = false;
3198 party_walking_flag = false; 3035 party_walking_flag = false;
3199 v102 = 0; 3036 v102 = 0;
3200 pModel_ = false; 3037 pModel_ = false;
3201 bWaterWalk = false; 3038 bWaterWalk = false;
3202 3039 //************************************
3203 if (!pParty->FeatherFallActive())//Проверка падение пера 3040 //Проверка падение пера
3041 if (!pParty->FeatherFallActive())
3204 { 3042 {
3205 bFeatherFall = false; 3043 bFeatherFall = false;
3206 for (int i = 0; i < 4; ++i) 3044 for (int i = 0; i < 4; ++i)
3207 if (pParty->pPlayers[i].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)) // seems like flying boots 3045 if (pParty->pPlayers[i].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)) // seems like flying boots
3208 { 3046 {
3210 break; 3048 break;
3211 } 3049 }
3212 } 3050 }
3213 else 3051 else
3214 bFeatherFall = true; 3052 bFeatherFall = true;
3215 3053 //************************************
3054 //Проверка хождения по воде
3216 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; 3055 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
3217 if (pParty->WaterWalkActive())//Проверка хождения по воде 3056 if (pParty->WaterWalkActive())
3218 { 3057 {
3219 //LOBYTE(pParty->uFlags) &= 0x7Fu; 3058 //LOBYTE(pParty->uFlags) &= 0x7Fu;
3220 bWaterWalk = true; 3059 bWaterWalk = true;
3221 *(short *)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1; 3060 *(short *)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1;
3222 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) && 3061 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) &&
3223 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 ) 3062 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 )
3224 bWaterWalk = false; 3063 bWaterWalk = false;
3225 } 3064 }
3226 3065 //*************************************
3227 int bmodel_standing_on_pid; 3066 //определение уровня пола
3228 int is_on_water = false; 3067 int bmodel_standing_on_pid; //данные 3D model'и
3229 floor_level = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk); 3068 int is_on_water = false; //на воду
3230 int is_not_on_bmodel = bmodel_standing_on_pid == 0; 3069 floor_level = ODM_GetFloorLevel(pX, pY, party_new_Z, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk);
3231 3070 int is_not_on_bmodel = bmodel_standing_on_pid == 0; //не на 3D model
3232 v111 = floor_level; 3071
3233 if ( bFeatherFall ) 3072 v111 = floor_level; //???
3073 //************************************
3074 //определение высоты падения
3075 if ( bFeatherFall ) //падение пера
3234 pParty->uFallStartY = floor_level; 3076 pParty->uFallStartY = floor_level;
3235 else 3077 else
3236 floor_level = pParty->uFallStartY; 3078 floor_level = pParty->uFallStartY;
3237 3079 //*************************************
3238 if ( floor_level - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 )//падение на 3D Model 3080 //падение на 3D Model
3081 if ( floor_level - party_new_Z > 512 && !bFeatherFall && party_new_Z <= v111 + 1 )
3239 { 3082 {
3240 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) 3083 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
3241 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; 3084 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
3242 else for (int i = 0; i < 4; ++i) // receive falling damage 3085 else for (int i = 0; i < 4; ++i) // receive falling damage
3243 { 3086 {
3244 if ( !pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) 3087 if ( !pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) )
3245 { 3088 {
3246 pParty->pPlayers[i].ReceiveDamage( 3089 pParty->pPlayers[i].ReceiveDamage(
3247 (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(pParty->pPlayers[i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL); 3090 (signed int)((pParty->uFallStartY - party_new_Z) * (unsigned __int64)(pParty->pPlayers[i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL);
3248 bonus = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance()); 3091 bonus = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance());
3249 pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)bonus * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); 3092 pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)bonus * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
3250 } 3093 }
3251 } 3094 }
3252 } 3095 }
3253 3096 //*********************************
3097 //определение высоты потолка
3254 ceiling_height = -1; 3098 ceiling_height = -1;
3255 if ( pParty->bFlying ) 3099 if ( pParty->bFlying ) //в полёте
3256 ceiling_height = GetCeilingHeight(pX, pY, pZ + pParty->uPartyHeight, (int)&v102);//высота потолка 3100 ceiling_height = GetCeilingHeight(pX, pY, party_new_Z + pParty->uPartyHeight, (int)&v102);//высота потолка
3257 //v107 = bmodel_standing_on_pid == 0; 3101 //v107 = bmodel_standing_on_pid == 0;
3258 on_ground = v111 + 1; 3102 on_ground = v111 + 1; //на земле
3259 if ( pZ <= on_ground )//полёт: посадка 3103 //**************************************
3104
3105 if ( party_new_Z <= on_ground )//полёт: посадка
3260 { 3106 {
3261 ceiling_height = -1; 3107 ceiling_height = -1;
3262 pParty->bFlying = false; 3108 pParty->bFlying = false;
3263 } 3109 }
3264 else 3110 else
3265 hovering = true; 3111 hovering = true;
3266 not_high_fall = pZ - v111 <= 32; 3112 not_high_fall = party_new_Z - v111 <= 32;
3267 3113 //****************************************
3268 if ( bWalkSound && pParty->walk_sound_timer)//timer update 3114 //timer update(обновить таймер звука ходьбы)
3115 if ( bWalkSound && pParty->walk_sound_timer)
3269 { 3116 {
3270 if (pParty->walk_sound_timer >= pEventTimer->uTimeElapsed) 3117 if (pParty->walk_sound_timer >= pEventTimer->uTimeElapsed)
3271 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed; 3118 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
3272 else 3119 else
3273 pParty->walk_sound_timer = 0; 3120 pParty->walk_sound_timer = 0;
3274 } 3121 }
3275 3122 //****************************************
3276 if (!bUnderwater && pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime <= 0)// конец действия полёта 3123 // конец действия полёта
3124 if (!bUnderwater && pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime <= 0)//не под водой и время закла полёта закончилось
3277 pParty->bFlying = false; 3125 pParty->bFlying = false;
3278 3126 //*****************************************
3279 if (!hovering)// 3127 // установить на чём стоит группа
3128 if (!hovering)//не в воздухе
3280 { 3129 {
3281 if ( pParty->floor_face_pid != PID(OBJECT_BModel, bmodel_standing_on_pid) ) 3130 if ( pParty->floor_face_pid != PID(OBJECT_BModel, bmodel_standing_on_pid) )
3282 { 3131 {
3283 if (bmodel_standing_on_pid) 3132 if (bmodel_standing_on_pid)
3284 { 3133 {
3285 if ( (bmodel_standing_on_pid >> 6) < pOutdoor->uNumBModels ) 3134 int BModel_id = bmodel_standing_on_pid >> 6;
3135 if ( BModel_id < pOutdoor->uNumBModels )
3286 { 3136 {
3287 face = pOutdoor->pBModels[bmodel_standing_on_pid >> 6].pFaces; 3137 face = pOutdoor->pBModels[BModel_id].pFaces;
3288 v6 = bmodel_standing_on_pid & 0x3F; 3138 int face_id = bmodel_standing_on_pid & 0x3F;
3289 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) 3139 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 )
3290 { 3140 {
3291 pParty->field_6F4_packedid = PID(OBJECT_BModel,v108); 3141 pParty->field_6F4_packedid = PID(OBJECT_BModel,v108);
3292 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); 3142 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
3293 }*/ 3143 }*/
3294 if ( face[v6].uAttributes & FACE_PRESSURE_PLATE ) 3144 if ( face[face_id].uAttributes & FACE_PRESSURE_PLATE )
3295 { 3145 {
3296 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); 3146 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);
3297 trigger_id = face[v6].sCogTriggeredID; // 3147 trigger_id = face[face_id].sCogTriggeredID; //EVT, панель имеет событие
3298 } 3148 }
3299 } 3149 }
3300 } 3150 }
3301 } 3151 }
3302 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); 3152 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);//6 - на земле
3303 } 3153 }
3304 3154 //***********************************************
3305 _walk_speed = pParty->uWalkSpeed; 3155 _walk_speed = pParty->uWalkSpeed;
3306 _angle_y = pParty->sRotationY; 3156 _angle_y = pParty->sRotationY;
3307 _angle_x = pParty->sRotationX; 3157 _angle_x = pParty->sRotationX;
3308 //v126 = pEventTimer->dt_in_some_format; 3158 //v126 = pEventTimer->dt_in_some_format;
3309 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format 3159 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format
3326 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 ) 3176 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )
3327 { 3177 {
3328 extern int max_flight_height; 3178 extern int max_flight_height;
3329 if ( pParty->vPosition.z < max_flight_height || hovering ) 3179 if ( pParty->vPosition.z < max_flight_height || hovering )
3330 { 3180 {
3331 pZ += 30; 3181 party_new_Z += 30;
3332 v113 += 30; 3182 v113 += 30;
3333 pParty->bFlying = true; 3183 pParty->bFlying = true;
3334 if ( pZ > max_flight_height ) 3184 if ( party_new_Z > max_flight_height )
3335 { 3185 {
3336 pZ = max_flight_height; 3186 party_new_Z = max_flight_height;
3337 v113 = max_flight_height; 3187 v113 = max_flight_height;
3338 } 3188 }
3339 v1 = 0; 3189 v1 = 0;
3340 v2 = 0; 3190 v2 = 0;
3341 fall_speed = 0; 3191 fall_speed = 0;
3342 *(float *)&v128 = 0.0; 3192 *(float *)&v128 = 0.0;
3343 if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//столкновение с потолком 3193 if ( v102 && party_new_Z < ceiling_height && (signed int)(pParty->uPartyHeight + party_new_Z) >= ceiling_height )//столкновение с потолком
3344 { 3194 {
3345 pParty->field_6E0 = 0; 3195 pParty->field_6E0 = 0;
3346 pParty->field_6E4 = 0; 3196 pParty->field_6E4 = 0;
3347 pPartyActionQueue->uNumActions = 0; 3197 pPartyActionQueue->uNumActions = 0;
3348 pParty->uFlags |= PARTY_FLAGS_1_LANDING; 3198 pParty->uFlags |= PARTY_FLAGS_1_LANDING;
3349 pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31; 3199 pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31;
3350 pParty->field_6F0 = pZ; 3200 pParty->field_6F0 = party_new_Z;
3351 pParty->bFlying = false; 3201 pParty->bFlying = false;
3352 pZ = ceiling_height - pParty->uPartyHeight - 31; 3202 party_new_Z = ceiling_height - pParty->uPartyHeight - 31;
3353 v113 = pParty->field_6F0; 3203 v113 = pParty->field_6F0;
3354 } 3204 }
3355 pParty->uFallSpeed = 0; 3205 pParty->uFallSpeed = 0;
3356 pModel_ = true; 3206 pModel_ = true;
3357 } 3207 }
3365 pParty->bFlying = false; 3215 pParty->bFlying = false;
3366 if ( bUnderwater 3216 if ( bUnderwater
3367 || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 3217 || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1
3368 || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 ) 3218 || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 )
3369 { 3219 {
3370 pZ -= 30; 3220 party_new_Z -= 30;
3371 v113 -= 30; 3221 v113 -= 30;
3372 pParty->uFallSpeed = 0; 3222 pParty->uFallSpeed = 0;
3373 fall_speed = 0; 3223 fall_speed = 0;
3374 pParty->bFlying = true; 3224 pParty->bFlying = true;
3375 pModel_ = true; 3225 pModel_ = true;
3376 if ( pZ <= v111 ) 3226 if ( party_new_Z <= v111 )
3377 { 3227 {
3378 pParty->bFlying = false; 3228 pParty->bFlying = false;
3379 pPartyActionQueue->uNumActions = 0; 3229 pPartyActionQueue->uNumActions = 0;
3380 } 3230 }
3381 } 3231 }
3382 } 3232 }
3383 break; 3233 break;
3384 3234
3385 case PARTY_TurnLeft: 3235 case PARTY_TurnLeft://поворот влево
3386 if (uTurnSpeed) 3236 if (uTurnSpeed)
3387 _angle_y += uTurnSpeed; //descrete turn 3237 _angle_y += uTurnSpeed; //descrete turn
3388 else 3238 else
3389 _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn 3239 _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn
3390 3240
3391 _angle_y &= stru_5C6E00->uDoublePiMask; 3241 _angle_y &= stru_5C6E00->uDoublePiMask;
3392 break; 3242 break;
3393 3243
3394 case PARTY_TurnRight: 3244 case PARTY_TurnRight://поворот вправо
3395 if (uTurnSpeed) 3245 if (uTurnSpeed)
3396 _angle_y -= uTurnSpeed; 3246 _angle_y -= uTurnSpeed;
3397 else 3247 else
3398 _angle_y -= dturn * fTurnSpeedMultiplier; 3248 _angle_y -= dturn * fTurnSpeedMultiplier;
3399 3249
3400 _angle_y &= stru_5C6E00->uDoublePiMask; 3250 _angle_y &= stru_5C6E00->uDoublePiMask;
3401 break; 3251 break;
3402 3252
3403 case PARTY_FastTurnLeft: 3253 case PARTY_FastTurnLeft://быстрый поворот влево
3404 if (uTurnSpeed) 3254 if (uTurnSpeed)
3405 _angle_y += uTurnSpeed; 3255 _angle_y += uTurnSpeed;
3406 else 3256 else
3407 _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn; 3257 _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn;
3408 3258
3409 _angle_y &= stru_5C6E00->uDoublePiMask; 3259 _angle_y &= stru_5C6E00->uDoublePiMask;
3410 break; 3260 break;
3411 3261
3412 case PARTY_FastTurnRight: 3262 case PARTY_FastTurnRight://быстрый поворот вправо
3413 if (!uTurnSpeed) 3263 if (!uTurnSpeed)
3414 _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn; 3264 _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn;
3415 else 3265 else
3416 _angle_y -= uTurnSpeed; 3266 _angle_y -= uTurnSpeed;
3417 3267
3420 3270
3421 case PARTY_StrafeLeft://хождение боком в влево 3271 case PARTY_StrafeLeft://хождение боком в влево
3422 { 3272 {
3423 *(float *)&v128 = pParty->uWalkSpeed; 3273 *(float *)&v128 = pParty->uWalkSpeed;
3424 3274
3425 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); 3275 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
3426 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 3276 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3427 v2 -= 3 * dx / 4; 3277 v2 -= 3 * dx / 4;
3428 3278
3429 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); 3279 float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
3430 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 3280 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3431 v1 += 3 * dy / 4; 3281 v1 += 3 * dy / 4;
3432 3282
3433 v128 = v1; 3283 v128 = v1;
3434 party_walking_flag = true; 3284 party_walking_flag = true;
3437 3287
3438 case PARTY_StrafeRight://хождение боком в вправо 3288 case PARTY_StrafeRight://хождение боком в вправо
3439 { 3289 {
3440 *(float *)&v128 = pParty->uWalkSpeed; 3290 *(float *)&v128 = pParty->uWalkSpeed;
3441 3291
3442 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); 3292 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
3443 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 3293 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3444 v2 += 3 * dx / 4; 3294 v2 += 3 * dx / 4;
3445 3295
3446 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); 3296 float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
3447 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 3297 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3448 v1 -= 3 * dy / 4; 3298 v1 -= 3 * dy / 4;
3449 3299
3450 v128 = v1; 3300 v128 = v1;
3451 party_walking_flag = true; 3301 party_walking_flag = true;
3454 3304
3455 case PARTY_WalkForward:// идти вперёд 3305 case PARTY_WalkForward:// идти вперёд
3456 { 3306 {
3457 *(float *)&v128 = _walk_speed; 3307 *(float *)&v128 = _walk_speed;
3458 3308
3459 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), 3309 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0),
3460 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); 3310 cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
3461 3311
3462 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 3312 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3463 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 3313 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3464 3314
3465 if ( new_speed ) 3315 if ( new_speed )
3480 3330
3481 case PARTY_RunForward://бежать вперёд 3331 case PARTY_RunForward://бежать вперёд
3482 { 3332 {
3483 *(float *)&v128 = _walk_speed; 3333 *(float *)&v128 = _walk_speed;
3484 3334
3485 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); 3335 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
3486 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); 3336 float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
3487 3337
3488 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 3338 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3489 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 3339 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3490 3340
3491 if (pParty->bFlying)//лететь вперёд 3341 if (pParty->bFlying)//лететь вперёд
3614 pParty->sRotationX = _angle_x; 3464 pParty->sRotationX = _angle_x;
3615 //------------------------------------------- 3465 //-------------------------------------------
3616 if ( pParty->bFlying ) 3466 if ( pParty->bFlying )
3617 { 3467 {
3618 v129 = fixpoint_mul(4, stru_5C6E00->Cos(GetTickCount())); 3468 v129 = fixpoint_mul(4, stru_5C6E00->Cos(GetTickCount()));
3619 pZ = v113 + v129; 3469 party_new_Z = v113 + v129;
3620 if ( pModel_ ) 3470 if ( pModel_ )
3621 pZ = v113; 3471 party_new_Z = v113;
3622 if (pParty->FlyActive()) 3472 if (pParty->FlyActive())
3623 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFE; 3473 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFE;
3624 pParty->uFallStartY = pZ; 3474 pParty->uFallStartY = party_new_Z;
3625 } 3475 }
3626 else if ( pZ < v111 ) 3476 else if ( party_new_Z < v111 )
3627 { 3477 {
3628 if ( is_on_water && fall_speed ) 3478 if ( is_on_water && fall_speed )
3629 SpriteObject::sub_42F960_create_object(pX, pY, v111); 3479 SpriteObject::sub_42F960_create_object(pX, pY, v111);
3630 fall_speed = 0; 3480 fall_speed = 0;
3631 pZ = v111; 3481 party_new_Z = v111;
3632 pParty->uFallStartY = v111; 3482 pParty->uFallStartY = v111;
3633 v113 = pZ; 3483 v113 = party_new_Z;
3634 if (pParty->FlyActive()) 3484 if (pParty->FlyActive())
3635 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1; 3485 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1;
3636 } 3486 }
3637 else 3487 else
3638 { 3488 {
3639 v113 = pZ; 3489 v113 = party_new_Z;
3640 if (pParty->FlyActive()) 3490 if (pParty->FlyActive())
3641 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1; 3491 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1;
3642 } 3492 }
3643 //------------------------------------------ 3493 //------------------------------------------
3644 if (hovering && !pParty->bFlying)//расчёт скорости падения 3494 if (hovering && !pParty->bFlying)//расчёт скорости падения
3654 if ( !bmodel_standing_on_pid ) 3504 if ( !bmodel_standing_on_pid )
3655 { 3505 {
3656 // rolling down the hill 3506 // rolling down the hill
3657 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air 3507 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
3658 // and falling to the gravity, gradually sliding downwards. nice trick 3508 // and falling to the gravity, gradually sliding downwards. nice trick
3659 pZ = v111; 3509 party_new_Z = v111;
3660 ODM_GetTerrainNormalAt(pX, pY, &v98); 3510 ODM_GetTerrainNormalAt(pX, pY, &v98);
3661 v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength())); 3511 v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength()));
3662 v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16; 3512 v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16;
3663 v2 += fixpoint_mul(v129, v98.x); 3513 v2 += fixpoint_mul(v129, v98.x);
3664 v1 += fixpoint_mul(v129, v98.y); 3514 v1 += fixpoint_mul(v129, v98.y);
3685 } 3535 }
3686 } 3536 }
3687 } 3537 }
3688 } 3538 }
3689 else 3539 else
3690 pParty->uFallStartY = pZ; 3540 pParty->uFallStartY = party_new_Z;
3691 3541
3692 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) 3542 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
3693 { 3543 {
3694 *(float *)&v128 = 0.0; 3544 *(float *)&v128 = 0.0;
3695 v2 = 0; 3545 v2 = 0;
3703 stru_721530.height = pParty->uPartyHeight - 32; 3553 stru_721530.height = pParty->uPartyHeight - 32;
3704 for ( uint i = 0; i < 100; i++ ) 3554 for ( uint i = 0; i < 100; i++ )
3705 { 3555 {
3706 stru_721530.position.x = pX; 3556 stru_721530.position.x = pX;
3707 stru_721530.position.y = pY; 3557 stru_721530.position.y = pY;
3708 stru_721530.position.z = stru_721530.height + pZ + 1; 3558 stru_721530.position.z = stru_721530.height + party_new_Z + 1;
3709 3559
3710 stru_721530.normal.x = pX; 3560 stru_721530.normal.x = pX;
3711 stru_721530.normal.y = pY; 3561 stru_721530.normal.y = pY;
3712 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1; 3562 stru_721530.normal.z = stru_721530.prolly_normal_d + party_new_Z + 1;
3713 3563
3714 stru_721530.velocity.x = v2; 3564 stru_721530.velocity.x = v2;
3715 stru_721530.velocity.y = v128; 3565 stru_721530.velocity.y = v128;
3716 stru_721530.velocity.z = fall_speed; 3566 stru_721530.velocity.z = fall_speed;
3717 3567
3737 else 3587 else
3738 { 3588 {
3739 _angle_x = pX + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); 3589 _angle_x = pX + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
3740 _angle_y = pY + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); 3590 _angle_y = pY + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
3741 //pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); 3591 //pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
3742 v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + pZ; 3592 v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + party_new_Z;
3743 } 3593 }
3744 v122 = v40; 3594 v122 = v40;
3745 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); 3595 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
3746 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0); 3596 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0);
3747 int v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0); 3597 int v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0);
3759 if ( v43 ) 3609 if ( v43 )
3760 pY = _angle_y; 3610 pY = _angle_y;
3761 } 3611 }
3762 else 3612 else
3763 { 3613 {
3764 if ( v42_ && v129 > pZ ) 3614 if ( v42_ && v129 > party_new_Z )
3765 v44 = 0; 3615 v44 = 0;
3766 if ( v42 && v119 > pZ ) 3616 if ( v42 && v119 > party_new_Z )
3767 v43 = 0; 3617 v43 = 0;
3768 if ( v44 ) 3618 if ( v44 )
3769 { 3619 {
3770 pX = _angle_x; 3620 pX = _angle_x;
3771 if ( v43 ) 3621 if ( v43 )
3774 else if ( v43 ) 3624 else if ( v43 )
3775 pY = _angle_y; 3625 pY = _angle_y;
3776 else 3626 else
3777 { 3627 {
3778 int new_ = ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); 3628 int new_ = ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
3779 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && new_ <= pZ ) 3629 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && new_ <= party_new_Z )
3780 { 3630 {
3781 v43 = 1; 3631 v43 = 1;
3782 pX = _angle_x; 3632 pX = _angle_x;
3783 if ( v43 ) 3633 if ( v43 )
3784 pY = _angle_y; 3634 pY = _angle_y;
3790 if ( !is_not_on_bmodel ) 3640 if ( !is_not_on_bmodel )
3791 { 3641 {
3792 pX = stru_721530.normal2.x; 3642 pX = stru_721530.normal2.x;
3793 pY = stru_721530.normal2.y; 3643 pY = stru_721530.normal2.y;
3794 } 3644 }
3795 pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; 3645 party_new_Z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
3796 break; 3646 break;
3797 } 3647 }
3798 stru_721530.field_70 += stru_721530.field_7C; 3648 stru_721530.field_70 += stru_721530.field_7C;
3799 pX = _angle_x; 3649 pX = _angle_x;
3800 pY = _angle_y; 3650 pY = _angle_y;
3801 v45 = stru_721530.uFaceID; 3651 v45 = stru_721530.uFaceID;
3802 pZ = v40; 3652 party_new_Z = v40;
3803 3653
3804 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) 3654 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
3805 { 3655 {
3806 if (pParty->Invisible()) 3656 if (pParty->Invisible())
3807 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); 3657 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
3829 v119 = 0; 3679 v119 = 0;
3830 if ( pODMFace->uPolygonType == POLYGON_Floor ) 3680 if ( pODMFace->uPolygonType == POLYGON_Floor )
3831 { 3681 {
3832 if ( fall_speed < 0 ) 3682 if ( fall_speed < 0 )
3833 fall_speed = 0; 3683 fall_speed = 0;
3834 pZ = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1; 3684 party_new_Z = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1;
3835 if ( v2 * v2 + v128 * v128 < 400 ) 3685 if ( v2 * v2 + v128 * v128 < 400 )
3836 { 3686 {
3837 v2 = 0; 3687 v2 = 0;
3838 *(float *)&v128 = 0.0; 3688 *(float *)&v128 = 0.0;
3839 } 3689 }
3860 if ( v55 > 0 ) 3710 if ( v55 > 0 )
3861 { 3711 {
3862 pX = _angle_x + fixpoint_mul(pODMFace->pFacePlane.vNormal.x, v55); 3712 pX = _angle_x + fixpoint_mul(pODMFace->pFacePlane.vNormal.x, v55);
3863 pY = _angle_y + fixpoint_mul(pODMFace->pFacePlane.vNormal.y, v55); 3713 pY = _angle_y + fixpoint_mul(pODMFace->pFacePlane.vNormal.y, v55);
3864 if ( !v119 ) 3714 if ( !v119 )
3865 pZ = v122 + fixpoint_mul(pODMFace->pFacePlane.vNormal.z, v55); 3715 party_new_Z = v122 + fixpoint_mul(pODMFace->pFacePlane.vNormal.z, v55);
3866 } 3716 }
3867 if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() ) 3717 if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() )
3868 { 3718 {
3869 pParty->floor_face_pid = stru_721530.uFaceID; 3719 pParty->floor_face_pid = stru_721530.uFaceID;
3870 trigger_id = pODMFace->sCogTriggeredID; // 3720 trigger_id = pODMFace->sCogTriggeredID; //
3902 } 3752 }
3903 3753
3904 //Воспроизведение звуков ходьбы/бега------------------------ 3754 //Воспроизведение звуков ходьбы/бега------------------------
3905 uint pX_ = abs(pParty->vPosition.x - pX); 3755 uint pX_ = abs(pParty->vPosition.x - pX);
3906 uint pY_ = abs(pParty->vPosition.y - pY); 3756 uint pY_ = abs(pParty->vPosition.y - pY);
3907 uint pZ_ = abs(pParty->vPosition.z - pZ); 3757 uint pZ_ = abs(pParty->vPosition.z - party_new_Z);
3908 if ( bWalkSound && pParty->walk_sound_timer <= 0 ) 3758 if ( bWalkSound && pParty->walk_sound_timer <= 0 )
3909 { 3759 {
3910 pAudioPlayer->_4AA258(804);//stop sound 3760 pAudioPlayer->_4AA258(804);//stop sound
3911 if ( party_running_flag && (!hovering || not_high_fall) ) 3761 if ( party_running_flag && (!hovering || not_high_fall) )
3912 { 3762 {
3913 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16 ) 3763 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16 )
3914 { 3764 {
3915 if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() ) 3765 if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() )
3916 pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);//бег на 3D Modelи 3766 pAudioPlayer->PlaySound(SOUND_RunWood, 804, 1, -1, 0, 0, 0, 0);//бег на 3D Modelи
3917 else 3767 else
3918 { 3768 {
3919 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1); 3769 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1);
3920 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле 56 3770 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле 56
3921 } 3771 }
3925 else if( party_walking_flag && (!hovering || not_high_fall) ) 3775 else if( party_walking_flag && (!hovering || not_high_fall) )
3926 { 3776 {
3927 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8 ) 3777 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8 )
3928 { 3778 {
3929 if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() ) 3779 if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() )
3930 pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);// хождение на 3D Modelи 3780 pAudioPlayer->PlaySound(SOUND_WalkWood, 804, 1, -1, 0, 0, 0, 0);// хождение на 3D Modelи
3931 else 3781 else
3932 { 3782 {
3933 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0); 3783 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0);
3934 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);// хождение по земле 3784 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);// хождение по земле
3935 } 3785 }
3960 v68 = 1; 3810 v68 = 1;
3961 if ( v68 ) 3811 if ( v68 )
3962 { 3812 {
3963 pParty->vPosition.x = pX; 3813 pParty->vPosition.x = pX;
3964 pParty->vPosition.y = pY; 3814 pParty->vPosition.y = pY;
3965 pParty->vPosition.z = pZ; 3815 pParty->vPosition.z = party_new_Z;
3966 pParty->field_6F0 = v113; 3816 pParty->field_6F0 = v113;
3967 pParty->uFallSpeed = fall_speed; 3817 pParty->uFallSpeed = fall_speed;
3968 if ( pZ > 8160 ) //ограничение высоты 3818 if ( party_new_Z > 8160 ) //ограничение высоты
3969 { 3819 {
3970 pZ = 8160; 3820 party_new_Z = 8160;
3971 pParty->uFallStartY = 8160; 3821 pParty->uFallStartY = 8160;
3972 pParty->vPosition.z = 8160; 3822 pParty->vPosition.z = 8160;
3973 } 3823 }
3974 3824
3975 if ( !trigger_id //падение на землю 3825 if ( !trigger_id //падение на землю
3976 || (EventProcessor(trigger_id, 0, 1), 3826 || (EventProcessor(trigger_id, 0, 1),
3977 pParty->vPosition.x == pX) 3827 pParty->vPosition.x == pX)
3978 && pParty->vPosition.y == pY 3828 && pParty->vPosition.y == pY
3979 && pParty->vPosition.z == pZ ) 3829 && pParty->vPosition.z == party_new_Z )
3980 { 3830 {
3981 if ( pParty->vPosition.z < v111 ) 3831 if ( pParty->vPosition.z < v111 )
3982 { 3832 {
3983 pParty->uFallSpeed = 0; 3833 pParty->uFallSpeed = 0;
3984 //v73 = v105; 3834 //v73 = v105;
3985 pParty->vPosition.z = on_ground; 3835 pParty->vPosition.z = on_ground;
3986 if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the ground(падение на землю с высоты) 3836 if ( pParty->uFallStartY - party_new_Z > 512 && !bFeatherFall
3837 && party_new_Z <= on_ground && !bUnderwater )//Fall to the ground(падение на землю с высоты)
3987 { 3838 {
3988 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) 3839 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
3989 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; 3840 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
3990 else 3841 else
3991 { 3842 {
3992 for ( uint i = 1; i <= 4; ++i ) 3843 for ( uint i = 1; i <= 4; ++i )
3993 { 3844 {
3994 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)pPlayers[i]->GetMaxHealth() * 0.1)) / 256, 3845 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - party_new_Z) * (unsigned __int64)(signed __int64)((double)pPlayers[i]->GetMaxHealth() * 0.1)) / 256,
3995 DMGT_PHISYCAL); 3846 DMGT_PHISYCAL);
3996 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance()); 3847 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
3997 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); 3848 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
3998 } 3849 }
3999 //v73 = pParty->vPosition.z; 3850 //v73 = pParty->vPosition.z;
4000 } 3851 }
4001 } 3852 }
4002 pParty->uFallStartY = pZ; 3853 pParty->uFallStartY = party_new_Z;
4003 } 3854 }
4004 if ( v102 && pParty->vPosition.z < ceiling_height ) 3855 if ( v102 && pParty->vPosition.z < ceiling_height )
4005 { 3856 {
4006 if ( (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height ) 3857 if ( (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height )
4007 { 3858 {
4064 pParty->walk_sound_timer = 64; 3915 pParty->walk_sound_timer = 64;
4065 } 3916 }
4066 3917
4067 //v81 = pZ; 3918 //v81 = pZ;
4068 //v82 = pZ; 3919 //v82 = pZ;
4069 pParty->vPosition.z = pZ; 3920 pParty->vPosition.z = party_new_Z;
4070 if ( pZ > 8160 )//опять ограничение высоты 3921 if ( party_new_Z > 8160 )//опять ограничение высоты
4071 { 3922 {
4072 //v82 = 8160; 3923 //v82 = 8160;
4073 pParty->uFallStartY = 8160; 3924 pParty->uFallStartY = 8160;
4074 pParty->vPosition.z = 8160; 3925 pParty->vPosition.z = 8160;
4075 } 3926 }
4085 3936
4086 if ( !trigger_id//падение на воду 3937 if ( !trigger_id//падение на воду
4087 || (EventProcessor(trigger_id, 0, 1), 3938 || (EventProcessor(trigger_id, 0, 1),
4088 pParty->vPosition.x == pX) 3939 pParty->vPosition.x == pX)
4089 && pParty->vPosition.y == pY 3940 && pParty->vPosition.y == pY
4090 && pParty->vPosition.z == pZ ) 3941 && pParty->vPosition.z == party_new_Z )
4091 { 3942 {
4092 if ( pParty->vPosition.z < v111 ) 3943 if ( pParty->vPosition.z < v111 )
4093 { 3944 {
4094 //v82 = on_ground; 3945 //v82 = on_ground;
4095 pParty->uFallSpeed = 0; 3946 pParty->uFallSpeed = 0;
4096 pParty->vPosition.z = on_ground; 3947 pParty->vPosition.z = on_ground;
4097 if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the water(падение на воду с высоты) 3948 if ( pParty->uFallStartY - party_new_Z > 512
3949 && !bFeatherFall && party_new_Z <= on_ground && !bUnderwater )//Fall to the water(падение на воду с высоты)
4098 { 3950 {
4099 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) 3951 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
4100 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; 3952 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
4101 else 3953 else
4102 { 3954 {
4103 for ( uint i = 1; i <= 4; ++i ) 3955 for ( uint i = 1; i <= 4; ++i )
4104 { 3956 {
4105 v110 = pPlayers[i]->GetMaxHealth(); 3957 v110 = pPlayers[i]->GetMaxHealth();
4106 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, 3958 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - party_new_Z) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
4107 DMGT_PHISYCAL); 3959 DMGT_PHISYCAL);
4108 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance()); 3960 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
4109 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); 3961 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
4110 } 3962 }
4111 //v82 = pParty->vPosition.z; 3963 //v82 = pParty->vPosition.z;
4112 } 3964 }
4113 } 3965 }
4114 pParty->uFallStartY = pZ; 3966 pParty->uFallStartY = party_new_Z;
4115 } 3967 }
4116 if ( v102 && pParty->vPosition.z < ceiling_height && (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height ) 3968 if ( v102 && pParty->vPosition.z < ceiling_height && (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height )
4117 { 3969 {
4118 pParty->vPosition.z = pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1; 3970 pParty->vPosition.z = pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1;
4119 pParty->field_6F0 = pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1; 3971 pParty->field_6F0 = pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1;