comparison Outdoor.cpp @ 1583:75fafd8ced59

Allocator (CMemory) bye-bye
author Nomad
date Tue, 10 Sep 2013 21:07:07 +0200
parents c4ab816fcc5e
children 61ea994a1812
comparison
equal deleted inserted replaced
1577:1b6217e07b26 1583:75fafd8ced59
9 #include "Outdoor.h" 9 #include "Outdoor.h"
10 #include "Outdoor_stuff.h" 10 #include "Outdoor_stuff.h"
11 #include "Party.h" 11 #include "Party.h"
12 #include "SpriteObject.h" 12 #include "SpriteObject.h"
13 #include "LOD.h" 13 #include "LOD.h"
14 #include "Allocator.h"
15 #include "PaletteManager.h" 14 #include "PaletteManager.h"
16 #include "GUIProgressBar.h" 15 #include "GUIProgressBar.h"
17 #include "AudioPlayer.h" 16 #include "AudioPlayer.h"
18 #include "IndoorCamera.h" 17 #include "IndoorCamera.h"
19 #include "DecorationList.h" 18 #include "DecorationList.h"
114 pIndoorCamera->uMapGridCellZ = WorldPosToGridCellZ(pParty->vPosition.y); 113 pIndoorCamera->uMapGridCellZ = WorldPosToGridCellZ(pParty->vPosition.y);
115 assert(pIndoorCamera->uMapGridCellX <= 127 && pIndoorCamera->uMapGridCellZ <= 127); 114 assert(pIndoorCamera->uMapGridCellX <= 127 && pIndoorCamera->uMapGridCellZ <= 127);
116 115
117 if (bRedraw) 116 if (bRedraw)
118 { 117 {
119 Software_ResetNewEdges();
120 sub_487DA9(); 118 sub_487DA9();
121 ptr_80C97C_Surfs = pSurfs;
122 ptr_80C978_Edges = pEdges;
123 } 119 }
124 if ( pParty->uCurrentMinute != pOutdoor->uLastSunlightUpdateMinute ) 120 if ( pParty->uCurrentMinute != pOutdoor->uLastSunlightUpdateMinute )
125 pOutdoor->UpdateSunlightVectors(); 121 pOutdoor->UpdateSunlightVectors();
126 pOutdoor->UpdateFog(); 122 pOutdoor->UpdateFog();
127 //pGame->pIndoorCameraD3D->sr_Reset_list_0037C(); 123 //pGame->pIndoorCameraD3D->sr_Reset_list_0037C();
329 else 325 else
330 { 326 {
331 result = 0; 327 result = 0;
332 } 328 }
333 return result; 329 return result;
334 }
335
336 //----- (0048901B) --------------------------------------------------------
337 bool OutdoorLocation::Release2()
338 {
339 Release();
340 pOutdoorCamera->ReleaseSoftwareDrawBuffers();
341 return true;
342 } 330 }
343 331
344 332
345 333
346 char foot_travel_destinations[15][4] = 334 char foot_travel_destinations[15][4] =
811 //----- (0047C7C2) -------------------------------------------------------- 799 //----- (0047C7C2) --------------------------------------------------------
812 void OutdoorLocationTerrain::Release()//очистить локацию 800 void OutdoorLocationTerrain::Release()//очистить локацию
813 { 801 {
814 if (pHeightmap) 802 if (pHeightmap)
815 { 803 {
816 pAllocator->FreeChunk(this->pHeightmap); 804 free(this->pHeightmap);
817 pHeightmap = nullptr; 805 pHeightmap = nullptr;
818 } 806 }
819 if (pTilemap) 807 if (pTilemap)
820 { 808 {
821 pAllocator->FreeChunk(pTilemap); 809 free(pTilemap);
822 pTilemap = nullptr; 810 pTilemap = nullptr;
823 } 811 }
824 if (pAttributemap) 812 if (pAttributemap)
825 { 813 {
826 pAllocator->FreeChunk(pAttributemap); 814 free(pAttributemap);
827 pAttributemap = nullptr; 815 pAttributemap = nullptr;
828 } 816 }
829 if (pDmap) 817 if (pDmap)
830 { 818 {
831 pAllocator->FreeChunk(pDmap); 819 free(pDmap);
832 pDmap = nullptr; 820 pDmap = nullptr;
833 } 821 }
834 822
835 _47C7A9(); 823 _47C7A9();
836 } 824 }
1132 } 1120 }
1133 1121
1134 //----- (0047CD44) -------------------------------------------------------- 1122 //----- (0047CD44) --------------------------------------------------------
1135 bool OutdoorLocationTerrain::Initialize() 1123 bool OutdoorLocationTerrain::Initialize()
1136 { 1124 {
1137 1125 pHeightmap = (unsigned __int8 *)malloc(0x4000u);//height map
1138 pHeightmap= (unsigned __int8 *)pAllocator->AllocNamedChunk(pHeightmap, 0x4000u, "HMAP");//height map 1126 pTilemap = (unsigned __int8 *)malloc(0x4000u);//tile map
1139 pTilemap = (unsigned __int8 *)pAllocator->AllocNamedChunk(pTilemap, 0x4000u, "TMAP");//tile map 1127 pAttributemap = (unsigned __int8 *)malloc(0x4000u);//карта атрибутов
1140 pAttributemap = (unsigned __int8 *)pAllocator->AllocNamedChunk(pAttributemap, 0x4000u, "AMAP");//карта атрибутов 1128 pDmap = (struct DMap *)malloc(0x8000u);
1141 pDmap=(struct DMap *)pAllocator->AllocNamedChunk(pDmap, 0x8000u, "DMAP"); 1129 if (pHeightmap && pTilemap && pAttributemap && pDmap )
1142 if ( pHeightmap && pTilemap && pAttributemap && pDmap )
1143 return true; 1130 return true;
1144 else 1131 else
1145 return false; 1132 return false;
1146 } 1133 }
1147 1134
1166 v1->pTileTypes[1].tileset = Tileset_Water; 1153 v1->pTileTypes[1].tileset = Tileset_Water;
1167 v1->pTileTypes[2].tileset = Tileset_6; 1154 v1->pTileTypes[2].tileset = Tileset_6;
1168 v1->pTileTypes[3].tileset = Tileset_RoadGrassCobble; 1155 v1->pTileTypes[3].tileset = Tileset_RoadGrassCobble;
1169 v1->LoadTileGroupIds(); 1156 v1->LoadTileGroupIds();
1170 v1->LoadRoadTileset(); 1157 v1->LoadRoadTileset();
1171 pAllocator->FreeChunk(v1->pBModels); 1158 free(v1->pBModels);
1172 pAllocator->FreeChunk(v1->pSpawnPoints); 1159 free(v1->pSpawnPoints);
1173 v1->pBModels = 0; 1160 v1->pBModels = 0;
1174 v1->pSpawnPoints = 0; 1161 v1->pSpawnPoints = 0;
1175 v1->pTerrain.Initialize(); 1162 v1->pTerrain.Initialize();
1176 v1->pTerrain.ZeroLandscape(); 1163 v1->pTerrain.ZeroLandscape();
1177 v1->pTerrain.FillDMap(0, 0, 128, 128); 1164 v1->pTerrain.FillDMap(0, 0, 128, 128);
1178 pAllocator->FreeChunk(v1->pCmap); 1165 free(v1->pCmap);
1179 v1->pCmap = 0; 1166 v1->pCmap = 0;
1180 v2 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); 1167 v2 = malloc(0x8000u);
1181 v3 = v1->pOMAP; 1168 v3 = v1->pOMAP;
1182 v1->pCmap = v2; 1169 v1->pCmap = v2;
1183 pAllocator->FreeChunk(v3); 1170 free(v3);
1184 v1->pOMAP = 0; 1171 v1->pOMAP = 0;
1185 v4 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); 1172 v4 = malloc(0x10000u);
1186 v1->pOMAP = (unsigned int *)v4; 1173 v1->pOMAP = (unsigned int *)v4;
1187 memset(v4, 0, 0x10000u); 1174 memset(v4, 0, 0x10000u);
1188 v5 = v1->pFaceIDLIST; 1175 v5 = v1->pFaceIDLIST;
1189 v1->numFaceIDListElems = 0; 1176 v1->numFaceIDListElems = 0;
1190 pAllocator->FreeChunk(v5); 1177 free(v5);
1191 v1->pFaceIDLIST = 0; 1178 v1->pFaceIDLIST = 0;
1192 v6 = pAllocator->AllocNamedChunk(0, 2u, "IDLIST"); 1179 v6 = malloc(2);
1193 v1->pFaceIDLIST = (unsigned __int16 *)v6; 1180 v1->pFaceIDLIST = (unsigned __int16 *)v6;
1194 *(short *)v6 = 0; 1181 *(short *)v6 = 0;
1195 strcpy(v1->pSkyTextureName, pDefaultSkyTexture.data()); 1182 strcpy(v1->pSkyTextureName, pDefaultSkyTexture.data());
1196 v1->uSky_TextureID = pBitmaps_LOD->LoadTexture(v1->pSkyTextureName); 1183 v1->uSky_TextureID = pBitmaps_LOD->LoadTexture(v1->pSkyTextureName);
1197 strcpy(v1->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data()); 1184 strcpy(v1->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data());
1227 if (pBModels) 1214 if (pBModels)
1228 { 1215 {
1229 for (uint i = 0; i < uNumBModels; ++i) 1216 for (uint i = 0; i < uNumBModels; ++i)
1230 pBModels[i].Release(); 1217 pBModels[i].Release();
1231 1218
1232 pAllocator->FreeChunk(pBModels); 1219 free(pBModels);
1233 pBModels = nullptr; 1220 pBModels = nullptr;
1234 uNumBModels = 0; 1221 uNumBModels = 0;
1235 } 1222 }
1236 1223
1237 if (pSpawnPoints) 1224 if (pSpawnPoints)
1238 { 1225 {
1239 pAllocator->FreeChunk(pSpawnPoints); 1226 free(pSpawnPoints);
1240 pSpawnPoints = nullptr; 1227 pSpawnPoints = nullptr;
1241 } 1228 }
1242 uNumSpawnPoints = 0; 1229 uNumSpawnPoints = 0;
1243 1230
1244 pTerrain.Release(); 1231 pTerrain.Release();
1245 1232
1246 if (pCmap) 1233 if (pCmap)
1247 { 1234 {
1248 pAllocator->FreeChunk(pCmap); 1235 free(pCmap);
1249 pCmap = nullptr; 1236 pCmap = nullptr;
1250 } 1237 }
1251 if (pOMAP) 1238 if (pOMAP)
1252 { 1239 {
1253 pAllocator->FreeChunk(pOMAP); 1240 free(pOMAP);
1254 pOMAP = nullptr; 1241 pOMAP = nullptr;
1255 } 1242 }
1256 if (pFaceIDLIST) 1243 if (pFaceIDLIST)
1257 { 1244 {
1258 pAllocator->FreeChunk(pFaceIDLIST); 1245 free(pFaceIDLIST);
1259 pFaceIDLIST = nullptr; 1246 pFaceIDLIST = nullptr;
1260 } 1247 }
1261 if (pTerrainNormals) 1248 if (pTerrainNormals)
1262 { 1249 {
1263 pAllocator->FreeChunk(pTerrainNormals); 1250 free(pTerrainNormals);
1264 pTerrainNormals = nullptr; 1251 pTerrainNormals = nullptr;
1265 } 1252 }
1266 } 1253 }
1267 1254
1268 //----- (0047D0A6) -------------------------------------------------------- 1255 //----- (0047D0A6) --------------------------------------------------------
1477 fseek((FILE *)v7, v120, 0); 1464 fseek((FILE *)v7, v120, 0);
1478 fread(pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7); 1465 fread(pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7);
1479 fseek((FILE *)v7, v121, 0); 1466 fseek((FILE *)v7, v121, 0);
1480 fread(pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7); 1467 fread(pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7);
1481 pTerrain._47C80A(0, 0, 128, 128); 1468 pTerrain._47C80A(0, 0, 128, 128);
1482 pAllocator->FreeChunk(ptr_D4); 1469 free(ptr_D4);
1483 ptr_D4 = 0; 1470 ptr_D4 = 0;
1484 v9 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); 1471 v9 = malloc(0, 0x8000u, "CMAP");
1485 v108 = (int)pOMAP; 1472 v108 = (int)pOMAP;
1486 ptr_D4 = v9; 1473 ptr_D4 = v9;
1487 pAllocator->FreeChunk((void *)v108); 1474 free((void *)v108);
1488 pOMAP = 0; 1475 pOMAP = 0;
1489 v10 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); 1476 v10 = malloc(0, 0x10000u, "OMAP");
1490 v108 = 0; 1477 v108 = 0;
1491 pOMAP = (unsigned int *)v10; 1478 pOMAP = (unsigned int *)v10;
1492 fseek((FILE *)v7, v136, v108); 1479 fseek((FILE *)v7, v136, v108);
1493 fread(&uNumTerrainNormals, 4u, 1u, (FILE *)v7); 1480 fread(&uNumTerrainNormals, 4u, 1u, (FILE *)v7);
1494 fread(pTerrainSomeOtherData, 1u, 0x20000u, (FILE *)v7); 1481 fread(pTerrainSomeOtherData, 1u, 0x20000u, (FILE *)v7);
1495 fread(pTerrainNormalIndices, 1u, 0x10000u, (FILE *)v7); 1482 fread(pTerrainNormalIndices, 1u, 0x10000u, (FILE *)v7);
1496 pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm"); 1483 pTerrainNormals = (Vec3_float_ *)malloc(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
1497 fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7); 1484 fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7);
1498 v11 = pAllocator->AllocNamedChunk(pBModels, 188 * uNumBModels, "BDdata"); 1485 v11 = malloc(pBModels, 188 * uNumBModels, "BDdata");
1499 v108 = 0; 1486 v108 = 0;
1500 pBModels = (BSPModel *)v11; 1487 pBModels = (BSPModel *)v11;
1501 fseek((FILE *)v7, v122, v108); 1488 fseek((FILE *)v7, v122, v108);
1502 fread(pBModels, 0xBCu, uNumBModels, (FILE *)v7); 1489 fread(pBModels, 0xBCu, uNumBModels, (FILE *)v7);
1503 fseek((FILE *)v7, v123, 0); 1490 fseek((FILE *)v7, v123, 0);
1514 FileName[0] = 0; 1501 FileName[0] = 0;
1515 v108 = (int)&pBModels[v12]; 1502 v108 = (int)&pBModels[v12];
1516 sprintfex(FileName, "%s", v108); 1503 sprintfex(FileName, "%s", v108);
1517 v13 = pBModels; 1504 v13 = pBModels;
1518 v138 = 0; 1505 v138 = 0;
1519 pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices, 1506 pBModels[v12].pVertices.pVertices = (Vec3_int_ *)malloc(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices,
1520 FileName); 1507 FileName);
1521 pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(pBModels[v12].pFaces, 308 * pBModels[v12].uNumFaces, 1508 pBModels[v12].pFaces = (ODMFace *)malloc(pBModels[v12].pFaces, 308 * pBModels[v12].uNumFaces,
1522 FileName); 1509 FileName);
1523 pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(pBModels[v12].pFacesOrdering, 1510 pBModels[v12].pFacesOrdering = (unsigned __int16 *)malloc(pBModels[v12].pFacesOrdering,
1524 2 * pBModels[v12].uNumFaces, FileName); 1511 2 * pBModels[v12].uNumFaces, FileName);
1525 v14 = pAllocator->AllocNamedChunk(pBModels[v12].pNodes, 8 * pBModels[v12].uNumNodes, FileName); 1512 v14 = malloc(pBModels[v12].pNodes, 8 * pBModels[v12].uNumNodes, FileName);
1526 v15 = pBModels; 1513 v15 = pBModels;
1527 v108 = (int)File; 1514 v108 = (int)File;
1528 v15[v12].pNodes = (BSPNode *)v14; 1515 v15[v12].pNodes = (BSPNode *)v14;
1529 fread(pBModels[v12].pVertices.pVertices, 0xCu, pBModels[v12].pVertices.uNumVertices, (FILE *)v108); 1516 fread(pBModels[v12].pVertices.pVertices, 0xCu, pBModels[v12].pVertices.uNumVertices, (FILE *)v108);
1530 fread(pBModels[v12].pFaces, 0x134u, pBModels[v12].uNumFaces, (FILE *)File); 1517 fread(pBModels[v12].pFaces, 0x134u, pBModels[v12].uNumFaces, (FILE *)File);
1650 fread(pActors, 0x344u, uNumActors, (FILE *)v22); 1637 fread(pActors, 0x344u, uNumActors, (FILE *)v22);
1651 fseek((FILE *)v22, v127, 0); 1638 fseek((FILE *)v22, v127, 0);
1652 fread(pChests, 0x14CCu, uNumChests, (FILE *)v22); 1639 fread(pChests, 0x14CCu, uNumChests, (FILE *)v22);
1653 fseek((FILE *)v22, v128, 0); 1640 fseek((FILE *)v22, v128, 0);
1654 fread(&field_DC, 4u, 1u, (FILE *)v22); 1641 fread(&field_DC, 4u, 1u, (FILE *)v22);
1655 pAllocator->FreeChunk(pFaceIDLIST); 1642 free(pFaceIDLIST);
1656 v32 = field_DC; 1643 v32 = field_DC;
1657 pFaceIDLIST = 0; 1644 pFaceIDLIST = 0;
1658 v33 = pAllocator->AllocNamedChunk(0, 2 * v32, "IDLIST"); 1645 v33 = malloc(0, 2 * v32, "IDLIST");
1659 v108 = (int)v22; 1646 v108 = (int)v22;
1660 pFaceIDLIST = (unsigned __int16 *)v33; 1647 pFaceIDLIST = (unsigned __int16 *)v33;
1661 fread(v33, 2u, field_DC, (FILE *)v108); 1648 fread(v33, 2u, field_DC, (FILE *)v108);
1662 fseek((FILE *)v22, v129, 0); 1649 fseek((FILE *)v22, v129, 0);
1663 fread(pOMAP, 4u, 0x4000u, (FILE *)v22); 1650 fread(pOMAP, 4u, 0x4000u, (FILE *)v22);
1664 fseek((FILE *)v22, v130, 0); 1651 fseek((FILE *)v22, v130, 0);
1665 fread(&uNumSpawnPoints, 4u, 1u, (FILE *)v22); 1652 fread(&uNumSpawnPoints, 4u, 1u, (FILE *)v22);
1666 pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn"); 1653 pSpawnPoints = (SpawnPointMM7 *)malloc(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn");
1667 fseek((FILE *)v22, v131, 0); 1654 fseek((FILE *)v22, v131, 0);
1668 fread(pSpawnPoints, 0x18u, uNumSpawnPoints, (FILE *)v22); 1655 fread(pSpawnPoints, 0x18u, uNumSpawnPoints, (FILE *)v22);
1669 fseek((FILE *)v22, v132, 0); 1656 fseek((FILE *)v22, v132, 0);
1670 fread(&ddm, 0x28u, 1u, (FILE *)v22); 1657 fread(&ddm, 0x28u, 1u, (FILE *)v22);
1671 fseek((FILE *)v22, v133, 0); 1658 fseek((FILE *)v22, v133, 0);
1801 1788
1802 //v43 = (char *)v43 + 16384; 1789 //v43 = (char *)v43 + 16384;
1803 //v108 = (int)ptr_D4; 1790 //v108 = (int)ptr_D4;
1804 if (pCmap) 1791 if (pCmap)
1805 { 1792 {
1806 pAllocator->FreeChunk(pCmap); 1793 free(pCmap);
1807 pCmap = nullptr; 1794 pCmap = nullptr;
1808 } 1795 }
1809 pCmap = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); 1796 pCmap = malloc(0x8000);
1810 pTerrain.FillDMap(0, 0, 128, 128); 1797 pTerrain.FillDMap(0, 0, 128, 128);
1811 1798
1812 pGameLoadingUI_ProgressBar->Progress(); 1799 pGameLoadingUI_ProgressBar->Progress();
1813 memcpy(&uNumTerrainNormals, pSrc, 4); 1800 memcpy(&uNumTerrainNormals, pSrc, 4);
1814 //v43 = (char *)v43 + 4; 1801 //v43 = (char *)v43 + 4;
1818 memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000); 1805 memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000);
1819 pSrc += 0x10000; 1806 pSrc += 0x10000;
1820 //v43 = (char *)v43 + 65536; 1807 //v43 = (char *)v43 + 65536;
1821 1808
1822 //pFilename = (char *)(12 * uNumTerrainNormals); 1809 //pFilename = (char *)(12 * uNumTerrainNormals);
1823 pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm"); 1810 pTerrainNormals = (Vec3_float_ *)malloc(sizeof(Vec3_float_) * uNumTerrainNormals);
1824 memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals); 1811 memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals);
1825 pSrc += 12 * uNumTerrainNormals; 1812 pSrc += 12 * uNumTerrainNormals;
1826 //v44 = (char *)v43 + (int)pFilename; 1813 //v44 = (char *)v43 + (int)pFilename;
1827 //v44 = (char *)v44 + 4; 1814 //v44 = (char *)v44 + 4;
1828 //v45 = uNumBModels; 1815 //v45 = uNumBModels;
1830 1817
1831 pGameLoadingUI_ProgressBar->Progress(); 1818 pGameLoadingUI_ProgressBar->Progress();
1832 1819
1833 //v107 = 188 * v45; 1820 //v107 = 188 * v45;
1834 //v106 = (char *)pBModels; 1821 //v106 = (char *)pBModels;
1835 //v46 = (BSPModel *)pAllocator->AllocNamedChunk(v106, 188 * v45, "BDdata"); 1822 //v46 = (BSPModel *)malloc(v106, 188 * v45, "BDdata");
1836 //v47 = uNumBModels; 1823 //v47 = uNumBModels;
1837 memcpy(&uNumBModels, pSrc, 4); 1824 memcpy(&uNumBModels, pSrc, 4);
1838 pBModels = (BSPModel *)pAllocator->AllocNamedChunk(pBModels, 188 * uNumBModels, "BDdata"); 1825 pBModels = (BSPModel *)malloc(188 * uNumBModels);
1839 //pFilename = (char *)(188 * v47); 1826 //pFilename = (char *)(188 * v47);
1840 memcpy(pBModels, pSrc + 4, 188 * uNumBModels); 1827 memcpy(pBModels, pSrc + 4, 188 * uNumBModels);
1841 pSrc += 4 + 188 * uNumBModels; 1828 pSrc += 4 + 188 * uNumBModels;
1842 1829
1843 pGameLoadingUI_ProgressBar->Progress(); 1830 pGameLoadingUI_ProgressBar->Progress();
1862 //v108 = (int)FileName; 1849 //v108 = (int)FileName;
1863 //v107 = 12 * v50->pVertices.uNumVertices; 1850 //v107 = 12 * v50->pVertices.uNumVertices;
1864 //v106 = (char *)v50->pVertices.pVertices; 1851 //v106 = (char *)v50->pVertices.pVertices;
1865 assert(sizeof(Vec3_int_) == 12); 1852 assert(sizeof(Vec3_int_) == 12);
1866 uint verticesSize = model->pVertices.uNumVertices * sizeof(Vec3_int_); 1853 uint verticesSize = model->pVertices.uNumVertices * sizeof(Vec3_int_);
1867 model->pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(model->pVertices.pVertices, verticesSize, ""); 1854 model->pVertices.pVertices = (Vec3_int_ *)malloc(verticesSize);
1868 memcpy(model->pVertices.pVertices, pSrc, verticesSize); 1855 memcpy(model->pVertices.pVertices, pSrc, verticesSize);
1869 pSrc += verticesSize; 1856 pSrc += verticesSize;
1870 //v51 = &pBModels[v48]; 1857 //v51 = &pBModels[v48];
1871 //v108 = (int)FileName; 1858 //v108 = (int)FileName;
1872 //v107 = 308 * v51->uNumFaces; 1859 //v107 = 308 * v51->uNumFaces;
1873 //v106 = (char *)v51->pFaces; 1860 //v106 = (char *)v51->pFaces;
1874 assert(sizeof(ODMFace) == 308); 1861 assert(sizeof(ODMFace) == 308);
1875 uint facesSize = model->uNumFaces * sizeof(ODMFace); 1862 uint facesSize = model->uNumFaces * sizeof(ODMFace);
1876 model->pFaces = (ODMFace *)pAllocator->AllocNamedChunk(model->pFaces, facesSize, ""); 1863 model->pFaces = (ODMFace *)malloc(facesSize);
1877 memcpy(model->pFaces, pSrc, facesSize); 1864 memcpy(model->pFaces, pSrc, facesSize);
1878 pSrc += facesSize; 1865 pSrc += facesSize;
1879 //v52 = &pBModels[v48]; 1866 //v52 = &pBModels[v48];
1880 //v108 = (int)FileName; 1867 //v108 = (int)FileName;
1881 //v107 = 2 * v52->uNumFaces; 1868 //v107 = 2 * v52->uNumFaces;
1882 //v106 = (char *)v52->pFacesOrdering; 1869 //v106 = (char *)v52->pFacesOrdering;
1883 uint facesOrderingSize = model->uNumFaces * sizeof(short); 1870 uint facesOrderingSize = model->uNumFaces * sizeof(short);
1884 model->pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(model->pFacesOrdering, facesOrderingSize, ""); 1871 model->pFacesOrdering = (unsigned __int16 *)malloc(facesOrderingSize);
1885 memcpy(model->pFacesOrdering, pSrc, facesOrderingSize); 1872 memcpy(model->pFacesOrdering, pSrc, facesOrderingSize);
1886 pSrc += facesOrderingSize; 1873 pSrc += facesOrderingSize;
1887 //v53 = &pBModels[v48]; 1874 //v53 = &pBModels[v48];
1888 //v108 = (int)FileName; 1875 //v108 = (int)FileName;
1889 //v107 = 8 * v53->uNumNodes; 1876 //v107 = 8 * v53->uNumNodes;
1890 //v106 = (char *)v53->pNodes; 1877 //v106 = (char *)v53->pNodes;
1891 assert(sizeof(BSPNode) == 8); 1878 assert(sizeof(BSPNode) == 8);
1892 uint nodesSize = model->uNumNodes * sizeof(BSPNode); 1879 uint nodesSize = model->uNumNodes * sizeof(BSPNode);
1893 model->pNodes = (BSPNode *)pAllocator->AllocNamedChunk(model->pNodes, nodesSize, ""); 1880 model->pNodes = (BSPNode *)malloc(nodesSize);
1894 memcpy(model->pNodes, pSrc, nodesSize); 1881 memcpy(model->pNodes, pSrc, nodesSize);
1895 pSrc += nodesSize; 1882 pSrc += nodesSize;
1896 //v54 = &pBModels[v48]; 1883 //v54 = &pBModels[v48];
1897 //v108 = 12 * v54->pVertices.uNumVertices; 1884 //v108 = 12 * v54->pVertices.uNumVertices;
1898 //pFilename = (char *)v108; 1885 //pFilename = (char *)v108;
2011 1998
2012 //uSourceLen = (char *)uSourceLen + 4; 1999 //uSourceLen = (char *)uSourceLen + 4;
2013 //v108 = (int)pFaceIDLIST; 2000 //v108 = (int)pFaceIDLIST;
2014 if (pFaceIDLIST) 2001 if (pFaceIDLIST)
2015 { 2002 {
2016 pAllocator->FreeChunk(pFaceIDLIST); 2003 free(pFaceIDLIST);
2017 pFaceIDLIST = nullptr; 2004 pFaceIDLIST = nullptr;
2018 } 2005 }
2019 //v66 = field_DC; 2006 //v66 = field_DC;
2020 //pFaceIDLIST = 0; 2007 //pFaceIDLIST = 0;
2021 //v67 = pAllocator->AllocNamedChunk(0, 2 * v66, "IDLIST"); 2008 //v67 = malloc(0, 2 * v66, "IDLIST");
2022 uint faceIDListSize = 2 * numFaceIDListElems; 2009 uint faceIDListSize = 2 * numFaceIDListElems;
2023 pFaceIDLIST = (unsigned short *)pAllocator->AllocNamedChunk(0, faceIDListSize, "IDLIST"); 2010 pFaceIDLIST = (unsigned short *)malloc(faceIDListSize);
2024 //v68 = field_DC; 2011 //v68 = field_DC;
2025 //pFaceIDLIST = (unsigned __int16 *)v67; 2012 //pFaceIDLIST = (unsigned __int16 *)v67;
2026 //pFilename = (char *)(2 * v68); 2013 //pFilename = (char *)(2 * v68);
2027 memcpy(pFaceIDLIST, pSrc + 4, faceIDListSize); 2014 memcpy(pFaceIDLIST, pSrc + 4, faceIDListSize);
2028 pSrc += 4 + faceIDListSize; 2015 pSrc += 4 + faceIDListSize;
2029 2016
2030 //uSourceLen = (char *)uSourceLen + (int)pFilename; 2017 //uSourceLen = (char *)uSourceLen + (int)pFilename;
2031 pGameLoadingUI_ProgressBar->Progress(); 2018 pGameLoadingUI_ProgressBar->Progress();
2032 2019
2033 //v108 = (int)pOMAP; 2020 //v108 = (int)pOMAP;
2034 //pAllocator->FreeChunk((void *)v108); 2021 //free((void *)v108);
2035 //pOMAP = 0; 2022 //pOMAP = 0;
2036 if (pOMAP) 2023 if (pOMAP)
2037 { 2024 {
2038 pAllocator->FreeChunk(pOMAP); 2025 free(pOMAP);
2039 pOMAP = nullptr; 2026 pOMAP = nullptr;
2040 } 2027 }
2041 //v69 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); 2028 //v69 = malloc(0, 0x10000u, "OMAP");
2042 pOMAP = (unsigned int *)pAllocator->AllocNamedChunk(0, 0x10000, "OMAP"); 2029 pOMAP = (unsigned int *)malloc(0x10000);
2043 //v108 = 65536; 2030 //v108 = 65536;
2044 //pOMAP = (unsigned int *)v69; 2031 //pOMAP = (unsigned int *)v69;
2045 memcpy(pOMAP, pSrc, 65536); 2032 memcpy(pOMAP, pSrc, 65536);
2046 pSrc += 65536; 2033 pSrc += 65536;
2047 2034
2055 //v108 = (int)"Spawn"; 2042 //v108 = (int)"Spawn";
2056 //v107 = 24 * v70; 2043 //v107 = 24 * v70;
2057 //v106 = (char *)pSpawnPoints; 2044 //v106 = (char *)pSpawnPoints;
2058 assert(sizeof(SpawnPointMM7) == 24); 2045 assert(sizeof(SpawnPointMM7) == 24);
2059 uint spawnPointsSize = uNumSpawnPoints * sizeof(SpawnPointMM7); 2046 uint spawnPointsSize = uNumSpawnPoints * sizeof(SpawnPointMM7);
2060 pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, spawnPointsSize, "Spawn"); 2047 pSpawnPoints = (SpawnPointMM7 *)malloc(spawnPointsSize);
2061 //v72 = uNumSpawnPoints; 2048 //v72 = uNumSpawnPoints;
2062 //pSpawnPoints = v71; 2049 //pSpawnPoints = v71;
2063 memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize); 2050 memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize);
2064 pSrc += 4 + spawnPointsSize; 2051 pSrc += 4 + spawnPointsSize;
2065 2052