diff options
author | Borja Lorente | 2016-06-17 12:53:32 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-14 18:28:06 +0200 |
commit | ec768fbec167321914326a54a7efc2032e03c3e3 (patch) | |
tree | 203c575c1321c3fc50dccb47f4f3c16c950d9360 /engines/macventure/macventure.cpp | |
parent | 79496ea5c07cf3da9fef845e53b6df2c36a6a8e7 (diff) | |
download | scummvm-rg350-ec768fbec167321914326a54a7efc2032e03c3e3.tar.gz scummvm-rg350-ec768fbec167321914326a54a7efc2032e03c3e3.tar.bz2 scummvm-rg350-ec768fbec167321914326a54a7efc2032e03c3e3.zip |
MACVENTURE: Test and complete main loop
Diffstat (limited to 'engines/macventure/macventure.cpp')
-rw-r--r-- | engines/macventure/macventure.cpp | 61 |
1 files changed, 45 insertions, 16 deletions
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp index 27a2aad1fc..3b453563a6 100644 --- a/engines/macventure/macventure.cpp +++ b/engines/macventure/macventure.cpp @@ -94,28 +94,34 @@ Common::Error MacVentureEngine::run() { _cmdReady = false; _haltedAtEnd = false; _haltedInSelection = false; + _prepared = true; while (!(_gameState == kGameStateQuitting)) { processEvents(); - if (!_halted) { - _gui->draw(); - } + if (_prepared) { + _prepared = false; + + if (!_halted) { + _gui->draw(); + } - if (_cmdReady || _halted) { - _halted = false; - if (runScriptEngine()) { - _halted = true; - _paused = true; - } else { - _paused = false; - if (!updateState()) { - updateControls(); + if (_cmdReady || _halted) { + _halted = false; + if (runScriptEngine()) { + _halted = true; + _paused = true; + } + else { + _paused = false; + if (!updateState()) { + updateControls(); + } } } - } - if (_gameState == kGameStateWinnig || _gameState == kGameStateLosing) { - endGame(); + if (_gameState == kGameStateWinnig || _gameState == kGameStateLosing) { + endGame(); + } } g_system->updateScreen(); @@ -144,13 +150,32 @@ void MacVentureEngine::selectControl(ControlReference id) { void MacVentureEngine::activateCommand(ControlReference id) { ControlAction action = referenceToAction(id); if (action != _activeControl) { - if (_activeControl) + if (_activeControl) _activeControl = kNoCommand; _activeControl = action; } debug(7, "Activating Command %x... Command %x is active", action, _activeControl); } +void MacVentureEngine::refreshReady() { + switch (objectsToApplyCommand()) { + case 0: // No selected object + _cmdReady = true; + break; + case 1: // We have some selected object + _cmdReady = _currentSelection.size() != 0; + break; + case 2: + if (_destObject > 0) // We have a destination seleted + _cmdReady = true; + break; + } +} + +void MacVentureEngine::preparedToRun() { + _prepared = true; +} + void MacVentureEngine::enqueueObject(ObjID id) { QueuedObject obj; obj.parent = _world->getObjAttr(id, kAttrParentObject); @@ -287,6 +312,10 @@ ControlAction MacVenture::MacVentureEngine::referenceToAction(ControlReference i } } +uint MacVentureEngine::objectsToApplyCommand() { + return uint(); +} + // Data retrieval bool MacVentureEngine::isPaused() { |