diff options
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/console.cpp | 9 | ||||
-rw-r--r-- | engines/mohawk/myst.cpp | 39 | ||||
-rw-r--r-- | engines/mohawk/myst.h | 1 | ||||
-rw-r--r-- | engines/mohawk/myst_areas.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/myst_graphics.cpp | 117 | ||||
-rw-r--r-- | engines/mohawk/myst_graphics.h | 6 | ||||
-rw-r--r-- | engines/mohawk/myst_scripts.cpp | 11 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/channelwood.cpp | 12 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/credits.cpp | 1 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/mechanical.cpp | 20 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/myst.cpp | 23 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/stoneship.cpp | 5 | ||||
-rw-r--r-- | engines/mohawk/riven.cpp | 2 |
13 files changed, 43 insertions, 207 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index cfabbd304d..374e2a51d9 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -194,7 +194,6 @@ bool MystConsole::Cmd_DrawImage(int argc, const char **argv) { rect = Common::Rect((uint16)atoi(argv[2]), (uint16)atoi(argv[3]), (uint16)atoi(argv[4]), (uint16)atoi(argv[5])); _vm->_gfx->copyImageToScreen((uint16)atoi(argv[1]), rect); - _vm->_system->updateScreen(); return false; } @@ -348,9 +347,7 @@ bool MystConsole::Cmd_QuickTest(int argc, const char **argv) { debug("Loading card %d", ids[j]); _vm->changeToCard(ids[j], kTransitionCopy); - _vm->_video->updateMovies(); - _vm->_scriptParser->runPersistentScripts(); - _vm->_system->updateScreen(); + _vm->doFrame(); int16 resIndex = _vm->_rnd->getRandomNumber(_vm->_resources.size()) - 1; if (resIndex >= 0 && _vm->_resources[resIndex]->isEnabled()) { @@ -358,9 +355,7 @@ bool MystConsole::Cmd_QuickTest(int argc, const char **argv) { _vm->_resources[resIndex]->handleMouseUp(); } - _vm->_video->updateMovies(); - _vm->_scriptParser->runPersistentScripts(); - _vm->_system->updateScreen(); + _vm->doFrame(); if (_vm->getCurStack() != i) { // Clicking may have linked us to another age diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 295abebd6d..24778fe5ae 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -251,6 +251,9 @@ void MohawkEngine_Myst::playMovieBlockingCentered(const Common::String &fileName } void MohawkEngine_Myst::waitUntilMovieEnds(const VideoEntryPtr &video) { + if (!video) + return; + _interactive = false; // Sanity check @@ -333,7 +336,11 @@ Common::Error MohawkEngine_Myst::run() { void MohawkEngine_Myst::doFrame() { // Update any background videos _video->updateMovies(); - _scriptParser->runPersistentScripts(); + if (!_scriptParser->isScriptRunning() && _interactive) { + _interactive = false; + _scriptParser->runPersistentScripts(); + _interactive = true; + } Common::Event event; while (_system->getEventManager()->pollEvent(event)) { @@ -422,39 +429,22 @@ void MohawkEngine_Myst::doFrame() { } bool MohawkEngine_Myst::wait(uint32 duration, bool skippable) { + _interactive = false; uint32 end = getTotalPlayTime() + duration; - while (getTotalPlayTime() < end && !shouldQuit()) { + do { doFrame(); if (_escapePressed && skippable) { _escapePressed = false; return true; // Return true if skipped } - } + } while (getTotalPlayTime() < end && !shouldQuit()); + _interactive = true; return false; } -void MohawkEngine_Myst::pollAndDiscardEvents() { - // Poll the events to update the mouse cursor position - Common::Event event; - while (_system->getEventManager()->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_SPACE: - pauseGame(); - break; - default: - break; - } - default: - break; - } - } -} - void MohawkEngine_Myst::pauseEngineIntern(bool pause) { MohawkEngine::pauseEngineIntern(pause); @@ -482,8 +472,6 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS else _gfx->clearScreenPalette(); - _system->updateScreen(); - _sound->stopSound(); _sound->stopBackgroundMyst(); _video->stopVideos(); @@ -680,7 +668,6 @@ void MohawkEngine_Myst::changeToCard(uint16 card, TransitionType transition) { _gfx->runTransition(transition, Common::Rect(544, 333), 10, 0); } else { _gfx->copyBackBufferToScreen(Common::Rect(544, 333)); - _system->updateScreen(); } } @@ -694,8 +681,6 @@ void MohawkEngine_Myst::drawResourceRects() { _resources[i]->getRect().debugPrint(0); _resources[i]->drawBoundingRect(); } - - _system->updateScreen(); } void MohawkEngine_Myst::updateActiveResource() { diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index ae3439427e..a411b64347 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -190,7 +190,6 @@ public: uint16 getMainCursor() { return _mainCursor; } void checkCursorHints(); MystArea *forceUpdateClickedResource(); - void pollAndDiscardEvents(); bool wait(uint32 duration, bool skippable = false); /** Update the game state according to events and update the screen */ diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp index 568a95d1de..5e6b39df15 100644 --- a/engines/mohawk/myst_areas.cpp +++ b/engines/mohawk/myst_areas.cpp @@ -443,7 +443,6 @@ void MystAreaImageSwitch::drawConditionalDataToScreen(uint16 state, bool update) // Draw to screen if (update) { _vm->_gfx->copyImageSectionToScreen(imageToDraw, _subImages[subImageId].rect, _rect); - _vm->_system->updateScreen(); } else { _vm->_gfx->copyImageSectionToBackBuffer(imageToDraw, _subImages[subImageId].rect, _rect); } @@ -777,7 +776,6 @@ MystVideoInfo::~MystVideoInfo() { void MystVideoInfo::drawFrame(uint16 frame) { _currentFrame = _firstFrame + frame; _vm->_gfx->copyImageToScreen(_currentFrame, _frameRect); - _vm->_system->updateScreen(); } bool MystVideoInfo::pullLeverV() { @@ -808,7 +806,7 @@ void MystVideoInfo::releaseLeverV() { // Release lever for (int i = step; i >= 0; i--) { drawFrame(i); - _vm->_system->delayMillis(10); + _vm->doFrame(); } } diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp index 333da402fa..0aceb1de04 100644 --- a/engines/mohawk/myst_graphics.cpp +++ b/engines/mohawk/myst_graphics.cpp @@ -55,9 +55,6 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) { // Initialize our buffer _backBuffer = new Graphics::Surface(); _backBuffer->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat); - - _nextAllowedDrawTime = _vm->_system->getMillis(); - _enableDrawingTimeSimulation = 0; } MystGraphics::~MystGraphics() { @@ -156,8 +153,6 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm debug(3, "\twidth: %d", width); debug(3, "\theight: %d", height); - simulatePreviousDrawDelay(dest); - _vm->_system->copyRectToScreen(surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height); } @@ -222,16 +217,11 @@ void MystGraphics::copyImageToBackBuffer(uint16 image, Common::Rect dest) { void MystGraphics::copyBackBufferToScreen(Common::Rect r) { r.clip(_viewport); - simulatePreviousDrawDelay(r); - _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(r.left, r.top), _backBuffer->pitch, r.left, r.top, r.width(), r.height()); } void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16 steps, uint16 delay) { - // Transitions are barely visible without adding delays between the draw calls - enableDrawingTimeSimulation(true); - switch (type) { case kTransitionLeftToRight: { debugC(kDebugView, "Left to Right"); @@ -242,18 +232,14 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16 area.left = rect.left + step * i; area.right = area.left + step; - _vm->_system->delayMillis(delay); - _vm->pollAndDiscardEvents(); - copyBackBufferToScreen(area); - _vm->_system->updateScreen(); + _vm->wait(delay); } if (area.right < rect.right) { area.left = area.right; area.right = rect.right; copyBackBufferToScreen(area); - _vm->_system->updateScreen(); } } break; @@ -266,18 +252,14 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16 area.right = rect.right - step * i; area.left = area.right - step; - _vm->_system->delayMillis(delay); - _vm->pollAndDiscardEvents(); - copyBackBufferToScreen(area); - _vm->_system->updateScreen(); + _vm->wait(delay); } if (area.left > rect.left) { area.right = area.left; area.left = rect.left; copyBackBufferToScreen(area); - _vm->_system->updateScreen(); } } break; @@ -293,11 +275,8 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16 debugC(kDebugView, "Dissolve"); for (int16 step = 0; step < 8; step++) { - // Only one eighth of the rect pixels are updated by a draw step, - // delay by one eighth of the regular time - simulatePreviousDrawDelay(Common::Rect(rect.width() / 8, rect.height())); - transitionDissolve(rect, step); + _vm->doFrame(); } } break; @@ -310,18 +289,14 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16 area.top = rect.top + step * i; area.bottom = area.top + step; - _vm->_system->delayMillis(delay); - _vm->pollAndDiscardEvents(); - copyBackBufferToScreen(area); - _vm->_system->updateScreen(); + _vm->wait(delay); } if (area.bottom < rect.bottom) { area.top = area.bottom; area.bottom = rect.bottom; copyBackBufferToScreen(area); - _vm->_system->updateScreen(); } } break; @@ -334,18 +309,14 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16 area.bottom = rect.bottom - step * i; area.top = area.bottom - step; - _vm->_system->delayMillis(delay); - _vm->pollAndDiscardEvents(); - copyBackBufferToScreen(area); - _vm->_system->updateScreen(); + _vm->wait(delay); } if (area.top > rect.top) { area.bottom = area.top; area.top = rect.top; copyBackBufferToScreen(area); - _vm->_system->updateScreen(); } } break; @@ -371,13 +342,10 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16 break; case kTransitionCopy: copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); break; default: error("Unknown transition %d", type); } - - enableDrawingTimeSimulation(false); } void MystGraphics::transitionDissolve(Common::Rect rect, uint step) { @@ -460,8 +428,6 @@ void MystGraphics::transitionDissolve(Common::Rect rect, uint step) { } _vm->_system->unlockScreen(); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); } void MystGraphics::transitionSlideToLeft(Common::Rect rect, uint16 steps, uint16 delay) { @@ -475,18 +441,13 @@ void MystGraphics::transitionSlideToLeft(Common::Rect rect, uint16 steps, uint16 dstRect.right = dstRect.left + step * stepWidth; srcRect.left = srcRect.right - step * stepWidth; - _vm->_system->delayMillis(delay); - - simulatePreviousDrawDelay(dstRect); _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top), _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height()); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->wait(delay); } if (dstRect.right != rect.right) { copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); } } @@ -501,18 +462,13 @@ void MystGraphics::transitionSlideToRight(Common::Rect rect, uint16 steps, uint1 dstRect.left = dstRect.right - step * stepWidth; srcRect.right = srcRect.left + step * stepWidth; - _vm->_system->delayMillis(delay); - - simulatePreviousDrawDelay(dstRect); _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top), _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height()); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->wait(delay); } if (dstRect.left != rect.left) { copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); } } @@ -527,19 +483,14 @@ void MystGraphics::transitionSlideToTop(Common::Rect rect, uint16 steps, uint16 dstRect.bottom = dstRect.top + step * stepWidth; srcRect.top = srcRect.bottom - step * stepWidth; - _vm->_system->delayMillis(delay); - - simulatePreviousDrawDelay(dstRect); _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top), _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height()); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->wait(delay); } if (dstRect.bottom < rect.bottom) { copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); } } @@ -554,19 +505,14 @@ void MystGraphics::transitionSlideToBottom(Common::Rect rect, uint16 steps, uint dstRect.top = dstRect.bottom - step * stepWidth; srcRect.bottom = srcRect.top + step * stepWidth; - _vm->_system->delayMillis(delay); - - simulatePreviousDrawDelay(dstRect); _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top), _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height()); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->wait(delay); } if (dstRect.top > rect.top) { copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); } } @@ -581,15 +527,12 @@ void MystGraphics::transitionPartialToRight(Common::Rect rect, uint32 width, uin dstRect.right = dstRect.left + step * stepWidth; srcRect.left = srcRect.right - step * stepWidth; - simulatePreviousDrawDelay(dstRect); _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top), _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height()); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->doFrame(); } copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); } void MystGraphics::transitionPartialToLeft(Common::Rect rect, uint32 width, uint32 steps) { @@ -603,15 +546,12 @@ void MystGraphics::transitionPartialToLeft(Common::Rect rect, uint32 width, uint dstRect.left = dstRect.right - step * stepWidth; srcRect.right = srcRect.left + step * stepWidth; - simulatePreviousDrawDelay(dstRect); _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top), _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height()); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->doFrame(); } copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); } void MystGraphics::drawRect(Common::Rect rect, RectState state) { @@ -637,36 +577,6 @@ void MystGraphics::drawLine(const Common::Point &p1, const Common::Point &p2, ui _backBuffer->drawLine(p1.x, p1.y, p2.x, p2.y, color); } -void MystGraphics::enableDrawingTimeSimulation(bool enable) { - if (enable) - _enableDrawingTimeSimulation++; - else - _enableDrawingTimeSimulation--; - - if (_enableDrawingTimeSimulation < 0) - _enableDrawingTimeSimulation = 0; -} - -void MystGraphics::simulatePreviousDrawDelay(const Common::Rect &dest) { - uint32 time = 0; - - if (_enableDrawingTimeSimulation) { - time = _vm->_system->getMillis(); - - // Do not draw anything new too quickly after the previous draw call - // so that images stay at least a little while on screen - // This is enabled only for scripted draw calls - if (time < _nextAllowedDrawTime) { - debugC(kDebugView, "Delaying draw call by %d ms", _nextAllowedDrawTime - time); - _vm->_system->delayMillis(_nextAllowedDrawTime - time); - } - } - - // Next draw call allowed at DELAY + AERA * COEFF milliseconds from now - time = _vm->_system->getMillis(); - _nextAllowedDrawTime = time + _constantDrawDelay + dest.height() * dest.width() / _proportionalDrawDelay; -} - void MystGraphics::fadeToBlack() { // This is only for the demo assert(!(_vm->getFeatures() & GF_ME)); @@ -681,7 +591,7 @@ void MystGraphics::fadeToBlack() { *dst++ = *src++ * i / 64; _vm->_system->getPaletteManager()->setPalette(palette, 0, 256); - _vm->_system->updateScreen(); + _vm->doFrame(); } } @@ -701,12 +611,11 @@ void MystGraphics::fadeFromBlack() { *dst++ = *src++ * i / 64; _vm->_system->getPaletteManager()->setPalette(palette, 0, 256); - _vm->_system->updateScreen(); + _vm->doFrame(); } // Set the full palette _vm->_system->getPaletteManager()->setPalette(_palette, 0, 256); - _vm->_system->updateScreen(); } void MystGraphics::clearScreenPalette() { diff --git a/engines/mohawk/myst_graphics.h b/engines/mohawk/myst_graphics.h index cd09a53a3a..173e02357d 100644 --- a/engines/mohawk/myst_graphics.h +++ b/engines/mohawk/myst_graphics.h @@ -72,12 +72,6 @@ private: Common::Rect _viewport; byte _palette[256 * 3]; - int _enableDrawingTimeSimulation; - uint32 _nextAllowedDrawTime; - static const uint _constantDrawDelay = 10; // ms - static const uint _proportionalDrawDelay = 500; // pixels per ms - - void simulatePreviousDrawDelay(const Common::Rect &dest); void transitionDissolve(Common::Rect rect, uint step); void transitionSlideToLeft(Common::Rect rect, uint16 steps, uint16 delay); void transitionSlideToRight(Common::Rect rect, uint16 steps, uint16 delay); diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp index 59d736296e..f3e44bc154 100644 --- a/engines/mohawk/myst_scripts.cpp +++ b/engines/mohawk/myst_scripts.cpp @@ -158,9 +158,6 @@ void MystScriptParser::setupCommonOpcodes() { void MystScriptParser::runScript(MystScript script, MystArea *invokingResource) { debugC(kDebugScript, "Script Size: %d", script->size()); - // Scripted drawing takes more time to simulate older hardware - // This way opcodes can't overwrite what the previous ones drew too quickly - _vm->_gfx->enableDrawingTimeSimulation(true); _scriptNestingLevel++; for (uint16 i = 0; i < script->size(); i++) { @@ -176,7 +173,6 @@ void MystScriptParser::runScript(MystScript script, MystArea *invokingResource) } _scriptNestingLevel--; - _vm->_gfx->enableDrawingTimeSimulation(false); } void MystScriptParser::runOpcode(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -412,7 +408,6 @@ void MystScriptParser::o_redrawCard(uint16 op, uint16 var, uint16 argc, uint16 * _vm->drawCardBackground(); _vm->drawResourceImages(); _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333)); - _vm->_system->updateScreen(); } void MystScriptParser::o_goToDest(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -671,7 +666,6 @@ void MystScriptParser::o_copyBackBufferToScreen(uint16 op, uint16 var, uint16 ar debugC(kDebugScript, "\trect.bottom: %d", rect.bottom); _vm->_gfx->copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); } void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -772,7 +766,6 @@ void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, uint16 argc, u debugC(kDebugScript, "\tdstRect.bottom: %d", dstRect.bottom); _vm->_gfx->copyImageSectionToScreen(imageId, srcRect, dstRect); - _vm->_system->updateScreen(); } void MystScriptParser::o_changeCard(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -797,7 +790,7 @@ void MystScriptParser::o_drawImageChangeCard(uint16 op, uint16 var, uint16 argc, debugC(kDebugScript, "\tcardId: %d", cardId); _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); - _vm->_system->updateScreen(); + _vm->wait(200); _vm->changeToCard(cardId, transition); } @@ -915,7 +908,7 @@ void MystScriptParser::o_soundWaitStop(uint16 op, uint16 var, uint16 argc, uint1 debugC(kDebugScript, "Opcode %d: Wait for foreground sound to finish", op); while (_vm->_sound->isPlaying()) - _vm->_system->delayMillis(10); + _vm->doFrame(); } void MystScriptParser::o_quit(uint16 op, uint16 var, uint16 argc, uint16 *argv) { diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp index 7e91dbb2c1..b8cdb599be 100644 --- a/engines/mohawk/myst_stacks/channelwood.cpp +++ b/engines/mohawk/myst_stacks/channelwood.cpp @@ -350,7 +350,7 @@ void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, uint16 a debugC(kDebugScript, "\tcardId: %d", cardId); _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); - _vm->_system->updateScreen(); + _vm->wait(200); _vm->changeToCard(cardId, kTransitionPartToLeft); @@ -368,8 +368,7 @@ void Channelwood::o_waterTankValveOpen(uint16 op, uint16 var, uint16 argc, uint1 for (uint i = 0; i < 2; i++) for (uint16 imageId = 3601; imageId >= 3595; imageId--) { _vm->_gfx->copyImageToScreen(imageId, rect); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->doFrame(); } pipeChangeValve(true, 0x80); @@ -448,14 +447,14 @@ void Channelwood::o_leverEndMoveWithSound(uint16 op, uint16 var, uint16 argc, ui void Channelwood::o_leverElev3StartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _vm->_gfx->copyImageToScreen(3970, Common::Rect(544, 333)); - _vm->_system->updateScreen(); + _vm->doFrame(); o_leverStartMove(op, var, argc, argv); } void Channelwood::o_leverElev3EndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { o_leverEndMove(op, var, argc, argv); _vm->_gfx->copyImageToScreen(3265, Common::Rect(544, 333)); - _vm->_system->updateScreen(); + _vm->doFrame(); _vm->_sound->replaceSoundMyst(5265); } @@ -700,8 +699,7 @@ void Channelwood::o_waterTankValveClose(uint16 op, uint16 var, uint16 argc, uint for (uint i = 0; i < 2; i++) for (uint16 imageId = 3595; imageId <= 3601; imageId++) { _vm->_gfx->copyImageToScreen(imageId, rect); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->doFrame(); } pipeChangeValve(false, 0x80); diff --git a/engines/mohawk/myst_stacks/credits.cpp b/engines/mohawk/myst_stacks/credits.cpp index c382263f7c..b295255dfb 100644 --- a/engines/mohawk/myst_stacks/credits.cpp +++ b/engines/mohawk/myst_stacks/credits.cpp @@ -74,7 +74,6 @@ void Credits::runPersistentScripts() { // Draw next image _vm->drawCardBackground(); _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333)); - _vm->_system->updateScreen(); _startTime = _vm->_system->getMillis(); } diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp index 3bbf749c1f..5f49e694d1 100644 --- a/engines/mohawk/myst_stacks/mechanical.cpp +++ b/engines/mohawk/myst_stacks/mechanical.cpp @@ -381,7 +381,7 @@ void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, uint16 argc, uint // Release lever for (int i = step; i >= 0; i--) { lever->drawFrame(i); - _vm->_system->delayMillis(10); + _vm->doFrame(); } // Stop persistent script @@ -449,7 +449,7 @@ void Mechanical::o_fortressRotationSpeedStop(uint16 op, uint16 var, uint16 argc, // Release lever for (int i = _fortressRotationSpeed; i >= 0; i--) { lever->drawFrame(i); - _vm->_system->delayMillis(10); + _vm->doFrame(); } _fortressRotationSpeed = 0; @@ -528,7 +528,7 @@ void Mechanical::o_fortressSimulationSpeedStop(uint16 op, uint16 var, uint16 arg // Release lever for (int i = _fortressSimulationSpeed; i >= 0; i--) { lever->drawFrame(i); - _vm->_system->delayMillis(10); + _vm->doFrame(); } _fortressSimulationSpeed = 0; @@ -607,7 +607,6 @@ void Mechanical::elevatorGoMiddle_run() { // Draw button pressed if (_elevatorInCabin) { _vm->_gfx->copyImageSectionToScreen(6332, Common::Rect(0, 35, 51, 63), Common::Rect(10, 137, 61, 165)); - _vm->_system->updateScreen(); } // Blip @@ -616,7 +615,6 @@ void Mechanical::elevatorGoMiddle_run() { // Restore button if (_elevatorInCabin) { _vm->_gfx->copyBackBufferToScreen(Common::Rect(10, 137, 61, 165)); - _vm->_system->updateScreen(); } } else { _elevatorTooLate = true; @@ -690,7 +688,7 @@ void Mechanical::o_elevatorWaitTimeout(uint16 op, uint16 var, uint16 argc, uint1 // Wait while the elevator times out while (_elevatorGoingMiddle) { runPersistentScripts(); - _vm->_system->delayMillis(10); + _vm->doFrame(); } } @@ -914,16 +912,9 @@ void Mechanical::fortressSimulation_run() { // Init sequence _vm->_sound->replaceBackgroundMyst(_fortressSimulationStartSound1, 65535); _vm->wait(5000, true); - _vm->_sound->replaceSoundMyst(_fortressSimulationStartSound2); - // Update movie while the sound is playing VideoEntryPtr startup = _fortressSimulationStartup->playMovie(); - while (_vm->_sound->isPlaying(_fortressSimulationStartSound2)) { - if (_vm->_video->updateMovies()) - _vm->_system->updateScreen(); - - _vm->_system->delayMillis(10); - } + _vm->playSoundBlocking(_fortressSimulationStartSound2); _vm->_sound->replaceBackgroundMyst(_fortressSimulationStartSound1, 65535); _vm->waitUntilMovieEnds(startup); _vm->_sound->stopBackgroundMyst(); @@ -934,7 +925,6 @@ void Mechanical::fortressSimulation_run() { Common::Rect dst = Common::Rect(187, 3, 363, 179); _vm->_gfx->copyImageSectionToBackBuffer(6046, src, dst); _vm->_gfx->copyBackBufferToScreen(dst); - _vm->_system->updateScreen(); _fortressSimulationStartup->pauseMovie(true); VideoEntryPtr holo = _fortressSimulationHolo->playMovie(); diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp index 8e130c8c62..d5e3fe25c2 100644 --- a/engines/mohawk/myst_stacks/myst.cpp +++ b/engines/mohawk/myst_stacks/myst.cpp @@ -828,8 +828,6 @@ void Myst::o_libraryBookPageTurnLeft(uint16 op, uint16 var, uint16 argc, uint16 _vm->_sound->replaceSoundMyst(_libraryBookSound1); else _vm->_sound->replaceSoundMyst(_libraryBookSound2); - - _vm->_system->updateScreen(); } } @@ -846,8 +844,6 @@ void Myst::o_libraryBookPageTurnRight(uint16 op, uint16 var, uint16 argc, uint16 _vm->_sound->replaceSoundMyst(_libraryBookSound1); else _vm->_sound->replaceSoundMyst(_libraryBookSound2); - - _vm->_system->updateScreen(); } } @@ -865,16 +861,14 @@ void Myst::o_fireplaceToggleButton(uint16 op, uint16 var, uint16 argc, uint16 *a // Unset button for (uint i = 4795; i >= 4779; i--) { _vm->_gfx->copyImageToScreen(i, getInvokingResource<MystArea>()->getRect()); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->doFrame(); } _fireplaceLines[var - 17] &= ~bitmask; } else { // Set button for (uint i = 4779; i <= 4795; i++) { _vm->_gfx->copyImageToScreen(i, getInvokingResource<MystArea>()->getRect()); - _vm->pollAndDiscardEvents(); - _vm->_system->updateScreen(); + _vm->doFrame(); } _fireplaceLines[var - 17] |= bitmask; } @@ -1178,12 +1172,11 @@ void Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) Common::Rect src = Common::Rect(0, 0, 32, 75); Common::Rect dest = Common::Rect(261, 257, 293, 332); _vm->_gfx->copyImageSectionToScreen(4699, src, dest); - _vm->_system->updateScreen(); _vm->wait(200); _vm->_gfx->copyBackBufferToScreen(dest); - _vm->_system->updateScreen(); + _vm->doFrame(); _vm->_cursor->hideCursor(); @@ -2316,7 +2309,6 @@ void Myst::o_rocketPianoStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) // Draw pressed piano key _vm->_gfx->copyImageSectionToScreen(key->getSubImage(1).wdib, src, dest); - _vm->_system->updateScreen(); // Play note _rocketPianoSound = 0; @@ -2386,7 +2378,6 @@ void Myst::o_rocketPianoStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { // Draw unpressed piano key _vm->_gfx->copyImageSectionToScreen(key->getSubImage(0).wdib, src, dest); - _vm->_system->updateScreen(); _vm->_sound->stopSound(); _vm->_sound->resumeBackgroundMyst(); @@ -2469,7 +2460,6 @@ void Myst::o_treePressureReleaseStart(uint16 op, uint16 var, uint16 argc, uint16 Common::Rect src = Common::Rect(0, 0, 49, 86); Common::Rect dest = Common::Rect(78, 46, 127, 132); _vm->_gfx->copyImageSectionToScreen(4631, src, dest); - _vm->_system->updateScreen(); _tempVar = _state.cabinValvePosition; @@ -2485,7 +2475,6 @@ void Myst::o_treePressureReleaseStop(uint16 op, uint16 var, uint16 argc, uint16 Common::Rect rect = Common::Rect(78, 46, 127, 132); _vm->_gfx->copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); _state.cabinValvePosition = _tempVar; _treeMinPosition = 0; @@ -2789,8 +2778,6 @@ void Myst::libraryCombinationBookTurnLeft() { _vm->_sound->replaceSoundMyst(_libraryBookSound1); else _vm->_sound->replaceSoundMyst(_libraryBookSound2); - - _vm->_system->updateScreen(); } } @@ -2815,8 +2802,6 @@ void Myst::libraryCombinationBookTurnRight() { _vm->_sound->replaceSoundMyst(_libraryBookSound1); else _vm->_sound->replaceSoundMyst(_libraryBookSound2); - - _vm->_system->updateScreen(); } } @@ -3166,7 +3151,6 @@ void Myst::towerRotationMap_run() { // Draw to screen _vm->_gfx->copyBackBufferToScreen(Common::Rect(106, 42, 459, 273)); - _vm->_system->updateScreen(); } uint32 time = _vm->_system->getMillis(); @@ -3305,7 +3289,6 @@ void Myst::towerRotationMapDrawLine(const Common::Point ¢er, const Common::P // Draw line _vm->_gfx->drawLine(center, end, color); _vm->_gfx->copyBackBufferToScreen(rect); - _vm->_system->updateScreen(); } void Myst::towerRotationMapRotate() { diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp index 5fbb664d7b..26c38f2a4f 100644 --- a/engines/mohawk/myst_stacks/stoneship.cpp +++ b/engines/mohawk/myst_stacks/stoneship.cpp @@ -481,7 +481,6 @@ void Stoneship::o_telescopeMove(uint16 op, uint16 var, uint16 argc, uint16 *argv // Draw lighthouse telescopeLighthouseDraw(); - _vm->_system->updateScreen(); } void Stoneship::o_telescopeStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -890,7 +889,6 @@ void Stoneship::batteryGauge_run() { _vm->drawCardBackground(); _vm->drawResourceImages(); _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333)); - _vm->_system->updateScreen(); } } @@ -920,7 +918,6 @@ void Stoneship::tunnel_run() { // Draw tunnel black if (_tunnelImagesCount) { _vm->_gfx->copyImageToScreen(_tunnelImages[1], Common::Rect(544, 333)); - _vm->_system->updateScreen(); } _vm->_sound->replaceSoundMyst(_tunnelAlarmSound); @@ -928,7 +925,6 @@ void Stoneship::tunnel_run() { // Draw tunnel dark if (_tunnelImagesCount) { _vm->_gfx->copyImageToScreen(_tunnelImages[0], Common::Rect(544, 333)); - _vm->_system->updateScreen(); } } } @@ -969,7 +965,6 @@ void Stoneship::telescope_run() { _telescopeLighthouseState = !_telescopeLighthouseState; telescopeLighthouseDraw(); - _vm->_system->updateScreen(); } } diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 495f399de7..d3f9e61d9f 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -164,7 +164,6 @@ Common::Error MohawkEngine_Riven::run() { // Start at main cursor _cursor->setCursor(kRivenMainCursor); _cursor->showCursor(); - _system->updateScreen(); // Let's begin, shall we? if (getFeatures() & GF_DEMO) { @@ -283,7 +282,6 @@ void MohawkEngine_Riven::pauseEngineIntern(bool pause) { _video->pauseVideos(); } else { _video->resumeVideos(); - _system->updateScreen(); } } |