aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2010-05-30 15:17:29 +0000
committerFilippos Karapetis2010-05-30 15:17:29 +0000
commit0276ec835ef3c77a4dbf772ea54cc6d5292452f2 (patch)
tree05008c64b8b80df0f033cc060fc02db1af40bfc5 /engines/sci
parentff3f0f5d65ec72e7a8e189089e59e8b818beddb7 (diff)
downloadscummvm-rg350-0276ec835ef3c77a4dbf772ea54cc6d5292452f2.tar.gz
scummvm-rg350-0276ec835ef3c77a4dbf772ea54cc6d5292452f2.tar.bz2
scummvm-rg350-0276ec835ef3c77a4dbf772ea54cc6d5292452f2.zip
Fixed findGameObject() for SCI11 games
svn-id: r49326
Diffstat (limited to 'engines/sci')
-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);
}