The segment manager is now initialized before the graphics subsystem. Fixes the detection of the fastCast object on startup, and hence fixes LSL1VGA

svn-id: r49553
This commit is contained in:
Filippos Karapetis 2010-06-09 21:41:20 +00:00
parent d44efa817f
commit 14437e6394
2 changed files with 16 additions and 11 deletions

View File

@ -74,6 +74,9 @@ int game_init(EngineState *s) {
s->initGlobals();
if (s->abortScriptProcessing == kAbortRestartGame && g_sci->_gfxMenu)
g_sci->_gfxMenu->reset();
s->_segMan->initSysStrings();
s->r_acc = s->r_prev = NULL_REG;
@ -101,10 +104,6 @@ int game_init(EngineState *s) {
voc->parser_base = make_reg(s->_segMan->getSysStringsSegment(), SYS_STRING_PARSER_BASE);
}
// Initialize menu TODO: Actually this should be another init()
if (g_sci->_gfxMenu)
g_sci->_gfxMenu->reset();
s->game_start_time = g_system->getMillis();
s->last_wait_time = s->game_start_time;

View File

@ -44,6 +44,7 @@
#include "sci/sound/soundcmd.h"
#include "sci/graphics/gui.h"
#include "sci/graphics/maciconbar.h"
#include "sci/graphics/menu.h"
#include "sci/graphics/ports.h"
#include "sci/graphics/palette.h"
#include "sci/graphics/cursor.h"
@ -193,6 +194,15 @@ Common::Error SciEngine::run() {
_gamestate = new EngineState(segMan);
_eventMan = new EventManager(_resMan);
// The game needs to be initialized before the graphics system is initialized, as
// the graphics code checks parts of the seg manager upon initialization (e.g. for
// the presence of the fastCast object)
if (game_init(_gamestate)) { /* Initialize */
warning("Game initialization failed: Aborting...");
// TODO: Add an "init failed" error?
return Common::kUnknownError;
}
#ifdef ENABLE_SCI32
if (getSciVersion() >= SCI_VERSION_2) {
_gfxAnimate = 0;
@ -209,15 +219,11 @@ Common::Error SciEngine::run() {
#ifdef ENABLE_SCI32
_gui32 = 0;
_gfxFrameout = 0;
g_sci->_gfxMenu->reset();
}
#endif
if (game_init(_gamestate)) { /* Initialize */
warning("Game initialization failed: Aborting...");
// TODO: Add an "init failed" error?
return Common::kUnknownError;
}
_kernel->loadKernelNames(_features); // Must be called after game_init()
script_adjust_opcode_formats(_gamestate);