aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2009-06-23 01:20:21 +0000
committerSven Hesse2009-06-23 01:20:21 +0000
commit8e63d7989f83877e63ee189693470eb2f61ecce5 (patch)
treecd216cbd2e489b7993f3e5c2e142876f7339dd46 /engines
parentec5b2d6c9ac7ef9370392f3a0c3e25b136dcb72b (diff)
downloadscummvm-rg350-8e63d7989f83877e63ee189693470eb2f61ecce5.tar.gz
scummvm-rg350-8e63d7989f83877e63ee189693470eb2f61ecce5.tar.bz2
scummvm-rg350-8e63d7989f83877e63ee189693470eb2f61ecce5.zip
Added Script::getTextsOffset()
svn-id: r41792
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/game_v1.cpp11
-rw-r--r--engines/gob/game_v2.cpp14
-rw-r--r--engines/gob/script.cpp6
-rw-r--r--engines/gob/script.h2
4 files changed, 17 insertions, 16 deletions
diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp
index 725ee6d8ff..60b922e530 100644
--- a/engines/gob/game_v1.cpp
+++ b/engines/gob/game_v1.cpp
@@ -121,15 +121,12 @@ void Game_v1::playTot(int16 skipPlay) {
debugC(4, kDebugFileIO, "IMA: %s", _curImaFile);
debugC(4, kDebugFileIO, "EXT: %s", _curExtFile);
- byte *filePtr = _script->getData() + 0x30;
-
_totTextData = 0;
- if (READ_LE_UINT32(filePtr) != (uint32) -1) {
+ if (_script->getTextsOffset() != ((uint32) -1)) {
_totTextData = new TotTextTable;
- _totTextData->dataPtr =
- (_script->getData() + READ_LE_UINT32(_script->getData() + 0x30));
+ _totTextData->dataPtr = _script->getData() + _script->getTextsOffset();
Common::MemoryReadStream totTextData(_totTextData->dataPtr,
- 4294967295U);
+ _script->getSize() - _script->getTextsOffset());
_totTextData->itemsCount = totTextData.readSint16LE();
@@ -140,7 +137,7 @@ void Game_v1::playTot(int16 skipPlay) {
}
}
- filePtr = _script->getData() + 0x34;
+ byte *filePtr = _script->getData() + 0x34;
_totResourceTable = 0;
if (READ_LE_UINT32(filePtr) != (uint32) -1) {
_totResourceTable = new TotResTable;
diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp
index c1205f3bcd..4ad710d854 100644
--- a/engines/gob/game_v2.cpp
+++ b/engines/gob/game_v2.cpp
@@ -128,29 +128,25 @@ void Game_v2::playTot(int16 skipPlay) {
debugC(4, kDebugFileIO, "IMA: %s", _curImaFile);
debugC(4, kDebugFileIO, "EXT: %s", _curExtFile);
- filePtr = _script->getData() + 0x30;
-
_totTextData = 0;
totTextLoc = false;
- if (READ_LE_UINT32(filePtr) != (uint32) -1) {
+ if (_script->getTextsOffset() != ((uint32) -1)) {
_totTextData = new TotTextTable;
int32 size;
- if (READ_LE_UINT32(filePtr) == 0) {
+ if (_script->getTextsOffset() == 0) {
_totTextData->dataPtr = loadLocTexts(&size);
totTextLoc = true;
} else {
- _totTextData->dataPtr =
- (_script->getData() + READ_LE_UINT32(_script->getData() + 0x30));
- size = _script->getSize();
+ _totTextData->dataPtr = _script->getData() + _script->getTextsOffset();
+ size = _script->getSize() - _script->getTextsOffset();
_vm->_global->_language = _vm->_global->_languageWanted;
}
_totTextData->items = 0;
if (_totTextData->dataPtr != 0) {
- Common::MemoryReadStream totTextData(_totTextData->dataPtr,
- 4294967295U);
+ Common::MemoryReadStream totTextData(_totTextData->dataPtr, size);
_totTextData->itemsCount = totTextData.readSint16LE() & 0x3FFF;
_totTextData->items = new TotTextItem[_totTextData->itemsCount];
diff --git a/engines/gob/script.cpp b/engines/gob/script.cpp
index 935bf80cd2..383ab56a13 100644
--- a/engines/gob/script.cpp
+++ b/engines/gob/script.cpp
@@ -413,6 +413,8 @@ bool Script::getTOTProperties() {
_variablesCount = READ_LE_UINT32(_totData + 44);
+ _textsOffset = READ_LE_UINT32(_totData + 48);
+
_imFileNumber = _totData[59];
_exFileNumber = _totData[60];
_communHandling = _totData[61];
@@ -505,6 +507,10 @@ uint32 Script::getVariablesCount() const {
return _variablesCount;
}
+uint32 Script::getTextsOffset() const {
+ return _textsOffset;
+}
+
uint8 Script::getImFileNumber() const {
return _imFileNumber;
}
diff --git a/engines/gob/script.h b/engines/gob/script.h
index e038507c52..31153407f1 100644
--- a/engines/gob/script.h
+++ b/engines/gob/script.h
@@ -120,6 +120,7 @@ public:
uint8 getVersionMajor() const;
uint8 getVersionMinor() const;
uint32 getVariablesCount() const;
+ uint32 getTextsOffset() const;
uint8 getImFileNumber() const;
uint8 getExFileNumber() const;
uint8 getCommunHandling() const;
@@ -147,6 +148,7 @@ private:
uint8 _versionMajor;
uint8 _versionMinor;
uint32 _variablesCount;
+ uint32 _textsOffset;
uint8 _imFileNumber;
uint8 _exFileNumber;
uint8 _communHandling;