diff options
-rw-r--r-- | engines/gob/game_v1.cpp | 8 | ||||
-rw-r--r-- | engines/gob/game_v2.cpp | 9 | ||||
-rw-r--r-- | engines/gob/script.cpp | 5 | ||||
-rw-r--r-- | engines/gob/script.h | 2 |
4 files changed, 13 insertions, 11 deletions
diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 60b922e530..fd859fdc2d 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -137,14 +137,12 @@ void Game_v1::playTot(int16 skipPlay) { } } - byte *filePtr = _script->getData() + 0x34; _totResourceTable = 0; - if (READ_LE_UINT32(filePtr) != (uint32) -1) { + if (_script->getResourcesOffset() != ((uint32) -1)) { _totResourceTable = new TotResTable; - _totResourceTable->dataPtr = - _script->getData() + READ_LE_UINT32(_script->getData() + 0x34); + _totResourceTable->dataPtr = _script->getData() + _script->getResourcesOffset(); Common::MemoryReadStream totResTable(_totResourceTable->dataPtr, - 4294967295U); + _script->getSize() - _script->getResourcesOffset()); _totResourceTable->itemsCount = totResTable.readSint16LE(); _totResourceTable->unknown = totResTable.readByte(); diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 4ad710d854..3c72172124 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -55,7 +55,6 @@ void Game_v2::playTot(int16 skipPlay) { int16 _captureCounter; int16 breakFrom; int16 nestLevel; - byte *filePtr; bool totTextLoc; oldNestLevel = _vm->_inter->_nestLevel; @@ -157,15 +156,13 @@ void Game_v2::playTot(int16 skipPlay) { } } - filePtr = _script->getData() + 0x34; _totResourceTable = 0; int32 resSize; - if (READ_LE_UINT32(filePtr) != (uint32) -1) { + if (_script->getResourcesOffset() != ((uint32) -1)) { _totResourceTable = new TotResTable; - _totResourceTable->dataPtr = - _script->getData() + READ_LE_UINT32(_script->getData() + 0x34); + _totResourceTable->dataPtr = _script->getData() + _script->getResourcesOffset(); Common::MemoryReadStream totResTable(_totResourceTable->dataPtr, - 4294967295U); + _script->getSize() - _script->getResourcesOffset()); _totResourceTable->itemsCount = totResTable.readSint16LE(); resSize = _totResourceTable->itemsCount * szGame_TotResItem + szGame_TotResTable; diff --git a/engines/gob/script.cpp b/engines/gob/script.cpp index 383ab56a13..b5b7566e35 100644 --- a/engines/gob/script.cpp +++ b/engines/gob/script.cpp @@ -414,6 +414,7 @@ bool Script::getTOTProperties() { _variablesCount = READ_LE_UINT32(_totData + 44); _textsOffset = READ_LE_UINT32(_totData + 48); + _resourcesOffset = READ_LE_UINT32(_totData + 52); _imFileNumber = _totData[59]; _exFileNumber = _totData[60]; @@ -511,6 +512,10 @@ uint32 Script::getTextsOffset() const { return _textsOffset; } +uint32 Script::getResourcesOffset() const { + return _resourcesOffset; +} + uint8 Script::getImFileNumber() const { return _imFileNumber; } diff --git a/engines/gob/script.h b/engines/gob/script.h index 31153407f1..577d9ef287 100644 --- a/engines/gob/script.h +++ b/engines/gob/script.h @@ -121,6 +121,7 @@ public: uint8 getVersionMinor() const; uint32 getVariablesCount() const; uint32 getTextsOffset() const; + uint32 getResourcesOffset() const; uint8 getImFileNumber() const; uint8 getExFileNumber() const; uint8 getCommunHandling() const; @@ -149,6 +150,7 @@ private: uint8 _versionMinor; uint32 _variablesCount; uint32 _textsOffset; + uint32 _resourcesOffset; uint8 _imFileNumber; uint8 _exFileNumber; uint8 _communHandling; |