Fixed findGameObject() for SCI11 games

svn-id: r49326
This commit is contained in:
Filippos Karapetis 2010-05-30 15:17:29 +00:00
parent ff3f0f5d65
commit 0276ec835e
2 changed files with 6 additions and 8 deletions

View File

@ -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)

View File

@ -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);
}