Mercurial > might-and-magic-trilogy
diff Outdoor.cpp @ 105:e633cde38d64
Слияние
author | Ritor1 |
---|---|
date | Fri, 02 Nov 2012 10:04:27 +0600 |
parents | 62bfa3ffe7db 8c6308bb19b3 |
children | 1e18102bd4d0 |
line wrap: on
line diff
--- a/Outdoor.cpp Fri Nov 02 10:04:08 2012 +0600 +++ b/Outdoor.cpp Fri Nov 02 10:04:27 2012 +0600 @@ -366,7 +366,7 @@ { v12 = (unsigned __int8)aTiletableLoadU[v10 + 39]; uDefaultTravelTime_ByFoot = (unsigned __int8)byte_4ECA93[v10]; - sprintf(pOut, "out%02d.odm", v12); + sprintfex(pOut, "out%02d.odm", v12); uLevel_StartingPointType = (unsigned __int8)byte_4ECACF[v10]; return 1; } @@ -720,7 +720,7 @@ pAllocator->FreeChunk(v3); v3 = nullptr; } - //pAllocator->FreeChunk(v3);// + //pAllocator->FreeChunk(v3); v4 = v1->ptr_C; v1->pAttributemap = 0; pAllocator->FreeChunk(v4); @@ -1073,7 +1073,7 @@ v1->pTileTypes[1].uTileGroup = 5; v1->pTileTypes[2].uTileGroup = 6; v1->pTileTypes[3].uTileGroup = 10; - v1->_47F420(); + v1->LoadTileGroupIds(); v1->_47F3EA(); pAllocator->FreeChunk(v1->pBModels); pAllocator->FreeChunk(v1->pSpawnPoints); @@ -1162,9 +1162,9 @@ } //----- (0047D0A6) -------------------------------------------------------- -bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t a4, int thisa) +bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t pNumItems, int thisa) { - OutdoorLocation *v5; // esi@1 + OutdoorLocation *pOutdoorLocation; // esi@1 bool result; // eax@9 bool v7; // ebx@9 size_t v8; // eax@10 @@ -1182,7 +1182,7 @@ __int16 v20; // ax@16 int v21; // ecx@16 ODMFace *v22; // ebx@26 - LayingItem *v23; // ecx@27 + LayingItem *pItems; // ecx@27 unsigned int v24; // eax@28 unsigned __int8 v25; // zf@28 unsigned __int8 v26; // sf@28 @@ -1313,34 +1313,34 @@ int v151; // [sp+B78h] [bp-8h]@59 void *uSourceLen; // [sp+B7Ch] [bp-4h]@59 - v5 = this; + pOutdoorLocation = this; strcpy(pContainer, pFilename); if ( bUnderwater ) { - pPaletteManager->field_267AD3 = 0x10u; - pPaletteManager->field_267AD4 = 0xC2u; - pPaletteManager->field_267AD5 = 0x99u; - pPaletteManager->field_267AD0 = 0x25u; - pPaletteManager->field_267AD1 = 0x8Fu; - pPaletteManager->field_267AD2 = 0x5Cu; + pPaletteManager->pPalette_tintColor[0] = 0x10u; + pPaletteManager->pPalette_tintColor[1] = 0xC2u; + pPaletteManager->pPalette_tintColor[2] = 0x99u; + pPaletteManager->pPalette_mistColor[0] = 0x25u; + pPaletteManager->pPalette_mistColor[1] = 0x8Fu; + pPaletteManager->pPalette_mistColor[2] = 0x5Cu; LABEL_7: pPaletteManager->RecalculateAll(); goto LABEL_8; } - pPaletteManager->field_267AD3 = 0; - pPaletteManager->field_267AD4 = 0; - pPaletteManager->field_267AD5 = 0; - if ( pPaletteManager->field_267AD0 != 0x80u - || pPaletteManager->field_267AD1 != 0x80u - || pPaletteManager->field_267AD2 != 0x80u ) + pPaletteManager->pPalette_tintColor[0] = 0; + pPaletteManager->pPalette_tintColor[1] = 0; + pPaletteManager->pPalette_tintColor[2] = 0; + if ( pPaletteManager->pPalette_mistColor[0] != 0x80u + || pPaletteManager->pPalette_mistColor[1] != 0x80u + || pPaletteManager->pPalette_mistColor[2] != 0x80u ) { - pPaletteManager->field_267AD0 = 0x80u; - pPaletteManager->field_267AD1 = 0x80u; - pPaletteManager->field_267AD2 = 0x80u; + pPaletteManager->pPalette_mistColor[0] = 0x80u; + pPaletteManager->pPalette_mistColor[1] = 0x80u; + pPaletteManager->pPalette_mistColor[2] = 0x80u; goto LABEL_7; } LABEL_8: - _6807E0_num_decorations_6807B8 = 0; + pNumSoundDecorations = 0; sprintf(FileName, "levels\\%s", pContainer); if ( GetFileAttributesA(FileName) != -1 ) { @@ -1353,17 +1353,15 @@ v8 = strlen(pContainer); v108 = 2; *((char *)&v139 + v8) = 0; - viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture( - pContainer, - (enum TEXTURE_TYPE)v108); + viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pContainer, (enum TEXTURE_TYPE)v108); fread(&DstBuf, 0x180u, 1u, (FILE *)v7); fseek((FILE *)v7, Offset, 0); - fread(v5, 0xB0u, 1u, (FILE *)v7); - v5->_47F420(); - v5->_47F3EA(); - strcpy(v5->pGroundTileset, "grastyl"); + fread(pOutdoorLocation, 0xB0u, 1u, (FILE *)v7); + pOutdoorLocation->LoadTileGroupIds(); + pOutdoorLocation->_47F3EA(); + strcpy(pOutdoorLocation->pGroundTileset, "grastyl"); fseek((FILE *)v7, v114, 0); - fread(&v5->uNumBModels, 4u, 1u, (FILE *)v7); + fread(&pOutdoorLocation->uNumBModels, 4u, 1u, (FILE *)v7); fseek((FILE *)v7, v115, 0); fread(&uNumLayingItems, 4u, 1u, (FILE *)v7); fseek((FILE *)v7, v116, 0); @@ -1372,91 +1370,79 @@ fread(&uNumActors, 4u, 1u, (FILE *)v7); fseek((FILE *)v7, v118, 0); fread(&uNumChests, 4u, 1u, (FILE *)v7); - v5->pTerrain.Initialize(); + pOutdoorLocation->pTerrain.Initialize(); fseek((FILE *)v7, v119, 0); - fread(v5->pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7); + fread(pOutdoorLocation->pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7); fseek((FILE *)v7, v120, 0); - fread(v5->pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7); + fread(pOutdoorLocation->pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7); fseek((FILE *)v7, v121, 0); - fread(v5->pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7); - v5->pTerrain._47C80A(0, 0, 128, 128); - pAllocator->FreeChunk(v5->ptr_D4); - v5->ptr_D4 = 0; + fread(pOutdoorLocation->pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7); + pOutdoorLocation->pTerrain._47C80A(0, 0, 128, 128); + pAllocator->FreeChunk(pOutdoorLocation->ptr_D4); + pOutdoorLocation->ptr_D4 = 0; v9 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); - v108 = (int)v5->pOMAP; - v5->ptr_D4 = v9; + v108 = (int)pOutdoorLocation->pOMAP; + pOutdoorLocation->ptr_D4 = v9; pAllocator->FreeChunk((void *)v108); - v5->pOMAP = 0; + pOutdoorLocation->pOMAP = 0; v10 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); v108 = 0; - v5->pOMAP = (unsigned int *)v10; + pOutdoorLocation->pOMAP = (unsigned int *)v10; fseek((FILE *)v7, v136, v108); fread(&uNumTerrainNormals, 4u, 1u, (FILE *)v7); fread(pTerrainSomeOtherData, 1u, 0x20000u, (FILE *)v7); fread(pTerrainNormalIndices, 1u, 0x10000u, (FILE *)v7); - pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk( - pTerrainNormals, - 12 * uNumTerrainNormals, - "TerNorm"); + pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm"); fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7); - v11 = pAllocator->AllocNamedChunk(v5->pBModels, 188 * v5->uNumBModels, "BDdata"); + v11 = pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels, 188 * pOutdoorLocation->uNumBModels, "BDdata"); v108 = 0; - v5->pBModels = (BSPModel *)v11; + pOutdoorLocation->pBModels = (BSPModel *)v11; fseek((FILE *)v7, v122, v108); - fread(v5->pBModels, 0xBCu, v5->uNumBModels, (FILE *)v7); + fread(pOutdoorLocation->pBModels, 0xBCu, pOutdoorLocation->uNumBModels, (FILE *)v7); fseek((FILE *)v7, v123, 0); - a4 = 0; - if ( (signed int)v5->uNumBModels > 0 ) + pNumItems = 0; + if ( (signed int)pOutdoorLocation->uNumBModels > 0 ) { v12 = 0; while ( 1 ) { - v5->pBModels[v12].pVertices.pVertices = 0; - v5->pBModels[v12].pFaces = 0; - v5->pBModels[v12].pFacesOrdering = 0; - v5->pBModels[v12].pNodes = 0; + pOutdoorLocation->pBModels[v12].pVertices.pVertices = 0; + pOutdoorLocation->pBModels[v12].pFaces = 0; + pOutdoorLocation->pBModels[v12].pFacesOrdering = 0; + pOutdoorLocation->pBModels[v12].pNodes = 0; FileName[0] = 0; - v108 = (int)&v5->pBModels[v12]; - sprintf(FileName, "%s", v108); - v13 = v5->pBModels; + v108 = (int)&pOutdoorLocation->pBModels[v12]; + sprintfex(FileName, "%s", v108); + v13 = pOutdoorLocation->pBModels; v138 = 0; - v5->pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk( - v13[v12].pVertices.pVertices, - 12 * v13[v12].pVertices.uNumVertices, + pOutdoorLocation->pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices, FileName); - v5->pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk( - v5->pBModels[v12].pFaces, - 308 * v5->pBModels[v12].uNumFaces, + pOutdoorLocation->pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pFaces, 308 * pOutdoorLocation->pBModels[v12].uNumFaces, FileName); - v5->pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk( - v5->pBModels[v12].pFacesOrdering, - 2 * v5->pBModels[v12].uNumFaces, - FileName); - v14 = pAllocator->AllocNamedChunk( - v5->pBModels[v12].pNodes, - 8 * v5->pBModels[v12].uNumNodes, - FileName); - v15 = v5->pBModels; + pOutdoorLocation->pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pFacesOrdering, + 2 * pOutdoorLocation->pBModels[v12].uNumFaces, FileName); + v14 = pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pNodes, 8 * pOutdoorLocation->pBModels[v12].uNumNodes, FileName); + v15 = pOutdoorLocation->pBModels; v108 = (int)File; v15[v12].pNodes = (BSPNode *)v14; - fread(v5->pBModels[v12].pVertices.pVertices, 0xCu, v5->pBModels[v12].pVertices.uNumVertices, (FILE *)v108); - fread(v5->pBModels[v12].pFaces, 0x134u, v5->pBModels[v12].uNumFaces, (FILE *)File); - fread(v5->pBModels[v12].pFacesOrdering, 2u, v5->pBModels[v12].uNumFaces, (FILE *)File); - fread(v5->pBModels[v12].pNodes, 8u, v5->pBModels[v12].uNumNodes, (FILE *)File); - v16 = malloc(10 * v5->pBModels[v12].uNumFaces); + fread(pOutdoorLocation->pBModels[v12].pVertices.pVertices, 0xCu, pOutdoorLocation->pBModels[v12].pVertices.uNumVertices, (FILE *)v108); + fread(pOutdoorLocation->pBModels[v12].pFaces, 0x134u, pOutdoorLocation->pBModels[v12].uNumFaces, (FILE *)File); + fread(pOutdoorLocation->pBModels[v12].pFacesOrdering, 2u, pOutdoorLocation->pBModels[v12].uNumFaces, (FILE *)File); + fread(pOutdoorLocation->pBModels[v12].pNodes, 8u, pOutdoorLocation->pBModels[v12].uNumNodes, (FILE *)File); + v16 = malloc(10 * pOutdoorLocation->pBModels[v12].uNumFaces); v107 = (int)File; - v17 = v5->pBModels; + v17 = pOutdoorLocation->pBModels; ptr = (FILE *)v16; fread(v16, 0xAu, v17[v12].uNumFaces, (FILE *)File); - v18 = v5->pBModels; + v18 = pOutdoorLocation->pBModels; Str2 = 0; if ( (signed int)v18[v12].uNumFaces > 0 ) break; LABEL_25: free(ptr); - ++a4; + ++pNumItems; ++v12; - if ( (signed int)a4 >= (signed int)v5->uNumBModels ) + if ( (signed int)pNumItems >= (signed int)pOutdoorLocation->uNumBModels ) goto LABEL_26; } pDestLen = 0; @@ -1481,8 +1467,7 @@ pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1); goto LABEL_20; } - pTextureFrameTable->LoadAnimationSequenceAndPalettes( - *(unsigned __int16 *)((char *)&v5->pBModels[v12].pFaces->uTextureID + pDestLen)); + pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(unsigned __int16 *)((char *)&pOutdoorLocation->pBModels[v12].pFaces->uTextureID + pDestLen)); LABEL_20: if ( *(short *)(thisa + 292) ) { @@ -1492,7 +1477,7 @@ *(char *)(thisa + 30) &= 0xEFu; } ++Str2; - v18 = v5->pBModels; + v18 = pOutdoorLocation->pBModels; pDestLen += 308; pFilename += 10; if ( (signed int)Str2 >= (signed int)v18[v12].uNumFaces ) @@ -1508,18 +1493,18 @@ fread(pLayingItems, 0x70u, uNumLayingItems, (FILE *)v22); if ( (signed int)uNumLayingItems > 0 ) { - v23 = pLayingItems; - a4 = uNumLayingItems; + pItems = pLayingItems; + pNumItems = uNumLayingItems; do { - v24 = v23->stru_24.uItemID; + v24 = pItems->stru_24.uItemID; thisa = 0; v27 = (ODMFace *)(48 * v24); v25 = pObjectList->uNumObjects == 0; v26 = (pObjectList->uNumObjects & 0x80000000u) != 0; LOWORD(v27) = *(short *)((char *)&v27->pFacePlane.vNormal.x + (int)((char *)&pItemsTable + 24)); File = v27; - v23->uItemType = (unsigned __int16)v27; + pItems->uItemType = (unsigned __int16)v27; if ( v26 | v25 ) { LABEL_33: @@ -1537,15 +1522,15 @@ } v29 = thisa; } - v23->uObjectDescID = v29; - ++v23; - --a4; + pItems->uObjectDescID = v29; + ++pItems; + --pNumItems; } - while ( a4 ); + while ( pNumItems ); } fseek((FILE *)v22, v125, 0); fread(pLevelDecorations, 0x20u, uNumLevelDecorations, (FILE *)v22); - a4 = 0; + pNumItems = 0; if ( (signed int)uNumLevelDecorations > 0 ) { thisa = (int)pLevelDecorations; @@ -1554,73 +1539,70 @@ fread(FileName, 1u, 0x20u, (FILE *)v22); v30 = pDecorationList->GetDecorIdByName(FileName); v31 = thisa; - ++a4; + ++pNumItems; thisa += 32; *(short *)v31 = v30; } - while ( (signed int)a4 < (signed int)uNumLevelDecorations ); + while ( (signed int)pNumItems < (signed int)uNumLevelDecorations ); } fseek((FILE *)v22, v126, 0); fread(pActors, 0x344u, uNumActors, (FILE *)v22); fseek((FILE *)v22, v127, 0); fread(pChests, 0x14CCu, uNumChests, (FILE *)v22); fseek((FILE *)v22, v128, 0); - fread(&v5->field_DC, 4u, 1u, (FILE *)v22); - pAllocator->FreeChunk(v5->pFaceIDLIST); - v32 = v5->field_DC; - v5->pFaceIDLIST = 0; + fread(&pOutdoorLocation->field_DC, 4u, 1u, (FILE *)v22); + pAllocator->FreeChunk(pOutdoorLocation->pFaceIDLIST); + v32 = pOutdoorLocation->field_DC; + pOutdoorLocation->pFaceIDLIST = 0; v33 = pAllocator->AllocNamedChunk(0, 2 * v32, "IDLIST"); v108 = (int)v22; - v5->pFaceIDLIST = (unsigned __int16 *)v33; - fread(v33, 2u, v5->field_DC, (FILE *)v108); + pOutdoorLocation->pFaceIDLIST = (unsigned __int16 *)v33; + fread(v33, 2u, pOutdoorLocation->field_DC, (FILE *)v108); fseek((FILE *)v22, v129, 0); - fread(v5->pOMAP, 4u, 0x4000u, (FILE *)v22); + fread(pOutdoorLocation->pOMAP, 4u, 0x4000u, (FILE *)v22); fseek((FILE *)v22, v130, 0); - fread(&v5->uNumSpawnPoints, 4u, 1u, (FILE *)v22); - v5->pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk( - v5->pSpawnPoints, - 24 * v5->uNumSpawnPoints, - "Spawn"); + fread(&pOutdoorLocation->uNumSpawnPoints, 4u, 1u, (FILE *)v22); + pOutdoorLocation->pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pOutdoorLocation->pSpawnPoints, 24 * pOutdoorLocation->uNumSpawnPoints, "Spawn"); fseek((FILE *)v22, v131, 0); - fread(v5->pSpawnPoints, 0x18u, v5->uNumSpawnPoints, (FILE *)v22); + fread(pOutdoorLocation->pSpawnPoints, 0x18u, pOutdoorLocation->uNumSpawnPoints, (FILE *)v22); fseek((FILE *)v22, v132, 0); - fread(&v5->ddm, 0x28u, 1u, (FILE *)v22); + fread(&pOutdoorLocation->ddm, 0x28u, 1u, (FILE *)v22); fseek((FILE *)v22, v133, 0); fread(&stru_5E4C90, 1u, 0xC8u, (FILE *)v22); fseek((FILE *)v22, v134, 0); - fread(&v5->uLastVisitDay, 1u, 0x38u, (FILE *)v22); + fread(&pOutdoorLocation->uLastVisitDay, 1u, 0x38u, (FILE *)v22); fseek((FILE *)v22, v135, 0); - fread(&v5->uLastVisitDay, 1u, 4u, (FILE *)v22); - thisa = (int)v5->pTileTypes; + fread(&pOutdoorLocation->uLastVisitDay, 1u, 4u, (FILE *)v22); + thisa = (int)pOutdoorLocation->pTileTypes; pTileTable->InitializeTileset(4); - pTileTable->InitializeTileset(v5->pTileTypes[0].uTileGroup); - pTileTable->InitializeTileset(v5->pTileTypes[1].uTileGroup); - pTileTable->InitializeTileset(v5->pTileTypes[2].uTileGroup); - pTileTable->InitializeTileset(v5->pTileTypes[3].uTileGroup); - if ( v5 != (OutdoorLocation *)-96 && v5->pSkyTextureName[0] ) + pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[0].uTileGroup); + pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[1].uTileGroup); + pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[2].uTileGroup); + pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[3].uTileGroup); + if ( pOutdoorLocation != (OutdoorLocation *)-96 && pOutdoorLocation->pSkyTextureName[0] ) { v108 = 0; - v107 = (int)v5->pSkyTextureName; + v107 = (int)pOutdoorLocation->pSkyTextureName; } else { v108 = 0; v107 = (int)pDefaultSkyTexture; } - v5->uSky_TextureID = pBitmaps_LOD->LoadTexture((const char *)v107, (enum TEXTURE_TYPE)v108); - strcpy(v5->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); - v34 = pTileTable->GetTileById(v5->pTileTypes[0].uTileID); + pOutdoorLocation->uSky_TextureID = pBitmaps_LOD->LoadTexture((const char *)v107, (enum TEXTURE_TYPE)v108); + strcpy(pOutdoorLocation->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); + v34 = pTileTable->GetTileById(pOutdoorLocation->pTileTypes[0].uTileID); v35 = pBitmaps_LOD->LoadTexture(v34->pTileName); - v36 = v5->uSky_TextureID; - v5->uMainTile_BitmapID = v35; + v36 = pOutdoorLocation->uSky_TextureID; + pOutdoorLocation->uMainTile_BitmapID = v35; if ( v36 != -1 ) pBitmaps_LOD->pTextures[v36].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v36].palette_id1); - v37 = v5->uMainTile_BitmapID; + v37 = pOutdoorLocation->uMainTile_BitmapID; if ( v37 != -1 ) pBitmaps_LOD->pTextures[v37].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v37].palette_id1); - v5->_47F0E2(); + pOutdoorLocation->_47F0E2(); pGameLoadingUI_ProgressBar->Progress(); fclose((FILE *)v22); goto LABEL_150; @@ -1668,30 +1650,30 @@ { fread(v41, pSource, 1u, ptr); } - memcpy(v5, v42, 0xB0u); + memcpy(pOutdoorLocation, v42, 0xB0u); v43 = (char *)v42 + 176; - v5->_47F420(); - v5->_47F3EA(); - strcpy(v5->pGroundTileset, "grastyl"); + pOutdoorLocation->LoadTileGroupIds(); + pOutdoorLocation->_47F3EA(); + strcpy(pOutdoorLocation->pGroundTileset, "grastyl"); pGameLoadingUI_ProgressBar->Progress(); - v5->pTerrain.Initialize(); + pOutdoorLocation->pTerrain.Initialize(); v108 = 16384; v107 = (int)v43; - v106 = (char *)v5->pTerrain.pHeightmap; + v106 = (char *)pOutdoorLocation->pTerrain.pHeightmap; memcpy(v106, v43, 0x4000u); v43 = (char *)v43 + 16384; v105 = 16384; v104 = (void *)v43; - v103 = v5->pTerrain.pTilemap; + v103 = pOutdoorLocation->pTerrain.pTilemap; memcpy(v103, v43, 0x4000u); v43 = (char *)v43 + 16384; - memcpy(v5->pTerrain.pAttributemap, v43, 0x4000u); + memcpy(pOutdoorLocation->pTerrain.pAttributemap, v43, 0x4000u); v43 = (char *)v43 + 16384; - v108 = (int)v5->ptr_D4; + v108 = (int)pOutdoorLocation->ptr_D4; pAllocator->FreeChunk((void *)v108); - v5->ptr_D4 = 0; - v5->ptr_D4 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); - v5->pTerrain._47C80A(0, 0, 128, 128); + pOutdoorLocation->ptr_D4 = 0; + pOutdoorLocation->ptr_D4 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); + pOutdoorLocation->pTerrain._47C80A(0, 0, 128, 128); pGameLoadingUI_ProgressBar->Progress(); memcpy(&uNumTerrainNormals, v43, 4u); v43 = (char *)v43 + 4; @@ -1700,101 +1682,95 @@ memcpy(pTerrainNormalIndices, v43, 0x10000u); v43 = (char *)v43 + 65536; pFilename = (char *)(12 * uNumTerrainNormals); - pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk( - pTerrainNormals, - 12 * uNumTerrainNormals, - "TerNorm"); + pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm"); memcpy(pTerrainNormals, v43, (size_t)pFilename); v44 = (char *)v43 + (int)pFilename; - memcpy(&v5->uNumBModels, v44, 4u); + memcpy(&pOutdoorLocation->uNumBModels, v44, 4u); v44 = (char *)v44 + 4; pGameLoadingUI_ProgressBar->Progress(); - v45 = v5->uNumBModels; + v45 = pOutdoorLocation->uNumBModels; v108 = (int)"BDdata"; v107 = 188 * v45; - v106 = (char *)v5->pBModels; + v106 = (char *)pOutdoorLocation->pBModels; v46 = (BSPModel *)pAllocator->AllocNamedChunk(v106, 188 * v45, "BDdata"); - v47 = v5->uNumBModels; - v5->pBModels = v46; + v47 = pOutdoorLocation->uNumBModels; + pOutdoorLocation->pBModels = v46; pFilename = (char *)(188 * v47); memcpy(v46, v44, 188 * v47); uSourceLen = (char *)v44 + (int)pFilename; pGameLoadingUI_ProgressBar->Progress(); v151 = 0; - if ( (signed int)v5->uNumBModels > 0 ) + if ( (signed int)pOutdoorLocation->uNumBModels > 0 ) { v48 = 0; while ( 1 ) { - v5->pBModels[v48].pVertices.pVertices = 0; - v5->pBModels[v48].pFaces = 0; - v5->pBModels[v48].pFacesOrdering = 0; - v5->pBModels[v48].pNodes = 0; + pOutdoorLocation->pBModels[v48].pVertices.pVertices = 0; + pOutdoorLocation->pBModels[v48].pFaces = 0; + pOutdoorLocation->pBModels[v48].pFacesOrdering = 0; + pOutdoorLocation->pBModels[v48].pNodes = 0; FileName[0] = 0; - v108 = (int)&v5->pBModels[v48]; + v108 = (int)&pOutdoorLocation->pBModels[v48]; sprintf(FileName, "%s", v108); - v49 = v5->pBModels; + v49 = pOutdoorLocation->pBModels; v138 = 0; v50 = &v49[v48]; v108 = (int)FileName; v107 = 12 * v50->pVertices.uNumVertices; v106 = (char *)v50->pVertices.pVertices; - v5->pBModels[v48].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v106, v107, FileName); - v51 = &v5->pBModels[v48]; + pOutdoorLocation->pBModels[v48].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v106, v107, FileName); + v51 = &pOutdoorLocation->pBModels[v48]; v108 = (int)FileName; v107 = 308 * v51->uNumFaces; v106 = (char *)v51->pFaces; - v5->pBModels[v48].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(v106, v107, FileName); - v52 = &v5->pBModels[v48]; + pOutdoorLocation->pBModels[v48].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(v106, v107, FileName); + v52 = &pOutdoorLocation->pBModels[v48]; v108 = (int)FileName; v107 = 2 * v52->uNumFaces; v106 = (char *)v52->pFacesOrdering; - v5->pBModels[v48].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk( - v106, - v107, - FileName); - v53 = &v5->pBModels[v48]; + pOutdoorLocation->pBModels[v48].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(v106, v107, FileName); + v53 = &pOutdoorLocation->pBModels[v48]; v108 = (int)FileName; v107 = 8 * v53->uNumNodes; v106 = (char *)v53->pNodes; - v5->pBModels[v48].pNodes = (BSPNode *)pAllocator->AllocNamedChunk(v106, v107, FileName); - v54 = &v5->pBModels[v48]; + pOutdoorLocation->pBModels[v48].pNodes = (BSPNode *)pAllocator->AllocNamedChunk(v106, v107, FileName); + v54 = &pOutdoorLocation->pBModels[v48]; v108 = 12 * v54->pVertices.uNumVertices; pFilename = (char *)v108; v107 = (int)uSourceLen; v106 = (char *)v54->pVertices.pVertices; memcpy(v106, uSourceLen, v108); uSourceLen = (char *)uSourceLen + (int)pFilename; - v55 = &v5->pBModels[v48]; + v55 = &pOutdoorLocation->pBModels[v48]; v105 = 308 * v55->uNumFaces; v104 = uSourceLen; v103 = v55->pFaces; pFilename = (char *)v105; memcpy(v103, uSourceLen, v105); - v56 = &v5->pBModels[v48]; + v56 = &pOutdoorLocation->pBModels[v48]; uSourceLen = (char *)uSourceLen + (int)pFilename; v57 = v56->pFacesOrdering; pFilename = (char *)(2 * v56->uNumFaces); memcpy(v57, uSourceLen, (size_t)pFilename); - v58 = &v5->pBModels[v48]; + v58 = &pOutdoorLocation->pBModels[v48]; uSourceLen = (char *)uSourceLen + (int)pFilename; v59 = v58->pNodes; pFilename = (char *)(8 * v58->uNumNodes); memcpy(v59, uSourceLen, (size_t)pFilename); uSourceLen = (char *)uSourceLen + (int)pFilename; - ptr = (FILE *)malloc(10 * v5->pBModels[v48].uNumFaces); - pFilename = (char *)(10 * v5->pBModels[v48].uNumFaces); + ptr = (FILE *)malloc(10 * pOutdoorLocation->pBModels[v48].uNumFaces); + pFilename = (char *)(10 * pOutdoorLocation->pBModels[v48].uNumFaces); memcpy(ptr, uSourceLen, (size_t)pFilename); v144 = 0; uSourceLen = (char *)uSourceLen + (int)pFilename; - v60 = v5->pBModels; + v60 = pOutdoorLocation->pBModels; if ( (signed int)v60[v48].uNumFaces > 0 ) break; LABEL_74: free(ptr); ++v151; ++v48; - if ( v151 >= (signed int)v5->uNumBModels ) + if ( v151 >= (signed int)pOutdoorLocation->uNumBModels ) goto LABEL_75; } v149 = 0; @@ -1819,7 +1795,7 @@ pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(v108); goto LABEL_69; } - v108 = *(unsigned __int16 *)((char *)&v5->pBModels[v48].pFaces->uTextureID + (unsigned int)v149); + v108 = *(unsigned __int16 *)((char *)&pOutdoorLocation->pBModels[v48].pFaces->uTextureID + (unsigned int)v149); pTextureFrameTable->LoadAnimationSequenceAndPalettes(v108); LABEL_69: if ( *((short *)pFilename + 146) ) @@ -1830,7 +1806,7 @@ pFilename[30] &= 0xEFu; } ++v144; - v60 = v5->pBModels; + v60 = pOutdoorLocation->pBModels; v149 = (char *)v149 + 308; Str2 += 10; if ( v144 >= (signed int)v60[v48].uNumFaces ) @@ -1869,45 +1845,45 @@ while ( v151 < (signed int)uNumLevelDecorations ); } pGameLoadingUI_ProgressBar->Progress(); - memcpy(&v5->field_DC, uSourceLen, 4u); + memcpy(&pOutdoorLocation->field_DC, uSourceLen, 4u); uSourceLen = (char *)uSourceLen + 4; - v108 = (int)v5->pFaceIDLIST; + v108 = (int)pOutdoorLocation->pFaceIDLIST; pAllocator->FreeChunk((void *)v108); - v66 = v5->field_DC; - v5->pFaceIDLIST = 0; + v66 = pOutdoorLocation->field_DC; + pOutdoorLocation->pFaceIDLIST = 0; v67 = pAllocator->AllocNamedChunk(0, 2 * v66, "IDLIST"); - v68 = v5->field_DC; - v5->pFaceIDLIST = (unsigned __int16 *)v67; + v68 = pOutdoorLocation->field_DC; + pOutdoorLocation->pFaceIDLIST = (unsigned __int16 *)v67; pFilename = (char *)(2 * v68); memcpy(v67, uSourceLen, 2 * v68); uSourceLen = (char *)uSourceLen + (int)pFilename; pGameLoadingUI_ProgressBar->Progress(); - v108 = (int)v5->pOMAP; + v108 = (int)pOutdoorLocation->pOMAP; pAllocator->FreeChunk((void *)v108); - v5->pOMAP = 0; + pOutdoorLocation->pOMAP = 0; v69 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); v108 = 65536; - v5->pOMAP = (unsigned int *)v69; + pOutdoorLocation->pOMAP = (unsigned int *)v69; memcpy(v69, uSourceLen, v108); uSourceLen = (char *)uSourceLen + 65536; pGameLoadingUI_ProgressBar->Progress(); - memcpy(&v5->uNumSpawnPoints, uSourceLen, 4u); + memcpy(&pOutdoorLocation->uNumSpawnPoints, uSourceLen, 4u); uSourceLen = (char *)uSourceLen + 4; pGameLoadingUI_ProgressBar->Progress(); - v70 = v5->uNumSpawnPoints; + v70 = pOutdoorLocation->uNumSpawnPoints; v108 = (int)"Spawn"; v107 = 24 * v70; - v106 = (char *)v5->pSpawnPoints; + v106 = (char *)pOutdoorLocation->pSpawnPoints; v71 = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(v106, 24 * v70, "Spawn"); - v72 = v5->uNumSpawnPoints; - v5->pSpawnPoints = v71; + v72 = pOutdoorLocation->uNumSpawnPoints; + pOutdoorLocation->pSpawnPoints = v71; memcpy(v71, uSourceLen, 24 * v72); pGameLoadingUI_ProgressBar->Progress(); free((void *)HIDWORD(v142)); v108 = (int)".ddm"; v73 = strlen(pContainer); strcpy((char *)v141 + v73, (const char *)v108); - v151 = (int)pNew_LOD->FindContainer(pContainer, 1); // + v151 = (int)pNew_LOD->FindContainer(pContainer, 1);// fread(&header, 0x10u, 1u, (FILE *)v151); Str2 = 0; if ( header.uVersion != 91969 @@ -1945,14 +1921,14 @@ { MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0); } - memcpy(&v5->ddm, v75, 0x28u); + memcpy(&pOutdoorLocation->ddm, v75, 0x28u); v74 = (int)((char *)v75 + 40); } - v76 = v5->uNumBModels; + v76 = pOutdoorLocation->uNumBModels; v77 = 0; if ( (signed int)v76 > 0 ) { - v78 = (char *)&v5->pBModels->uNumFaces; + v78 = (char *)&pOutdoorLocation->pBModels->uNumFaces; do { v77 += *(int *)v78; @@ -1961,38 +1937,38 @@ } while ( v76 ); } - v79 = v5->ddm.uNumFacesInBModels; + v79 = pOutdoorLocation->ddm.uNumFacesInBModels; if ( v79 ) { - if ( v5->ddm.uNumBModels ) + if ( pOutdoorLocation->ddm.uNumBModels ) { - v80 = v5->ddm.uNumDecorations; + v80 = pOutdoorLocation->ddm.uNumDecorations; if ( v80 ) { - if ( v79 != v77 || v5->ddm.uNumBModels != v5->uNumBModels || v80 != uNumLevelDecorations ) + if ( v79 != v77 || pOutdoorLocation->ddm.uNumBModels != pOutdoorLocation->uNumBModels || v80 != uNumLevelDecorations ) Str2 = (char *)1; } } } if ( BYTE1(dword_6BE364_game_settings_1) & 0x20 ) - a4 = 29030400; + pNumItems = 29030400; if ( Str2 ) { memset(Dst, 0, 0x3C8u); memset(Src, 0, 0x3C8u); goto LABEL_112; } - v81 = v5->ddm.uLastRepawnDay; - if ( (unsigned int)((char *)File - v81) >= a4 || !v81 ) + v81 = pOutdoorLocation->ddm.uLastRepawnDay; + if ( (unsigned int)((char *)File - v81) >= pNumItems || !v81 ) { memcpy(Dst, (const void *)v74, 0x3C8u); memcpy(Src, (const void *)(v74 + 968), 0x3C8u); LABEL_112: free(v149); v25 = Str2 == 0; - v5->ddm.uLastRepawnDay = (int)File; + pOutdoorLocation->ddm.uLastRepawnDay = (int)File; if ( v25 ) - ++v5->ddm.uNumRespawns; + ++pOutdoorLocation->ddm.uNumRespawns; v108 = 0; *(int *)thisa = 1; v151 = (int)pGames_LOD->FindContainer(pContainer, v108); @@ -2027,27 +2003,27 @@ v108 = (int)".odm"; v83 = strlen(pContainer); strcpy((char *)v141 + v83, (const char *)v108); - memcpy(v5->array_528, (const void *)v74, 0x3C8u); + memcpy(pOutdoorLocation->array_528, (const void *)v74, 0x3C8u); v84 = (const void *)(v74 + 968); - memcpy(v5->array_8F0, v84, 0x3C8u); + memcpy(pOutdoorLocation->array_8F0, v84, 0x3C8u); v85 = (char *)v84 + 968; pGameLoadingUI_ProgressBar->Progress(); if ( *(int *)thisa ) { - memcpy(v5->array_528, Dst, 0x3C8u); - memcpy(v5->array_8F0, Src, 0x3C8u); + memcpy(pOutdoorLocation->array_528, Dst, 0x3C8u); + memcpy(pOutdoorLocation->array_8F0, Src, 0x3C8u); } - v25 = v5->uNumBModels == 0; - v26 = (v5->uNumBModels & 0x80000000u) != 0; + v25 = pOutdoorLocation->uNumBModels == 0; + v26 = (pOutdoorLocation->uNumBModels & 0x80000000u) != 0; v151 = 0; if ( !(v26 | v25) ) { - a4 = 0; + pNumItems = 0; do { - v86 = v5->pBModels; + v86 = pOutdoorLocation->pBModels; thisa = 0; - v87 = (unsigned int)((char *)v86 + a4); + v87 = (unsigned int)((char *)v86 + pNumItems); if ( *(int *)(v87 + 76) > 0 ) { File = 0; @@ -2055,22 +2031,22 @@ { v106 = (char *)&File->uAttributes + *(int *)(v87 + 84); memcpy(v106, v85, 4u); - v88 = v5->pBModels; + v88 = pOutdoorLocation->pBModels; ++File; v85 = (char *)v85 + 4; ++thisa; - v87 = (unsigned int)((char *)v88 + a4); + v87 = (unsigned int)((char *)v88 + pNumItems); } while ( thisa < *(int *)(v87 + 76) ); } - v89 = v5->pBModels; + v89 = pOutdoorLocation->pBModels; thisa = 0; - if ( *(signed int *)((char *)&v89->uNumFaces + a4) > 0 ) + if ( *(signed int *)((char *)&v89->uNumFaces + pNumItems) > 0 ) { pFilename = 0; do { - v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + a4)]; + v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)]; File = v90; if ( v90->sCogTriggeredID ) { @@ -2080,15 +2056,15 @@ BYTE2(File->uAttributes) &= 0xEFu; } ++thisa; - v89 = v5->pBModels; + v89 = pOutdoorLocation->pBModels; pFilename += 308; } - while ( thisa < *(signed int *)((char *)&v89->uNumFaces + a4) ); + while ( thisa < *(signed int *)((char *)&v89->uNumFaces + pNumItems) ); } ++v151; - a4 += 188; + pNumItems += 188; } - while ( v151 < (signed int)v5->uNumBModels ); + while ( v151 < (signed int)pOutdoorLocation->uNumBModels ); } pGameLoadingUI_ProgressBar->Progress(); v151 = 0; @@ -2140,34 +2116,34 @@ pGameLoadingUI_ProgressBar->Progress(); memcpy(&stru_5E4C90, v96, 0xC8u); pGameLoadingUI_ProgressBar->Progress(); - memcpy(&v5->uLastVisitDay, v96 + 200, 0x38u); + memcpy(&pOutdoorLocation->uLastVisitDay, v96 + 200, 0x38u); free(v149); pTileTable->InitializeTileset(4); - thisa = (int)v5->pTileTypes; - v108 = v5->pTileTypes[0].uTileGroup; + thisa = (int)pOutdoorLocation->pTileTypes; + v108 = pOutdoorLocation->pTileTypes[0].uTileGroup; pTileTable->InitializeTileset(v108); - v108 = v5->pTileTypes[1].uTileGroup; + v108 = pOutdoorLocation->pTileTypes[1].uTileGroup; pTileTable->InitializeTileset(v108); - v108 = v5->pTileTypes[2].uTileGroup; + v108 = pOutdoorLocation->pTileTypes[2].uTileGroup; pTileTable->InitializeTileset(v108); - v108 = v5->pTileTypes[3].uTileGroup; + v108 = pOutdoorLocation->pTileTypes[3].uTileGroup; pTileTable->InitializeTileset(v108); - strcpy(v5->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); - v97 = v5->pTileTypes[0].uTileID; + strcpy(pOutdoorLocation->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); + v97 = pOutdoorLocation->pTileTypes[0].uTileID; v108 = 0; v98 = pTileTable->GetTileById(v97); v99 = pBitmaps_LOD->LoadTexture(v98->pTileName, (enum TEXTURE_TYPE)v108); - v5->uMainTile_BitmapID = v99; + pOutdoorLocation->uMainTile_BitmapID = v99; if ( v99 != -1 ) { v108 = (v99 != -1 ? pBitmaps_LOD->pTextures[v99].palette_id1 : 36); if (v99 != -1) pBitmaps_LOD->pTextures[v99].palette_id2 = pPaletteManager->LoadPalette(v108); } - v5->_47F0E2(); + pOutdoorLocation->_47F0E2(); LABEL_150: - v100 = HIDWORD(v5->uLastVisitDay); - LODWORD(v142) = LODWORD(v5->uLastVisitDay); + v100 = HIDWORD(pOutdoorLocation->uLastVisitDay); + LODWORD(v142) = LODWORD(pOutdoorLocation->uLastVisitDay); HIDWORD(v142) = v100; if ( v100 | (unsigned int)v142 ) { @@ -2178,15 +2154,15 @@ v108 = dword_4EC268[rand() % dword_4EC2A8]; else v108 = dword_4EC28C[rand() % dword_4EC2AC]; - sprintf(v5->field_4F8, "plansky%d", v108); + sprintf(pOutdoorLocation->field_4F8, "plansky%d", v108); } } else { - strcpy(v5->field_4F8, "plansky3"); + strcpy(pOutdoorLocation->field_4F8, "plansky3"); } - v101 = pBitmaps_LOD->LoadTexture(v5->field_4F8); - v5->uSky_TextureID = v101; + v101 = pBitmaps_LOD->LoadTexture(pOutdoorLocation->field_4F8); + pOutdoorLocation->uSky_TextureID = v101; if ( v101 != -1 ) { v108 = (v101 != -1 ? pBitmaps_LOD->pTextures[v101].palette_id1 : 36); @@ -2601,10 +2577,10 @@ { pDecorationList->InitializeDecorationSprite(v3->uDecorationDescID); v4 = pDecorationList->pDecorations[v3->uDecorationDescID].uSoundID; - if ( v4 && _6807E0_num_decorations_6807B8 < 9 ) + if ( v4 && pNumSoundDecorations < 9 ) { pSoundList->_4A9A67(v4, 0); - v5 = _6807E0_num_decorations_6807B8++; + v5 = pNumSoundDecorations++; _6807B8_level_decorations_ids[v5] = v2; } if ( v8 && v3->uCog == 20 ) @@ -2747,7 +2723,7 @@ } //----- (0047F420) -------------------------------------------------------- -bool OutdoorLocation::_47F420() +bool OutdoorLocation::LoadTileGroupIds() { char *v1; // esi@1 signed int v2; // edi@1