From cb564a2d544ce5fe25905cc1d706de79397f5ae4 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 4 Jul 2021 05:06:22 +0200 Subject: [PATCH] Clean up A-D --- CMakeLists.txt | 1 - Source/control.cpp | 8 +- Source/dead.cpp | 26 ++-- Source/dead.h | 4 +- Source/doom.cpp | 25 +--- Source/doom.h | 3 - Source/drlg_l1.cpp | 298 +++++++++----------------------------------- Source/drlg_l1.h | 2 - Source/drlg_l2.cpp | 29 +---- Source/drlg_l2.h | 1 - Source/drlg_l3.cpp | 4 +- Source/drlg_l4.cpp | 4 +- Source/loadsave.cpp | 4 +- Source/objects.cpp | 2 - Source/scrollrt.cpp | 6 +- test/doom_test.cpp | 17 --- 16 files changed, 89 insertions(+), 345 deletions(-) delete mode 100644 test/doom_test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d923cadd..9e5d58185 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -520,7 +520,6 @@ if(RUN_TESTS) test/codec_test.cpp test/dead_test.cpp test/diablo_test.cpp - test/doom_test.cpp test/drlg_l1_test.cpp test/drlg_l2_test.cpp test/drlg_l3_test.cpp diff --git a/Source/control.cpp b/Source/control.cpp index 56555ab1b..3543e3fa6 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1736,8 +1736,6 @@ void control_drop_gold(char vkey) input[strlen(input)] = vkey; if (atoi(input) > initialDropGoldValue) return; - if (strlen(input) > strlen(input)) - return; } else { input[0] = vkey; } @@ -1787,12 +1785,12 @@ void DrawTalkPan(const Surface &out) } DrawPanelBox(out, { 170, sgbPlrTalkTbl + 80, 310, 55 }, { PANEL_X + 170, PANEL_Y + 64 }); char *msg = sgszTalkMsg; - int i = 0; + int x = PANEL_LEFT + 200; int y = PANEL_Y + 22; - i = DrawString(out, msg, { { x, y + i }, { 250, 39 } }, UIS_SILVER, 1, 13, true); - msg[i] = '\0'; + int idx = DrawString(out, msg, { { x, y }, { 250, 39 } }, UIS_SILVER, 1, 13, true); + msg[idx] = '\0'; x += 46; int talkBtn = 0; diff --git a/Source/dead.cpp b/Source/dead.cpp index 06f06fb7c..bd53d30dd 100644 --- a/Source/dead.cpp +++ b/Source/dead.cpp @@ -12,7 +12,7 @@ namespace devilution { -DeadStruct dead[MaxDead]; +DeadStruct Dead[MaxDead]; int8_t stonendx; namespace { @@ -36,27 +36,27 @@ void InitDead() if (mtypes[Monsters[i].mtype] != 0) continue; - InitDeadAnimationFromMonster(dead[nd], Monsters[i]); - dead[nd]._deadtrans = 0; + InitDeadAnimationFromMonster(Dead[nd], Monsters[i]); + Dead[nd].translationPaletteIndex = 0; nd++; Monsters[i].mdeadval = nd; mtypes[Monsters[i].mtype] = nd; } - for (auto &dead : dead[nd].data) + for (auto &dead : Dead[nd].data) dead = misfiledata[MFILE_BLODBUR].mAnimData[0]; - dead[nd].frame = 8; - dead[nd].width = 128; - dead[nd]._deadtrans = 0; + Dead[nd].frame = 8; + Dead[nd].width = 128; + Dead[nd].translationPaletteIndex = 0; nd++; - for (auto &dead : dead[nd].data) + for (auto &dead : Dead[nd].data) dead = misfiledata[MFILE_SHATTER1].mAnimData[0]; - dead[nd].frame = 12; - dead[nd].width = 128; - dead[nd]._deadtrans = 0; + Dead[nd].frame = 12; + Dead[nd].width = 128; + Dead[nd].translationPaletteIndex = 0; nd++; stonendx = nd; @@ -64,8 +64,8 @@ void InitDead() for (int i = 0; i < nummonsters; i++) { int mi = monstactive[i]; if (monster[mi]._uniqtype != 0) { - InitDeadAnimationFromMonster(dead[nd], *monster[mi].MType); - dead[nd]._deadtrans = monster[mi]._uniqtrans + 4; + InitDeadAnimationFromMonster(Dead[nd], *monster[mi].MType); + Dead[nd].translationPaletteIndex = monster[mi]._uniqtrans + 4; nd++; monster[mi]._udeadval = nd; diff --git a/Source/dead.h b/Source/dead.h index 8f7b7a946..bd2154912 100644 --- a/Source/dead.h +++ b/Source/dead.h @@ -19,10 +19,10 @@ struct DeadStruct { std::array data; int frame; int width; - uint8_t _deadtrans; + uint8_t translationPaletteIndex; }; -extern DeadStruct dead[MaxDead]; +extern DeadStruct Dead[MaxDead]; extern int8_t stonendx; void InitDead(); diff --git a/Source/doom.cpp b/Source/doom.cpp index c62dfaf81..b5caa41be 100644 --- a/Source/doom.cpp +++ b/Source/doom.cpp @@ -17,33 +17,12 @@ namespace { std::optional DoomCel; } // namespace -int DoomQuestTime; bool DoomFlag; -int DoomQuestState; - -int doom_get_frame_from_time() -{ - if (DoomQuestState == 36001) { - return 31; - } - - return DoomQuestState / 1200; -} - -static bool DoomLoadGraphics() -{ - DoomCel = LoadCel("Items\\Map\\MapZtown.CEL", 640); - return true; -} void doom_init() { - DoomQuestTime = doom_get_frame_from_time() == 31 ? 31 : 0; - if (DoomLoadGraphics()) { - DoomFlag = true; - } else { - doom_close(); - } + DoomCel = LoadCel("Items\\Map\\MapZtown.CEL", 640); + DoomFlag = true; } void doom_close() diff --git a/Source/doom.h b/Source/doom.h index b15cd66c8..5a6b38c2c 100644 --- a/Source/doom.h +++ b/Source/doom.h @@ -10,9 +10,6 @@ namespace devilution { extern bool DoomFlag; -extern int DoomQuestState; - -int doom_get_frame_from_time(); void doom_init(); void doom_close(); void doom_draw(const Surface &out); diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index fda3439db..a0c6f51a0 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -18,8 +18,6 @@ namespace devilution { int UberRow; int UberCol; bool IsUberRoomOpened; -int UberLeverRow; -int UberLeverCol; bool IsUberLeverActivated; int UberDiabloMonsterIndex; @@ -585,6 +583,8 @@ void drlg_l1_crypt_lavafloor() for (int i = 1; i < 40; i++) { switch (dungeon[i][j]) { case 5: + case 116: + case 133: if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; if (dungeon[i - 1][j - 1] == 13) @@ -593,18 +593,40 @@ void drlg_l1_crypt_lavafloor() dungeon[i][j - 1] = 205; break; case 7: + case 15: + case 17: + case 118: + case 126: + case 128: + case 135: + case 152: + case 160: if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 8: + case 11: + case 14: + case 95: + case 119: + case 125: + case 136: + case 142: + case 153: + case 156: + case 159: + case 185: + case 186: if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 9: + case 120: + case 154: if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; if (dungeon[i - 1][j - 1] == 13) @@ -613,127 +635,25 @@ void drlg_l1_crypt_lavafloor() dungeon[i][j - 1] = 205; break; case 10: - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 205; - break; - case 11: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; case 12: + case 121: + case 123: + case 138: + case 155: if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; - case 14: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; - case 15: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - break; - case 17: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - break; - case 95: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; case 96: + case 187: if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 208; break; - case 116: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 205; - break; - case 118: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - break; - case 119: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; - case 120: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 205; - break; - case 121: - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 205; - break; case 122: if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 211; if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 212; break; - case 123: - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 205; - break; - case 125: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; - case 126: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - break; - case 128: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - break; - case 133: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 205; - break; - case 135: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - break; - case 136: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; case 137: if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 213; @@ -742,10 +662,6 @@ void drlg_l1_crypt_lavafloor() if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; - case 138: - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 205; - break; case 139: if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 215; @@ -753,21 +669,11 @@ void drlg_l1_crypt_lavafloor() dungeon[i - 1][j - 1] = 216; break; case 140: + case 157: if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 217; break; - case 142: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; case 143: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 213; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 214; - break; case 145: if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 213; @@ -782,80 +688,8 @@ void drlg_l1_crypt_lavafloor() if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 217; break; - case 152: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - break; - case 153: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; - case 154: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 205; - break; - case 155: - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 205; - break; - case 156: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; - case 157: - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 217; - break; - case 159: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; - case 160: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 206; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 207; - break; case 162: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 209; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 210; - break; case 167: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 209; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 210; - break; - case 187: - if (dungeon[i][j - 1] == 13) - dungeon[i][j - 1] = 208; - break; - case 185: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; - case 186: - if (dungeon[i - 1][j] == 13) - dungeon[i - 1][j] = 203; - if (dungeon[i - 1][j - 1] == 13) - dungeon[i - 1][j - 1] = 204; - break; case 192: if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 209; @@ -1008,7 +842,7 @@ static int DrlgPlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int } if (miniset == PWATERIN) { - int t = TransVal; + int8_t t = TransVal; TransVal = 0; DRLG_MRectTrans(sx, sy + 2, sx + 5, sy + 4); TransVal = t; @@ -1054,18 +888,20 @@ static void DrlgL1Floor() void DRLG_LPass3(int lv) { - MegaTile mega = pMegaTiles[lv]; - int v1 = SDL_SwapLE16(mega.micro1) + 1; - int v2 = SDL_SwapLE16(mega.micro2) + 1; - int v3 = SDL_SwapLE16(mega.micro3) + 1; - int v4 = SDL_SwapLE16(mega.micro4) + 1; - - for (int j = 0; j < MAXDUNY; j += 2) { - for (int i = 0; i < MAXDUNX; i += 2) { - dPiece[i + 0][j + 0] = v1; - dPiece[i + 1][j + 0] = v2; - dPiece[i + 0][j + 1] = v3; - dPiece[i + 1][j + 1] = v4; + { + MegaTile mega = pMegaTiles[lv]; + int v1 = SDL_SwapLE16(mega.micro1) + 1; + int v2 = SDL_SwapLE16(mega.micro2) + 1; + int v3 = SDL_SwapLE16(mega.micro3) + 1; + int v4 = SDL_SwapLE16(mega.micro4) + 1; + + for (int j = 0; j < MAXDUNY; j += 2) { + for (int i = 0; i < MAXDUNX; i += 2) { + dPiece[i + 0][j + 0] = v1; + dPiece[i + 1][j + 0] = v2; + dPiece[i + 0][j + 1] = v3; + dPiece[i + 1][j + 1] = v4; + } } } @@ -1073,10 +909,10 @@ void DRLG_LPass3(int lv) for (int j = 0; j < DMAXY; j++) { int xx = 16; for (int i = 0; i < DMAXX; i++) { // NOLINT(modernize-loop-convert) - v1 = 0; - v2 = 0; - v3 = 0; - v4 = 0; + int v1 = 0; + int v2 = 0; + int v3 = 0; + int v4 = 0; int tileId = dungeon[i][j] - 1; if (tileId >= 0) { @@ -1139,42 +975,22 @@ void DRLG_Init_Globals() static void DrlgInitL1Vals() { - int pc; + int8_t pc; for (int j = 0; j < MAXDUNY; j++) { for (int i = 0; i < MAXDUNX; i++) { - if (dPiece[i][j] == 12) { + if (IsAnyOf(dPiece[i][j], 12, 71, 321, 211, 341, 418)) { pc = 1; - } else if (dPiece[i][j] == 11) { + } else if (IsAnyOf(dPiece[i][j], 11, 249, 325, 344, 331, 421)) { pc = 2; - } else if (dPiece[i][j] == 71) { - pc = 1; } else if (dPiece[i][j] == 253) { pc = 3; - } else if (dPiece[i][j] == 267) { - pc = 6; - } else if (dPiece[i][j] == 259) { - pc = 5; - } else if (dPiece[i][j] == 249) { - pc = 2; - } else if (dPiece[i][j] == 325) { - pc = 2; - } else if (dPiece[i][j] == 321) { - pc = 1; } else if (dPiece[i][j] == 255) { pc = 4; - } else if (dPiece[i][j] == 211) { - pc = 1; - } else if (dPiece[i][j] == 344) { - pc = 2; - } else if (dPiece[i][j] == 341) { - pc = 1; - } else if (dPiece[i][j] == 331) { - pc = 2; - } else if (dPiece[i][j] == 418) { - pc = 1; - } else if (dPiece[i][j] == 421) { - pc = 2; + } else if (dPiece[i][j] == 259) { + pc = 5; + } else if (dPiece[i][j] == 267) { + pc = 6; } else { continue; } @@ -2677,8 +2493,6 @@ void CreateL5Dungeon(uint32_t rseed, lvl_entry entry) UberRow = 0; UberCol = 0; IsUberRoomOpened = false; - UberLeverRow = 0; - UberLeverCol = 0; IsUberLeverActivated = false; UberDiabloMonsterIndex = 0; diff --git a/Source/drlg_l1.h b/Source/drlg_l1.h index 72a43b91b..372569475 100644 --- a/Source/drlg_l1.h +++ b/Source/drlg_l1.h @@ -14,8 +14,6 @@ namespace devilution { extern int UberRow; extern int UberCol; extern bool IsUberRoomOpened; -extern int UberLeverRow; -extern int UberLeverCol; extern bool IsUberLeverActivated; extern int UberDiabloMonsterIndex; diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 12ce8867f..113074629 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -2026,7 +2026,6 @@ static void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir } int nRid = nRoomCnt; - RoomList[nRid].nRoomDest = nRDest; if (nRDest != 0) { int nHx1 = 0; @@ -3131,19 +3130,13 @@ static void DrlgL2(lvl_entry entry) static void DrlgInitL2Vals() { - int pc; + int8_t pc; for (int j = 0; j < MAXDUNY; j++) { for (int i = 0; i < MAXDUNX; i++) { - if (dPiece[i][j] == 541) { + if (IsAnyOf(dPiece[i][j], 541, 178, 551)) { pc = 5; - } else if (dPiece[i][j] == 178) { - pc = 5; - } else if (dPiece[i][j] == 551) { - pc = 5; - } else if (dPiece[i][j] == 542) { - pc = 6; - } else if (dPiece[i][j] == 553) { + } else if (IsAnyOf(dPiece[i][j], 542, 553)) { pc = 6; } else { continue; @@ -3214,20 +3207,10 @@ void LoadL2Dungeon(const char *path, int vx, int vy) for (int j = 0; j < MAXDUNY; j++) { for (int i = 0; i < MAXDUNX; i++) { - int pc = 0; - if (dPiece[i][j] == 541) { - pc = 5; - } - if (dPiece[i][j] == 178) { + int8_t pc = 0; + if (IsAnyOf(dPiece[i][j], 541, 178, 551)) { pc = 5; - } - if (dPiece[i][j] == 551) { - pc = 5; - } - if (dPiece[i][j] == 542) { - pc = 6; - } - if (dPiece[i][j] == 553) { + } else if (IsAnyOf(dPiece[i][j], 542, 553)) { pc = 6; } dSpecial[i][j] = pc; diff --git a/Source/drlg_l2.h b/Source/drlg_l2.h index d77b33e10..7ee862874 100644 --- a/Source/drlg_l2.h +++ b/Source/drlg_l2.h @@ -22,7 +22,6 @@ struct ROOMNODE { int nRoomy1; int nRoomx2; int nRoomy2; - int nRoomDest; }; extern BYTE predungeon[DMAXX][DMAXY]; diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 360ce8f73..297baedcb 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -2565,9 +2565,7 @@ void LoadL3Dungeon(const char *path, int vx, int vy) DoLighting({ i, j }, 7, -1); } else if (dPiece[i][j] >= 154 && dPiece[i][j] <= 161) { DoLighting({ i, j }, 7, -1); - } else if (dPiece[i][j] == 150) { - DoLighting({ i, j }, 7, -1); - } else if (dPiece[i][j] == 152) { + } else if (IsAnyOf(dPiece[i][j], 150, 152)) { DoLighting({ i, j }, 7, -1); } } diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 78a8744f8..ff1d1fd33 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1328,9 +1328,7 @@ static void DrlgL4Corners() for (int j = 1; j < DMAXY - 1; j++) { for (int i = 1; i < DMAXX - 1; i++) { if (dungeon[i][j] >= 18 && dungeon[i][j] <= 30) { - if (dungeon[i + 1][j] < 18) { - dungeon[i][j] += 98; - } else if (dungeon[i][j + 1] < 18) { + if (dungeon[i + 1][j] < 18 || dungeon[i][j + 1] < 18) { dungeon[i][j] += 98; } } diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 2d25f7d52..0d0dae6b3 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -773,7 +773,7 @@ static void LoadQuest(LoadHelper *file, int i) ReturnLvlY = file->NextBE(); ReturnLvl = file->NextBE(); ReturnLvlT = static_cast(file->NextBE()); - DoomQuestState = file->NextBE(); + file->Skip(sizeof(int32_t)); // Skip DoomQuestState } static void LoadLighting(LoadHelper *file, LightListStruct *pLight) @@ -1813,7 +1813,7 @@ static void SaveQuest(SaveHelper *file, int i) file->WriteBE(ReturnLvlY); file->WriteBE(ReturnLvl); file->WriteBE(ReturnLvlT); - file->WriteBE(DoomQuestState); + file->Skip(sizeof(int32_t)); // Skip DoomQuestState } static void SaveLighting(SaveHelper *file, LightListStruct *pLight) diff --git a/Source/objects.cpp b/Source/objects.cpp index 10d081d8c..da38db53e 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -5458,8 +5458,6 @@ void AddNakrulLeaver() break; } } - UberLeverRow = UberRow + 3; - UberLeverCol = UberCol - 1; AddObject(OBJ_LEVER, UberRow + 3, UberCol - 1); } diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 6031c3991..198fc2026 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -778,7 +778,7 @@ static void DrawDungeon(const Surface &out, int sx, int sy, int dx, int dy) if (light_table_index < lightmax && bDead != 0) { do { - DeadStruct *pDeadGuy = &dead[(bDead & 0x1F) - 1]; + DeadStruct *pDeadGuy = &Dead[(bDead & 0x1F) - 1]; auto dd = static_cast((bDead >> 5) & 7); int px = dx - CalculateWidth2(pDeadGuy->width); const byte *pCelBuff = pDeadGuy->data[dd]; @@ -790,8 +790,8 @@ static void DrawDungeon(const Surface &out, int sx, int sy, int dx, int dy) Log("Unclipped dead: frame {} of {}, deadnum=={}", nCel, frames, (bDead & 0x1F) - 1); break; } - if (pDeadGuy->_deadtrans != 0) { - Cl2DrawLightTbl(out, px, dy, CelSprite(pCelBuff, pDeadGuy->width), nCel, pDeadGuy->_deadtrans); + if (pDeadGuy->translationPaletteIndex != 0) { + Cl2DrawLightTbl(out, px, dy, CelSprite(pCelBuff, pDeadGuy->width), nCel, pDeadGuy->translationPaletteIndex); } else { Cl2DrawLight(out, px, dy, CelSprite(pCelBuff, pDeadGuy->width), nCel); } diff --git a/test/doom_test.cpp b/test/doom_test.cpp deleted file mode 100644 index c20a20ffa..000000000 --- a/test/doom_test.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#include "doom.h" - -using namespace devilution; - -TEST(Doom, doom_get_frame_from_time) -{ - DoomQuestState = 1200 * 8 + 548; - EXPECT_EQ(doom_get_frame_from_time(), 8); -} - -TEST(Doom, doom_get_frame_from_time_max) -{ - DoomQuestState = 1200 * 30 + 1; - EXPECT_EQ(doom_get_frame_from_time(), 31); -}