Mercurial > mm7
diff Outdoor.cpp @ 630:1b813023fcbd
Tilesets change according to current season
author | Nomad |
---|---|
date | Mon, 11 Mar 2013 03:37:48 +0200 |
parents | cb0ad52d6a26 |
children | 71ecba604995 |
line wrap: on
line diff
--- a/Outdoor.cpp Fri Mar 08 17:08:08 2013 +0200 +++ b/Outdoor.cpp Mon Mar 11 03:37:48 2013 +0200 @@ -43,6 +43,9 @@ Edge stru_80C9D8; + + + //----- (0047A59E) -------------------------------------------------------- void OutdoorLocation::ExecDraw(unsigned int bRedraw) { @@ -283,7 +286,7 @@ day_fogrange_2 = v5->day_fogrange_2; if ( Is_out15odm_underwater() ) SetUnderwaterFog(); - _6BE134_odm_main_tile_group = v5->pTileTypes[0].uTileGroup; + _6BE134_odm_main_tile_group = v5->pTileTypes[0].tileset; result = 1; } else @@ -520,7 +523,7 @@ v5 = WorldPosToGridCellX(pParty->vPosition.x); v6 = WorldPosToGridCellZ(pParty->vPosition.y); v7 = _47ED83(v5, v6 - 1); - v8 = pTileTable->pTiles[_47ECC1(v7)].uTerrainType; + v8 = pTileTable->pTiles[_47ECC1(v7)].tileset; if ( v8 ) { v9 = v8 - 1; @@ -1086,12 +1089,12 @@ strcpy(v1->pLocationFileName, "i6.odm"); strcpy(v1->pLocationFileDescription, "MM6 Outdoor v1.00"); v1->uNumBModels = 0; - v1->pTileTypes[0].uTileGroup = 0; - v1->pTileTypes[1].uTileGroup = 5; - v1->pTileTypes[2].uTileGroup = 6; - v1->pTileTypes[3].uTileGroup = 10; + v1->pTileTypes[0].tileset = Tileset_Grass; + v1->pTileTypes[1].tileset = Tileset_Water; + v1->pTileTypes[2].tileset = Tileset_6; + v1->pTileTypes[3].tileset = Tileset_RoadGrassCobble; v1->LoadTileGroupIds(); - v1->_47F3EA(); + v1->LoadRoadTileset(); pAllocator->FreeChunk(v1->pBModels); pAllocator->FreeChunk(v1->pSpawnPoints); v1->pBModels = 0; @@ -1386,7 +1389,7 @@ fseek((FILE *)v7, Offset, 0); fread(this, 0xB0u, 1u, (FILE *)v7); LoadTileGroupIds(); - _47F3EA(); + LoadRoadTileset(); strcpy(pGroundTileset, "grastyl"); fseek((FILE *)v7, v114, 0); fread(&uNumBModels, 4u, 1u, (FILE *)v7); @@ -1705,7 +1708,7 @@ //v43 = (char *)pSrc + 176; LoadTileGroupIds(); - _47F3EA(); + LoadRoadTileset(); strcpy(pGroundTileset, "grastyl"); pGameLoadingUI_ProgressBar->Progress(); pTerrain.Initialize(); @@ -2258,16 +2261,17 @@ free(pSrcMem); - pTileTable->InitializeTileset(4); + pTileTable->InitializeTileset(Tileset_Dirt); + pTileTable->InitializeTileset(Tileset_Snow); //thisa = (int)pTileTypes; //v108 = pTileTypes[0].uTileGroup; - pTileTable->InitializeTileset(pTileTypes[0].uTileGroup); + pTileTable->InitializeTileset(pTileTypes[0].tileset); //v108 = pTileTypes[1].uTileGroup; - pTileTable->InitializeTileset(pTileTypes[1].uTileGroup); + pTileTable->InitializeTileset(pTileTypes[1].tileset); //v108 = pTileTypes[2].uTileGroup; - pTileTable->InitializeTileset(pTileTypes[2].uTileGroup); + pTileTable->InitializeTileset(pTileTypes[2].tileset); //v108 = pTileTypes[3].uTileGroup; - pTileTable->InitializeTileset(pTileTypes[3].uTileGroup); + pTileTable->InitializeTileset(pTileTypes[3].tileset); strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); //v97 = pTileTypes[0].uTileID; //v108 = 0; @@ -2402,11 +2406,10 @@ int v3; // esi@5 unsigned int result; // eax@9 - if ( uX < 0 || uX > 127 || uY < 0 || uY > 127) - return 0; + assert(uX < 128 && uY < 128); v3 = this->pTerrain.pTilemap[uY * 128 + uX]; - if (v3 < 198) + if (v3 < 198) // < Tileset_3 { if (v3 >= 90) v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; @@ -2414,6 +2417,41 @@ else v3 = v3 + this->pTileTypes[3].uTileID - 198; + static int f = 0; + if (f) + pParty->uCurrentMonth = 2; + + switch (pParty->uCurrentMonth) + { + case 11: case 0: case 1: // winter + if (v3 >= 90) // Tileset_Grass begins at TileID = 90 + { + if (v3 <= 95) // some grastyl entries + v3 = 348; + else if (v3 <= 113) // rest of grastyl & all grdrt* + v3 = 348 + (v3 - 96); + } + /*switch (v3) + { + case 102: v3 = 354; break; // grdrtNE -> SNdrtne + case 104: v3 = 356; break; // grdrtNW -> SNdrtnw + case 108: v3 = 360; break; // grdrtN -> SNdrtn + }*/ + break; + + case 2: case 3: case 4: // spring + case 8: case 9: case 10: // autumn + if (v3 >= 90 && v3 <= 113) // just convert all Tileset_Grass to dirt + v3 = 1; + break; + + case 5: case 6: case 7: // summer + //all tiles are green grass by default + break; + + default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); + } + return pTileTable->pTiles[v3].uBitmapID; } @@ -2488,10 +2526,10 @@ LOBYTE(v6) = v6 & 0xD9; return v6 + 92; } - v8 = pTileTable->pTiles[v5].uTerrainType; + v8 = pTileTable->pTiles[v5].tileset; if ( v8 <= 6 ) { - if ( v8 == 6 ) + if ( v8 == Tileset_6 ) { v17 = -(a4 != 0); LOBYTE(v17) = v17 & 0xD9; @@ -2841,13 +2879,13 @@ } //----- (0047F3EA) -------------------------------------------------------- -bool OutdoorLocation::_47F3EA() +bool OutdoorLocation::LoadRoadTileset() { OutdoorLocationTileType *v1; // esi@1 v1 = &this->pTileTypes[3]; - this->pTileTypes[3].uTileID = pTileTable->method_487ED6(this->pTileTypes[3].uTileGroup, 1); - pTileTable->InitializeTileset(v1->uTileGroup); + pTileTypes[3].uTileID = pTileTable->method_487ED6(pTileTypes[3].tileset, 1); + pTileTable->InitializeTileset(v1->tileset); return 1; } @@ -2855,7 +2893,7 @@ bool OutdoorLocation::LoadTileGroupIds() { for (uint i = 0; i < 3; ++i) - pTileTypes[i].uTileID = pTileTable->method_487ED6(pTileTypes[i].uTileGroup, 1); + pTileTypes[i].uTileID = pTileTable->method_487ED6(pTileTypes[i].tileset, 1); return true; }