From 1c2a9d2e122304b1f6b8ca78b96e34b2a2ed53c8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 3 Nov 2017 09:14:58 +0200 Subject: DRASCULA: characterMoved and characterVisible are boolean variables --- engines/drascula/actors.cpp | 28 ++++++++++++++-------------- engines/drascula/animation.cpp | 22 +++++++++++----------- engines/drascula/drascula.cpp | 14 +++++++------- engines/drascula/drascula.h | 4 ++-- engines/drascula/objects.cpp | 4 ++-- engines/drascula/rooms.cpp | 20 ++++++++++---------- engines/drascula/saveload.cpp | 2 +- 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/engines/drascula/actors.cpp b/engines/drascula/actors.cpp index 3b1ac7cb60..8ab3839ebb 100644 --- a/engines/drascula/actors.cpp +++ b/engines/drascula/actors.cpp @@ -105,7 +105,7 @@ void DrasculaEngine::hiccup(int counter) { } void DrasculaEngine::startWalking() { - characterMoved = 1; + _characterMoved = true; stepX = STEP_X; stepY = STEP_Y; @@ -124,7 +124,7 @@ void DrasculaEngine::startWalking() { else if (roomY > curY + curHeight) walkDown(); else - characterMoved = 0; + _characterMoved = false; } else { if ((roomX < curX + curWidth / 2 ) && (roomY <= (curY + curHeight))) quadrant_1(); @@ -135,7 +135,7 @@ void DrasculaEngine::startWalking() { else if ((roomX > curX + curWidth / 2) && (roomY > (curY + curHeight))) quadrant_4(); else - characterMoved = 0; + _characterMoved = false; } _startTime = getTime(); } @@ -144,16 +144,16 @@ void DrasculaEngine::moveCharacters() { int curPos[6]; int r; - if (characterMoved == 1 && stepX == STEP_X) { + if (_characterMoved && stepX == STEP_X) { for (r = 0; r < stepX; r++) { if (currentChapter != 2) { if (trackProtagonist == 0 && roomX - r == curX + curWidth / 2) { - characterMoved = 0; + _characterMoved = false; stepX = STEP_X; stepY = STEP_Y; } if (trackProtagonist == 1 && roomX + r == curX + curWidth / 2) { - characterMoved = 0; + _characterMoved = false; stepX = STEP_X; stepY = STEP_Y; curX = roomX - curWidth / 2; @@ -161,12 +161,12 @@ void DrasculaEngine::moveCharacters() { } } else if (currentChapter == 2) { if (trackProtagonist == 0 && roomX - r == curX) { - characterMoved = 0; + _characterMoved = false; stepX = STEP_X; stepY = STEP_Y; } if (trackProtagonist == 1 && roomX + r == curX + curWidth) { - characterMoved = 0; + _characterMoved = false; stepX = STEP_X; stepY = STEP_Y; curX = roomX - curWidth + 4; @@ -175,15 +175,15 @@ void DrasculaEngine::moveCharacters() { } } } - if (characterMoved == 1 && stepY == STEP_Y) { + if (_characterMoved && stepY == STEP_Y) { for (r = 0; r < stepY; r++) { if (trackProtagonist == 2 && roomY - r == curY + curHeight) { - characterMoved = 0; + _characterMoved = false; stepX = STEP_X; stepY = STEP_Y; } if (trackProtagonist == 3 && roomY + r == curY + curHeight) { - characterMoved = 0; + _characterMoved = false; stepX = STEP_X; stepY = STEP_Y; } @@ -191,13 +191,13 @@ void DrasculaEngine::moveCharacters() { } if (currentChapter != 2 && currentChapter != 3) { - if (characterVisible == 0) { + if (!_characterVisible) { increaseFrameNum(); return; } } - if (characterMoved == 0) { + if (!_characterMoved) { curPos[0] = 0; curPos[1] = DIF_MASK_HARE; curPos[2] = curX; @@ -240,7 +240,7 @@ void DrasculaEngine::moveCharacters() { reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], factor_red[curY + curHeight], frontSurface, screenSurface); } - } else if (characterMoved == 1) { + } else if (_characterMoved) { curPos[0] = _frameX[_characterFrame]; curPos[1] = frame_y + DIF_MASK_HARE; curPos[2] = curX; diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index 792b2720a9..b8bbd566b3 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -363,7 +363,7 @@ void DrasculaEngine::animation_2_1() { int l; gotoObject(231, 91); - characterVisible = 0; + _characterVisible = false; term_int = 0; @@ -436,7 +436,7 @@ void DrasculaEngine::animation_2_1() { curX = 91; curY = 95; trackProtagonist = 1; - characterVisible = 1; + _characterVisible = true; loadPic("97g.alg", extraSurface); if (animate("lev.bin", 15)) @@ -1143,7 +1143,7 @@ void DrasculaEngine::animation_6_3() { int yoda_x[] = { 3 ,82, 161, 240, 3, 82 }; int yoda_y[] = { 3, 3, 3, 3, 94, 94 }; - characterMoved = 0; + _characterMoved = false; flags[3] = 1; updateRoom(); updateScreen(); @@ -1239,7 +1239,7 @@ void DrasculaEngine::animation_1_5() { talk_bj(21); while (!shouldQuit()) { - if (characterMoved == 0) + if (!_characterMoved) break; updateRoom(); updateScreen(); @@ -1437,10 +1437,10 @@ void DrasculaEngine::animation_12_5() { doBreak = 1; previousMusic = roomMusic; - characterVisible = 1; + _characterVisible = true; clearRoom(); trackProtagonist = 1; - characterMoved = 0; + _characterMoved = false; curX = -1; objExit = 104; selectVerb(kVerbNone); @@ -1547,7 +1547,7 @@ void DrasculaEngine::animation_1_6() { updateEvents(); clearRoom(); black(); - characterVisible = 0; + _characterVisible = false; flags[0] = 0; updateRoom(); updateScreen(); @@ -1622,7 +1622,7 @@ void DrasculaEngine::animation_6_6() { curX = -1; selectVerb(kVerbNone); enterRoom(58); - characterVisible = 1; + _characterVisible = true; trackProtagonist = 1; animate("hbp.bin", 14); @@ -2144,7 +2144,7 @@ void DrasculaEngine::animation_5_4(){ loadPic("anh_dr.alg", backSurface); gotoObject(99, 160); gotoObject(38, 177); - characterVisible = 0; + _characterVisible = false; updateRoom(); updateScreen(); delay(800); @@ -2162,7 +2162,7 @@ void DrasculaEngine::animation_5_4(){ talk_igor(30, kIgorFront); loadPic(96, frontSurface); loadPic(99, backSurface); - characterVisible = 1; + _characterVisible = true; fadeToBlack(0); exitRoom(0); } @@ -2217,7 +2217,7 @@ void DrasculaEngine::activatePendulum() { debug(4, "activatePendulum()"); flags[1] = 2; - characterVisible = 0; + _characterVisible = false; _roomNumber = 102; loadPic(102, bgSurface, HALF_PAL); loadPic("an_p1.alg", drawSurface3); diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index d0d2790c0e..0f031b10f5 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -136,11 +136,11 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam frame_y = 0; curX = 0; curY = 0; - characterMoved = 0; + _characterMoved = false; curDirection = 0; trackProtagonist = 0; _characterFrame = 0; - characterVisible = 0; + _characterVisible = false; roomX = 0; roomY = 0; checkFlags = 0; @@ -292,10 +292,10 @@ Common::Error DrasculaEngine::run() { _hasName = false; frame_y = 0; curX = -1; - characterMoved = 0; + _characterMoved = false; trackProtagonist = 3; _characterFrame = 0; - characterVisible = 1; + _characterVisible = true; checkFlags = 1; doBreak = 0; walkToObject = 0; @@ -537,11 +537,11 @@ bool DrasculaEngine::runCurrentChapter() { showCursor(); while (!shouldQuit()) { - if (characterMoved == 0) { + if (!_characterMoved) { stepX = STEP_X; stepY = STEP_Y; } - if (characterMoved == 0 && walkToObject == 1) { + if (!_characterMoved && walkToObject == 1) { trackProtagonist = trackFinal; walkToObject = 0; } @@ -629,7 +629,7 @@ bool DrasculaEngine::runCurrentChapter() { !(currentChapter == 5 && pickedObject == 16)) { #endif _rightMouseButton = 0; - characterMoved = 0; + _characterMoved = false; if (trackProtagonist == 2) trackProtagonist = 1; if (currentChapter == 4) { diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 2f8fc86209..a74328c874 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -435,8 +435,8 @@ public: int flags[NUM_FLAGS]; int frame_y; - int curX, curY, characterMoved, curDirection, trackProtagonist, _characterFrame; - int characterVisible; + int curX, curY, curDirection, trackProtagonist, _characterFrame; + bool _characterMoved, _characterVisible; int roomX, roomY, checkFlags; int doBreak; int stepX, stepY; diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp index 02846abcc9..4087eee11b 100644 --- a/engines/drascula/objects.cpp +++ b/engines/drascula/objects.cpp @@ -62,7 +62,7 @@ void DrasculaEngine::gotoObject(int pointX, int pointY) { hideCursor(); if (currentChapter == 5 || currentChapter == 6) { - if (characterVisible == 0) { + if (!_characterVisible) { curX = roomX; curY = roomY; updateRoom(); @@ -78,7 +78,7 @@ void DrasculaEngine::gotoObject(int pointX, int pointY) { updateRoom(); updateScreen(); updateEvents(); - if (characterMoved == 0) + if (!_characterMoved) break; pause(3); diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index 57d4517295..df41feab29 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -980,12 +980,12 @@ bool DrasculaEngine::room_59(int fl) { playSound(12); pause(19); stopSound(); - characterVisible = 0; + _characterVisible = false; updateRoom(); copyRect(101, 34, curX - 4, curY - 1, 37, 70, drawSurface3, screenSurface); copyBackground(0, 0, 0, 0, 320, 200, screenSurface, bgSurface); updateScreen(); - characterVisible = 1; + _characterVisible = true; clearRoom(); loadPic("tlef0.alg", bgSurface, COMPLETE_PAL); loadPic("tlef1.alg", drawSurface3); @@ -1399,7 +1399,7 @@ void DrasculaEngine::update_58_pre() { } void DrasculaEngine::update_58() { - if (characterVisible == 1) + if (_characterVisible) copyRect(67, 139, 140, 147, 12, 16, drawSurface3, screenSurface); } @@ -1524,7 +1524,7 @@ void DrasculaEngine::update_102() { bool DrasculaEngine::checkAction(int fl) { hideCursor(); - characterMoved = 0; + _characterMoved = false; updateRoom(); updateScreen(); @@ -1774,7 +1774,7 @@ void DrasculaEngine::enterRoom(int roomIndex) { curX = _destX[objIsExit]; curY = _destY[objIsExit] - curHeight; } - characterMoved = 0; + _characterMoved = false; } loadPic(roomDisk, drawSurface3); @@ -1833,7 +1833,7 @@ void DrasculaEngine::enterRoom(int roomIndex) { curHeight = (CHARACTER_HEIGHT * factor_red[curY]) / 100; curWidth = (CHARACTER_WIDTH * factor_red[curY]) / 100; } - characterMoved = 0; + _characterMoved = false; } if (currentChapter == 2) { @@ -1845,7 +1845,7 @@ void DrasculaEngine::enterRoom(int roomIndex) { } if (currentChapter == 5) - characterVisible = 1; + _characterVisible = true; updateVisible(); @@ -1885,7 +1885,7 @@ void DrasculaEngine::enterRoom(int roomIndex) { if (currentChapter == 5) { if (_roomNumber == 45) - characterVisible = 0; + _characterVisible = false; if (_roomNumber == 49 && flags[7] == 0) { playTalkSequence(4); // sequence 4, chapter 5 } @@ -1925,7 +1925,7 @@ bool DrasculaEngine::exitRoom(int doorNumber) { updateRoom(); updateScreen(); } - characterMoved = 0; + _characterMoved = false; trackProtagonist = trackCharacter_alkeva[doorNumber]; objExit = roomExits[doorNumber]; doBreak = 1; @@ -1961,7 +1961,7 @@ bool DrasculaEngine::exitRoom(int doorNumber) { } if (currentChapter == 5) - characterVisible = 1; + _characterVisible = true; clearRoom(); if (!sscanf(_targetSurface[doorNumber], "%d", &roomNum)) { diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp index f0484e29b4..01c7ab7ee7 100644 --- a/engines/drascula/saveload.cpp +++ b/engines/drascula/saveload.cpp @@ -281,7 +281,7 @@ bool DrasculaEngine::loadGame(int slot) { // things. Reset those before loading the savegame otherwise we may have some // issues such as the protagonist being invisible after reloading a savegame. if (_roomNumber == 102 && flags[1] == 2) { - characterVisible = 1; + _characterVisible = true; loadPic(96, frontSurface); loadPic(97, frontSurface); loadPic(97, extraSurface); -- cgit v1.2.3