Mercurial > mm7
changeset 630:1b813023fcbd
Tilesets change according to current season
author | Nomad |
---|---|
date | Mon, 11 Mar 2013 03:37:48 +0200 |
parents | 574cc56e05e9 |
children | 3d03a3a674bc |
files | Outdoor.cpp Outdoor.h ParticleEngine.cpp TileFrameTable.h mm7_2.cpp mm7_4.cpp |
diffstat | 6 files changed, 116 insertions(+), 68 deletions(-) [+] |
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; }
--- a/Outdoor.h Fri Mar 08 17:08:08 2013 +0200 +++ b/Outdoor.h Mon Mar 11 03:37:48 2013 +0200 @@ -2,6 +2,7 @@ #include "BSPModel.h" #include "OutdoorCamera.h" #include "Indoor.h" +#include "TileFrameTable.h" @@ -22,7 +23,7 @@ #pragma pack(push, 1) struct OutdoorLocationTileType { - unsigned __int16 uTileGroup; + Tileset tileset; unsigned __int16 uTileID; }; #pragma pack(pop) @@ -160,7 +161,7 @@ bool PrepareDecorations(); int _47F223_LooksLikeGenerateMonsterLoot(); bool InitalizeActors(int a1); - bool _47F3EA(); + bool LoadRoadTileset(); bool LoadTileGroupIds(); double GetFogDensityByTime(); int GetSomeOtherTileInfo(int sX, int sY); @@ -182,7 +183,7 @@ char pLocationFileDescription[32]; char pSkyTextureName[32]; char pGroundTileset[32]; - OutdoorLocationTileType pTileTypes[4]; + OutdoorLocationTileType pTileTypes[4]; // [3] road tileset unsigned int uNumBModels; struct OutdoorLocationTerrain pTerrain; void *ptr_D4;
--- a/ParticleEngine.cpp Fri Mar 08 17:08:08 2013 +0200 +++ b/ParticleEngine.cpp Mon Mar 11 03:37:48 2013 +0200 @@ -695,7 +695,7 @@ } else { - pRenderer->MakeParticleBillboardAndPush_BLV_Software(v13, v12, p->sZValue, p->uLightColor, v11); + pRenderer->MakeParticleBillboardAndPush_BLV_Software(v13, v12, p->sZValue, p->uLightColor, v11); } } }
--- a/TileFrameTable.h Fri Mar 08 17:08:08 2013 +0200 +++ b/TileFrameTable.h Mon Mar 11 03:37:48 2013 +0200 @@ -21,6 +21,20 @@ }; +enum Tileset: unsigned __int16 +{ + Tileset_Grass = 0, + Tileset_Snow = 1, + Tileset_2 = 2, + Tileset_3 = 3, + Tileset_Dirt = 4, + Tileset_Water = 5, + Tileset_6 = 6, + Tileset_Swamp = 7, + Tileset_8 = 8, + Tileset_9 = 9, + Tileset_RoadGrassCobble = 10 +}; /* 48 */ #pragma pack(push, 1) @@ -29,7 +43,7 @@ char pTileName[16]; unsigned __int16 uTileID; unsigned __int16 uBitmapID; - unsigned __int16 uTerrainType; + Tileset tileset; unsigned __int16 uSection; unsigned __int16 uAttributes; }; @@ -48,7 +62,7 @@ ~TileTable(); TileDesc *GetTileById(unsigned int uTileID); - void InitializeTileset(int uTerrainType); + void InitializeTileset(Tileset tileset); int method_487ED6(signed int a1, int a2); unsigned int GetTileId(unsigned int uTerrainType, unsigned int uSection); void ToFile();
--- a/mm7_2.cpp Fri Mar 08 17:08:08 2013 +0200 +++ b/mm7_2.cpp Mon Mar 11 03:37:48 2013 +0200 @@ -3293,6 +3293,7 @@ if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) { pParty->field_75A[v0] = 0; + __debugbreak(); // starting year-related constant here; v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); pParty->field_3C.field_0[2 * v0] = v1; @@ -15921,15 +15922,11 @@ } else { - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) BLV_UpdateUserInputAndOther(); - } - else - { - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) + else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) ODM_UpdateUserInputAndOther(); - } + _438F8F_area_of_effect__damage_evaluate(); } }
--- a/mm7_4.cpp Fri Mar 08 17:08:08 2013 +0200 +++ b/mm7_4.cpp Mon Mar 11 03:37:48 2013 +0200 @@ -1683,14 +1683,12 @@ result = &this->pTiles[uTileID]; return result;*/ - if (uTileID < 0 || uTileID > this->uNumTiles - 1) - return this->pTiles; - else - return &this->pTiles[uTileID]; + assert(uTileID < uNumTiles); + return &pTiles[uTileID]; } //----- (00487E58) -------------------------------------------------------- -void TileTable::InitializeTileset(int uTerrainType) +void TileTable::InitializeTileset(Tileset tileset) { TileTable *v2; // edi@1 int v3; // ebx@1 @@ -1702,7 +1700,7 @@ for ( i = 0; i < (signed int)v2->uNumTiles; ++v3 ) { v4 = &v2->pTiles[v3]; - if ( uTerrainType == v4->uTerrainType && v4->pTileName[0] ) + if (v4->tileset == tileset && v4->pTileName[0] ) { v2->pTiles[v3].uBitmapID = pBitmaps_LOD->LoadTexture(v4->pTileName); if ( v2->pTiles[v3].uBitmapID != -1 ) @@ -1978,7 +1976,7 @@ v8 = atoi(v7); v9 = v84.pProperties[3]; v2->pTiles[v2->uNumTiles].uBitmapID = v8; - v2->pTiles[v2->uNumTiles].uTerrainType = 0; + v2->pTiles[v2->uNumTiles].tileset = Tileset_Grass; if ( _strcmpi(v9, "TTtype_NULL") ) { if ( _strcmpi(v9, "TTtype_Start") ) @@ -2033,145 +2031,145 @@ { if ( !_strcmpi(v9, "TTtype_RoadCityStone") ) { - v34 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v34 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v34 |= 0x1Cu; } } else { - v33 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v33 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v33 |= 0xDu; } } else { - v32 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v32 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v32 |= 0xCu; } } else { - v31 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v31 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v31 |= 0x1Bu; } } else { - v30 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v30 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v30 |= 0x1Au; } } else { - v29 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v29 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v29 |= 0x19u; } } else { - v28 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v28 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v28 |= 0x18u; } } else { - v27 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v27 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v27 |= 0x11u; } } else { - v26 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v26 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v26 |= 0x10u; } } else { - v25 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v25 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v25 |= 0xFu; } } else { - v24 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v24 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v24 |= 0xEu; } } else { - v23 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v23 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v23 |= 0x17u; } } else { - v22 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v22 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v22 |= 0x16u; } } else { - v21 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v21 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v21 |= 0xBu; } } else { - v20 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v20 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v20 |= 0xAu; } } else { - v19 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v19 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v19 |= 9u; } } else { - v18 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v18 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v18 |= 7u; } } else { - v17 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v17 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v17 |= 8u; } } else { - v16 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v16 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v16 |= 5u; } } else { - v15 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v15 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v15 |= 4u; } } else { - v14 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v14 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v14 |= 3u; } } else { - v13 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v13 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v13 |= 2u; } } else { - v12 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v12 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v12 |= 1u; } } else { - v11 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v11 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v11 |= 6u; } } @@ -2184,7 +2182,7 @@ } else { - LOBYTE(v2->pTiles[v2->uNumTiles].uTerrainType) = -1; + LOBYTE(v2->pTiles[v2->uNumTiles].tileset) = -1; } v35 = v84.pProperties[4]; v2->pTiles[v2->uNumTiles].uSection = 0;