aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/game.cpp8
-rw-r--r--engines/sci/resource.cpp6
2 files changed, 6 insertions, 8 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 241df94316..232e0eca55 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -127,13 +127,7 @@ int game_init(EngineState *s) {
srand(g_system->getMillis()); // Initialize random number generator
- // TODO: This is sometimes off by 1... find out why
- //s->_gameObj = g_sci->getResMan()->findGameObject();
- // Replaced by the code below for now
- Script *scr000 = s->_segMan->getScript(1);
- s->_gameObj = make_reg(1, scr000->validateExportFunc(0));
- if (getSciVersion() >= SCI_VERSION_1_1)
- s->_gameObj.offset += scr000->_scriptSize;
+ s->_gameObj = g_sci->getResMan()->findGameObject();
#ifdef USE_OLD_MUSIC_FUNCTIONS
if (s->sfx_init_flags & SFX_STATE_FLAG_NOSOUND)
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 56ff24389e..ba5689dcf0 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1923,9 +1923,13 @@ reg_t ResourceManager::findGameObject(bool addSci11ScriptOffset) {
// In SCI1.1 and newer, the heap is appended at the end of the script,
// so adjust the offset accordingly
- if (getSciVersion() >= SCI_VERSION_1_1 && addSci11ScriptOffset)
+ if (getSciVersion() >= SCI_VERSION_1_1 && addSci11ScriptOffset) {
offset += script->size;
+ if (script->size & 2)
+ offset++;
+ }
+
return make_reg(1, offset);
}