From 1f1d860797029dbe58ea4cc282ff3489768965d5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 3 Nov 2017 09:59:49 +0200 Subject: DRASCULA: Merge the floor coordinates into _walkRect --- engines/drascula/drascula.cpp | 8 ++------ engines/drascula/drascula.h | 2 +- engines/drascula/rooms.cpp | 21 +++++++++++---------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index bb126e5307..3f840b0901 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -94,10 +94,6 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam _talkSequencesSize = 0; _numLangs = 0; feetHeight = 0; - floorX1 = 0; - floorY1 = 0; - floorX2 = 0; - floorY2 = 0; lowerLimit = 0; upperLimit = 0; trackFinal = 0; @@ -768,8 +764,8 @@ bool DrasculaEngine::verify1() { } if (doBreak == 0) { - roomX = CLIP(_mouseX, floorX1, floorX2); - roomY = CLIP(_mouseY, floorY1 + feetHeight, floorY2); + roomX = CLIP(_mouseX, _walkRect.left, _walkRect.right); + roomY = CLIP(_mouseY, _walkRect.top + feetHeight, _walkRect.bottom); startWalking(); } doBreak = 0; diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 090ab65524..fa96fb5e5a 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -443,7 +443,7 @@ public: int doBreak; int stepX, stepY; int curHeight, curWidth, feetHeight; - int floorX1, floorY1, floorX2, floorY2; + Common::Rect _walkRect; int lowerLimit, upperLimit; int trackFinal; bool _walkToObject; diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index c6632f52d6..b8dc51e6b5 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -1732,10 +1732,11 @@ void DrasculaEngine::enterRoom(int roomIndex) { } } - p.parseInt(floorX1); - p.parseInt(floorY1); - p.parseInt(floorX2); - p.parseInt(floorY2); + p.parseInt(x1); + p.parseInt(y1); + p.parseInt(x2); + p.parseInt(y2); + _walkRect = Common::Rect(x1, y1, x2, y2); if (currentChapter != 2) { p.parseInt(upperLimit); @@ -1797,27 +1798,27 @@ void DrasculaEngine::enterRoom(int roomIndex) { color_abc(kColorLightGreen); if (currentChapter != 2) { - for (l = 0; l <= floorY1; l++) + for (l = 0; l <= _walkRect.top; l++) factor_red[l] = upperLimit; - for (l = floorY1; l <= 201; l++) + for (l = _walkRect.top; l <= 201; l++) factor_red[l] = lowerLimit; - chiquez = (float)(lowerLimit - upperLimit) / (float)(floorY2 - floorY1); - for (l = floorY1; l <= floorY2; l++) { + chiquez = (float)(lowerLimit - upperLimit) / (float)(_walkRect.bottom - _walkRect.top); + for (l = _walkRect.top; l <= _walkRect.bottom; l++) { factor_red[l] = (int)(upperLimit + pequegnez); pequegnez = pequegnez + chiquez; } } if (_roomNumber == 24) { - for (l = floorY1 - 1; l > 74; l--) { + for (l = _walkRect.top - 1; l > 74; l--) { factor_red[l] = (int)(upperLimit - pequegnez); pequegnez = pequegnez + chiquez; } } if (currentChapter == 5 && _roomNumber == 54) { - for (l = floorY1 - 1; l > 84; l--) { + for (l = _walkRect.top - 1; l > 84; l--) { factor_red[l] = (int)(upperLimit - pequegnez); pequegnez = pequegnez + chiquez; } -- cgit v1.2.3