aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/game.cpp7
-rw-r--r--engines/sci/sci.cpp20
2 files changed, 16 insertions, 11 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 704fe877c7..04f8501027 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -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;
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 1d0bbadd63..d5cab1adc9 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -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;
- }
-#endif
- if (game_init(_gamestate)) { /* Initialize */
- warning("Game initialization failed: Aborting...");
- // TODO: Add an "init failed" error?
- return Common::kUnknownError;
+ g_sci->_gfxMenu->reset();
}
-
+#endif
+
_kernel->loadKernelNames(_features); // Must be called after game_init()
script_adjust_opcode_formats(_gamestate);