diff options
author | Bastien Bouclet | 2017-07-17 06:34:25 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-07-22 20:38:56 +0200 |
commit | 64303abb07c058a92ebe1ab8d91dc0c85b1ec432 (patch) | |
tree | 9f35f12d6cf63bf3b7053d582728a8846cf82ff4 /engines/mohawk/myst_stacks | |
parent | 9cb6c872b7ffb2a852a81c19369dcae4f8b6c8ed (diff) | |
download | scummvm-rg350-64303abb07c058a92ebe1ab8d91dc0c85b1ec432.tar.gz scummvm-rg350-64303abb07c058a92ebe1ab8d91dc0c85b1ec432.tar.bz2 scummvm-rg350-64303abb07c058a92ebe1ab8d91dc0c85b1ec432.zip |
MOHAWK: Myst: Update the screen only once per frame
Change all inner loops to call the same frame function.
Remove the draw delay code. Now that we have proper frame pacing it is
not necessary anymore to wait before drawing to make sure the previous
frame stayed on the screen long enough.
Fixes #9915, #9922, #9923.
Diffstat (limited to 'engines/mohawk/myst_stacks')
-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 |
5 files changed, 13 insertions, 48 deletions
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(); } } |