aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/myst.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2017-07-17 06:34:25 +0200
committerBastien Bouclet2017-07-22 20:38:56 +0200
commit64303abb07c058a92ebe1ab8d91dc0c85b1ec432 (patch)
tree9f35f12d6cf63bf3b7053d582728a8846cf82ff4 /engines/mohawk/myst.cpp
parent9cb6c872b7ffb2a852a81c19369dcae4f8b6c8ed (diff)
downloadscummvm-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.cpp')
-rw-r--r--engines/mohawk/myst.cpp39
1 files changed, 12 insertions, 27 deletions
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() {