SUPERNOVA: Adds init function to SupernovaEngine

This commit is contained in:
Joseph-Eugene Winzer 2018-03-21 12:19:47 +01:00
parent 26543be637
commit 32877639d7
2 changed files with 21 additions and 17 deletions

View File

@ -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:

View File

@ -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();