# HG changeset patch # User Nomad # Date 1364060838 -7200 # Node ID a84db04439a4db9d0e65edc0c9f2e075515b7429 # Parent cf2fbac6edc9ec776dc1268c3c4ff5ba002fb43c# Parent f24fb0d64a5c7919183bd610e9fb4e0e64fc3609 Merge diff -r cf2fbac6edc9 -r a84db04439a4 Actor.cpp --- a/Actor.cpp Sat Mar 23 19:47:01 2013 +0200 +++ b/Actor.cpp Sat Mar 23 19:47:18 2013 +0200 @@ -25,7 +25,7 @@ Actor pActors[500]; -size_t uNumActors; +int uNumActors; stru319 stru_50C198; // idb diff -r cf2fbac6edc9 -r a84db04439a4 Actor.h --- a/Actor.h Sat Mar 23 19:47:01 2013 +0200 +++ b/Actor.h Sat Mar 23 19:47:18 2013 +0200 @@ -287,4 +287,4 @@ extern Actor pActors[500]; -extern size_t uNumActors; \ No newline at end of file +extern int uNumActors; \ No newline at end of file diff -r cf2fbac6edc9 -r a84db04439a4 Outdoor.cpp --- a/Outdoor.cpp Sat Mar 23 19:47:01 2013 +0200 +++ b/Outdoor.cpp Sat Mar 23 19:47:18 2013 +0200 @@ -42,7 +42,11 @@ Edge stru_80C9A4; Edge stru_80C9D8; - +//for future sky textures? +int dword_4EC268[9]={3,3,3,3,3,3,3,3,3}; // weak +int dword_4EC28C[7]={3,3,3,3,3,3,3}; // weak +int dword_4EC2A8=9; // weak +int dword_4EC2AC=7; // weak @@ -739,18 +743,18 @@ pAllocator->FreeChunk(pAttributemap); pAttributemap = nullptr; } - if (ptr_C) + if (pDmap) { - pAllocator->FreeChunk(ptr_C); - ptr_C = nullptr; + pAllocator->FreeChunk(pDmap); + pDmap = nullptr; } _47C7A9(); } //----- (0047C80A) -------------------------------------------------------- -int OutdoorLocationTerrain::_47C80A(int a2, int a3, int a4, int a5) -{ +void OutdoorLocationTerrain::FillDMap( int X, int Y, int W, int Z ) + { OutdoorLocationTerrain *pOutLocTerrain; // ebx@1 double v6; // st7@1 double v7; // st7@2 @@ -819,30 +823,30 @@ v46 = v8; v47 = v8; } - result = a3; - if ( a3 > a5 ) + result = Y; + if ( Y > Z ) { - v10 = a5 ^ a3; - a5 ^= a3 ^ a5; - result = a5 ^ v10; + v10 = Z ^ Y; + Z ^= Y ^ Z; + result = Z ^ v10; } - v11 = a2; - if ( a2 > a4 ) + v11 = X; + if ( X > W ) { - v12 = a4 ^ a2; - a4 ^= a2 ^ a4; - v11 = a4 ^ v12; + v12 = W ^ X; + W ^= X ^ W; + v11 = W ^ v12; } v13 = result - 1; v48 = result - 1; - if ( result - 1 <= a5 ) + if ( result - 1 <= Z ) { v39 = v11 - 1; do { v14 = v39; v50 = v39; - if ( v39 <= a4 ) + if ( v39 <= W ) { result = (v39 - 63) << 9; v49 = (v39 - 63) << 9; @@ -864,6 +868,8 @@ v24 = v22 - v19; v40 = 32 * *(char *)v23; v42 = 32 * *(char *)(v23 + 1); + + v25 = v49 - 512 - v49; v26 = (double)-((v20 - v21) * v24); v51 = v26; @@ -886,7 +892,8 @@ v31 = 31.0; v44 = 2 * (v50 + v48 * pOutLocTerrain2->field_10); pOutLocTerrain = pOutLocTerrain2; - *((char *)pOutLocTerrain2->ptr_C + v44 + 1) = (signed __int64)v31; + *((char *)pOutLocTerrain2->pDmap + v44 + 1) = (signed __int64)v31; + v32 = v49 - (v49 - 512); v33 = (double)-((v42 - v40) * (v19 - v41)); v52 = v33; @@ -908,7 +915,7 @@ if ( v38 > 31.0 ) v38 = 31.0; v13 = v48; - *((char *)pOutLocTerrain2->ptr_C + v44) = (signed __int64)v38; + *((char *)pOutLocTerrain2->pDmap + v44) = (signed __int64)v38; v14 = v50; result = v49; } @@ -917,14 +924,13 @@ v50 = v14; v49 = result; } - while ( v14 <= a4 ); + while ( v14 <= W ); } ++v13; v48 = v13; } - while ( v13 <= a5 ); + while ( v13 <= Z ); } - return result; } //----- (0047CB57) -------------------------------------------------------- @@ -1032,7 +1038,7 @@ memset(this->pHeightmap, 0, 0x4000u); memset(v1->pTilemap, 90, 0x4000u); memset(v1->pAttributemap, 0, 0x4000u); - memset(v1->ptr_C, 0, 0x8000u); + memset(v1->pDmap, 0, 0x8000u); v1->field_12 = 128; v1->field_10 = 128; v1->field_16 = 7; @@ -1045,31 +1051,15 @@ //----- (0047CD44) -------------------------------------------------------- bool OutdoorLocationTerrain::Initialize() { - OutdoorLocationTerrain *v1; // esi@1 - void *v2; // eax@1 - bool result; // eax@2 - void *v4; // eax@3 - void *v5; // eax@4 - void *v6; // eax@5 - v1 = this; - v2 = pAllocator->AllocNamedChunk(this->pHeightmap, 0x4000u, "HMAP");//карта высот - v1->pHeightmap = (unsigned __int8 *)v2; - if ( v2 - && (v4 = pAllocator->AllocNamedChunk(v1->pTilemap, 0x4000u, "TMAP"),//карта тайлов - (v1->pTilemap = (unsigned __int8 *)v4) != 0) - && (v5 = pAllocator->AllocNamedChunk(v1->pAttributemap, 0x4000u, "AMAP"),//карта атрибутов - (v1->pAttributemap = (unsigned __int8 *)v5) != 0) ) - { - v6 = pAllocator->AllocNamedChunk(v1->ptr_C, 0x8000u, "DMAP"); - v1->ptr_C = v6; - result = v6 != 0; - } + pHeightmap= (unsigned __int8 *)pAllocator->AllocNamedChunk(pHeightmap, 0x4000u, "HMAP");//height map + pTilemap = (unsigned __int8 *)pAllocator->AllocNamedChunk(pTilemap, 0x4000u, "TMAP");//tile map + pAttributemap = (unsigned __int8 *)pAllocator->AllocNamedChunk(pAttributemap, 0x4000u, "AMAP");//карта атрибутов + pDmap=(struct DMap *)pAllocator->AllocNamedChunk(pDmap, 0x8000u, "DMAP"); + if (pHeightmap&&pTilemap&&pAttributemap&&pDmap) + return true; else - { - result = 0; - } - return result; + return false; } //----- (0047CDE2) -------------------------------------------------------- @@ -1101,12 +1091,12 @@ v1->pSpawnPoints = 0; v1->pTerrain.Initialize(); v1->pTerrain.ZeroLandscape(); - v1->pTerrain._47C80A(0, 0, 128, 128); - pAllocator->FreeChunk(v1->ptr_D4); - v1->ptr_D4 = 0; + v1->pTerrain.FillDMap(0, 0, 128, 128); + pAllocator->FreeChunk(v1->pCmap); + v1->pCmap = 0; v2 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); v3 = v1->pOMAP; - v1->ptr_D4 = v2; + v1->pCmap = v2; pAllocator->FreeChunk(v3); v1->pOMAP = 0; v4 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); @@ -1169,10 +1159,10 @@ pTerrain.Release(); - if (ptr_D4) + if (pCmap) { - pAllocator->FreeChunk(ptr_D4); - ptr_D4 = nullptr; + pAllocator->FreeChunk(pCmap); + pCmap = nullptr; } if (pOMAP) { @@ -1727,13 +1717,13 @@ //v43 = (char *)v43 + 16384; //v108 = (int)ptr_D4; - if (ptr_D4) + if (pCmap) { - pAllocator->FreeChunk(ptr_D4); - ptr_D4 = nullptr; + pAllocator->FreeChunk(pCmap); + pCmap = nullptr; } - ptr_D4 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); - pTerrain._47C80A(0, 0, 128, 128); + pCmap = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); + pTerrain.FillDMap(0, 0, 128, 128); pGameLoadingUI_ProgressBar->Progress(); memcpy(&uNumTerrainNormals, pSrc, 4); @@ -1871,7 +1861,7 @@ { v62 = pBitmaps_LOD->LoadTexture(texFilename); //v63 = (ODMFace *)pFilename; - BYTE1(face->uAttributes) &= 0xBFu; + face->uAttributes &= 0xFFBFu; LABEL_68: face->uTextureID = v62; //v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0; @@ -1885,9 +1875,9 @@ if (face->sCogTriggeredID) { if (face->HasEventHint()) - BYTE2(face->uAttributes) |= 0x10u; + face->uAttributes |= 0x1000u; else - BYTE2(face->uAttributes) &= 0xEFu; + face->uAttributes &= 0xEFFFu; } //++v144; //v60 = pBModels; @@ -1916,7 +1906,7 @@ assert(sizeof(LevelDecoration) == 32); //pFilename = (char *)(32 * uNumLevelDecorations); memcpy(pLevelDecorations, pSrc + 4, uNumLevelDecorations * sizeof(LevelDecoration)); - pSrc += 4 + 32 * uNumLevelDecorations; + pSrc += 4 + sizeof(LevelDecoration) * uNumLevelDecorations; pGameLoadingUI_ProgressBar->Progress(); @@ -1925,8 +1915,8 @@ for (uint i = 0; i < uNumLevelDecorations; ++i) { char name[256]; - memcpy(name, pSrc, 32); - pSrc += 32; + memcpy(name, pSrc, sizeof(LevelDecoration)); + pSrc += sizeof(LevelDecoration); pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(name); } @@ -2171,9 +2161,9 @@ if (face.sCogTriggeredID) { if (face.HasEventHint()) - BYTE2(face.uAttributes) |= 0x10u; + face.uAttributes |= 0x1000u; else - BYTE2(face.uAttributes) &= 0xEFu; + face.uAttributes &= 0xEFFFu; } //++thisa; //v89 = pBModels; @@ -2259,7 +2249,6 @@ pTileTable->InitializeTileset(Tileset_Dirt); pTileTable->InitializeTileset(Tileset_Snow); - //thisa = (int)pTileTypes; //v108 = pTileTypes[0].uTileGroup; pTileTable->InitializeTileset(pTileTypes[0].tileset); //v108 = pTileTypes[1].uTileGroup; @@ -2285,22 +2274,21 @@ //HIDWORD(v142) = v100; if (uLastVisitDay) { - auto v108 = 28; - if ( (signed int)((signed int)(signed __int64)((double)uLastVisitDay * 0.234375) / 60 / 60 / 0x18u) % 28 != pParty->uDaysPlayed ) + if ( (signed int)((signed int)(signed __int64)((double)uLastVisitDay * 0.234375) / 60 / 60 / 24) % 28 != pParty->uDaysPlayed ) { if ( rand() % 100 >= 20 ) v108 = dword_4EC268[rand() % dword_4EC2A8]; else v108 = dword_4EC28C[rand() % dword_4EC2AC]; - sprintf(field_4F8, "plansky%d", v108); + sprintf(sky_texture_name, "plansky%d", v108); } } else { - strcpy(field_4F8, "plansky3"); + strcpy(sky_texture_name, "plansky3"); } //v101 = pBitmaps_LOD->LoadTexture(field_4F8); - uSky_TextureID = pBitmaps_LOD->LoadTexture(field_4F8); + uSky_TextureID = pBitmaps_LOD->LoadTexture(sky_texture_name); if (uSky_TextureID != -1) pBitmaps_LOD->pTextures[uSky_TextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[uSky_TextureID].palette_id1); @@ -2311,60 +2299,41 @@ pSoundList->LoadSound(96, 0); pSoundList->LoadSound(64, 0); pSoundList->LoadSound(103, 0); - v102 = thisa; - thisa = 3; - do + for (int i=0; i<3;++i) { - if ( *(short *)v102 ) - { - switch ( *(short *)v102 ) + + switch ( pTileTypes[i].tileset ) { - case 1: + case Tileset_Grass: + pSoundList->LoadSound(54, 0); + pSoundList->LoadSound(93, 0); + break; + case Tileset_Snow: pSoundList->LoadSound(58, 0); - v108 = 0; - v107 = 97; + pSoundList->LoadSound(97, 0); break; - case 2: + case Tileset_2: pSoundList->LoadSound(52, 0); - v108 = 0; - v107 = 91; + pSoundList->LoadSound(91, 0); break; - case 3: + case Tileset_3: pSoundList->LoadSound(51, 0); - v108 = 0; - v107 = 90; + pSoundList->LoadSound(90, 0); break; - case 5: + case Tileset_Water: pSoundList->LoadSound(62, 0); - v108 = 0; - v107 = 101; + pSoundList->LoadSound(101, 0); break; - case 6: + case Tileset_6: pSoundList->LoadSound(49, 0); - v108 = 0; - v107 = 88; - break; - default: - if ( *(short *)v102 != 7 ) - goto LABEL_175; - pSoundList->LoadSound(61, 0); - v108 = 0; - v107 = 100; + pSoundList->LoadSound(88, 0); break; - } - } - else - { - pSoundList->LoadSound(54, 0); - v108 = 0; - v107 = 93; - } - pSoundList->LoadSound(v107, v108); -LABEL_175: - v102 += 4; - --thisa; + case Tileset_Swamp: + pSoundList->LoadSound(61, 0); + pSoundList->LoadSound(100, 0); + break; + } } - while ( thisa ); return true; } @@ -2792,95 +2761,83 @@ //----- (0047F2D3) -------------------------------------------------------- bool OutdoorLocation::InitalizeActors(int a1) { - int v2; // ebx@1 Actor *v3; // esi@2 int v4; // eax@3 __int16 v5; // ax@11 - int v8; // [sp+348h] [bp-8h]@1 + int alert_status; // [sp+348h] [bp-8h]@1 int v9; // [sp+34Ch] [bp-4h]@1 - v2 = 0; - v8 = 0; - v9 = 0; - if ( (signed int)uNumActors > 0 ) - { - v3 = pActors;//[0].uAttributes; - while ( v9 < (signed int)uNumActors ) - { - v4 = v3->uAttributes; + alert_status = 0; + for(int i=0; iuCurrentActionTime = v2; - v3->uCurrentActionLength = v2; - if ( v4 & 0x10000 ) - v3->uAIState = (AIState) 19; - v5 = v3->uAIState; - if ( v5 != 11 && v5 != 19 && (v3->sCurrentHP == (short)v2 || v3->pMonsterInfo.uHP == v2) ) - v3->uAIState = (AIState) 5; - v3->vVelocity.x = v2; - v3->vVelocity.y = v2; - v3->vVelocity.z = v2; - v3->UpdateAnimation(); - v3->pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)0; - v3->PrepareSprites(0); - v2 = 0; - } - else - { - v3->uAIState = (AIState) 19; - v3->uAttributes = v4 | 0x10000; - } - } - else if ( a1 == v2 ) - { - v3->uAIState = (AIState) 19; - v3->uAttributes = v4 | 0x10000; - } - else if ( v8 != v2 ) - { - v3->uCurrentActionTime = v2; - v3->uCurrentActionLength = v2; - if ( v4 & 0x10000 ) - v3->uAIState = (AIState) 19; - v5 = v3->uAIState; - if ( v5 != 11 && v5 != 19 && (v3->sCurrentHP == (short)v2 || v3->pMonsterInfo.uHP == v2) ) - v3->uAIState = (AIState) 5; - v3->vVelocity.x = v2; - v3->vVelocity.y = v2; - v3->vVelocity.z = v2; - v3->UpdateAnimation(); - v3->pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)0; - v3->PrepareSprites(0); - v2 = 0; - } - else - { - v3->uAIState = (AIState) 19; - v3->uAttributes = v4 | 0x10000; - v8 = GetAlertStatus(); - } - ++v9; - ++v3; - } - } + { + if ( alert_status != 1 ) + { + pActors[i].uCurrentActionTime = 0; + pActors[i].uCurrentActionLength = 0; + if ( v4 & 0x10000 ) + pActors[i].uAIState = AIState::Disabled; + if ( pActors[i].uAIState != AIState::Removed && pActors[i].uAIState != AIState::Disabled && + (pActors[i].sCurrentHP == 0 || pActors[i].pMonsterInfo.uHP == 0) ) + pActors[i].uAIState = AIState::Dead; + pActors[i].vVelocity.x = 0; + pActors[i].vVelocity.y = 0; + pActors[i].vVelocity.z = 0; + pActors[i].UpdateAnimation(); + pActors[i].pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)0; + pActors[i].PrepareSprites(0); + } + else + { + pActors[i].uAIState = AIState::Disabled; + pActors[i].uAttributes = v4 | 0x10000; + } + } + else if ( a1 == 0 ) + { + pActors[i].uAIState = AIState::Disabled; + pActors[i].uAttributes = v4 | 0x10000; + } + else if ( alert_status != 0 ) + { + pActors[i].uCurrentActionTime = 0; + pActors[i].uCurrentActionLength = 0; + if ( v4 & 0x10000 ) + pActors[i].uAIState = AIState::Disabled; + v5 = pActors[i].uAIState; + if ( pActors[i].uAIState != AIState::Removed && pActors[i].uAIState != AIState::Disabled && + (pActors[i].sCurrentHP == 0 || pActors[i].pMonsterInfo.uHP == 0) ) + pActors[i].uAIState = AIState::Dead; + pActors[i].vVelocity.x = 0; + pActors[i].vVelocity.y = 0; + pActors[i].vVelocity.z = 0; + pActors[i].UpdateAnimation(); + pActors[i].pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)0; + pActors[i].PrepareSprites(0); + } + else + { + pActors[i].uAIState = AIState::Disabled; + pActors[i].uAttributes = v4 | 0x10000; + alert_status = GetAlertStatus(); + } + } + pGameLoadingUI_ProgressBar->Progress(); - - Actor thisa; - thisa.pMonsterInfo.uID = 45; - thisa.PrepareSprites(v2); + //no use for this +// Actor thisa; +// thisa.pMonsterInfo.uID = 45; +// thisa.PrepareSprites(0); return 1; } //----- (0047F3EA) -------------------------------------------------------- bool OutdoorLocation::LoadRoadTileset() { - OutdoorLocationTileType *v1; // esi@1 - - v1 = &this->pTileTypes[3]; - pTileTypes[3].uTileID = pTileTable->method_487ED6(pTileTypes[3].tileset, 1); - pTileTable->InitializeTileset(v1->tileset); + pTileTypes[3].uTileID = pTileTable->GetTileForTerrainType(pTileTypes[3].tileset, 1); + pTileTable->InitializeTileset(pTileTypes[3].tileset); return 1; } @@ -2888,7 +2845,7 @@ bool OutdoorLocation::LoadTileGroupIds() { for (uint i = 0; i < 3; ++i) - pTileTypes[i].uTileID = pTileTable->method_487ED6(pTileTypes[i].tileset, 1); + pTileTypes[i].uTileID = pTileTable->GetTileForTerrainType(pTileTypes[i].tileset, 1); return true; } diff -r cf2fbac6edc9 -r a84db04439a4 Outdoor.h --- a/Outdoor.h Sat Mar 23 19:47:01 2013 +0200 +++ b/Outdoor.h Sat Mar 23 19:47:18 2013 +0200 @@ -5,7 +5,6 @@ #include "TileFrameTable.h" - /* 256 */ #pragma pack(push, 1) struct ODMHeader @@ -28,8 +27,13 @@ }; #pragma pack(pop) - - +#pragma pack(push, 1) +struct DMap + { + unsigned __int8 field0; + unsigned __int8 field1; + }; +#pragma pack(pop) /* 79 */ #pragma pack(push, 1) @@ -38,18 +42,19 @@ //----- (0047C794) -------------------------------------------------------- inline OutdoorLocationTerrain() { - this->pHeightmap = 0; - this->pTilemap = 0; - this->ptr_C = 0; + pHeightmap = NULL; + pTilemap = NULL; + pAttributemap = NULL; + pDmap = NULL;; this->field_10 = 0; this->field_12 = 0; - pAttributemap = nullptr; + } void _47C7A9(); void Release(); - int _47C80A(int a2, int a3, int a4, int a5); + void FillDMap(int X, int Y, int W, int Z); int _47CB57(int a1, int a2, int a3); bool ZeroLandscape(); bool Initialize(); @@ -58,7 +63,7 @@ unsigned __int8 *pHeightmap; unsigned __int8 *pTilemap; unsigned __int8 *pAttributemap; - void *ptr_C; + struct DMap *pDmap; __int16 field_10; __int16 field_12; __int16 field_14; @@ -138,7 +143,7 @@ //DLVHeader::DLVHeader(&v1->ddm); pSpawnPoints = 0; pBModels = 0; - ptr_D4 = 0; + pCmap = 0; pFaceIDLIST = 0; pOMAP = 0; } @@ -186,7 +191,7 @@ OutdoorLocationTileType pTileTypes[4]; // [3] road tileset unsigned int uNumBModels; struct OutdoorLocationTerrain pTerrain; - void *ptr_D4; + void *pCmap; struct BSPModel *pBModels; unsigned int numFaceIDListElems; unsigned __int16 *pFaceIDLIST; @@ -201,7 +206,7 @@ struct SpawnPointMM7 *pSpawnPoints; struct DDM_DLV_Header ddm; unsigned __int64 uLastVisitDay; - char field_4F8[12]; + char sky_texture_name[12]; int day_attrib; int day_fogrange_1; int day_fogrange_2; diff -r cf2fbac6edc9 -r a84db04439a4 TileFrameTable.h --- a/TileFrameTable.h Sat Mar 23 19:47:01 2013 +0200 +++ b/TileFrameTable.h Sat Mar 23 19:47:18 2013 +0200 @@ -21,7 +21,7 @@ }; -enum Tileset: unsigned __int16 +enum Tileset: signed __int16 { Tileset_Grass = 0, Tileset_Snow = 1, @@ -33,12 +33,13 @@ Tileset_Swamp = 7, Tileset_8 = 8, Tileset_9 = 9, - Tileset_RoadGrassCobble = 10 + Tileset_RoadGrassCobble = 10, + Tileset_NULL =-1 }; /* 48 */ #pragma pack(push, 1) -struct TileDesc +struct TileDesc //26 { char pTileName[16]; unsigned __int16 uTileID; @@ -57,19 +58,19 @@ TileTable() { this->pTiles = nullptr; - this->uNumTiles = 0; + this->sNumTiles = 0; } ~TileTable(); TileDesc *GetTileById(unsigned int uTileID); void InitializeTileset(Tileset tileset); - int method_487ED6(signed int a1, int a2); + int GetTileForTerrainType(signed int a1, bool a2); unsigned int GetTileId(unsigned int uTerrainType, unsigned int uSection); void ToFile(); void FromFile(void *pSerialized); int FromFileTxt(const char *pFilename); - unsigned int uNumTiles; + signed int sNumTiles; struct TileDesc *pTiles; }; #pragma pack(pop) diff -r cf2fbac6edc9 -r a84db04439a4 TileTable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TileTable.cpp Sat Mar 23 19:47:18 2013 +0200 @@ -0,0 +1,796 @@ +#include +#include +#include +#include + +#include "TileFrameTable.h" +#include "FrameTableInc.h" +#include "Allocator.h" +#include "PaletteManager.h" +#include "LOD.h" + +#include "mm7_data.h" + + +//----- (00487E1D) -------------------------------------------------------- +TileTable::~TileTable() +{ + if ( pTiles ) + { + pAllocator->FreeChunk(pTiles); + pTiles = nullptr; + } + sNumTiles = 0; +} + +//----- (00487E3B) -------------------------------------------------------- +TileDesc *TileTable::GetTileById(unsigned int uTileID) +{ + /*TileDesc *result; // eax@3 + + if ( (uTileID & 0x80000000u) != 0 || (signed int)uTileID > (signed int)(this->uNumTiles - 1) ) + result = this->pTiles; + else + result = &this->pTiles[uTileID]; + return result;*/ + + assert(uTileID < sNumTiles); + return &pTiles[uTileID]; +} + +//----- (00487E58) -------------------------------------------------------- +void TileTable::InitializeTileset(Tileset tileset) +{ + for (int i = 0; i < sNumTiles; ++i ) + { + if (pTiles[i].tileset == tileset && pTiles[i].pTileName[0] ) + { + pTiles[i].uBitmapID = pBitmaps_LOD->LoadTexture(pTiles[i].pTileName); + if ( pTiles[i].uBitmapID != -1 ) + pBitmaps_LOD->pTextures[pTiles[i].uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[pTiles[i].uBitmapID].palette_id1); + } + } +} + +//----- (00487ED6) -------------------------------------------------------- +int TileTable::GetTileForTerrainType( signed int terrain_type, bool not_random ) + { + int v5; // edx@3 + int v6; // edx@11 + + if ( not_random || terrain_type > 8 ) + { + return GetTileId(terrain_type, 0); + } + v5 = rand() % 50; + if ( v5 < 20) + { + return GetTileId(terrain_type, 0); + } + else if ( v5 < 30 ) + { + return GetTileId(terrain_type, 1); + } + else if ( v5 < 40 ) + { + return GetTileId(terrain_type, 2); + } + else if ( v5 < 48 ) + { + return GetTileId(terrain_type, 3); + } + v6 = rand() % 8; + return GetTileId(terrain_type, v6+4); + return 0; +} + +//----- (00487F84) -------------------------------------------------------- +unsigned int TileTable::GetTileId(unsigned int uTerrainType, unsigned int uSection) +{ + for (int i=0; ipTiles, 0x1Au, v1->sNumTiles, v3); + fclose(v3); +} + +//----- (00488000) -------------------------------------------------------- +void TileTable::FromFile(void *pSerialized) +{ + sNumTiles = *(int *)pSerialized; + pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sizeof(TileDesc) * sNumTiles, "Tile Descrip"); + memcpy(pTiles, (char *)pSerialized + 4, sizeof(TileDesc) * sNumTiles); +} + +//----- (00488047) -------------------------------------------------------- +int TileTable::FromFileTxt(const char *pFilename) +{ + TileTable *v2; // ebp@1 + FILE *v3; // eax@1 + unsigned int v4; // ebx@3 + void *v5; // eax@9 + unsigned __int16 v6; // ax@14 + const char *v7; // ST14_4@14 + unsigned __int16 v8; // ax@14 + const char *v9; // esi@14 + int v10; // eax@17 + int v11; // eax@20 + int v12; // eax@22 + int v13; // eax@24 + int v14; // eax@26 + int v15; // eax@28 + int v16; // eax@30 + int v17; // eax@32 + int v18; // eax@34 + int v19; // eax@36 + int v20; // eax@38 + int v21; // eax@40 + int v22; // eax@42 + int v23; // eax@44 + int v24; // eax@46 + int v25; // eax@48 + int v26; // eax@50 + int v27; // eax@52 + int v28; // eax@54 + int v29; // eax@56 + int v30; // eax@58 + int v31; // eax@60 + int v32; // eax@62 + int v33; // eax@64 + int v34; // eax@66 + const char *v35; // esi@67 + int v36; // eax@70 + int v37; // eax@73 + int v38; // eax@75 + int v39; // eax@77 + int v40; // eax@79 + int v41; // eax@81 + int v42; // eax@83 + int v43; // eax@85 + int v44; // eax@87 + int v45; // eax@89 + int v46; // eax@91 + int v47; // eax@93 + int v48; // eax@108 + int v49; // eax@110 + int v50; // eax@112 + int v51; // eax@114 + int v52; // eax@116 + int v53; // eax@118 + int v54; // eax@120 + int v55; // eax@122 + int v56; // eax@124 + int v57; // eax@126 + int v58; // eax@128 + int v59; // eax@130 + int v60; // eax@132 + int v61; // eax@134 + int v62; // eax@136 + int v63; // eax@138 + int v64; // eax@140 + int v65; // eax@142 + int v66; // eax@144 + int v67; // eax@146 + int v68; // eax@148 + int v69; // eax@150 + int v70; // eax@151 + int j; // edi@152 + const char *v72; // esi@153 + int v73; // eax@154 + int v74; // eax@156 + int v75; // eax@160 + int v76; // eax@162 + int v77; // eax@164 + int v78; // eax@166 + int v79; // eax@168 + int v80; // eax@170 + FILE *i; // [sp-10h] [bp-304h]@3 + FILE *File; // [sp+4h] [bp-2F0h]@1 + FrameTableTxtLine v84; // [sp+8h] [bp-2ECh]@4 + FrameTableTxtLine v85; // [sp+84h] [bp-270h]@4 + char Buf; // [sp+100h] [bp-1F4h]@4 + + v2 = this; + v3 = fopen(pFilename, "r"); + File = v3; + if ( !v3 ) + Abortf("TileTable::load - Unable to open file: %s."); + v4 = 0; + for ( i = v3; fgets(&Buf, 490, i); i = File ) + { + *strchr(&Buf, 10) = 0; + memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); + if ( v84.uPropCount && *v84.pProperties[0] != 47 ) + ++v4; + } + v2->sNumTiles = v4; + v5 = pAllocator->AllocNamedChunk(v2->pTiles, 26 * v4, "Tile Descrip"); + v2->pTiles = (TileDesc *)v5; + if ( !v5 ) + Abortf("TileTable::Load - Out of Memory!"); + memset(v5, 0, 26 * v2->sNumTiles); + v2->sNumTiles = 0; + fseek(File, 0, 0); + if ( fgets(&Buf, 490, File) ) + { + while ( 1 ) + { + *strchr(&Buf, 10) = 0; + memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); + if ( v84.uPropCount ) + { + if ( *v84.pProperties[0] != 47 ) + break; + } +LABEL_173: + if ( !fgets(&Buf, 490, File) ) + goto LABEL_174; + } + strcpy(v2->pTiles[v2->sNumTiles].pTileName, v84.pProperties[0]); + v6 = atoi(v84.pProperties[1]); + v7 = v84.pProperties[2]; + v2->pTiles[v2->sNumTiles].uTileID = v6; + v8 = atoi(v7); + v9 = v84.pProperties[3]; + v2->pTiles[v2->sNumTiles].uBitmapID = v8; + v2->pTiles[v2->sNumTiles].tileset = Tileset_Grass; + if ( _strcmpi(v9, "TTtype_NULL") ) + { + if ( _strcmpi(v9, "TTtype_Start") ) + { + if ( _strcmpi(v9, "TTtype_Grass") ) + { + if ( _strcmpi(v9, "TTtype_Cracked") ) + { + if ( _strcmpi(v9, "TTtype_Snow") ) + { + if ( _strcmpi(v9, "TTtype_Sand") ) + { + if ( _strcmpi(v9, "TTtype_Volcano") ) + { + if ( _strcmpi(v9, "TTtype_Dirt") ) + { + if ( _strcmpi(v9, "TTtype_Water") ) + { + if ( _strcmpi(v9, "TTtype_Tropical") ) + { + if ( _strcmpi(v9, "TTtype_Swamp") ) + { + if ( _strcmpi(v9, "TTtype_City") ) + { + if ( _strcmpi(v9, "TTtype_RoadGrassCobble") ) + { + if ( _strcmpi(v9, "TTtype_RoadGrassDirt") ) + { + if ( _strcmpi(v9, "TTtype_RoadCrackedCobble") ) + { + if ( _strcmpi(v9, "TTtype_RoadCrackedDirt") ) + { + if ( _strcmpi(v9, "TTtype_RoadSandCobble") ) + { + if ( _strcmpi(v9, "TTtype_RoadSandDirt") ) + { + if ( _strcmpi(v9, "TTtype_RoadVolcanoCobble") ) + { + if ( _strcmpi(v9, "TTtype_RoadVolcanoDirt") ) + { + if ( _strcmpi(v9, "TTtype_RoadSwampCobble") ) + { + if ( _strcmpi(v9, "TTtype_RoadSwampDirt") ) + { + if ( _strcmpi(v9, "TTtype_RoadTropicalCobble") ) + { + if ( _strcmpi(v9, "TTtype_RoadTropicalDirt") ) + { + if ( _strcmpi(v9, "TTtype_RoadSnowCobble") ) + { + if ( _strcmpi(v9, "TTtype_RoadSnowDirt") ) + { + if ( !_strcmpi(v9, "TTtype_RoadCityStone") ) + { + v34 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v34 |= 0x1Cu; + } + } + else + { + v33 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v33 |= 0xDu; + } + } + else + { + v32 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v32 |= 0xCu; + } + } + else + { + v31 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v31 |= 0x1Bu; + } + } + else + { + v30 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v30 |= 0x1Au; + } + } + else + { + v29 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v29 |= 0x19u; + } + } + else + { + v28 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v28 |= 0x18u; + } + } + else + { + v27 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v27 |= 0x11u; + } + } + else + { + v26 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v26 |= 0x10u; + } + } + else + { + v25 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v25 |= 0xFu; + } + } + else + { + v24 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v24 |= 0xEu; + } + } + else + { + v23 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v23 |= 0x17u; + } + } + else + { + v22 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v22 |= 0x16u; + } + } + else + { + v21 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v21 |= 0xBu; + } + } + else + { + v20 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v20 |= 0xAu; + } + } + else + { + v19 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v19 |= 9u; + } + } + else + { + v18 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v18 |= 7u; + } + } + else + { + v17 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v17 |= 8u; + } + } + else + { + v16 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v16 |= 5u; + } + } + else + { + v15 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v15 |= 4u; + } + } + else + { + v14 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v14 |= 3u; + } + } + else + { + v13 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v13 |= 2u; + } + } + else + { + v12 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v12 |= 1u; + } + } + else + { + v11 = (int)&v2->pTiles[v2->sNumTiles].tileset; + *(char *)v11 |= 6u; + } + } + } + else + { + v10 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v10 |= 0xFEu; + } + } + else + { + LOBYTE(v2->pTiles[v2->sNumTiles].tileset) = -1; + } + v35 = v84.pProperties[4]; + v2->pTiles[v2->sNumTiles].uSection = 0; + v2->pTiles[v2->sNumTiles].uAttributes = 0; + if ( !_strcmpi(v35, "TTsect_NULL") ) + { + LOBYTE(v2->pTiles[v2->sNumTiles].uSection) = -1; +LABEL_152: + for ( j = 5; j < v84.uPropCount; ++j ) + { + v72 = v84.pProperties[j]; + if ( _strcmpi(v84.pProperties[j], "TTattr_Burn") ) + { + if ( _strcmpi(v72, "TTattr_Water") ) + { + if ( _strcmpi(v72, "TTattr_Water2") ) + { + if ( _strcmpi(v72, "TTattr_Block") ) + { + if ( _strcmpi(v72, "TTattr_Repulse") ) + { + if ( _strcmpi(v72, "TTattr_Flat") ) + { + if ( _strcmpi(v72, "TTattr_Wave") ) + { + if ( _strcmpi(v72, "TTattr_NoDraw") ) + { + if ( !_strcmpi(v72, "TTattr_Transition") ) + { + v80 = (int)&v2->pTiles[v2->sNumTiles].uAttributes; + *(short *)v80 |= 0x200u; + } + } + else + { + v79 = (int)&v2->pTiles[v2->sNumTiles].uAttributes; + *(char *)v79 |= 0x40u; + } + } + else + { + v78 = (int)&v2->pTiles[v2->sNumTiles].uAttributes; + *(char *)v78 |= 0x20u; + } + } + else + { + v77 = (int)&v2->pTiles[v2->sNumTiles].uAttributes; + *(char *)v77 |= 0x10u; + } + } + else + { + v76 = (int)&v2->pTiles[v2->sNumTiles].uAttributes; + *(char *)v76 |= 8u; + } + } + else + { + v75 = (int)&v2->pTiles[v2->sNumTiles].uAttributes; + *(char *)v75 |= 4u; + } + } + else + { + HIBYTE(v2->pTiles[v2->sNumTiles].uAttributes) |= 1u; + } + } + else + { + v74 = (int)&v2->pTiles[v2->sNumTiles].uAttributes; + *(char *)v74 |= 2u; + } + } + else + { + v73 = (int)&v2->pTiles[v2->sNumTiles].uAttributes; + *(char *)v73 |= 1u; + } + } + ++v2->sNumTiles; + goto LABEL_173; + } + if ( !_strcmpi(v35, "TTsect_Start") ) + { + v36 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v36 |= 0xFEu; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Base1") ) + goto LABEL_152; + if ( !_strcmpi(v35, "TTsect_Base2") ) + { + v37 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v37 |= 1u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Base3") ) + { + v38 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v38 |= 2u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Base4") ) + { + v39 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v39 |= 3u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Special1") ) + { + v40 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v40 |= 4u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Special2") ) + { + v41 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v41 |= 5u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Special3") ) + { + v42 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v42 |= 6u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Special4") ) + { + v43 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v43 |= 7u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Special5") ) + { + v44 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v44 |= 8u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Special6") ) + { + v45 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v45 |= 9u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Special7") ) + { + v46 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v46 |= 0xAu; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_Special8") ) + { + v47 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v47 |= 0xBu; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_NE1") ) + goto LABEL_130; + if ( !_strcmpi(v35, "TTsect_NW1") ) + goto LABEL_134; + if ( !_strcmpi(v35, "TTsect_SE1") ) + goto LABEL_130; + if ( !_strcmpi(v35, "TTsect_SW1") ) + goto LABEL_134; + if ( !_strcmpi(v35, "TTsect_E1") ) + goto LABEL_138; + if ( !_strcmpi(v35, "TTsect_W1") ) + goto LABEL_140; + if ( !_strcmpi(v35, "TTsect_N1") ) + goto LABEL_142; + if ( !_strcmpi(v35, "TTsect_S1") ) + goto LABEL_144; + if ( !_strcmpi(v35, "TTsect_XNE1") ) + goto LABEL_146; + if ( _strcmpi(v35, "TTsect_XNW1") ) + { + if ( !_strcmpi(v35, "TTsect_XSE1") ) + goto LABEL_146; + if ( _strcmpi(v35, "TTsect_XSW1") ) + { + if ( !_strcmpi(v35, "TTsect_CROS") ) + { +LABEL_151: + v70 = (int)&v2->pTiles[v2->sNumTiles].uAttributes; + *(short *)v70 |= 0x200u; + goto LABEL_152; + } + if ( !_strcmpi(v35, "TTsect_NS") ) + { + v48 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v48 |= 1u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_EW") ) + { + v49 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v49 |= 2u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_N_E") ) + { + v50 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v50 |= 3u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_N_W") ) + { + v51 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v51 |= 4u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_S_E") ) + { + v52 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v52 |= 5u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_S_W") ) + { + v53 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v53 |= 6u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_NS_E") ) + { + v54 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v54 |= 7u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_NS_W") ) + { + v55 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v55 |= 8u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_EW_N") ) + { + v56 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v56 |= 9u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_EW_S") ) + { + v57 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v57 |= 0xAu; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_NCAP") ) + { + v58 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v58 |= 0xBu; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_ECAP") ) + { +LABEL_130: + v59 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v59 |= 0xCu; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_SCAP") ) + { + v60 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v60 |= 0xDu; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_WCAP") ) + { +LABEL_134: + v61 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v61 |= 0xEu; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_DN") ) + { + v62 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v62 |= 0xFu; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_DS") ) + { +LABEL_138: + v63 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v63 |= 0x10u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_DW") ) + { +LABEL_140: + v64 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v64 |= 0x11u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_DE") ) + { +LABEL_142: + v65 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v65 |= 0x12u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_DSW") ) + { +LABEL_144: + v66 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v66 |= 0x13u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_DNE") ) + { +LABEL_146: + v67 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v67 |= 0x14u; + goto LABEL_151; + } + if ( !_strcmpi(v35, "TTsect_DSE") ) + { + v68 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v68 |= 0x15u; + goto LABEL_151; + } + if ( _strcmpi(v35, "TTsect_DNW") ) + goto LABEL_152; + } + } + v69 = (int)&v2->pTiles[v2->sNumTiles].uSection; + *(char *)v69 |= 0x16u; + goto LABEL_151; + } +LABEL_174: + fclose(File); + return 1; +} + diff -r cf2fbac6edc9 -r a84db04439a4 mm7_4.cpp --- a/mm7_4.cpp Sat Mar 23 19:47:01 2013 +0200 +++ b/mm7_4.cpp Sat Mar 23 19:47:18 2013 +0200 @@ -1522,863 +1522,6 @@ -//----- (00487E1D) -------------------------------------------------------- -TileTable::~TileTable() -{ - if ( this->pTiles ) - { - pAllocator->FreeChunk(this->pTiles); - pTiles = nullptr; - } - uNumTiles = 0; -} - -//----- (00487E3B) -------------------------------------------------------- -TileDesc *TileTable::GetTileById(unsigned int uTileID) -{ - /*TileDesc *result; // eax@3 - - if ( (uTileID & 0x80000000u) != 0 || (signed int)uTileID > (signed int)(this->uNumTiles - 1) ) - result = this->pTiles; - else - result = &this->pTiles[uTileID]; - return result;*/ - - assert(uTileID < uNumTiles); - return &pTiles[uTileID]; -} - -//----- (00487E58) -------------------------------------------------------- -void TileTable::InitializeTileset(Tileset tileset) -{ - TileTable *v2; // edi@1 - int v3; // ebx@1 - TileDesc *v4; // eax@2 - signed int i; // [sp+8h] [bp-4h]@1 - - v2 = this; - v3 = 0; - for ( i = 0; i < (signed int)v2->uNumTiles; ++v3 ) - { - v4 = &v2->pTiles[v3]; - if (v4->tileset == tileset && v4->pTileName[0] ) - { - v2->pTiles[v3].uBitmapID = pBitmaps_LOD->LoadTexture(v4->pTileName); - if ( v2->pTiles[v3].uBitmapID != -1 ) - pBitmaps_LOD->pTextures[v2->pTiles[v3].uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2->pTiles[v3].uBitmapID].palette_id1); - } - ++i; - } -} - -//----- (00487ED6) -------------------------------------------------------- -int TileTable::method_487ED6(signed int a1, int a2) -{ - int v3; // esi@1 - TileTable *v4; // edi@1 - int v5; // edx@3 - int v6; // edx@11 - unsigned int v8; // [sp-4h] [bp-10h]@4 - - v3 = 0; - v4 = this; - if ( a1 > 8 ) - { - v8 = 0; - return v4->GetTileId(a1, v8); - } - if ( a2 || (v5 = rand() % 50, v5 < 20) ) - { - v8 = 0; - return v4->GetTileId(a1, v8); - } - if ( v5 < 30 ) - { - v8 = 1; - return v4->GetTileId(a1, v8); - } - if ( v5 < 40 ) - { - v8 = 2; - return v4->GetTileId(a1, v8); - } - if ( v5 < 48 ) - { - v8 = 3; - return v4->GetTileId(a1, v8); - } - v6 = rand() % 8; - if ( !v6 ) - { - v8 = 4; - return v4->GetTileId(a1, v8); - } - if ( v6 == 1 ) - { - v8 = 5; - return v4->GetTileId(a1, v8); - } - if ( v6 == 2 ) - { - v8 = 6; - return v4->GetTileId(a1, v8); - } - if ( v6 == 3 ) - { - v8 = 7; - return v4->GetTileId(a1, v8); - } - if ( v6 == 4 ) - { - v8 = 8; - return v4->GetTileId(a1, v8); - } - if ( v6 == 5 ) - { - v8 = 9; - return v4->GetTileId(a1, v8); - } - if ( v6 == 6 ) - { - v8 = 10; - return v4->GetTileId(a1, v8); - } - if ( v6 == 7 ) - { - v8 = 11; - return v4->GetTileId(a1, v8); - } - return v3; -} - -//----- (00487F84) -------------------------------------------------------- -unsigned int TileTable::GetTileId(unsigned int uTerrainType, unsigned int uSection) -{ - unsigned int v3; // edx@1 - unsigned int result; // eax@1 - unsigned __int16 *v5; // ecx@2 - - v3 = this->uNumTiles; - result = 0; - if ( (signed int)this->uNumTiles <= 0 ) - { -LABEL_6: - result = 0; - } - else - { - v5 = &this->pTiles->uSection; - while ( (signed __int16)*(v5 - 1) != uTerrainType || (signed __int16)*v5 != uSection ) - { - ++result; - v5 += 13; - if ( (signed int)result >= (signed int)v3 ) - goto LABEL_6; - } - } - return result; -} - -//----- (00487FB4) -------------------------------------------------------- -void TileTable::ToFile() -{ - TileTable *v1; // esi@1 - FILE *v2; // eax@1 - FILE *v3; // edi@1 - - auto Str = this; - - v1 = Str; - v2 = fopen("data\\dtile.bin", "wb"); - v3 = v2; - if ( !v2 ) - Abortf("Unable to save dtile.bin!"); - fwrite(v1, 4u, 1u, v2); - fwrite(v1->pTiles, 0x1Au, v1->uNumTiles, v3); - fclose(v3); -} - -//----- (00488000) -------------------------------------------------------- -void TileTable::FromFile(void *pSerialized) -{ - uNumTiles = *(int *)pSerialized; - pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, 26 * uNumTiles, "Tile Descrip"); - memcpy(pTiles, (char *)pSerialized + 4, 26 * uNumTiles); -} - -//----- (00488047) -------------------------------------------------------- -int TileTable::FromFileTxt(const char *pFilename) -{ - TileTable *v2; // ebp@1 - FILE *v3; // eax@1 - unsigned int v4; // ebx@3 - void *v5; // eax@9 - unsigned __int16 v6; // ax@14 - const char *v7; // ST14_4@14 - unsigned __int16 v8; // ax@14 - const char *v9; // esi@14 - int v10; // eax@17 - int v11; // eax@20 - int v12; // eax@22 - int v13; // eax@24 - int v14; // eax@26 - int v15; // eax@28 - int v16; // eax@30 - int v17; // eax@32 - int v18; // eax@34 - int v19; // eax@36 - int v20; // eax@38 - int v21; // eax@40 - int v22; // eax@42 - int v23; // eax@44 - int v24; // eax@46 - int v25; // eax@48 - int v26; // eax@50 - int v27; // eax@52 - int v28; // eax@54 - int v29; // eax@56 - int v30; // eax@58 - int v31; // eax@60 - int v32; // eax@62 - int v33; // eax@64 - int v34; // eax@66 - const char *v35; // esi@67 - int v36; // eax@70 - int v37; // eax@73 - int v38; // eax@75 - int v39; // eax@77 - int v40; // eax@79 - int v41; // eax@81 - int v42; // eax@83 - int v43; // eax@85 - int v44; // eax@87 - int v45; // eax@89 - int v46; // eax@91 - int v47; // eax@93 - int v48; // eax@108 - int v49; // eax@110 - int v50; // eax@112 - int v51; // eax@114 - int v52; // eax@116 - int v53; // eax@118 - int v54; // eax@120 - int v55; // eax@122 - int v56; // eax@124 - int v57; // eax@126 - int v58; // eax@128 - int v59; // eax@130 - int v60; // eax@132 - int v61; // eax@134 - int v62; // eax@136 - int v63; // eax@138 - int v64; // eax@140 - int v65; // eax@142 - int v66; // eax@144 - int v67; // eax@146 - int v68; // eax@148 - int v69; // eax@150 - int v70; // eax@151 - int j; // edi@152 - const char *v72; // esi@153 - int v73; // eax@154 - int v74; // eax@156 - int v75; // eax@160 - int v76; // eax@162 - int v77; // eax@164 - int v78; // eax@166 - int v79; // eax@168 - int v80; // eax@170 - FILE *i; // [sp-10h] [bp-304h]@3 - FILE *File; // [sp+4h] [bp-2F0h]@1 - FrameTableTxtLine v84; // [sp+8h] [bp-2ECh]@4 - FrameTableTxtLine v85; // [sp+84h] [bp-270h]@4 - char Buf; // [sp+100h] [bp-1F4h]@4 - - v2 = this; - v3 = fopen(pFilename, "r"); - File = v3; - if ( !v3 ) - Abortf("TileTable::load - Unable to open file: %s."); - v4 = 0; - for ( i = v3; fgets(&Buf, 490, i); i = File ) - { - *strchr(&Buf, 10) = 0; - memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); - if ( v84.uPropCount && *v84.pProperties[0] != 47 ) - ++v4; - } - v2->uNumTiles = v4; - v5 = pAllocator->AllocNamedChunk(v2->pTiles, 26 * v4, "Tile Descrip"); - v2->pTiles = (TileDesc *)v5; - if ( !v5 ) - Abortf("TileTable::Load - Out of Memory!"); - memset(v5, 0, 26 * v2->uNumTiles); - v2->uNumTiles = 0; - fseek(File, 0, 0); - if ( fgets(&Buf, 490, File) ) - { - while ( 1 ) - { - *strchr(&Buf, 10) = 0; - memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); - if ( v84.uPropCount ) - { - if ( *v84.pProperties[0] != 47 ) - break; - } -LABEL_173: - if ( !fgets(&Buf, 490, File) ) - goto LABEL_174; - } - strcpy(v2->pTiles[v2->uNumTiles].pTileName, v84.pProperties[0]); - v6 = atoi(v84.pProperties[1]); - v7 = v84.pProperties[2]; - v2->pTiles[v2->uNumTiles].uTileID = v6; - v8 = atoi(v7); - v9 = v84.pProperties[3]; - v2->pTiles[v2->uNumTiles].uBitmapID = v8; - v2->pTiles[v2->uNumTiles].tileset = Tileset_Grass; - if ( _strcmpi(v9, "TTtype_NULL") ) - { - if ( _strcmpi(v9, "TTtype_Start") ) - { - if ( _strcmpi(v9, "TTtype_Grass") ) - { - if ( _strcmpi(v9, "TTtype_Cracked") ) - { - if ( _strcmpi(v9, "TTtype_Snow") ) - { - if ( _strcmpi(v9, "TTtype_Sand") ) - { - if ( _strcmpi(v9, "TTtype_Volcano") ) - { - if ( _strcmpi(v9, "TTtype_Dirt") ) - { - if ( _strcmpi(v9, "TTtype_Water") ) - { - if ( _strcmpi(v9, "TTtype_Tropical") ) - { - if ( _strcmpi(v9, "TTtype_Swamp") ) - { - if ( _strcmpi(v9, "TTtype_City") ) - { - if ( _strcmpi(v9, "TTtype_RoadGrassCobble") ) - { - if ( _strcmpi(v9, "TTtype_RoadGrassDirt") ) - { - if ( _strcmpi(v9, "TTtype_RoadCrackedCobble") ) - { - if ( _strcmpi(v9, "TTtype_RoadCrackedDirt") ) - { - if ( _strcmpi(v9, "TTtype_RoadSandCobble") ) - { - if ( _strcmpi(v9, "TTtype_RoadSandDirt") ) - { - if ( _strcmpi(v9, "TTtype_RoadVolcanoCobble") ) - { - if ( _strcmpi(v9, "TTtype_RoadVolcanoDirt") ) - { - if ( _strcmpi(v9, "TTtype_RoadSwampCobble") ) - { - if ( _strcmpi(v9, "TTtype_RoadSwampDirt") ) - { - if ( _strcmpi(v9, "TTtype_RoadTropicalCobble") ) - { - if ( _strcmpi(v9, "TTtype_RoadTropicalDirt") ) - { - if ( _strcmpi(v9, "TTtype_RoadSnowCobble") ) - { - if ( _strcmpi(v9, "TTtype_RoadSnowDirt") ) - { - if ( !_strcmpi(v9, "TTtype_RoadCityStone") ) - { - v34 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v34 |= 0x1Cu; - } - } - else - { - v33 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v33 |= 0xDu; - } - } - else - { - v32 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v32 |= 0xCu; - } - } - else - { - v31 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v31 |= 0x1Bu; - } - } - else - { - v30 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v30 |= 0x1Au; - } - } - else - { - v29 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v29 |= 0x19u; - } - } - else - { - v28 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v28 |= 0x18u; - } - } - else - { - v27 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v27 |= 0x11u; - } - } - else - { - v26 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v26 |= 0x10u; - } - } - else - { - v25 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v25 |= 0xFu; - } - } - else - { - v24 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v24 |= 0xEu; - } - } - else - { - v23 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v23 |= 0x17u; - } - } - else - { - v22 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v22 |= 0x16u; - } - } - else - { - v21 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v21 |= 0xBu; - } - } - else - { - v20 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v20 |= 0xAu; - } - } - else - { - v19 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v19 |= 9u; - } - } - else - { - v18 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v18 |= 7u; - } - } - else - { - v17 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v17 |= 8u; - } - } - else - { - v16 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v16 |= 5u; - } - } - else - { - v15 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v15 |= 4u; - } - } - else - { - v14 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v14 |= 3u; - } - } - else - { - v13 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v13 |= 2u; - } - } - else - { - v12 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v12 |= 1u; - } - } - else - { - v11 = (int)&v2->pTiles[v2->uNumTiles].tileset; - *(char *)v11 |= 6u; - } - } - } - else - { - v10 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v10 |= 0xFEu; - } - } - else - { - LOBYTE(v2->pTiles[v2->uNumTiles].tileset) = -1; - } - v35 = v84.pProperties[4]; - v2->pTiles[v2->uNumTiles].uSection = 0; - v2->pTiles[v2->uNumTiles].uAttributes = 0; - if ( !_strcmpi(v35, "TTsect_NULL") ) - { - LOBYTE(v2->pTiles[v2->uNumTiles].uSection) = -1; -LABEL_152: - for ( j = 5; j < v84.uPropCount; ++j ) - { - v72 = v84.pProperties[j]; - if ( _strcmpi(v84.pProperties[j], "TTattr_Burn") ) - { - if ( _strcmpi(v72, "TTattr_Water") ) - { - if ( _strcmpi(v72, "TTattr_Water2") ) - { - if ( _strcmpi(v72, "TTattr_Block") ) - { - if ( _strcmpi(v72, "TTattr_Repulse") ) - { - if ( _strcmpi(v72, "TTattr_Flat") ) - { - if ( _strcmpi(v72, "TTattr_Wave") ) - { - if ( _strcmpi(v72, "TTattr_NoDraw") ) - { - if ( !_strcmpi(v72, "TTattr_Transition") ) - { - v80 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; - *(short *)v80 |= 0x200u; - } - } - else - { - v79 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; - *(char *)v79 |= 0x40u; - } - } - else - { - v78 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; - *(char *)v78 |= 0x20u; - } - } - else - { - v77 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; - *(char *)v77 |= 0x10u; - } - } - else - { - v76 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; - *(char *)v76 |= 8u; - } - } - else - { - v75 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; - *(char *)v75 |= 4u; - } - } - else - { - HIBYTE(v2->pTiles[v2->uNumTiles].uAttributes) |= 1u; - } - } - else - { - v74 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; - *(char *)v74 |= 2u; - } - } - else - { - v73 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; - *(char *)v73 |= 1u; - } - } - ++v2->uNumTiles; - goto LABEL_173; - } - if ( !_strcmpi(v35, "TTsect_Start") ) - { - v36 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v36 |= 0xFEu; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Base1") ) - goto LABEL_152; - if ( !_strcmpi(v35, "TTsect_Base2") ) - { - v37 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v37 |= 1u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Base3") ) - { - v38 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v38 |= 2u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Base4") ) - { - v39 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v39 |= 3u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Special1") ) - { - v40 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v40 |= 4u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Special2") ) - { - v41 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v41 |= 5u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Special3") ) - { - v42 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v42 |= 6u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Special4") ) - { - v43 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v43 |= 7u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Special5") ) - { - v44 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v44 |= 8u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Special6") ) - { - v45 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v45 |= 9u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Special7") ) - { - v46 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v46 |= 0xAu; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_Special8") ) - { - v47 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v47 |= 0xBu; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_NE1") ) - goto LABEL_130; - if ( !_strcmpi(v35, "TTsect_NW1") ) - goto LABEL_134; - if ( !_strcmpi(v35, "TTsect_SE1") ) - goto LABEL_130; - if ( !_strcmpi(v35, "TTsect_SW1") ) - goto LABEL_134; - if ( !_strcmpi(v35, "TTsect_E1") ) - goto LABEL_138; - if ( !_strcmpi(v35, "TTsect_W1") ) - goto LABEL_140; - if ( !_strcmpi(v35, "TTsect_N1") ) - goto LABEL_142; - if ( !_strcmpi(v35, "TTsect_S1") ) - goto LABEL_144; - if ( !_strcmpi(v35, "TTsect_XNE1") ) - goto LABEL_146; - if ( _strcmpi(v35, "TTsect_XNW1") ) - { - if ( !_strcmpi(v35, "TTsect_XSE1") ) - goto LABEL_146; - if ( _strcmpi(v35, "TTsect_XSW1") ) - { - if ( !_strcmpi(v35, "TTsect_CROS") ) - { -LABEL_151: - v70 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; - *(short *)v70 |= 0x200u; - goto LABEL_152; - } - if ( !_strcmpi(v35, "TTsect_NS") ) - { - v48 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v48 |= 1u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_EW") ) - { - v49 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v49 |= 2u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_N_E") ) - { - v50 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v50 |= 3u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_N_W") ) - { - v51 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v51 |= 4u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_S_E") ) - { - v52 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v52 |= 5u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_S_W") ) - { - v53 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v53 |= 6u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_NS_E") ) - { - v54 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v54 |= 7u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_NS_W") ) - { - v55 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v55 |= 8u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_EW_N") ) - { - v56 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v56 |= 9u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_EW_S") ) - { - v57 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v57 |= 0xAu; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_NCAP") ) - { - v58 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v58 |= 0xBu; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_ECAP") ) - { -LABEL_130: - v59 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v59 |= 0xCu; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_SCAP") ) - { - v60 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v60 |= 0xDu; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_WCAP") ) - { -LABEL_134: - v61 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v61 |= 0xEu; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_DN") ) - { - v62 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v62 |= 0xFu; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_DS") ) - { -LABEL_138: - v63 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v63 |= 0x10u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_DW") ) - { -LABEL_140: - v64 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v64 |= 0x11u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_DE") ) - { -LABEL_142: - v65 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v65 |= 0x12u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_DSW") ) - { -LABEL_144: - v66 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v66 |= 0x13u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_DNE") ) - { -LABEL_146: - v67 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v67 |= 0x14u; - goto LABEL_151; - } - if ( !_strcmpi(v35, "TTsect_DSE") ) - { - v68 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v68 |= 0x15u; - goto LABEL_151; - } - if ( _strcmpi(v35, "TTsect_DNW") ) - goto LABEL_152; - } - } - v69 = (int)&v2->pTiles[v2->uNumTiles].uSection; - *(char *)v69 |= 0x16u; - goto LABEL_151; - } -LABEL_174: - fclose(File); - return 1; -} - - //----- (0048958E) -------------------------------------------------------- stru12_MemoryBlock::stru12_MemoryBlock(int a2) diff -r cf2fbac6edc9 -r a84db04439a4 mm7_data.cpp --- a/mm7_data.cpp Sat Mar 23 19:47:01 2013 +0200 +++ b/mm7_data.cpp Sat Mar 23 19:47:18 2013 +0200 @@ -983,10 +983,7 @@ char aAmap[777]; // idb char aTmap[777]; // idb char aHmap[777]; // idb -int dword_4EC268[777]; // weak -int dword_4EC28C[777]; // weak -int dword_4EC2A8; // weak -int dword_4EC2AC; // weak + char aInvalidGroundT[777]; // idb char aInvalidSkyTexH[777]; // idb char aIdlist[777]; // idb