diff options
author | Filippos Karapetis | 2013-08-19 03:08:11 +0300 |
---|---|---|
committer | Filippos Karapetis | 2013-08-19 03:08:58 +0300 |
commit | d531484350291f037c896c05fdaf691231ef3c04 (patch) | |
tree | be07e362767f156842dac5353522dd7b4b16c555 /engines/drascula/drascula.cpp | |
parent | d17dcc1cbed57b0c6861b5b0c91106aa26aa6b83 (diff) | |
download | scummvm-rg350-d531484350291f037c896c05fdaf691231ef3c04.tar.gz scummvm-rg350-d531484350291f037c896c05fdaf691231ef3c04.tar.bz2 scummvm-rg350-d531484350291f037c896c05fdaf691231ef3c04.zip |
DRASCULA: Some renaming. Also, get rid of some extraneous globals
This removes the superfluous talkHeight, talkWidth and timeDiff
variables. It also changes _loadedDifferentChapter to be a boolean
Diffstat (limited to 'engines/drascula/drascula.cpp')
-rw-r--r-- | engines/drascula/drascula.cpp | 93 |
1 files changed, 45 insertions, 48 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 804881cf9a..cde00baa32 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -91,10 +91,10 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam _color = 0; blinking = 0; - mouseX = 0; - mouseY = 0; - leftMouseButton = 0; - rightMouseButton = 0; + _mouseX = 0; + _mouseY = 0; + _leftMouseButton = 0; + _rightMouseButton = 0; *textName = 0; _rnd = new Common::RandomSource("drascula"); @@ -197,7 +197,7 @@ Common::Error DrasculaEngine::run() { syncSoundSettings(); currentChapter = 1; // values from 1 to 6 will start each part of game - loadedDifferentChapter = 0; + _loadedDifferentChapter = false; setTotalPlayTime(0); // Check if a save is loaded from the launcher @@ -218,7 +218,7 @@ Common::Error DrasculaEngine::run() { curX = -1; characterMoved = 0; trackProtagonist = 3; - num_frame = 0; + _characterFrame = 0; hare_se_ve = 1; checkFlags = 1; doBreak = 0; @@ -231,9 +231,6 @@ Common::Error DrasculaEngine::run() { curWidth = CHARACTER_WIDTH; feetHeight = FEET_HEIGHT; - talkHeight = TALK_HEIGHT; - talkWidth = TALK_WIDTH; - hasAnswer = 0; savedTime = 0; breakOut = 0; @@ -246,7 +243,7 @@ Common::Error DrasculaEngine::run() { globalSpeed = 0; curExcuseLook = 0; curExcuseAction = 0; - roomNumber = 0; + _roomNumber = 0; for (i = 0; i < 8; i++) actorFrames[i] = 0; @@ -268,7 +265,7 @@ Common::Error DrasculaEngine::run() { loadPic("aux13.alg", bgSurface, COMPLETE_PAL); loadPic(96, frontSurface); } else if (currentChapter == 4) { - if (loadedDifferentChapter == 0) + if (!_loadedDifferentChapter) animation_castle(); loadPic(96, frontSurface); clearRoom(); @@ -330,7 +327,7 @@ void DrasculaEngine::endChapter() { bool DrasculaEngine::runCurrentChapter() { int n; - rightMouseButton = 0; + _rightMouseButton = 0; previousMusic = -1; @@ -360,14 +357,14 @@ bool DrasculaEngine::runCurrentChapter() { if (currentChapter == 1) { pickObject(28); - if (loadedDifferentChapter == 0) + if (!_loadedDifferentChapter) animation_1_1(); selectVerb(kVerbNone); loadPic("2aux62.alg", drawSurface2); trackProtagonist = 1; objExit = 104; - if (loadedDifferentChapter != 0) { + if (_loadedDifferentChapter) { if (!loadGame(_currentSaveSlot)) { return true; } @@ -383,7 +380,7 @@ bool DrasculaEngine::runCurrentChapter() { addObject(kItemPhone); trackProtagonist = 3; objExit = 162; - if (loadedDifferentChapter == 0) + if (!_loadedDifferentChapter) enterRoom(14); else { if (!loadGame(_currentSaveSlot)) { @@ -401,7 +398,7 @@ bool DrasculaEngine::runCurrentChapter() { flags[1] = 1; trackProtagonist = 1; objExit = 99; - if (loadedDifferentChapter == 0) + if (!_loadedDifferentChapter) enterRoom(20); else { if (!loadGame(_currentSaveSlot)) { @@ -415,7 +412,7 @@ bool DrasculaEngine::runCurrentChapter() { addObject(kItemReefer2); addObject(kItemOneCoin2); objExit = 100; - if (loadedDifferentChapter == 0) { + if (!_loadedDifferentChapter) { enterRoom(21); trackProtagonist = 0; curX = 235; @@ -437,7 +434,7 @@ bool DrasculaEngine::runCurrentChapter() { addObject(20); trackProtagonist = 1; objExit = 100; - if (loadedDifferentChapter == 0) { + if (!_loadedDifferentChapter) { enterRoom(45); } else { if (!loadGame(_currentSaveSlot)) { @@ -450,7 +447,7 @@ bool DrasculaEngine::runCurrentChapter() { trackProtagonist = 1; objExit = 104; - if (loadedDifferentChapter == 0) { + if (!_loadedDifferentChapter) { enterRoom(58); animation_1_6(); } else { @@ -480,13 +477,13 @@ bool DrasculaEngine::runCurrentChapter() { // lead to an incorrect setting of the protagonist's tracking flag (above). This // made the character start walking off screen, as his actual position was // different than the displayed one - if (roomNumber == 3 && (curX == 279) && (curY + curHeight == 101)) { + if (_roomNumber == 3 && (curX == 279) && (curY + curHeight == 101)) { gotoObject(178, 121); gotoObject(169, 135); - } else if (roomNumber == 14 && (curX == 214) && (curY + curHeight == 121)) { + } else if (_roomNumber == 14 && (curX == 214) && (curY + curHeight == 121)) { walkToObject = 1; gotoObject(190, 130); - } else if (roomNumber == 14 && (curX == 246) && (curY + curHeight == 112)) { + } else if (_roomNumber == 14 && (curX == 246) && (curY + curHeight == 112)) { walkToObject = 1; gotoObject(190, 130); } @@ -518,12 +515,12 @@ bool DrasculaEngine::runCurrentChapter() { checkObjects(); #ifdef _WIN32_WCE - if (rightMouseButton) { + if (_rightMouseButton) { if (_menuScreen) { #else - if (rightMouseButton == 1 && _menuScreen) { + if (_rightMouseButton == 1 && _menuScreen) { #endif - rightMouseButton = 0; + _rightMouseButton = 0; delay(100); if (currentChapter == 2) { loadPic(menuBackground, cursorSurface); @@ -549,10 +546,10 @@ bool DrasculaEngine::runCurrentChapter() { // Do not show the inventory screen in chapter 5, if the right mouse button is clicked // while the plug (object 16) is held // Fixes bug #2059621 - "DRASCULA: Plug bug" - if (rightMouseButton == 1 && !_menuScreen && + if (_rightMouseButton == 1 && !_menuScreen && !(currentChapter == 5 && pickedObject == 16)) { #endif - rightMouseButton = 0; + _rightMouseButton = 0; delay(100); characterMoved = 0; if (trackProtagonist == 2) @@ -580,19 +577,19 @@ bool DrasculaEngine::runCurrentChapter() { } #endif - if (leftMouseButton == 1 && _menuBar) { + if (_leftMouseButton == 1 && _menuBar) { delay(100); selectVerbFromBar(); - } else if (leftMouseButton == 1 && takeObject == 0) { + } else if (_leftMouseButton == 1 && takeObject == 0) { delay(100); if (verify1()) return true; - } else if (leftMouseButton == 1 && takeObject == 1) { + } else if (_leftMouseButton == 1 && takeObject == 1) { if (verify2()) return true; } - _menuBar = (mouseY < 24 && !_menuScreen) ? true : false; + _menuBar = (_mouseY < 24 && !_menuScreen) ? true : false; Common::KeyCode key = getScan(); if (key == Common::KEYCODE_F1 && !_menuScreen) { @@ -644,11 +641,11 @@ bool DrasculaEngine::runCurrentChapter() { } else if (key == Common::KEYCODE_TILDE || key == Common::KEYCODE_BACKQUOTE) { _console->attach(); _console->onFrame(); - } else if (currentChapter == 6 && key == Common::KEYCODE_0 && roomNumber == 61) { + } else if (currentChapter == 6 && key == Common::KEYCODE_0 && _roomNumber == 61) { loadPic("alcbar.alg", bgSurface, 255); } - if (leftMouseButton != 0 || rightMouseButton != 0 || key != 0) + if (_leftMouseButton != 0 || _rightMouseButton != 0 || key != 0) framesWithoutAction = 0; if (framesWithoutAction == 15000) { @@ -670,8 +667,8 @@ bool DrasculaEngine::verify1() { removeObject(); else { for (l = 0; l < numRoomObjs; l++) { - if (mouseX >= _objectX1[l] && mouseY >= _objectY1[l] - && mouseX <= _objectX2[l] && mouseY <= _objectY2[l] && doBreak == 0) { + if (_mouseX >= _objectX1[l] && _mouseY >= _objectY1[l] + && _mouseX <= _objectX2[l] && _mouseY <= _objectY2[l] && doBreak == 0) { if (exitRoom(l)) return true; if (doBreak == 1) @@ -679,13 +676,13 @@ bool DrasculaEngine::verify1() { } } - if (mouseX > curX && mouseY > curY - && mouseX < curX + curWidth && mouseY < curY + curHeight) + if (_mouseX > curX && _mouseY > curY + && _mouseX < curX + curWidth && _mouseY < curY + curHeight) doBreak = 1; for (l = 0; l < numRoomObjs; l++) { - if (mouseX > _objectX1[l] && mouseY > _objectY1[l] - && mouseX < _objectX2[l] && mouseY < _objectY2[l] && doBreak == 0) { + if (_mouseX > _objectX1[l] && _mouseY > _objectY1[l] + && _mouseX < _objectX2[l] && _mouseY < _objectY2[l] && doBreak == 0) { roomX = roomObjX[l]; roomY = roomObjY[l]; trackFinal = trackObj[l]; @@ -696,8 +693,8 @@ bool DrasculaEngine::verify1() { } if (doBreak == 0) { - roomX = CLIP(mouseX, floorX1, floorX2); - roomY = CLIP(mouseY, floorY1 + feetHeight, floorY2); + roomX = CLIP(_mouseX, floorX1, floorX2); + roomY = CLIP(_mouseY, floorY1 + feetHeight, floorY2); startWalking(); } doBreak = 0; @@ -718,8 +715,8 @@ bool DrasculaEngine::verify2() { return true; } else { for (l = 0; l < numRoomObjs; l++) { - if (mouseX > _objectX1[l] && mouseY > _objectY1[l] - && mouseX < _objectX2[l] && mouseY < _objectY2[l] && visible[l] == 1) { + if (_mouseX > _objectX1[l] && _mouseY > _objectY1[l] + && _mouseX < _objectX2[l] && _mouseY < _objectY2[l] && visible[l] == 1) { trackFinal = trackObj[l]; walkToObject = 1; gotoObject(roomObjX[l], roomObjY[l]); @@ -779,20 +776,20 @@ void DrasculaEngine::updateEvents() { case Common::EVENT_KEYUP: break; case Common::EVENT_MOUSEMOVE: - mouseX = event.mouse.x; - mouseY = event.mouse.y; + _mouseX = event.mouse.x; + _mouseY = event.mouse.y; break; case Common::EVENT_LBUTTONDOWN: - leftMouseButton = 1; + _leftMouseButton = 1; break; case Common::EVENT_LBUTTONUP: - leftMouseButton = 0; + _leftMouseButton = 0; break; case Common::EVENT_RBUTTONDOWN: // We changed semantic and react only on button up event break; case Common::EVENT_RBUTTONUP: - rightMouseButton = 1; + _rightMouseButton = 1; break; default: break; |