diff options
-rw-r--r-- | engines/gob/draw_v2.cpp | 2 | ||||
-rw-r--r-- | engines/gob/mult_v2.cpp | 4 | ||||
-rw-r--r-- | engines/gob/script.cpp | 24 | ||||
-rw-r--r-- | engines/gob/script.h | 9 |
4 files changed, 35 insertions, 4 deletions
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 8a5b42f679..096f7b7975 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -329,7 +329,7 @@ void Draw_v2::printTotText(int16 id) { ptrEnd = ptr; while (((ptrEnd - dataPtr) < size) && (*ptrEnd != 1)) { // Converting to unknown commands/characters to spaces - if ((_vm->_game->_script->getData()[0x29] < 0x32) && (*ptrEnd > 3) && (*ptrEnd < 32)) + if ((_vm->_game->_script->getVersionMinor() < 2) && (*ptrEnd > 3) && (*ptrEnd < 32)) *ptrEnd = 32; switch (*ptrEnd) { diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index 489e5b0e54..87e3234e49 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -253,7 +253,7 @@ void Mult_v2::loadImds(Common::SeekableReadStream &data) { _multData->execPtr = _vm->_game->_script->getData() + _vm->_game->_script->pos(); _vm->_game->_script->skip(size * 2); - if (_vm->_game->_script->getData()[0x29] < 51) + if (_vm->_game->_script->getVersionMinor() < 3) return; size = data.readSint16LE(); @@ -871,7 +871,7 @@ void Mult_v2::animate() { animObj.newBottom = MAX(animObj.lastBottom, _vm->_scenery->_toRedrawBottom); - if ((_vm->_game->_script->getData()[0x29] > 50) && + if ((_vm->_game->_script->getVersionMinor() > 2) && (animObj.newLeft == animObj.lastLeft) && (animObj.newTop == animObj.lastTop) && (animObj.newRight == animObj.lastRight) && diff --git a/engines/gob/script.cpp b/engines/gob/script.cpp index abcc4511b3..61876d7a4a 100644 --- a/engines/gob/script.cpp +++ b/engines/gob/script.cpp @@ -376,7 +376,10 @@ bool Script::loadTOT(const Common::String &fileName) { } } - return (_totData != 0); + if (_totData == 0) + return false; + + return getTOTProperties(); } bool Script::loadLOM(const Common::String &fileName) { @@ -400,6 +403,17 @@ bool Script::loadLOM(const Common::String &fileName) { return true; } +bool Script::getTOTProperties() { + // Offset 39-41: Version in "Major.Minor" string form + if (_totData[40] != '.') + return false; + + _versionMajor = _totData[39] - '0'; + _versionMinor = _totData[41] - '0'; + + return true; +} + void Script::unload() { unloadTOT(); } @@ -473,4 +487,12 @@ void Script::call(uint32 offset) { seek(offset); } +uint8 Script::getVersionMajor() const { + return _versionMajor; +} + +uint8 Script::getVersionMinor() const { + return _versionMinor; +} + } // End of namespace Gob diff --git a/engines/gob/script.h b/engines/gob/script.h index 697bad344d..63cb237e6e 100644 --- a/engines/gob/script.h +++ b/engines/gob/script.h @@ -116,6 +116,10 @@ public: /** Push the current script position and branch to the specified offset. */ void call(uint32 offset); + // Fixed properties + uint8 getVersionMajor() const; + uint8 getVersionMinor() const; + private: struct CallEntry { byte *totPtr; @@ -134,6 +138,9 @@ private: int16 _lomHandle; + uint8 _versionMajor; + uint8 _versionMinor; + Common::Stack<CallEntry> _callStack; /** Loading a TOT file. */ @@ -141,6 +148,8 @@ private: /** Loading a LOM file. */ bool loadLOM(const Common::String &fileName); + bool getTOTProperties(); + /** Unloading a TOT file. */ void unloadTOT(); }; |