Permalink
Browse files

MOHAWK: RIVEN: Move input handling to a separate function

Simplifies doFrame().
  • Loading branch information...
dafioram committed Aug 8, 2018
1 parent bb995bc commit 663a6430a1693171e9936399ab33b4364ef17c2d
Showing with 24 additions and 20 deletions.
  1. +24 −20 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() {

0 comments on commit 663a643

Please sign in to comment.