comparison Outdoor.cpp @ 90:8c6308bb19b3

2.11.12
author Ritor1
date Fri, 02 Nov 2012 00:41:52 +0600
parents 6b46c3e15e21
children b5e26a133fae 51a5b0dc3f30 e633cde38d64
comparison
equal deleted inserted replaced
89:ecbd9b6ccf52 90:8c6308bb19b3
713 v2 = v1->pTilemap; 713 v2 = v1->pTilemap;
714 v1->pHeightmap = 0; 714 v1->pHeightmap = 0;
715 pAllocator->FreeChunk(v2); 715 pAllocator->FreeChunk(v2);
716 v3 = v1->pAttributemap; 716 v3 = v1->pAttributemap;
717 v1->pTilemap = 0; 717 v1->pTilemap = 0;
718 pAllocator->FreeChunk(v3); // 718 if (v3)
719 {
720 pAllocator->FreeChunk(v3);
721 v3 = nullptr;
722 }
723 //pAllocator->FreeChunk(v3);
719 v4 = v1->ptr_C; 724 v4 = v1->ptr_C;
720 v1->pAttributemap = 0; 725 v1->pAttributemap = 0;
721 pAllocator->FreeChunk(v4); 726 pAllocator->FreeChunk(v4);
722 v1->ptr_C = 0; 727 v1->ptr_C = 0;
723 _47C7A9(); 728 _47C7A9();
1066 v1->uNumBModels = 0; 1071 v1->uNumBModels = 0;
1067 v1->pTileTypes[0].uTileGroup = 0; 1072 v1->pTileTypes[0].uTileGroup = 0;
1068 v1->pTileTypes[1].uTileGroup = 5; 1073 v1->pTileTypes[1].uTileGroup = 5;
1069 v1->pTileTypes[2].uTileGroup = 6; 1074 v1->pTileTypes[2].uTileGroup = 6;
1070 v1->pTileTypes[3].uTileGroup = 10; 1075 v1->pTileTypes[3].uTileGroup = 10;
1071 v1->_47F420(); 1076 v1->LoadTileGroupIds();
1072 v1->_47F3EA(); 1077 v1->_47F3EA();
1073 pAllocator->FreeChunk(v1->pBModels); 1078 pAllocator->FreeChunk(v1->pBModels);
1074 pAllocator->FreeChunk(v1->pSpawnPoints); 1079 pAllocator->FreeChunk(v1->pSpawnPoints);
1075 v1->pBModels = 0; 1080 v1->pBModels = 0;
1076 v1->pSpawnPoints = 0; 1081 v1->pSpawnPoints = 0;
1155 pAllocator->FreeChunk(pTerrainNormals); 1160 pAllocator->FreeChunk(pTerrainNormals);
1156 pTerrainNormals = 0; 1161 pTerrainNormals = 0;
1157 } 1162 }
1158 1163
1159 //----- (0047D0A6) -------------------------------------------------------- 1164 //----- (0047D0A6) --------------------------------------------------------
1160 bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t a4, int thisa) 1165 bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t pNumItems, int thisa)
1161 { 1166 {
1162 OutdoorLocation *v5; // esi@1 1167 OutdoorLocation *pOutdoorLocation; // esi@1
1163 bool result; // eax@9 1168 bool result; // eax@9
1164 bool v7; // ebx@9 1169 bool v7; // ebx@9
1165 size_t v8; // eax@10 1170 size_t v8; // eax@10
1166 void *v9; // eax@10 1171 void *v9; // eax@10
1167 void *v10; // eax@10 1172 void *v10; // eax@10
1175 BSPModel *v18; // eax@12 1180 BSPModel *v18; // eax@12
1176 __int16 v19; // ax@15 1181 __int16 v19; // ax@15
1177 __int16 v20; // ax@16 1182 __int16 v20; // ax@16
1178 int v21; // ecx@16 1183 int v21; // ecx@16
1179 ODMFace *v22; // ebx@26 1184 ODMFace *v22; // ebx@26
1180 LayingItem *v23; // ecx@27 1185 LayingItem *pItems; // ecx@27
1181 unsigned int v24; // eax@28 1186 unsigned int v24; // eax@28
1182 unsigned __int8 v25; // zf@28 1187 unsigned __int8 v25; // zf@28
1183 unsigned __int8 v26; // sf@28 1188 unsigned __int8 v26; // sf@28
1184 ODMFace *v27; // eax@28 1189 ODMFace *v27; // eax@28
1185 const char *i; // edx@29 1190 const char *i; // edx@29
1306 void *v149; // [sp+B70h] [bp-10h]@19 1311 void *v149; // [sp+B70h] [bp-10h]@19
1307 char *Str2; // [sp+B74h] [bp-Ch]@12 1312 char *Str2; // [sp+B74h] [bp-Ch]@12
1308 int v151; // [sp+B78h] [bp-8h]@59 1313 int v151; // [sp+B78h] [bp-8h]@59
1309 void *uSourceLen; // [sp+B7Ch] [bp-4h]@59 1314 void *uSourceLen; // [sp+B7Ch] [bp-4h]@59
1310 1315
1311 v5 = this; 1316 pOutdoorLocation = this;
1312 strcpy(pContainer, pFilename); 1317 strcpy(pContainer, pFilename);
1313 if ( bUnderwater ) 1318 if ( bUnderwater )
1314 { 1319 {
1315 pPaletteManager->field_267AD3 = 0x10u; 1320 pPaletteManager->pPalette_tintColor[0] = 0x10u;
1316 pPaletteManager->field_267AD4 = 0xC2u; 1321 pPaletteManager->pPalette_tintColor[1] = 0xC2u;
1317 pPaletteManager->field_267AD5 = 0x99u; 1322 pPaletteManager->pPalette_tintColor[2] = 0x99u;
1318 pPaletteManager->field_267AD0 = 0x25u; 1323 pPaletteManager->pPalette_mistColor[0] = 0x25u;
1319 pPaletteManager->field_267AD1 = 0x8Fu; 1324 pPaletteManager->pPalette_mistColor[1] = 0x8Fu;
1320 pPaletteManager->field_267AD2 = 0x5Cu; 1325 pPaletteManager->pPalette_mistColor[2] = 0x5Cu;
1321 LABEL_7: 1326 LABEL_7:
1322 pPaletteManager->RecalculateAll(); 1327 pPaletteManager->RecalculateAll();
1323 goto LABEL_8; 1328 goto LABEL_8;
1324 } 1329 }
1325 pPaletteManager->field_267AD3 = 0; 1330 pPaletteManager->pPalette_tintColor[0] = 0;
1326 pPaletteManager->field_267AD4 = 0; 1331 pPaletteManager->pPalette_tintColor[1] = 0;
1327 pPaletteManager->field_267AD5 = 0; 1332 pPaletteManager->pPalette_tintColor[2] = 0;
1328 if ( pPaletteManager->field_267AD0 != 0x80u 1333 if ( pPaletteManager->pPalette_mistColor[0] != 0x80u
1329 || pPaletteManager->field_267AD1 != 0x80u 1334 || pPaletteManager->pPalette_mistColor[1] != 0x80u
1330 || pPaletteManager->field_267AD2 != 0x80u ) 1335 || pPaletteManager->pPalette_mistColor[2] != 0x80u )
1331 { 1336 {
1332 pPaletteManager->field_267AD0 = 0x80u; 1337 pPaletteManager->pPalette_mistColor[0] = 0x80u;
1333 pPaletteManager->field_267AD1 = 0x80u; 1338 pPaletteManager->pPalette_mistColor[1] = 0x80u;
1334 pPaletteManager->field_267AD2 = 0x80u; 1339 pPaletteManager->pPalette_mistColor[2] = 0x80u;
1335 goto LABEL_7; 1340 goto LABEL_7;
1336 } 1341 }
1337 LABEL_8: 1342 LABEL_8:
1338 _6807E0_num_decorations_6807B8 = 0; 1343 pNumSoundDecorations = 0;
1339 sprintfex(FileName, "levels\\%s", pContainer); 1344 sprintf(FileName, "levels\\%s", pContainer);
1340 if ( GetFileAttributesA(FileName) != -1 ) 1345 if ( GetFileAttributesA(FileName) != -1 )
1341 { 1346 {
1342 result = (bool)fopen(FileName, "rb"); 1347 result = (bool)fopen(FileName, "rb");
1343 v7 = result; 1348 v7 = result;
1344 File = (ODMFace *)result; 1349 File = (ODMFace *)result;
1346 return result; 1351 return result;
1347 *(int *)thisa = 1; 1352 *(int *)thisa = 1;
1348 v8 = strlen(pContainer); 1353 v8 = strlen(pContainer);
1349 v108 = 2; 1354 v108 = 2;
1350 *((char *)&v139 + v8) = 0; 1355 *((char *)&v139 + v8) = 0;
1351 viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture( 1356 viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pContainer, (enum TEXTURE_TYPE)v108);
1352 pContainer,
1353 (enum TEXTURE_TYPE)v108);
1354 fread(&DstBuf, 0x180u, 1u, (FILE *)v7); 1357 fread(&DstBuf, 0x180u, 1u, (FILE *)v7);
1355 fseek((FILE *)v7, Offset, 0); 1358 fseek((FILE *)v7, Offset, 0);
1356 fread(v5, 0xB0u, 1u, (FILE *)v7); 1359 fread(pOutdoorLocation, 0xB0u, 1u, (FILE *)v7);
1357 v5->_47F420(); 1360 pOutdoorLocation->LoadTileGroupIds();
1358 v5->_47F3EA(); 1361 pOutdoorLocation->_47F3EA();
1359 strcpy(v5->pGroundTileset, "grastyl"); 1362 strcpy(pOutdoorLocation->pGroundTileset, "grastyl");
1360 fseek((FILE *)v7, v114, 0); 1363 fseek((FILE *)v7, v114, 0);
1361 fread(&v5->uNumBModels, 4u, 1u, (FILE *)v7); 1364 fread(&pOutdoorLocation->uNumBModels, 4u, 1u, (FILE *)v7);
1362 fseek((FILE *)v7, v115, 0); 1365 fseek((FILE *)v7, v115, 0);
1363 fread(&uNumLayingItems, 4u, 1u, (FILE *)v7); 1366 fread(&uNumLayingItems, 4u, 1u, (FILE *)v7);
1364 fseek((FILE *)v7, v116, 0); 1367 fseek((FILE *)v7, v116, 0);
1365 fread(&uNumLevelDecorations, 4u, 1u, (FILE *)v7); 1368 fread(&uNumLevelDecorations, 4u, 1u, (FILE *)v7);
1366 fseek((FILE *)v7, v117, 0); 1369 fseek((FILE *)v7, v117, 0);
1367 fread(&uNumActors, 4u, 1u, (FILE *)v7); 1370 fread(&uNumActors, 4u, 1u, (FILE *)v7);
1368 fseek((FILE *)v7, v118, 0); 1371 fseek((FILE *)v7, v118, 0);
1369 fread(&uNumChests, 4u, 1u, (FILE *)v7); 1372 fread(&uNumChests, 4u, 1u, (FILE *)v7);
1370 v5->pTerrain.Initialize(); 1373 pOutdoorLocation->pTerrain.Initialize();
1371 fseek((FILE *)v7, v119, 0); 1374 fseek((FILE *)v7, v119, 0);
1372 fread(v5->pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7); 1375 fread(pOutdoorLocation->pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7);
1373 fseek((FILE *)v7, v120, 0); 1376 fseek((FILE *)v7, v120, 0);
1374 fread(v5->pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7); 1377 fread(pOutdoorLocation->pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7);
1375 fseek((FILE *)v7, v121, 0); 1378 fseek((FILE *)v7, v121, 0);
1376 fread(v5->pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7); 1379 fread(pOutdoorLocation->pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7);
1377 v5->pTerrain._47C80A(0, 0, 128, 128); 1380 pOutdoorLocation->pTerrain._47C80A(0, 0, 128, 128);
1378 pAllocator->FreeChunk(v5->ptr_D4); 1381 pAllocator->FreeChunk(pOutdoorLocation->ptr_D4);
1379 v5->ptr_D4 = 0; 1382 pOutdoorLocation->ptr_D4 = 0;
1380 v9 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); 1383 v9 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
1381 v108 = (int)v5->pOMAP; 1384 v108 = (int)pOutdoorLocation->pOMAP;
1382 v5->ptr_D4 = v9; 1385 pOutdoorLocation->ptr_D4 = v9;
1383 pAllocator->FreeChunk((void *)v108); 1386 pAllocator->FreeChunk((void *)v108);
1384 v5->pOMAP = 0; 1387 pOutdoorLocation->pOMAP = 0;
1385 v10 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); 1388 v10 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
1386 v108 = 0; 1389 v108 = 0;
1387 v5->pOMAP = (unsigned int *)v10; 1390 pOutdoorLocation->pOMAP = (unsigned int *)v10;
1388 fseek((FILE *)v7, v136, v108); 1391 fseek((FILE *)v7, v136, v108);
1389 fread(&uNumTerrainNormals, 4u, 1u, (FILE *)v7); 1392 fread(&uNumTerrainNormals, 4u, 1u, (FILE *)v7);
1390 fread(pTerrainSomeOtherData, 1u, 0x20000u, (FILE *)v7); 1393 fread(pTerrainSomeOtherData, 1u, 0x20000u, (FILE *)v7);
1391 fread(pTerrainNormalIndices, 1u, 0x10000u, (FILE *)v7); 1394 fread(pTerrainNormalIndices, 1u, 0x10000u, (FILE *)v7);
1392 pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk( 1395 pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
1393 pTerrainNormals,
1394 12 * uNumTerrainNormals,
1395 "TerNorm");
1396 fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7); 1396 fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7);
1397 v11 = pAllocator->AllocNamedChunk(v5->pBModels, 188 * v5->uNumBModels, "BDdata"); 1397 v11 = pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels, 188 * pOutdoorLocation->uNumBModels, "BDdata");
1398 v108 = 0; 1398 v108 = 0;
1399 v5->pBModels = (BSPModel *)v11; 1399 pOutdoorLocation->pBModels = (BSPModel *)v11;
1400 fseek((FILE *)v7, v122, v108); 1400 fseek((FILE *)v7, v122, v108);
1401 fread(v5->pBModels, 0xBCu, v5->uNumBModels, (FILE *)v7); 1401 fread(pOutdoorLocation->pBModels, 0xBCu, pOutdoorLocation->uNumBModels, (FILE *)v7);
1402 fseek((FILE *)v7, v123, 0); 1402 fseek((FILE *)v7, v123, 0);
1403 a4 = 0; 1403 pNumItems = 0;
1404 if ( (signed int)v5->uNumBModels > 0 ) 1404 if ( (signed int)pOutdoorLocation->uNumBModels > 0 )
1405 { 1405 {
1406 v12 = 0; 1406 v12 = 0;
1407 while ( 1 ) 1407 while ( 1 )
1408 { 1408 {
1409 v5->pBModels[v12].pVertices.pVertices = 0; 1409 pOutdoorLocation->pBModels[v12].pVertices.pVertices = 0;
1410 v5->pBModels[v12].pFaces = 0; 1410 pOutdoorLocation->pBModels[v12].pFaces = 0;
1411 v5->pBModels[v12].pFacesOrdering = 0; 1411 pOutdoorLocation->pBModels[v12].pFacesOrdering = 0;
1412 v5->pBModels[v12].pNodes = 0; 1412 pOutdoorLocation->pBModels[v12].pNodes = 0;
1413 FileName[0] = 0; 1413 FileName[0] = 0;
1414 v108 = (int)&v5->pBModels[v12]; 1414 v108 = (int)&pOutdoorLocation->pBModels[v12];
1415 sprintfex(FileName, "%s", v108); 1415 sprintfex(FileName, "%s", v108);
1416 v13 = v5->pBModels; 1416 v13 = pOutdoorLocation->pBModels;
1417 v138 = 0; 1417 v138 = 0;
1418 v5->pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk( 1418 pOutdoorLocation->pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices,
1419 v13[v12].pVertices.pVertices,
1420 12 * v13[v12].pVertices.uNumVertices,
1421 FileName); 1419 FileName);
1422 v5->pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk( 1420 pOutdoorLocation->pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pFaces, 308 * pOutdoorLocation->pBModels[v12].uNumFaces,
1423 v5->pBModels[v12].pFaces,
1424 308 * v5->pBModels[v12].uNumFaces,
1425 FileName); 1421 FileName);
1426 v5->pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk( 1422 pOutdoorLocation->pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pFacesOrdering,
1427 v5->pBModels[v12].pFacesOrdering, 1423 2 * pOutdoorLocation->pBModels[v12].uNumFaces, FileName);
1428 2 * v5->pBModels[v12].uNumFaces, 1424 v14 = pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pNodes, 8 * pOutdoorLocation->pBModels[v12].uNumNodes, FileName);
1429 FileName); 1425 v15 = pOutdoorLocation->pBModels;
1430 v14 = pAllocator->AllocNamedChunk(
1431 v5->pBModels[v12].pNodes,
1432 8 * v5->pBModels[v12].uNumNodes,
1433 FileName);
1434 v15 = v5->pBModels;
1435 v108 = (int)File; 1426 v108 = (int)File;
1436 v15[v12].pNodes = (BSPNode *)v14; 1427 v15[v12].pNodes = (BSPNode *)v14;
1437 fread(v5->pBModels[v12].pVertices.pVertices, 0xCu, v5->pBModels[v12].pVertices.uNumVertices, (FILE *)v108); 1428 fread(pOutdoorLocation->pBModels[v12].pVertices.pVertices, 0xCu, pOutdoorLocation->pBModels[v12].pVertices.uNumVertices, (FILE *)v108);
1438 fread(v5->pBModels[v12].pFaces, 0x134u, v5->pBModels[v12].uNumFaces, (FILE *)File); 1429 fread(pOutdoorLocation->pBModels[v12].pFaces, 0x134u, pOutdoorLocation->pBModels[v12].uNumFaces, (FILE *)File);
1439 fread(v5->pBModels[v12].pFacesOrdering, 2u, v5->pBModels[v12].uNumFaces, (FILE *)File); 1430 fread(pOutdoorLocation->pBModels[v12].pFacesOrdering, 2u, pOutdoorLocation->pBModels[v12].uNumFaces, (FILE *)File);
1440 fread(v5->pBModels[v12].pNodes, 8u, v5->pBModels[v12].uNumNodes, (FILE *)File); 1431 fread(pOutdoorLocation->pBModels[v12].pNodes, 8u, pOutdoorLocation->pBModels[v12].uNumNodes, (FILE *)File);
1441 v16 = malloc(10 * v5->pBModels[v12].uNumFaces); 1432 v16 = malloc(10 * pOutdoorLocation->pBModels[v12].uNumFaces);
1442 v107 = (int)File; 1433 v107 = (int)File;
1443 v17 = v5->pBModels; 1434 v17 = pOutdoorLocation->pBModels;
1444 ptr = (FILE *)v16; 1435 ptr = (FILE *)v16;
1445 fread(v16, 0xAu, v17[v12].uNumFaces, (FILE *)File); 1436 fread(v16, 0xAu, v17[v12].uNumFaces, (FILE *)File);
1446 v18 = v5->pBModels; 1437 v18 = pOutdoorLocation->pBModels;
1447 Str2 = 0; 1438 Str2 = 0;
1448 if ( (signed int)v18[v12].uNumFaces > 0 ) 1439 if ( (signed int)v18[v12].uNumFaces > 0 )
1449 break; 1440 break;
1450 LABEL_25: 1441 LABEL_25:
1451 free(ptr); 1442 free(ptr);
1452 ++a4; 1443 ++pNumItems;
1453 ++v12; 1444 ++v12;
1454 if ( (signed int)a4 >= (signed int)v5->uNumBModels ) 1445 if ( (signed int)pNumItems >= (signed int)pOutdoorLocation->uNumBModels )
1455 goto LABEL_26; 1446 goto LABEL_26;
1456 } 1447 }
1457 pDestLen = 0; 1448 pDestLen = 0;
1458 pFilename = (char *)ptr; 1449 pFilename = (char *)ptr;
1459 while ( 1 ) 1450 while ( 1 )
1474 auto pTex = (Texture *)v149; 1465 auto pTex = (Texture *)v149;
1475 if (pTex) 1466 if (pTex)
1476 pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1); 1467 pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1);
1477 goto LABEL_20; 1468 goto LABEL_20;
1478 } 1469 }
1479 pTextureFrameTable->LoadAnimationSequenceAndPalettes( 1470 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(unsigned __int16 *)((char *)&pOutdoorLocation->pBModels[v12].pFaces->uTextureID + pDestLen));
1480 *(unsigned __int16 *)((char *)&v5->pBModels[v12].pFaces->uTextureID + pDestLen));
1481 LABEL_20: 1471 LABEL_20:
1482 if ( *(short *)(thisa + 292) ) 1472 if ( *(short *)(thisa + 292) )
1483 { 1473 {
1484 if ( ((ODMFace *)thisa)->HasEventHint() ) 1474 if ( ((ODMFace *)thisa)->HasEventHint() )
1485 *(char *)(thisa + 30) |= 0x10u; 1475 *(char *)(thisa + 30) |= 0x10u;
1486 else 1476 else
1487 *(char *)(thisa + 30) &= 0xEFu; 1477 *(char *)(thisa + 30) &= 0xEFu;
1488 } 1478 }
1489 ++Str2; 1479 ++Str2;
1490 v18 = v5->pBModels; 1480 v18 = pOutdoorLocation->pBModels;
1491 pDestLen += 308; 1481 pDestLen += 308;
1492 pFilename += 10; 1482 pFilename += 10;
1493 if ( (signed int)Str2 >= (signed int)v18[v12].uNumFaces ) 1483 if ( (signed int)Str2 >= (signed int)v18[v12].uNumFaces )
1494 goto LABEL_25; 1484 goto LABEL_25;
1495 } 1485 }
1501 v22 = File; 1491 v22 = File;
1502 fseek((FILE *)File, v124, 0); 1492 fseek((FILE *)File, v124, 0);
1503 fread(pLayingItems, 0x70u, uNumLayingItems, (FILE *)v22); 1493 fread(pLayingItems, 0x70u, uNumLayingItems, (FILE *)v22);
1504 if ( (signed int)uNumLayingItems > 0 ) 1494 if ( (signed int)uNumLayingItems > 0 )
1505 { 1495 {
1506 v23 = pLayingItems; 1496 pItems = pLayingItems;
1507 a4 = uNumLayingItems; 1497 pNumItems = uNumLayingItems;
1508 do 1498 do
1509 { 1499 {
1510 v24 = v23->stru_24.uItemID; 1500 v24 = pItems->stru_24.uItemID;
1511 thisa = 0; 1501 thisa = 0;
1512 v27 = (ODMFace *)(48 * v24); 1502 v27 = (ODMFace *)(48 * v24);
1513 v25 = pObjectList->uNumObjects == 0; 1503 v25 = pObjectList->uNumObjects == 0;
1514 v26 = (pObjectList->uNumObjects & 0x80000000u) != 0; 1504 v26 = (pObjectList->uNumObjects & 0x80000000u) != 0;
1515 LOWORD(v27) = *(short *)((char *)&v27->pFacePlane.vNormal.x + (int)((char *)&pItemsTable + 24)); 1505 LOWORD(v27) = *(short *)((char *)&v27->pFacePlane.vNormal.x + (int)((char *)&pItemsTable + 24));
1516 File = v27; 1506 File = v27;
1517 v23->uItemType = (unsigned __int16)v27; 1507 pItems->uItemType = (unsigned __int16)v27;
1518 if ( v26 | v25 ) 1508 if ( v26 | v25 )
1519 { 1509 {
1520 LABEL_33: 1510 LABEL_33:
1521 v29 = 0; 1511 v29 = 0;
1522 } 1512 }
1530 goto LABEL_33; 1520 goto LABEL_33;
1531 LOWORD(v27) = (short)File; 1521 LOWORD(v27) = (short)File;
1532 } 1522 }
1533 v29 = thisa; 1523 v29 = thisa;
1534 } 1524 }
1535 v23->uObjectDescID = v29; 1525 pItems->uObjectDescID = v29;
1536 ++v23; 1526 ++pItems;
1537 --a4; 1527 --pNumItems;
1538 } 1528 }
1539 while ( a4 ); 1529 while ( pNumItems );
1540 } 1530 }
1541 fseek((FILE *)v22, v125, 0); 1531 fseek((FILE *)v22, v125, 0);
1542 fread(pLevelDecorations, 0x20u, uNumLevelDecorations, (FILE *)v22); 1532 fread(pLevelDecorations, 0x20u, uNumLevelDecorations, (FILE *)v22);
1543 a4 = 0; 1533 pNumItems = 0;
1544 if ( (signed int)uNumLevelDecorations > 0 ) 1534 if ( (signed int)uNumLevelDecorations > 0 )
1545 { 1535 {
1546 thisa = (int)pLevelDecorations; 1536 thisa = (int)pLevelDecorations;
1547 do 1537 do
1548 { 1538 {
1549 fread(FileName, 1u, 0x20u, (FILE *)v22); 1539 fread(FileName, 1u, 0x20u, (FILE *)v22);
1550 v30 = pDecorationList->GetDecorIdByName(FileName); 1540 v30 = pDecorationList->GetDecorIdByName(FileName);
1551 v31 = thisa; 1541 v31 = thisa;
1552 ++a4; 1542 ++pNumItems;
1553 thisa += 32; 1543 thisa += 32;
1554 *(short *)v31 = v30; 1544 *(short *)v31 = v30;
1555 } 1545 }
1556 while ( (signed int)a4 < (signed int)uNumLevelDecorations ); 1546 while ( (signed int)pNumItems < (signed int)uNumLevelDecorations );
1557 } 1547 }
1558 fseek((FILE *)v22, v126, 0); 1548 fseek((FILE *)v22, v126, 0);
1559 fread(pActors, 0x344u, uNumActors, (FILE *)v22); 1549 fread(pActors, 0x344u, uNumActors, (FILE *)v22);
1560 fseek((FILE *)v22, v127, 0); 1550 fseek((FILE *)v22, v127, 0);
1561 fread(pChests, 0x14CCu, uNumChests, (FILE *)v22); 1551 fread(pChests, 0x14CCu, uNumChests, (FILE *)v22);
1562 fseek((FILE *)v22, v128, 0); 1552 fseek((FILE *)v22, v128, 0);
1563 fread(&v5->field_DC, 4u, 1u, (FILE *)v22); 1553 fread(&pOutdoorLocation->field_DC, 4u, 1u, (FILE *)v22);
1564 pAllocator->FreeChunk(v5->pFaceIDLIST); 1554 pAllocator->FreeChunk(pOutdoorLocation->pFaceIDLIST);
1565 v32 = v5->field_DC; 1555 v32 = pOutdoorLocation->field_DC;
1566 v5->pFaceIDLIST = 0; 1556 pOutdoorLocation->pFaceIDLIST = 0;
1567 v33 = pAllocator->AllocNamedChunk(0, 2 * v32, "IDLIST"); 1557 v33 = pAllocator->AllocNamedChunk(0, 2 * v32, "IDLIST");
1568 v108 = (int)v22; 1558 v108 = (int)v22;
1569 v5->pFaceIDLIST = (unsigned __int16 *)v33; 1559 pOutdoorLocation->pFaceIDLIST = (unsigned __int16 *)v33;
1570 fread(v33, 2u, v5->field_DC, (FILE *)v108); 1560 fread(v33, 2u, pOutdoorLocation->field_DC, (FILE *)v108);
1571 fseek((FILE *)v22, v129, 0); 1561 fseek((FILE *)v22, v129, 0);
1572 fread(v5->pOMAP, 4u, 0x4000u, (FILE *)v22); 1562 fread(pOutdoorLocation->pOMAP, 4u, 0x4000u, (FILE *)v22);
1573 fseek((FILE *)v22, v130, 0); 1563 fseek((FILE *)v22, v130, 0);
1574 fread(&v5->uNumSpawnPoints, 4u, 1u, (FILE *)v22); 1564 fread(&pOutdoorLocation->uNumSpawnPoints, 4u, 1u, (FILE *)v22);
1575 v5->pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk( 1565 pOutdoorLocation->pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pOutdoorLocation->pSpawnPoints, 24 * pOutdoorLocation->uNumSpawnPoints, "Spawn");
1576 v5->pSpawnPoints,
1577 24 * v5->uNumSpawnPoints,
1578 "Spawn");
1579 fseek((FILE *)v22, v131, 0); 1566 fseek((FILE *)v22, v131, 0);
1580 fread(v5->pSpawnPoints, 0x18u, v5->uNumSpawnPoints, (FILE *)v22); 1567 fread(pOutdoorLocation->pSpawnPoints, 0x18u, pOutdoorLocation->uNumSpawnPoints, (FILE *)v22);
1581 fseek((FILE *)v22, v132, 0); 1568 fseek((FILE *)v22, v132, 0);
1582 fread(&v5->ddm, 0x28u, 1u, (FILE *)v22); 1569 fread(&pOutdoorLocation->ddm, 0x28u, 1u, (FILE *)v22);
1583 fseek((FILE *)v22, v133, 0); 1570 fseek((FILE *)v22, v133, 0);
1584 fread(&stru_5E4C90, 1u, 0xC8u, (FILE *)v22); 1571 fread(&stru_5E4C90, 1u, 0xC8u, (FILE *)v22);
1585 fseek((FILE *)v22, v134, 0); 1572 fseek((FILE *)v22, v134, 0);
1586 fread(&v5->uLastVisitDay, 1u, 0x38u, (FILE *)v22); 1573 fread(&pOutdoorLocation->uLastVisitDay, 1u, 0x38u, (FILE *)v22);
1587 fseek((FILE *)v22, v135, 0); 1574 fseek((FILE *)v22, v135, 0);
1588 fread(&v5->uLastVisitDay, 1u, 4u, (FILE *)v22); 1575 fread(&pOutdoorLocation->uLastVisitDay, 1u, 4u, (FILE *)v22);
1589 thisa = (int)v5->pTileTypes; 1576 thisa = (int)pOutdoorLocation->pTileTypes;
1590 pTileTable->InitializeTileset(4); 1577 pTileTable->InitializeTileset(4);
1591 pTileTable->InitializeTileset(v5->pTileTypes[0].uTileGroup); 1578 pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[0].uTileGroup);
1592 pTileTable->InitializeTileset(v5->pTileTypes[1].uTileGroup); 1579 pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[1].uTileGroup);
1593 pTileTable->InitializeTileset(v5->pTileTypes[2].uTileGroup); 1580 pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[2].uTileGroup);
1594 pTileTable->InitializeTileset(v5->pTileTypes[3].uTileGroup); 1581 pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[3].uTileGroup);
1595 if ( v5 != (OutdoorLocation *)-96 && v5->pSkyTextureName[0] ) 1582 if ( pOutdoorLocation != (OutdoorLocation *)-96 && pOutdoorLocation->pSkyTextureName[0] )
1596 { 1583 {
1597 v108 = 0; 1584 v108 = 0;
1598 v107 = (int)v5->pSkyTextureName; 1585 v107 = (int)pOutdoorLocation->pSkyTextureName;
1599 } 1586 }
1600 else 1587 else
1601 { 1588 {
1602 v108 = 0; 1589 v108 = 0;
1603 v107 = (int)pDefaultSkyTexture; 1590 v107 = (int)pDefaultSkyTexture;
1604 } 1591 }
1605 v5->uSky_TextureID = pBitmaps_LOD->LoadTexture((const char *)v107, (enum TEXTURE_TYPE)v108); 1592 pOutdoorLocation->uSky_TextureID = pBitmaps_LOD->LoadTexture((const char *)v107, (enum TEXTURE_TYPE)v108);
1606 strcpy(v5->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); 1593 strcpy(pOutdoorLocation->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
1607 v34 = pTileTable->GetTileById(v5->pTileTypes[0].uTileID); 1594 v34 = pTileTable->GetTileById(pOutdoorLocation->pTileTypes[0].uTileID);
1608 v35 = pBitmaps_LOD->LoadTexture(v34->pTileName); 1595 v35 = pBitmaps_LOD->LoadTexture(v34->pTileName);
1609 v36 = v5->uSky_TextureID; 1596 v36 = pOutdoorLocation->uSky_TextureID;
1610 v5->uMainTile_BitmapID = v35; 1597 pOutdoorLocation->uMainTile_BitmapID = v35;
1611 if ( v36 != -1 ) 1598 if ( v36 != -1 )
1612 pBitmaps_LOD->pTextures[v36].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v36].palette_id1); 1599 pBitmaps_LOD->pTextures[v36].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v36].palette_id1);
1613 1600
1614 v37 = v5->uMainTile_BitmapID; 1601 v37 = pOutdoorLocation->uMainTile_BitmapID;
1615 if ( v37 != -1 ) 1602 if ( v37 != -1 )
1616 pBitmaps_LOD->pTextures[v37].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v37].palette_id1); 1603 pBitmaps_LOD->pTextures[v37].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v37].palette_id1);
1617 1604
1618 v5->_47F0E2(); 1605 pOutdoorLocation->_47F0E2();
1619 pGameLoadingUI_ProgressBar->Progress(); 1606 pGameLoadingUI_ProgressBar->Progress();
1620 fclose((FILE *)v22); 1607 fclose((FILE *)v22);
1621 goto LABEL_150; 1608 goto LABEL_150;
1622 } 1609 }
1623 if ( !pGames_LOD->DoesContainerExist(pContainer) ) 1610 if ( !pGames_LOD->DoesContainerExist(pContainer) )
1661 } 1648 }
1662 else 1649 else
1663 { 1650 {
1664 fread(v41, pSource, 1u, ptr); 1651 fread(v41, pSource, 1u, ptr);
1665 } 1652 }
1666 memcpy(v5, v42, 0xB0u); 1653 memcpy(pOutdoorLocation, v42, 0xB0u);
1667 v43 = (char *)v42 + 176; 1654 v43 = (char *)v42 + 176;
1668 v5->_47F420(); 1655 pOutdoorLocation->LoadTileGroupIds();
1669 v5->_47F3EA(); 1656 pOutdoorLocation->_47F3EA();
1670 strcpy(v5->pGroundTileset, "grastyl"); 1657 strcpy(pOutdoorLocation->pGroundTileset, "grastyl");
1671 pGameLoadingUI_ProgressBar->Progress(); 1658 pGameLoadingUI_ProgressBar->Progress();
1672 v5->pTerrain.Initialize(); 1659 pOutdoorLocation->pTerrain.Initialize();
1673 v108 = 16384; 1660 v108 = 16384;
1674 v107 = (int)v43; 1661 v107 = (int)v43;
1675 v106 = (char *)v5->pTerrain.pHeightmap; 1662 v106 = (char *)pOutdoorLocation->pTerrain.pHeightmap;
1676 memcpy(v106, v43, 0x4000u); 1663 memcpy(v106, v43, 0x4000u);
1677 v43 = (char *)v43 + 16384; 1664 v43 = (char *)v43 + 16384;
1678 v105 = 16384; 1665 v105 = 16384;
1679 v104 = (void *)v43; 1666 v104 = (void *)v43;
1680 v103 = v5->pTerrain.pTilemap; 1667 v103 = pOutdoorLocation->pTerrain.pTilemap;
1681 memcpy(v103, v43, 0x4000u); 1668 memcpy(v103, v43, 0x4000u);
1682 v43 = (char *)v43 + 16384; 1669 v43 = (char *)v43 + 16384;
1683 memcpy(v5->pTerrain.pAttributemap, v43, 0x4000u); 1670 memcpy(pOutdoorLocation->pTerrain.pAttributemap, v43, 0x4000u);
1684 v43 = (char *)v43 + 16384; 1671 v43 = (char *)v43 + 16384;
1685 v108 = (int)v5->ptr_D4; 1672 v108 = (int)pOutdoorLocation->ptr_D4;
1686 pAllocator->FreeChunk((void *)v108); 1673 pAllocator->FreeChunk((void *)v108);
1687 v5->ptr_D4 = 0; 1674 pOutdoorLocation->ptr_D4 = 0;
1688 v5->ptr_D4 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); 1675 pOutdoorLocation->ptr_D4 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
1689 v5->pTerrain._47C80A(0, 0, 128, 128); 1676 pOutdoorLocation->pTerrain._47C80A(0, 0, 128, 128);
1690 pGameLoadingUI_ProgressBar->Progress(); 1677 pGameLoadingUI_ProgressBar->Progress();
1691 memcpy(&uNumTerrainNormals, v43, 4u); 1678 memcpy(&uNumTerrainNormals, v43, 4u);
1692 v43 = (char *)v43 + 4; 1679 v43 = (char *)v43 + 4;
1693 memcpy(pTerrainSomeOtherData, v43, 0x20000u); 1680 memcpy(pTerrainSomeOtherData, v43, 0x20000u);
1694 v43 = (char *)v43 + 131072; 1681 v43 = (char *)v43 + 131072;
1695 memcpy(pTerrainNormalIndices, v43, 0x10000u); 1682 memcpy(pTerrainNormalIndices, v43, 0x10000u);
1696 v43 = (char *)v43 + 65536; 1683 v43 = (char *)v43 + 65536;
1697 pFilename = (char *)(12 * uNumTerrainNormals); 1684 pFilename = (char *)(12 * uNumTerrainNormals);
1698 pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk( 1685 pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
1699 pTerrainNormals,
1700 12 * uNumTerrainNormals,
1701 "TerNorm");
1702 memcpy(pTerrainNormals, v43, (size_t)pFilename); 1686 memcpy(pTerrainNormals, v43, (size_t)pFilename);
1703 v44 = (char *)v43 + (int)pFilename; 1687 v44 = (char *)v43 + (int)pFilename;
1704 memcpy(&v5->uNumBModels, v44, 4u); 1688 memcpy(&pOutdoorLocation->uNumBModels, v44, 4u);
1705 v44 = (char *)v44 + 4; 1689 v44 = (char *)v44 + 4;
1706 pGameLoadingUI_ProgressBar->Progress(); 1690 pGameLoadingUI_ProgressBar->Progress();
1707 v45 = v5->uNumBModels; 1691 v45 = pOutdoorLocation->uNumBModels;
1708 v108 = (int)"BDdata"; 1692 v108 = (int)"BDdata";
1709 v107 = 188 * v45; 1693 v107 = 188 * v45;
1710 v106 = (char *)v5->pBModels; 1694 v106 = (char *)pOutdoorLocation->pBModels;
1711 v46 = (BSPModel *)pAllocator->AllocNamedChunk(v106, 188 * v45, "BDdata"); 1695 v46 = (BSPModel *)pAllocator->AllocNamedChunk(v106, 188 * v45, "BDdata");
1712 v47 = v5->uNumBModels; 1696 v47 = pOutdoorLocation->uNumBModels;
1713 v5->pBModels = v46; 1697 pOutdoorLocation->pBModels = v46;
1714 pFilename = (char *)(188 * v47); 1698 pFilename = (char *)(188 * v47);
1715 memcpy(v46, v44, 188 * v47); 1699 memcpy(v46, v44, 188 * v47);
1716 uSourceLen = (char *)v44 + (int)pFilename; 1700 uSourceLen = (char *)v44 + (int)pFilename;
1717 pGameLoadingUI_ProgressBar->Progress(); 1701 pGameLoadingUI_ProgressBar->Progress();
1718 v151 = 0; 1702 v151 = 0;
1719 if ( (signed int)v5->uNumBModels > 0 ) 1703 if ( (signed int)pOutdoorLocation->uNumBModels > 0 )
1720 { 1704 {
1721 v48 = 0; 1705 v48 = 0;
1722 while ( 1 ) 1706 while ( 1 )
1723 { 1707 {
1724 v5->pBModels[v48].pVertices.pVertices = 0; 1708 pOutdoorLocation->pBModels[v48].pVertices.pVertices = 0;
1725 v5->pBModels[v48].pFaces = 0; 1709 pOutdoorLocation->pBModels[v48].pFaces = 0;
1726 v5->pBModels[v48].pFacesOrdering = 0; 1710 pOutdoorLocation->pBModels[v48].pFacesOrdering = 0;
1727 v5->pBModels[v48].pNodes = 0; 1711 pOutdoorLocation->pBModels[v48].pNodes = 0;
1728 FileName[0] = 0; 1712 FileName[0] = 0;
1729 v108 = (int)&v5->pBModels[v48]; 1713 v108 = (int)&pOutdoorLocation->pBModels[v48];
1730 sprintfex(FileName, "%s", v108); 1714 sprintf(FileName, "%s", v108);
1731 v49 = v5->pBModels; 1715 v49 = pOutdoorLocation->pBModels;
1732 v138 = 0; 1716 v138 = 0;
1733 v50 = &v49[v48]; 1717 v50 = &v49[v48];
1734 v108 = (int)FileName; 1718 v108 = (int)FileName;
1735 v107 = 12 * v50->pVertices.uNumVertices; 1719 v107 = 12 * v50->pVertices.uNumVertices;
1736 v106 = (char *)v50->pVertices.pVertices; 1720 v106 = (char *)v50->pVertices.pVertices;
1737 v5->pBModels[v48].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v106, v107, FileName); 1721 pOutdoorLocation->pBModels[v48].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v106, v107, FileName);
1738 v51 = &v5->pBModels[v48]; 1722 v51 = &pOutdoorLocation->pBModels[v48];
1739 v108 = (int)FileName; 1723 v108 = (int)FileName;
1740 v107 = 308 * v51->uNumFaces; 1724 v107 = 308 * v51->uNumFaces;
1741 v106 = (char *)v51->pFaces; 1725 v106 = (char *)v51->pFaces;
1742 v5->pBModels[v48].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(v106, v107, FileName); 1726 pOutdoorLocation->pBModels[v48].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(v106, v107, FileName);
1743 v52 = &v5->pBModels[v48]; 1727 v52 = &pOutdoorLocation->pBModels[v48];
1744 v108 = (int)FileName; 1728 v108 = (int)FileName;
1745 v107 = 2 * v52->uNumFaces; 1729 v107 = 2 * v52->uNumFaces;
1746 v106 = (char *)v52->pFacesOrdering; 1730 v106 = (char *)v52->pFacesOrdering;
1747 v5->pBModels[v48].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk( 1731 pOutdoorLocation->pBModels[v48].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(v106, v107, FileName);
1748 v106, 1732 v53 = &pOutdoorLocation->pBModels[v48];
1749 v107,
1750 FileName);
1751 v53 = &v5->pBModels[v48];
1752 v108 = (int)FileName; 1733 v108 = (int)FileName;
1753 v107 = 8 * v53->uNumNodes; 1734 v107 = 8 * v53->uNumNodes;
1754 v106 = (char *)v53->pNodes; 1735 v106 = (char *)v53->pNodes;
1755 v5->pBModels[v48].pNodes = (BSPNode *)pAllocator->AllocNamedChunk(v106, v107, FileName); 1736 pOutdoorLocation->pBModels[v48].pNodes = (BSPNode *)pAllocator->AllocNamedChunk(v106, v107, FileName);
1756 v54 = &v5->pBModels[v48]; 1737 v54 = &pOutdoorLocation->pBModels[v48];
1757 v108 = 12 * v54->pVertices.uNumVertices; 1738 v108 = 12 * v54->pVertices.uNumVertices;
1758 pFilename = (char *)v108; 1739 pFilename = (char *)v108;
1759 v107 = (int)uSourceLen; 1740 v107 = (int)uSourceLen;
1760 v106 = (char *)v54->pVertices.pVertices; 1741 v106 = (char *)v54->pVertices.pVertices;
1761 memcpy(v106, uSourceLen, v108); 1742 memcpy(v106, uSourceLen, v108);
1762 uSourceLen = (char *)uSourceLen + (int)pFilename; 1743 uSourceLen = (char *)uSourceLen + (int)pFilename;
1763 v55 = &v5->pBModels[v48]; 1744 v55 = &pOutdoorLocation->pBModels[v48];
1764 v105 = 308 * v55->uNumFaces; 1745 v105 = 308 * v55->uNumFaces;
1765 v104 = uSourceLen; 1746 v104 = uSourceLen;
1766 v103 = v55->pFaces; 1747 v103 = v55->pFaces;
1767 pFilename = (char *)v105; 1748 pFilename = (char *)v105;
1768 memcpy(v103, uSourceLen, v105); 1749 memcpy(v103, uSourceLen, v105);
1769 v56 = &v5->pBModels[v48]; 1750 v56 = &pOutdoorLocation->pBModels[v48];
1770 uSourceLen = (char *)uSourceLen + (int)pFilename; 1751 uSourceLen = (char *)uSourceLen + (int)pFilename;
1771 v57 = v56->pFacesOrdering; 1752 v57 = v56->pFacesOrdering;
1772 pFilename = (char *)(2 * v56->uNumFaces); 1753 pFilename = (char *)(2 * v56->uNumFaces);
1773 memcpy(v57, uSourceLen, (size_t)pFilename); 1754 memcpy(v57, uSourceLen, (size_t)pFilename);
1774 v58 = &v5->pBModels[v48]; 1755 v58 = &pOutdoorLocation->pBModels[v48];
1775 uSourceLen = (char *)uSourceLen + (int)pFilename; 1756 uSourceLen = (char *)uSourceLen + (int)pFilename;
1776 v59 = v58->pNodes; 1757 v59 = v58->pNodes;
1777 pFilename = (char *)(8 * v58->uNumNodes); 1758 pFilename = (char *)(8 * v58->uNumNodes);
1778 memcpy(v59, uSourceLen, (size_t)pFilename); 1759 memcpy(v59, uSourceLen, (size_t)pFilename);
1779 uSourceLen = (char *)uSourceLen + (int)pFilename; 1760 uSourceLen = (char *)uSourceLen + (int)pFilename;
1780 ptr = (FILE *)malloc(10 * v5->pBModels[v48].uNumFaces); 1761 ptr = (FILE *)malloc(10 * pOutdoorLocation->pBModels[v48].uNumFaces);
1781 pFilename = (char *)(10 * v5->pBModels[v48].uNumFaces); 1762 pFilename = (char *)(10 * pOutdoorLocation->pBModels[v48].uNumFaces);
1782 memcpy(ptr, uSourceLen, (size_t)pFilename); 1763 memcpy(ptr, uSourceLen, (size_t)pFilename);
1783 v144 = 0; 1764 v144 = 0;
1784 uSourceLen = (char *)uSourceLen + (int)pFilename; 1765 uSourceLen = (char *)uSourceLen + (int)pFilename;
1785 v60 = v5->pBModels; 1766 v60 = pOutdoorLocation->pBModels;
1786 if ( (signed int)v60[v48].uNumFaces > 0 ) 1767 if ( (signed int)v60[v48].uNumFaces > 0 )
1787 break; 1768 break;
1788 LABEL_74: 1769 LABEL_74:
1789 free(ptr); 1770 free(ptr);
1790 ++v151; 1771 ++v151;
1791 ++v48; 1772 ++v48;
1792 if ( v151 >= (signed int)v5->uNumBModels ) 1773 if ( v151 >= (signed int)pOutdoorLocation->uNumBModels )
1793 goto LABEL_75; 1774 goto LABEL_75;
1794 } 1775 }
1795 v149 = 0; 1776 v149 = 0;
1796 Str2 = (char *)ptr; 1777 Str2 = (char *)ptr;
1797 while ( 1 ) 1778 while ( 1 )
1812 v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36); 1793 v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36);
1813 if ((signed __int16)v62 != -1) 1794 if ((signed __int16)v62 != -1)
1814 pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(v108); 1795 pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(v108);
1815 goto LABEL_69; 1796 goto LABEL_69;
1816 } 1797 }
1817 v108 = *(unsigned __int16 *)((char *)&v5->pBModels[v48].pFaces->uTextureID + (unsigned int)v149); 1798 v108 = *(unsigned __int16 *)((char *)&pOutdoorLocation->pBModels[v48].pFaces->uTextureID + (unsigned int)v149);
1818 pTextureFrameTable->LoadAnimationSequenceAndPalettes(v108); 1799 pTextureFrameTable->LoadAnimationSequenceAndPalettes(v108);
1819 LABEL_69: 1800 LABEL_69:
1820 if ( *((short *)pFilename + 146) ) 1801 if ( *((short *)pFilename + 146) )
1821 { 1802 {
1822 if ( ((ODMFace *)pFilename)->HasEventHint() ) 1803 if ( ((ODMFace *)pFilename)->HasEventHint() )
1823 pFilename[30] |= 0x10u; 1804 pFilename[30] |= 0x10u;
1824 else 1805 else
1825 pFilename[30] &= 0xEFu; 1806 pFilename[30] &= 0xEFu;
1826 } 1807 }
1827 ++v144; 1808 ++v144;
1828 v60 = v5->pBModels; 1809 v60 = pOutdoorLocation->pBModels;
1829 v149 = (char *)v149 + 308; 1810 v149 = (char *)v149 + 308;
1830 Str2 += 10; 1811 Str2 += 10;
1831 if ( v144 >= (signed int)v60[v48].uNumFaces ) 1812 if ( v144 >= (signed int)v60[v48].uNumFaces )
1832 goto LABEL_74; 1813 goto LABEL_74;
1833 } 1814 }
1862 *(short *)v65 = v64; 1843 *(short *)v65 = v64;
1863 } 1844 }
1864 while ( v151 < (signed int)uNumLevelDecorations ); 1845 while ( v151 < (signed int)uNumLevelDecorations );
1865 } 1846 }
1866 pGameLoadingUI_ProgressBar->Progress(); 1847 pGameLoadingUI_ProgressBar->Progress();
1867 memcpy(&v5->field_DC, uSourceLen, 4u); 1848 memcpy(&pOutdoorLocation->field_DC, uSourceLen, 4u);
1868 uSourceLen = (char *)uSourceLen + 4; 1849 uSourceLen = (char *)uSourceLen + 4;
1869 v108 = (int)v5->pFaceIDLIST; 1850 v108 = (int)pOutdoorLocation->pFaceIDLIST;
1870 pAllocator->FreeChunk((void *)v108); 1851 pAllocator->FreeChunk((void *)v108);
1871 v66 = v5->field_DC; 1852 v66 = pOutdoorLocation->field_DC;
1872 v5->pFaceIDLIST = 0; 1853 pOutdoorLocation->pFaceIDLIST = 0;
1873 v67 = pAllocator->AllocNamedChunk(0, 2 * v66, "IDLIST"); 1854 v67 = pAllocator->AllocNamedChunk(0, 2 * v66, "IDLIST");
1874 v68 = v5->field_DC; 1855 v68 = pOutdoorLocation->field_DC;
1875 v5->pFaceIDLIST = (unsigned __int16 *)v67; 1856 pOutdoorLocation->pFaceIDLIST = (unsigned __int16 *)v67;
1876 pFilename = (char *)(2 * v68); 1857 pFilename = (char *)(2 * v68);
1877 memcpy(v67, uSourceLen, 2 * v68); 1858 memcpy(v67, uSourceLen, 2 * v68);
1878 uSourceLen = (char *)uSourceLen + (int)pFilename; 1859 uSourceLen = (char *)uSourceLen + (int)pFilename;
1879 pGameLoadingUI_ProgressBar->Progress(); 1860 pGameLoadingUI_ProgressBar->Progress();
1880 v108 = (int)v5->pOMAP; 1861 v108 = (int)pOutdoorLocation->pOMAP;
1881 pAllocator->FreeChunk((void *)v108); 1862 pAllocator->FreeChunk((void *)v108);
1882 v5->pOMAP = 0; 1863 pOutdoorLocation->pOMAP = 0;
1883 v69 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); 1864 v69 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
1884 v108 = 65536; 1865 v108 = 65536;
1885 v5->pOMAP = (unsigned int *)v69; 1866 pOutdoorLocation->pOMAP = (unsigned int *)v69;
1886 memcpy(v69, uSourceLen, v108); 1867 memcpy(v69, uSourceLen, v108);
1887 uSourceLen = (char *)uSourceLen + 65536; 1868 uSourceLen = (char *)uSourceLen + 65536;
1888 pGameLoadingUI_ProgressBar->Progress(); 1869 pGameLoadingUI_ProgressBar->Progress();
1889 memcpy(&v5->uNumSpawnPoints, uSourceLen, 4u); 1870 memcpy(&pOutdoorLocation->uNumSpawnPoints, uSourceLen, 4u);
1890 uSourceLen = (char *)uSourceLen + 4; 1871 uSourceLen = (char *)uSourceLen + 4;
1891 pGameLoadingUI_ProgressBar->Progress(); 1872 pGameLoadingUI_ProgressBar->Progress();
1892 v70 = v5->uNumSpawnPoints; 1873 v70 = pOutdoorLocation->uNumSpawnPoints;
1893 v108 = (int)"Spawn"; 1874 v108 = (int)"Spawn";
1894 v107 = 24 * v70; 1875 v107 = 24 * v70;
1895 v106 = (char *)v5->pSpawnPoints; 1876 v106 = (char *)pOutdoorLocation->pSpawnPoints;
1896 v71 = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(v106, 24 * v70, "Spawn"); 1877 v71 = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(v106, 24 * v70, "Spawn");
1897 v72 = v5->uNumSpawnPoints; 1878 v72 = pOutdoorLocation->uNumSpawnPoints;
1898 v5->pSpawnPoints = v71; 1879 pOutdoorLocation->pSpawnPoints = v71;
1899 memcpy(v71, uSourceLen, 24 * v72); 1880 memcpy(v71, uSourceLen, 24 * v72);
1900 pGameLoadingUI_ProgressBar->Progress(); 1881 pGameLoadingUI_ProgressBar->Progress();
1901 free((void *)HIDWORD(v142)); 1882 free((void *)HIDWORD(v142));
1902 v108 = (int)".ddm"; 1883 v108 = (int)".ddm";
1903 v73 = strlen(pContainer); 1884 v73 = strlen(pContainer);
1904 strcpy((char *)v141 + v73, (const char *)v108); 1885 strcpy((char *)v141 + v73, (const char *)v108);
1905 v151 = (int)pNew_LOD->FindContainer(pContainer, 1); 1886 v151 = (int)pNew_LOD->FindContainer(pContainer, 1);//
1906 fread(&header, 0x10u, 1u, (FILE *)v151); 1887 fread(&header, 0x10u, 1u, (FILE *)v151);
1907 Str2 = 0; 1888 Str2 = 0;
1908 if ( header.uVersion != 91969 1889 if ( header.uVersion != 91969
1909 || header.pMagic[0] != 'm' 1890 || header.pMagic[0] != 'm'
1910 || header.pMagic[1] != 'v' 1891 || header.pMagic[1] != 'v'
1938 } 1919 }
1939 else 1920 else
1940 { 1921 {
1941 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0); 1922 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0);
1942 } 1923 }
1943 memcpy(&v5->ddm, v75, 0x28u); 1924 memcpy(&pOutdoorLocation->ddm, v75, 0x28u);
1944 v74 = (int)((char *)v75 + 40); 1925 v74 = (int)((char *)v75 + 40);
1945 } 1926 }
1946 v76 = v5->uNumBModels; 1927 v76 = pOutdoorLocation->uNumBModels;
1947 v77 = 0; 1928 v77 = 0;
1948 if ( (signed int)v76 > 0 ) 1929 if ( (signed int)v76 > 0 )
1949 { 1930 {
1950 v78 = (char *)&v5->pBModels->uNumFaces; 1931 v78 = (char *)&pOutdoorLocation->pBModels->uNumFaces;
1951 do 1932 do
1952 { 1933 {
1953 v77 += *(int *)v78; 1934 v77 += *(int *)v78;
1954 v78 += 188; 1935 v78 += 188;
1955 --v76; 1936 --v76;
1956 } 1937 }
1957 while ( v76 ); 1938 while ( v76 );
1958 } 1939 }
1959 v79 = v5->ddm.uNumFacesInBModels; 1940 v79 = pOutdoorLocation->ddm.uNumFacesInBModels;
1960 if ( v79 ) 1941 if ( v79 )
1961 { 1942 {
1962 if ( v5->ddm.uNumBModels ) 1943 if ( pOutdoorLocation->ddm.uNumBModels )
1963 { 1944 {
1964 v80 = v5->ddm.uNumDecorations; 1945 v80 = pOutdoorLocation->ddm.uNumDecorations;
1965 if ( v80 ) 1946 if ( v80 )
1966 { 1947 {
1967 if ( v79 != v77 || v5->ddm.uNumBModels != v5->uNumBModels || v80 != uNumLevelDecorations ) 1948 if ( v79 != v77 || pOutdoorLocation->ddm.uNumBModels != pOutdoorLocation->uNumBModels || v80 != uNumLevelDecorations )
1968 Str2 = (char *)1; 1949 Str2 = (char *)1;
1969 } 1950 }
1970 } 1951 }
1971 } 1952 }
1972 if ( BYTE1(dword_6BE364_game_settings_1) & 0x20 ) 1953 if ( BYTE1(dword_6BE364_game_settings_1) & 0x20 )
1973 a4 = 29030400; 1954 pNumItems = 29030400;
1974 if ( Str2 ) 1955 if ( Str2 )
1975 { 1956 {
1976 memset(Dst, 0, 0x3C8u); 1957 memset(Dst, 0, 0x3C8u);
1977 memset(Src, 0, 0x3C8u); 1958 memset(Src, 0, 0x3C8u);
1978 goto LABEL_112; 1959 goto LABEL_112;
1979 } 1960 }
1980 v81 = v5->ddm.uLastRepawnDay; 1961 v81 = pOutdoorLocation->ddm.uLastRepawnDay;
1981 if ( (unsigned int)((char *)File - v81) >= a4 || !v81 ) 1962 if ( (unsigned int)((char *)File - v81) >= pNumItems || !v81 )
1982 { 1963 {
1983 memcpy(Dst, (const void *)v74, 0x3C8u); 1964 memcpy(Dst, (const void *)v74, 0x3C8u);
1984 memcpy(Src, (const void *)(v74 + 968), 0x3C8u); 1965 memcpy(Src, (const void *)(v74 + 968), 0x3C8u);
1985 LABEL_112: 1966 LABEL_112:
1986 free(v149); 1967 free(v149);
1987 v25 = Str2 == 0; 1968 v25 = Str2 == 0;
1988 v5->ddm.uLastRepawnDay = (int)File; 1969 pOutdoorLocation->ddm.uLastRepawnDay = (int)File;
1989 if ( v25 ) 1970 if ( v25 )
1990 ++v5->ddm.uNumRespawns; 1971 ++pOutdoorLocation->ddm.uNumRespawns;
1991 v108 = 0; 1972 v108 = 0;
1992 *(int *)thisa = 1; 1973 *(int *)thisa = 1;
1993 v151 = (int)pGames_LOD->FindContainer(pContainer, v108); 1974 v151 = (int)pGames_LOD->FindContainer(pContainer, v108);
1994 fread(&header, 0x10u, 1u, (FILE *)v151); 1975 fread(&header, 0x10u, 1u, (FILE *)v151);
1995 pFilename = (char *)header.uCompressedSize; 1976 pFilename = (char *)header.uCompressedSize;
2020 *(int *)thisa = 0; 2001 *(int *)thisa = 0;
2021 LABEL_120: 2002 LABEL_120:
2022 v108 = (int)".odm"; 2003 v108 = (int)".odm";
2023 v83 = strlen(pContainer); 2004 v83 = strlen(pContainer);
2024 strcpy((char *)v141 + v83, (const char *)v108); 2005 strcpy((char *)v141 + v83, (const char *)v108);
2025 memcpy(v5->array_528, (const void *)v74, 0x3C8u); 2006 memcpy(pOutdoorLocation->array_528, (const void *)v74, 0x3C8u);
2026 v84 = (const void *)(v74 + 968); 2007 v84 = (const void *)(v74 + 968);
2027 memcpy(v5->array_8F0, v84, 0x3C8u); 2008 memcpy(pOutdoorLocation->array_8F0, v84, 0x3C8u);
2028 v85 = (char *)v84 + 968; 2009 v85 = (char *)v84 + 968;
2029 pGameLoadingUI_ProgressBar->Progress(); 2010 pGameLoadingUI_ProgressBar->Progress();
2030 if ( *(int *)thisa ) 2011 if ( *(int *)thisa )
2031 { 2012 {
2032 memcpy(v5->array_528, Dst, 0x3C8u); 2013 memcpy(pOutdoorLocation->array_528, Dst, 0x3C8u);
2033 memcpy(v5->array_8F0, Src, 0x3C8u); 2014 memcpy(pOutdoorLocation->array_8F0, Src, 0x3C8u);
2034 } 2015 }
2035 v25 = v5->uNumBModels == 0; 2016 v25 = pOutdoorLocation->uNumBModels == 0;
2036 v26 = (v5->uNumBModels & 0x80000000u) != 0; 2017 v26 = (pOutdoorLocation->uNumBModels & 0x80000000u) != 0;
2037 v151 = 0; 2018 v151 = 0;
2038 if ( !(v26 | v25) ) 2019 if ( !(v26 | v25) )
2039 { 2020 {
2040 a4 = 0; 2021 pNumItems = 0;
2041 do 2022 do
2042 { 2023 {
2043 v86 = v5->pBModels; 2024 v86 = pOutdoorLocation->pBModels;
2044 thisa = 0; 2025 thisa = 0;
2045 v87 = (unsigned int)((char *)v86 + a4); 2026 v87 = (unsigned int)((char *)v86 + pNumItems);
2046 if ( *(int *)(v87 + 76) > 0 ) 2027 if ( *(int *)(v87 + 76) > 0 )
2047 { 2028 {
2048 File = 0; 2029 File = 0;
2049 do 2030 do
2050 { 2031 {
2051 v106 = (char *)&File->uAttributes + *(int *)(v87 + 84); 2032 v106 = (char *)&File->uAttributes + *(int *)(v87 + 84);
2052 memcpy(v106, v85, 4u); 2033 memcpy(v106, v85, 4u);
2053 v88 = v5->pBModels; 2034 v88 = pOutdoorLocation->pBModels;
2054 ++File; 2035 ++File;
2055 v85 = (char *)v85 + 4; 2036 v85 = (char *)v85 + 4;
2056 ++thisa; 2037 ++thisa;
2057 v87 = (unsigned int)((char *)v88 + a4); 2038 v87 = (unsigned int)((char *)v88 + pNumItems);
2058 } 2039 }
2059 while ( thisa < *(int *)(v87 + 76) ); 2040 while ( thisa < *(int *)(v87 + 76) );
2060 } 2041 }
2061 v89 = v5->pBModels; 2042 v89 = pOutdoorLocation->pBModels;
2062 thisa = 0; 2043 thisa = 0;
2063 if ( *(signed int *)((char *)&v89->uNumFaces + a4) > 0 ) 2044 if ( *(signed int *)((char *)&v89->uNumFaces + pNumItems) > 0 )
2064 { 2045 {
2065 pFilename = 0; 2046 pFilename = 0;
2066 do 2047 do
2067 { 2048 {
2068 v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + a4)]; 2049 v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)];
2069 File = v90; 2050 File = v90;
2070 if ( v90->sCogTriggeredID ) 2051 if ( v90->sCogTriggeredID )
2071 { 2052 {
2072 if ( v90->HasEventHint() ) 2053 if ( v90->HasEventHint() )
2073 BYTE2(File->uAttributes) |= 0x10u; 2054 BYTE2(File->uAttributes) |= 0x10u;
2074 else 2055 else
2075 BYTE2(File->uAttributes) &= 0xEFu; 2056 BYTE2(File->uAttributes) &= 0xEFu;
2076 } 2057 }
2077 ++thisa; 2058 ++thisa;
2078 v89 = v5->pBModels; 2059 v89 = pOutdoorLocation->pBModels;
2079 pFilename += 308; 2060 pFilename += 308;
2080 } 2061 }
2081 while ( thisa < *(signed int *)((char *)&v89->uNumFaces + a4) ); 2062 while ( thisa < *(signed int *)((char *)&v89->uNumFaces + pNumItems) );
2082 } 2063 }
2083 ++v151; 2064 ++v151;
2084 a4 += 188; 2065 pNumItems += 188;
2085 } 2066 }
2086 while ( v151 < (signed int)v5->uNumBModels ); 2067 while ( v151 < (signed int)pOutdoorLocation->uNumBModels );
2087 } 2068 }
2088 pGameLoadingUI_ProgressBar->Progress(); 2069 pGameLoadingUI_ProgressBar->Progress();
2089 v151 = 0; 2070 v151 = 0;
2090 if ( (signed int)uNumLevelDecorations > 0 ) 2071 if ( (signed int)uNumLevelDecorations > 0 )
2091 { 2072 {
2133 memcpy(pChests, v95, 5324 * uNumChests); 2114 memcpy(pChests, v95, 5324 * uNumChests);
2134 v96 = (char *)v95 + (int)pFilename; 2115 v96 = (char *)v95 + (int)pFilename;
2135 pGameLoadingUI_ProgressBar->Progress(); 2116 pGameLoadingUI_ProgressBar->Progress();
2136 memcpy(&stru_5E4C90, v96, 0xC8u); 2117 memcpy(&stru_5E4C90, v96, 0xC8u);
2137 pGameLoadingUI_ProgressBar->Progress(); 2118 pGameLoadingUI_ProgressBar->Progress();
2138 memcpy(&v5->uLastVisitDay, v96 + 200, 0x38u); 2119 memcpy(&pOutdoorLocation->uLastVisitDay, v96 + 200, 0x38u);
2139 free(v149); 2120 free(v149);
2140 pTileTable->InitializeTileset(4); 2121 pTileTable->InitializeTileset(4);
2141 thisa = (int)v5->pTileTypes; 2122 thisa = (int)pOutdoorLocation->pTileTypes;
2142 v108 = v5->pTileTypes[0].uTileGroup; 2123 v108 = pOutdoorLocation->pTileTypes[0].uTileGroup;
2143 pTileTable->InitializeTileset(v108); 2124 pTileTable->InitializeTileset(v108);
2144 v108 = v5->pTileTypes[1].uTileGroup; 2125 v108 = pOutdoorLocation->pTileTypes[1].uTileGroup;
2145 pTileTable->InitializeTileset(v108); 2126 pTileTable->InitializeTileset(v108);
2146 v108 = v5->pTileTypes[2].uTileGroup; 2127 v108 = pOutdoorLocation->pTileTypes[2].uTileGroup;
2147 pTileTable->InitializeTileset(v108); 2128 pTileTable->InitializeTileset(v108);
2148 v108 = v5->pTileTypes[3].uTileGroup; 2129 v108 = pOutdoorLocation->pTileTypes[3].uTileGroup;
2149 pTileTable->InitializeTileset(v108); 2130 pTileTable->InitializeTileset(v108);
2150 strcpy(v5->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); 2131 strcpy(pOutdoorLocation->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
2151 v97 = v5->pTileTypes[0].uTileID; 2132 v97 = pOutdoorLocation->pTileTypes[0].uTileID;
2152 v108 = 0; 2133 v108 = 0;
2153 v98 = pTileTable->GetTileById(v97); 2134 v98 = pTileTable->GetTileById(v97);
2154 v99 = pBitmaps_LOD->LoadTexture(v98->pTileName, (enum TEXTURE_TYPE)v108); 2135 v99 = pBitmaps_LOD->LoadTexture(v98->pTileName, (enum TEXTURE_TYPE)v108);
2155 v5->uMainTile_BitmapID = v99; 2136 pOutdoorLocation->uMainTile_BitmapID = v99;
2156 if ( v99 != -1 ) 2137 if ( v99 != -1 )
2157 { 2138 {
2158 v108 = (v99 != -1 ? pBitmaps_LOD->pTextures[v99].palette_id1 : 36); 2139 v108 = (v99 != -1 ? pBitmaps_LOD->pTextures[v99].palette_id1 : 36);
2159 if (v99 != -1) 2140 if (v99 != -1)
2160 pBitmaps_LOD->pTextures[v99].palette_id2 = pPaletteManager->LoadPalette(v108); 2141 pBitmaps_LOD->pTextures[v99].palette_id2 = pPaletteManager->LoadPalette(v108);
2161 } 2142 }
2162 v5->_47F0E2(); 2143 pOutdoorLocation->_47F0E2();
2163 LABEL_150: 2144 LABEL_150:
2164 v100 = HIDWORD(v5->uLastVisitDay); 2145 v100 = HIDWORD(pOutdoorLocation->uLastVisitDay);
2165 LODWORD(v142) = LODWORD(v5->uLastVisitDay); 2146 LODWORD(v142) = LODWORD(pOutdoorLocation->uLastVisitDay);
2166 HIDWORD(v142) = v100; 2147 HIDWORD(v142) = v100;
2167 if ( v100 | (unsigned int)v142 ) 2148 if ( v100 | (unsigned int)v142 )
2168 { 2149 {
2169 v108 = 28; 2150 v108 = 28;
2170 if ( (signed int)((signed int)(signed __int64)((double)v142 * 0.234375) / 60 / 60 / 0x18u) % 28 != pParty->uDaysPlayed ) 2151 if ( (signed int)((signed int)(signed __int64)((double)v142 * 0.234375) / 60 / 60 / 0x18u) % 28 != pParty->uDaysPlayed )
2171 { 2152 {
2172 if ( rand() % 100 >= 20 ) 2153 if ( rand() % 100 >= 20 )
2173 v108 = dword_4EC268[rand() % dword_4EC2A8]; 2154 v108 = dword_4EC268[rand() % dword_4EC2A8];
2174 else 2155 else
2175 v108 = dword_4EC28C[rand() % dword_4EC2AC]; 2156 v108 = dword_4EC28C[rand() % dword_4EC2AC];
2176 sprintfex(v5->field_4F8, "plansky%d", v108); 2157 sprintf(pOutdoorLocation->field_4F8, "plansky%d", v108);
2177 } 2158 }
2178 } 2159 }
2179 else 2160 else
2180 { 2161 {
2181 strcpy(v5->field_4F8, "plansky3"); 2162 strcpy(pOutdoorLocation->field_4F8, "plansky3");
2182 } 2163 }
2183 v101 = pBitmaps_LOD->LoadTexture(v5->field_4F8); 2164 v101 = pBitmaps_LOD->LoadTexture(pOutdoorLocation->field_4F8);
2184 v5->uSky_TextureID = v101; 2165 pOutdoorLocation->uSky_TextureID = v101;
2185 if ( v101 != -1 ) 2166 if ( v101 != -1 )
2186 { 2167 {
2187 v108 = (v101 != -1 ? pBitmaps_LOD->pTextures[v101].palette_id1 : 36); 2168 v108 = (v101 != -1 ? pBitmaps_LOD->pTextures[v101].palette_id1 : 36);
2188 if (v101 != -1) 2169 if (v101 != -1)
2189 pBitmaps_LOD->pTextures[v101].palette_id2 = pPaletteManager->LoadPalette(v108); 2170 pBitmaps_LOD->pTextures[v101].palette_id2 = pPaletteManager->LoadPalette(v108);
2594 v3 = pLevelDecorations; 2575 v3 = pLevelDecorations;
2595 do 2576 do
2596 { 2577 {
2597 pDecorationList->InitializeDecorationSprite(v3->uDecorationDescID); 2578 pDecorationList->InitializeDecorationSprite(v3->uDecorationDescID);
2598 v4 = pDecorationList->pDecorations[v3->uDecorationDescID].uSoundID; 2579 v4 = pDecorationList->pDecorations[v3->uDecorationDescID].uSoundID;
2599 if ( v4 && _6807E0_num_decorations_6807B8 < 9 ) 2580 if ( v4 && pNumSoundDecorations < 9 )
2600 { 2581 {
2601 pSoundList->_4A9A67(v4, 0); 2582 pSoundList->_4A9A67(v4, 0);
2602 v5 = _6807E0_num_decorations_6807B8++; 2583 v5 = pNumSoundDecorations++;
2603 _6807B8_level_decorations_ids[v5] = v2; 2584 _6807B8_level_decorations_ids[v5] = v2;
2604 } 2585 }
2605 if ( v8 && v3->uCog == 20 ) 2586 if ( v8 && v3->uCog == 20 )
2606 LOBYTE(v3->field_2) |= 0x40u; 2587 LOBYTE(v3->field_2) |= 0x40u;
2607 if ( !v3->field_16_event_id ) 2588 if ( !v3->field_16_event_id )
2740 pTileTable->InitializeTileset(v1->uTileGroup); 2721 pTileTable->InitializeTileset(v1->uTileGroup);
2741 return 1; 2722 return 1;
2742 } 2723 }
2743 2724
2744 //----- (0047F420) -------------------------------------------------------- 2725 //----- (0047F420) --------------------------------------------------------
2745 bool OutdoorLocation::_47F420() 2726 bool OutdoorLocation::LoadTileGroupIds()
2746 { 2727 {
2747 char *v1; // esi@1 2728 char *v1; // esi@1
2748 signed int v2; // edi@1 2729 signed int v2; // edi@1
2749 2730
2750 v1 = (char *)&this->pTileTypes[0].uTileID; 2731 v1 = (char *)&this->pTileTypes[0].uTileID;