aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-05-29 15:27:27 +0000
committerFilippos Karapetis2010-05-29 15:27:27 +0000
commit3d09af03773d353e73b61197befa63031e99d096 (patch)
treef25a3ba0bb5c728905827170580f53574797916c
parent708b37898c17ca520e8b3ae92a2e458665c7bd81 (diff)
downloadscummvm-rg350-3d09af03773d353e73b61197befa63031e99d096.tar.gz
scummvm-rg350-3d09af03773d353e73b61197befa63031e99d096.tar.bz2
scummvm-rg350-3d09af03773d353e73b61197befa63031e99d096.zip
Removed the hack inside findGameObject(), and replaced it with code from the segment manager, till we find out why the segment is sometimes off by 1 (note that findGameObject() works fine for finding the game ID itself)
svn-id: r49310
-rw-r--r--engines/sci/engine/game.cpp8
-rw-r--r--engines/sci/resource.cpp8
2 files changed, 7 insertions, 9 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 232e0eca55..241df94316 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -127,7 +127,13 @@ int game_init(EngineState *s) {
srand(g_system->getMillis()); // Initialize random number generator
- s->_gameObj = g_sci->getResMan()->findGameObject();
+ // 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;
#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 ab46fa3abd..56ff24389e 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1926,10 +1926,6 @@ reg_t ResourceManager::findGameObject(bool addSci11ScriptOffset) {
if (getSciVersion() >= SCI_VERSION_1_1 && addSci11ScriptOffset)
offset += script->size;
- // TODO: Investigate why this is needed for SCI2+ games
- if (getSciVersion() >= SCI_VERSION_2)
- offset += 1;
-
return make_reg(1, offset);
}
@@ -1947,10 +1943,6 @@ Common::String ResourceManager::findSierraGameId() {
int16 gameObjectOffset = findGameObject(false).offset;
- // Compensate for the odd offsets of SCI2+ games
- if (getSciVersion() >= SCI_VERSION_2)
- gameObjectOffset -= 1;
-
// Seek to the name selector of the first export
byte *seeker = heap->data + READ_UINT16(heap->data + gameObjectOffset + nameSelector * 2);
Common::String sierraId;