From dd64f18a49aff7a17bc9cb6713a7503ece14300d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 16 Feb 2020 02:30:33 +0100 Subject: [PATCH] Merge SetDungeonMicros and SetTownMicros --- Source/diablo.cpp | 3 +-- Source/gendung.cpp | 7 +++++-- Source/town.cpp | 29 ----------------------------- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 1a7528838..a99831ba7 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1603,8 +1603,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir) } } - if (leveltype != DTYPE_TOWN) - SetDungeonMicros(); + SetDungeonMicros(); InitLightMax(); IncProgress(); diff --git a/Source/gendung.cpp b/Source/gendung.cpp index f5e605900..1d28d4e95 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -117,7 +117,10 @@ void SetDungeonMicros() WORD *pPiece; MICROS *pMap; - if (leveltype != DTYPE_HELL) { + if (leveltype == DTYPE_TOWN) { + MicroTileLen = 16; + blocks = 16; + } else if (leveltype != DTYPE_HELL) { MicroTileLen = 10; blocks = 10; } else { @@ -131,7 +134,7 @@ void SetDungeonMicros() pMap = &dpiece_defs_map_2[x][y]; if (lv) { lv--; - if (leveltype != DTYPE_HELL) + if (leveltype != DTYPE_HELL && leveltype != DTYPE_TOWN) pPiece = (WORD *)&pLevelPieces[20 * lv]; else pPiece = (WORD *)&pLevelPieces[32 * lv]; diff --git a/Source/town.cpp b/Source/town.cpp index 8fe574026..00bb59282 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -2,33 +2,6 @@ DEVILUTION_BEGIN_NAMESPACE -void SetTownMicros() -{ - int i, x, y, lv; - WORD *pPiece; - MICROS *pMap; - - MicroTileLen = 16; - - for (y = 0; y < MAXDUNY; y++) { - for (x = 0; x < MAXDUNX; x++) { - lv = dPiece[x][y]; - pMap = &dpiece_defs_map_2[x][y]; - if (lv != 0) { - lv--; - pPiece = (WORD *)&pLevelPieces[32 * lv]; - for (i = 0; i < 16; i++) { - pMap->mt[i] = SDL_SwapLE16(pPiece[(i & 1) + 16 - 2 - (i & 0xE)]); - } - } else { - for (i = 0; i < 16; i++) { - pMap->mt[i] = 0; - } - } - } - } -} - /** * @brief Load level data into dPiece * @param P3Tiles Tile set @@ -244,8 +217,6 @@ void CreateTown(int entry) } } } - - SetTownMicros(); } DEVILUTION_END_NAMESPACE