diff options
author | Borja Lorente | 2016-08-04 10:56:51 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-14 19:01:00 +0200 |
commit | 5b63e29d5e2ff4710cf4d417474b607d84317dee (patch) | |
tree | 7d3f4596a128ff2e90696cd96f9bcd43d7e4ec2a | |
parent | 0202ff9c508ad8d510014a7c5581d57385d2acd2 (diff) | |
download | scummvm-rg350-5b63e29d5e2ff4710cf4d417474b607d84317dee.tar.gz scummvm-rg350-5b63e29d5e2ff4710cf4d417474b607d84317dee.tar.bz2 scummvm-rg350-5b63e29d5e2ff4710cf4d417474b607d84317dee.zip |
MACVENTURE: Clean up updateState function
-rw-r--r-- | engines/macventure/macventure.cpp | 34 | ||||
-rw-r--r-- | engines/macventure/macventure.h | 6 | ||||
-rw-r--r-- | engines/macventure/script.cpp | 11 | ||||
-rw-r--r-- | engines/macventure/script.h | 2 |
4 files changed, 21 insertions, 32 deletions
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp index 6ed11eb9c7..867504b427 100644 --- a/engines/macventure/macventure.cpp +++ b/engines/macventure/macventure.cpp @@ -160,20 +160,18 @@ Common::Error MacVentureEngine::run() { _prepared = false; if (!_halted) - updateState(); + updateState(false); if (_cmdReady || _halted) { _halted = false; if (runScriptEngine()) { _halted = true; _paused = true; - } - else { + } else { _paused = false; - if (!updateState()) { - updateControls(); - updateExits(); - } + updateState(true); + updateControls(); + updateExits(); } } @@ -485,8 +483,7 @@ bool MacVenture::MacVentureEngine::runScriptEngine() { _haltedInSelection = true; return true; } - if (updateState()) - return true; + updateState(true); } while (!_currentSelection.empty()) { @@ -497,9 +494,7 @@ bool MacVenture::MacVentureEngine::runScriptEngine() { _haltedInSelection = true; return true; } - if (updateState()) { - return true; - } + updateState(true); } } if (_selectedControl == 1) @@ -518,12 +513,10 @@ void MacVentureEngine::endGame() { requestQuit(); } -bool MacVentureEngine::updateState() { +void MacVentureEngine::updateState(bool pause) { runObjQueue(); - bool wait = printTexts(); - // HACK playSounds should accept a bool passed to updateState - wait |= playSounds(true); - return wait; + printTexts(); + playSounds(pause); } void MacVentureEngine::revert() { @@ -575,7 +568,7 @@ void MacVentureEngine::runObjQueue() { } } -bool MacVentureEngine::printTexts() { +void MacVentureEngine::printTexts() { for (uint i = 0; i < _textQueue.size(); i++) { QueuedText text = _textQueue.front(); _textQueue.remove_at(0); @@ -594,10 +587,9 @@ bool MacVentureEngine::printTexts() { break; } } - return false; } -bool MacVentureEngine::playSounds(bool pause) { +void MacVentureEngine::playSounds(bool pause) { int delay=0; while (!_soundQueue.empty()) { QueuedSound item = _soundQueue.front(); @@ -618,9 +610,7 @@ bool MacVentureEngine::playSounds(bool pause) { warning("Sound pausing not yet tested. Pausing for %d", delay * 1000); g_system->delayMillis(delay * 1000); preparedToRun(); - return true; } - return false; } void MacVentureEngine::updateControls() { diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h index 6953b61904..275a7ac1a7 100644 --- a/engines/macventure/macventure.h +++ b/engines/macventure/macventure.h @@ -210,7 +210,7 @@ public: void loseGame(); void clickToContinue(); - bool updateState(); + void updateState(bool pause); void revert(); void enqueueObject(ObjectQueueID type, ObjID objID, ObjID target = 0); @@ -218,8 +218,8 @@ public: void enqueueSound(SoundQueueID type, ObjID target); void runObjQueue(); - bool printTexts(); - bool playSounds(bool pause); + void printTexts(); + void playSounds(bool pause); void handleObjectSelect(ObjID objID, WindowReference win, bool shiftPressed, bool isDoubleClick); void handleObjectDrop(ObjID objID, Common::Point delta, ObjID newParent); diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp index 6f0a7820b3..ef1d36cbae 100644 --- a/engines/macventure/script.cpp +++ b/engines/macventure/script.cpp @@ -453,8 +453,7 @@ bool ScriptEngine::runFunc(EngineFrame *frame) { opdbROBQ(state, frame); break; case 0xdc: //run sound queue - if (opdcRSQ(state, frame)) - return true; + opdcRSQ(state, frame); break; case 0xdd: //run text queue opddRTQ(state, frame); @@ -1102,7 +1101,7 @@ void ScriptEngine::opd9SLEEP(EngineState * state, EngineFrame * frame) { } void ScriptEngine::opdaCLICK(EngineState * state, EngineFrame * frame) { - _engine->updateState(); + _engine->updateState(false); _engine->clickToContinue(); } @@ -1110,8 +1109,8 @@ void ScriptEngine::opdbROBQ(EngineState * state, EngineFrame * frame) { _engine->runObjQueue(); } -bool ScriptEngine::opdcRSQ(EngineState * state, EngineFrame * frame) { - return _engine->playSounds(true); +void ScriptEngine::opdcRSQ(EngineState * state, EngineFrame * frame) { + _engine->playSounds(true); } void ScriptEngine::opddRTQ(EngineState * state, EngineFrame * frame) { @@ -1119,7 +1118,7 @@ void ScriptEngine::opddRTQ(EngineState * state, EngineFrame * frame) { } void ScriptEngine::opdeUPSC(EngineState * state, EngineFrame * frame) { - _engine->updateState(); + _engine->updateState(true); } void ScriptEngine::opdfFMAI(EngineState * state, EngineFrame * frame) { diff --git a/engines/macventure/script.h b/engines/macventure/script.h index 7c4b77df75..5760a31e8a 100644 --- a/engines/macventure/script.h +++ b/engines/macventure/script.h @@ -257,7 +257,7 @@ private: void opd9SLEEP(EngineState *state, EngineFrame *frame); //sleep void opdaCLICK(EngineState *state, EngineFrame *frame); //click to continue void opdbROBQ(EngineState *state, EngineFrame *frame); //run queue - bool opdcRSQ(EngineState *state, EngineFrame *frame); //run sound queue + void opdcRSQ(EngineState *state, EngineFrame *frame); //run sound queue void opddRTQ(EngineState *state, EngineFrame *frame); //run text queue void opdeUPSC(EngineState *state, EngineFrame *frame); //update screen void opdfFMAI(EngineState *state, EngineFrame *frame); //flash main window |