aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/supernova/supernova.cpp37
-rw-r--r--engines/supernova/supernova.h1
2 files changed, 21 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:
diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h
index 2f21422fce..37747a4e75 100644
--- a/engines/supernova/supernova.h
+++ b/engines/supernova/supernova.h
@@ -129,6 +129,7 @@ public:
int textWidth(const char *text);
int textWidth(const uint16 key);
Common::Error loadGameStrings();
+ void init();
void initData();
void initPalette();
void paletteFadeIn();