diff options
Diffstat (limited to 'engines/drascula/drascula.cpp')
-rw-r--r-- | engines/drascula/drascula.cpp | 188 |
1 files changed, 139 insertions, 49 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 804881cf9a..163f0077fc 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -89,14 +89,107 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam _talkSequences = 0; _currentSaveSlot = 0; + bjX = 0; + bjY = 0; + trackBJ = 0; + framesWithoutAction = 0; + term_int = 0; + currentChapter = 0; + _loadedDifferentChapter = 0; + musicStopped = 0; + FrameSSN = 0; + globalSpeed = 0; + LastFrame = 0; + flag_tv = 0; + _charMapSize = 0; + _itemLocationsSize = 0; + _polXSize = 0; + _verbBarXSize = 0; + _x1dMenuSize = 0; + _frameXSize = 0; + _candleXSize = 0; + _pianistXSize = 0; + _drunkXSize = 0; + _roomPreUpdatesSize = 0; + _roomUpdatesSize = 0; + _roomActionsSize = 0; + _talkSequencesSize = 0; + _numLangs = 0; + feetHeight = 0; + floorX1 = 0; + floorY1 = 0; + floorX2 = 0; + floorY2 = 0; + lowerLimit = 0; + upperLimit = 0; + trackFinal = 0; + walkToObject = 0; + objExit = 0; + _startTime = 0; + hasAnswer = 0; + savedTime = 0; + breakOut = 0; + vonBraunX = 0; + trackVonBraun = 0; + vonBraunHasMoved = 0; + newHeight = 0; + newWidth = 0; + color_solo = 0; + igorX = 0; + igorY = 0; + trackIgor = 0; + drasculaX = 0; + drasculaY = 0; + trackDrascula = 0; + _roomNumber = 0; + numRoomObjs = 0; + takeObject = 0; + pickedObject = 0; + _subtitlesDisabled = 0; + _menuBar = 0; + _menuScreen = 0; + _hasName = 0; + curExcuseLook = 0; + curExcuseAction = 0; + frame_y = 0; + curX = 0; + curY = 0; + characterMoved = 0; + curDirection = 0; + trackProtagonist = 0; + _characterFrame = 0; + hare_se_ve = 0; + roomX = 0; + roomY = 0; + checkFlags = 0; + doBreak = 0; + stepX = 0; + stepY = 0; + curHeight = 0; + curWidth = 0; + _color = 0; blinking = 0; - mouseX = 0; - mouseY = 0; - leftMouseButton = 0; - rightMouseButton = 0; + _mouseX = 0; + _mouseY = 0; + _leftMouseButton = 0; + _rightMouseButton = 0; *textName = 0; + crosshairCursor = 0; + mouseCursor = 0; + bgSurface = 0; + backSurface = 0; + cursorSurface = 0; + drawSurface3 = 0; + drawSurface2 = 0; + tableSurface = 0; + extraSurface = 0; + screenSurface = 0; + frontSurface = 0; + previousMusic = 0; + roomMusic = 0; + _rnd = new Common::RandomSource("drascula"); _console = 0; @@ -197,7 +290,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 +311,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 +324,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 +336,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 +358,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(); @@ -300,7 +390,7 @@ Common::Error DrasculaEngine::run() { memset(iconName, 0, sizeof(iconName)); for (i = 0; i < 6; i++) - strcpy(iconName[i + 1], _textverbs[i]); + Common::strlcpy(iconName[i + 1], _textverbs[i], 13); assignPalette(defaultPalette); @@ -330,7 +420,7 @@ void DrasculaEngine::endChapter() { bool DrasculaEngine::runCurrentChapter() { int n; - rightMouseButton = 0; + _rightMouseButton = 0; previousMusic = -1; @@ -360,14 +450,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 +473,7 @@ bool DrasculaEngine::runCurrentChapter() { addObject(kItemPhone); trackProtagonist = 3; objExit = 162; - if (loadedDifferentChapter == 0) + if (!_loadedDifferentChapter) enterRoom(14); else { if (!loadGame(_currentSaveSlot)) { @@ -401,7 +491,7 @@ bool DrasculaEngine::runCurrentChapter() { flags[1] = 1; trackProtagonist = 1; objExit = 99; - if (loadedDifferentChapter == 0) + if (!_loadedDifferentChapter) enterRoom(20); else { if (!loadGame(_currentSaveSlot)) { @@ -415,7 +505,7 @@ bool DrasculaEngine::runCurrentChapter() { addObject(kItemReefer2); addObject(kItemOneCoin2); objExit = 100; - if (loadedDifferentChapter == 0) { + if (!_loadedDifferentChapter) { enterRoom(21); trackProtagonist = 0; curX = 235; @@ -437,7 +527,7 @@ bool DrasculaEngine::runCurrentChapter() { addObject(20); trackProtagonist = 1; objExit = 100; - if (loadedDifferentChapter == 0) { + if (!_loadedDifferentChapter) { enterRoom(45); } else { if (!loadGame(_currentSaveSlot)) { @@ -450,7 +540,7 @@ bool DrasculaEngine::runCurrentChapter() { trackProtagonist = 1; objExit = 104; - if (loadedDifferentChapter == 0) { + if (!_loadedDifferentChapter) { enterRoom(58); animation_1_6(); } else { @@ -480,13 +570,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 +608,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 +639,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 +670,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 +734,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 +760,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 +769,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 +786,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 +808,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 +869,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; |