diff options
author | Paul Gilbert | 2013-12-08 23:44:06 -0500 |
---|---|---|
committer | Paul Gilbert | 2013-12-08 23:44:06 -0500 |
commit | afc4e0ed333ca4acd5fcb092362f9910225ffd93 (patch) | |
tree | 05252f4650b9b0857983a9ed7ee3ddeb224852f8 /engines | |
parent | ce9b127cbcea20c827cd20b0385776338b08b7bc (diff) | |
download | scummvm-rg350-afc4e0ed333ca4acd5fcb092362f9910225ffd93.tar.gz scummvm-rg350-afc4e0ed333ca4acd5fcb092362f9910225ffd93.tar.bz2 scummvm-rg350-afc4e0ed333ca4acd5fcb092362f9910225ffd93.zip |
VOYEUR: Implemented thread getButtonsText and support methods
Diffstat (limited to 'engines')
-rw-r--r-- | engines/voyeur/files.cpp | 66 | ||||
-rw-r--r-- | engines/voyeur/files.h | 3 |
2 files changed, 68 insertions, 1 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index 5b7e475640..c5838637c8 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -1387,7 +1387,21 @@ byte *ThreadResource::getDataOffset() { } void ThreadResource::getButtonsText() { - warning("TODO: stm_getButtonsText"); + int idx = 0; + + for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + if (*p == 0xC0) { + ++p; + if (*p++ & 0x80) { + assert(idx < 7); + _field8E[idx] = getRecordOffset(p); + p += 4; + } + + ++idx; + _field8E[idx] = NULL; + } + } } void ThreadResource::unloadAllStacks(VoyeurEngine *vm) { @@ -1403,6 +1417,56 @@ void ThreadResource::initUseCount() { Common::fill(&_useCount[0], &_useCount[8], 0); } +const byte *ThreadResource::getRecordOffset(const byte *p) { + uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(p + 6); + return _ctlPtr + recSize; +} + +const byte *ThreadResource::getNextRecord(const byte *p) { + byte v = *p++; + + switch (v) { + case 2: + case 4: + case 6: + case 8: + case 10: + return p + 8; + case 1: + case 3: + case 5: + case 7: + case 9: + case 11: + case 21: + case 22: + case 25: + case 26: + return p + 5; + case 17: + case 23: + case 24: + case 27: + case 28: + return p + 2; + case 19: + case 41: + return p + 6; + case 18: + case 51: + case 52: + return p + 1; + case 74: + return p + 4; + case 192: + if (*p * 0x80) + p += 4; + return p + 2; + default: + return p; + } +} + /*------------------------------------------------------------------------*/ PtrResource::PtrResource(BoltFilesState &state, const byte *src) { diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 1beb091a19..13023f80fb 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -424,6 +424,8 @@ private: bool getStateInfo(); byte *getDataOffset(); void getButtonsText(); + const byte *getRecordOffset(const byte *p); + const byte *getNextRecord(const byte *p); public: VoyeurEngine *_vm; @@ -439,6 +441,7 @@ public: int _field44; uint32 _field46; byte *_field4A; + const byte *_field8E[8]; byte *_ctlPtr; byte *_field28E; |