diff options
author | Joseph-Eugene Winzer | 2018-03-21 12:19:47 +0100 |
---|---|---|
committer | Joseph-Eugene Winzer | 2018-04-14 11:45:52 +0200 |
commit | 32877639d7bef9fe60f19717561d68d7656ad820 (patch) | |
tree | a7d5b233c0f726935555b07f096fa9aae4dc5e40 /engines/supernova/supernova.cpp | |
parent | 26543be637feee241812e40785b731a9eff86cdf (diff) | |
download | scummvm-rg350-32877639d7bef9fe60f19717561d68d7656ad820.tar.gz scummvm-rg350-32877639d7bef9fe60f19717561d68d7656ad820.tar.bz2 scummvm-rg350-32877639d7bef9fe60f19717561d68d7656ad820.zip |
SUPERNOVA: Adds init function to SupernovaEngine
Diffstat (limited to 'engines/supernova/supernova.cpp')
-rw-r--r-- | engines/supernova/supernova.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 7ac8d59245..641801cdfa 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -137,6 +137,25 @@ SupernovaEngine::~SupernovaEngine() { } Common::Error SupernovaEngine::run() { + init(); + + while (!shouldQuit()) { + uint32 start = _system->getMillis(); + _gm->updateEvents(); + _gm->executeRoom(); + _console->onFrame(); + _system->updateScreen(); + int end = _delay - (_system->getMillis() - start); + if (end > 0) + _system->delayMillis(end); + } + + _mixer->stopAll(); + + return Common::kNoError; +} + +void SupernovaEngine::init() { Graphics::ModeList modes; modes.push_back(Graphics::Mode(320, 200)); modes.push_back(Graphics::Mode(640, 480)); @@ -145,7 +164,7 @@ Common::Error SupernovaEngine::run() { Common::Error status = loadGameStrings(); if (status.getCode() != Common::kNoError) - return status; + error("Failed reading game strings"); initData(); initPalette(); @@ -165,24 +184,8 @@ Common::Error SupernovaEngine::run() { if (loadGameState(saveSlot).getCode() != Common::kNoError) error("Failed to load save game from slot %i", saveSlot); } - - while (!shouldQuit()) { - uint32 start = _system->getMillis(); - _gm->updateEvents(); - _gm->executeRoom(); - _console->onFrame(); - _system->updateScreen(); - int end = _delay - (_system->getMillis() - start); - if (end > 0) - _system->delayMillis(end); - } - - _mixer->stopAll(); - - return Common::kNoError; } - bool SupernovaEngine::hasFeature(EngineFeature f) const { switch (f) { case kSupportsRTL: |