diff options
author | David Fioramonti | 2018-08-07 17:49:58 -0700 |
---|---|---|
committer | Bastien Bouclet | 2018-08-11 10:47:37 +0200 |
commit | 56389b1a5d3adb2a836e63ae1d530a8866e833e6 (patch) | |
tree | a17ecfa726e156c7131ca5b8c12f76bd79f11382 | |
parent | 2b82bb33cbbfef678de2dbc6e675c443addb8281 (diff) | |
download | scummvm-rg350-56389b1a5d3adb2a836e63ae1d530a8866e833e6.tar.gz scummvm-rg350-56389b1a5d3adb2a836e63ae1d530a8866e833e6.tar.bz2 scummvm-rg350-56389b1a5d3adb2a836e63ae1d530a8866e833e6.zip |
MOHAWK: RIVEN: Move input handling to a separate function
Simplifies doFrame().
-rw-r--r-- | engines/mohawk/riven.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index a668052503..37a7745d34 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -216,6 +216,30 @@ void MohawkEngine_Riven::doFrame() { _stack->keyResetAction(); } + processInput(); + + _stack->onFrame(); + + if (!_scriptMan->runningQueuedScripts()) { + // Don't run queued scripts if we are calling from a queued script + // otherwise infinite looping will happen. + _scriptMan->runQueuedScripts(); + } + + if (shouldPerformAutoSave(_lastSaveTime)) { + tryAutoSaving(); + } + + _inventory->onFrame(); + + // Update the screen once per frame + _system->updateScreen(); + + // Cut down on CPU usage + _system->delayMillis(10); +} + +void MohawkEngine_Riven::processInput() { Common::Event event; while (_eventMan->pollEvent(event)) { switch (event.type) { @@ -305,26 +329,6 @@ void MohawkEngine_Riven::doFrame() { break; } } - - _stack->onFrame(); - - if (!_scriptMan->runningQueuedScripts()) { - // Don't run queued scripts if we are calling from a queued script - // otherwise infinite looping will happen. - _scriptMan->runQueuedScripts(); - } - - if (shouldPerformAutoSave(_lastSaveTime)) { - tryAutoSaving(); - } - - _inventory->onFrame(); - - // Update the screen once per frame - _system->updateScreen(); - - // Cut down on CPU usage - _system->delayMillis(10); } void MohawkEngine_Riven::goToMainMenu() { |