diff options
author | Paul Gilbert | 2013-12-08 10:40:26 -0500 |
---|---|---|
committer | Paul Gilbert | 2013-12-08 10:40:26 -0500 |
commit | a86b1c3d583d0c1646844e23005f3197fca608f3 (patch) | |
tree | fc761f0502b050bb9290541591cbc94394a6d070 /engines | |
parent | a6ceaf29854a47785c7a36831bea41411e1bb0cf (diff) | |
download | scummvm-rg350-a86b1c3d583d0c1646844e23005f3197fca608f3.tar.gz scummvm-rg350-a86b1c3d583d0c1646844e23005f3197fca608f3.tar.bz2 scummvm-rg350-a86b1c3d583d0c1646844e23005f3197fca608f3.zip |
VOYEUR: Implementation of basic StampBoltFile resource types
Diffstat (limited to 'engines')
-rw-r--r-- | engines/voyeur/files.cpp | 64 | ||||
-rw-r--r-- | engines/voyeur/files.h | 31 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 1 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 4 | ||||
-rw-r--r-- | engines/voyeur/voyeur_game.cpp | 10 |
5 files changed, 105 insertions, 5 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index 9f7242c0d2..ab8c54d1cd 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -532,12 +532,35 @@ StampBoltFile::StampBoltFile(BoltFilesState &state): BoltFile("stampblt.blt", st void StampBoltFile::initResource(int resType) { switch (resType) { + case 6: + initPtr(); + break; + case 24: + initControl(); + break; default: initDefault(); break; } } +void StampBoltFile::initPtr() { + initDefault(); + + _state._curMemberPtr->_ptrResource = new PtrResource(_state, + _state._curMemberPtr->_data); +} + +void StampBoltFile::initControl() { + initDefault(); + + ControlResource *res; + _state._curMemberPtr->_controlResource = res = new ControlResource(_state, + _state._curMemberPtr->_data); + + _state._vm->_controlPtr = res; +} + /*------------------------------------------------------------------------*/ BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) { @@ -585,6 +608,8 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) { _fontInfoResource = NULL; _cMapResource = NULL; _vInitCyclResource = NULL; + _ptrResource = NULL; + _controlResource = NULL; byte buffer[16]; _file->read(&buffer[0], 16); @@ -605,6 +630,8 @@ BoltEntry::~BoltEntry() { delete _fontInfoResource; delete _cMapResource; delete _vInitCyclResource; + delete _ptrResource; + delete _controlResource; } void BoltEntry::load() { @@ -617,7 +644,8 @@ void BoltEntry::load() { */ bool BoltEntry::hasResource() const { return _picResource || _viewPortResource || _viewPortListResource - || _fontResource || _fontInfoResource || _cMapResource || _vInitCyclResource; + || _fontResource || _fontInfoResource || _cMapResource + || _vInitCyclResource || _ptrResource || _controlResource; } /*------------------------------------------------------------------------*/ @@ -1257,4 +1285,38 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) { } } +/*------------------------------------------------------------------------*/ + +PtrResource::PtrResource(BoltFilesState &state, const byte *src) { + // Load pointer list + uint32 *idP = (uint32 *)&src[0]; + int size = state._curMemberPtr->_size; + + for (int i = 0; i < size / 4; ++i, ++idP) { + uint32 id = READ_LE_UINT32(idP); + BoltEntry &entry = state._curLibPtr->getBoltEntryFromLong(id); + + _entries.push_back(&entry); + } +} + +/*------------------------------------------------------------------------*/ + +ControlResource::ControlResource(BoltFilesState &state, const byte *src) { + // Get pointer + uint32 ptrId = READ_LE_UINT32(&src[0x32]); + _ptr = state._curLibPtr->getBoltEntryFromLong(ptrId)._data; + + // Load pointer list + uint32 *idP = (uint32 *)&src[0x10]; + int count = READ_LE_UINT16(&src[0x36]); + + for (int i = 0; i < count; ++i, ++idP) { + uint32 id = READ_LE_UINT32(idP); + BoltEntry &entry = state._curLibPtr->getBoltEntryFromLong(id); + + _entries.push_back(entry._data); + } +} + } // End of namespace Voyeur diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 0871a5eeae..584328c853 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -41,6 +41,8 @@ class ViewPortListResource; class FontResource; class CMapResource; class VInitCyclResource; +class PtrResource; +class ControlResource; #define DECOMPRESS_SIZE 0x7000 @@ -147,6 +149,9 @@ public: }; class StampBoltFile: public BoltFile { +private: + void initPtr(); + void initControl(); protected: virtual void initResource(int resType); public: @@ -185,6 +190,7 @@ public: int _size; byte *_data; + // bvoy.blt resource types PictureResource *_picResource; ViewPortResource *_viewPortResource; ViewPortListResource *_viewPortListResource; @@ -192,6 +198,10 @@ public: FontInfoResource *_fontInfoResource; CMapResource *_cMapResource; VInitCyclResource *_vInitCyclResource; + + // stampblt.blt resource types + PtrResource *_ptrResource; + ControlResource *_controlResource; public: BoltEntry(Common::SeekableReadStream *f); virtual ~BoltEntry(); @@ -225,6 +235,8 @@ public: uint32 _flags; }; +/* bvoy.blt resource types */ + class PictureResource: public DisplayResource { public: byte _select; @@ -376,6 +388,25 @@ public: virtual ~VInitCyclResource() {} }; +/* stampblt.blt resources */ + +class PtrResource { +public: + Common::Array<BoltEntry *> _entries; + + PtrResource(BoltFilesState &state, const byte *src); + virtual ~PtrResource() {} +}; + +class ControlResource { +public: + byte *_ptr; + Common::Array<byte *> _entries; + + ControlResource(BoltFilesState &state, const byte *src); + virtual ~ControlResource() {} +}; + } // End of namespace Voyeur #endif /* VOYEUR_FILES_H */ diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 72de920680..b890d0af95 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -40,6 +40,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); _bVoy = NULL; _iForceDeath = -1; + _controlPtr = NULL; initialiseManagers(); } diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index 56301e5107..681e87637b 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -83,7 +83,7 @@ private: void doOpening(); void playStamp(); - void initThreadStruct(int commandId); + void initThreadStruct(byte *threadStruct); protected: // Engine APIs virtual Common::Error run(); @@ -96,6 +96,8 @@ public: GraphicsManager _graphicsManager; SoundManager _soundManager; SVoy _voy; + + ControlResource *_controlPtr; public: VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc); virtual ~VoyeurEngine(); diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index 43227d3dd8..fc21604651 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -41,9 +41,9 @@ void VoyeurEngine::playStamp() { boltFile->getBoltGroup(0x10000); _voy._resolvePtr = &RESOLVE_TABLE[0]; - byte *commandData = boltFile->memberAddr(3); - //uint32 commandId = READ_LE_UINT32(commandData); - //initThreadStruct(commandId); + PtrResource *threadsList = boltFile->boltEntry(3)._ptrResource; + byte *threadP = threadsList->_entries[0]->_data; + initThreadStruct(threadP); _voy._delaySecs = 0; _eventsManager._videoComputerNum = 9; @@ -59,4 +59,8 @@ void VoyeurEngine::playStamp() { _voy._field4386 = 0; } +void VoyeurEngine::initThreadStruct(byte *threadStruct) { + // TODO +} + } // End of namespace Voyeur |