VOYEUR: Implementation of basic StampBoltFile resource types

This commit is contained in:
Paul Gilbert 2013-12-08 10:40:26 -05:00
parent a6ceaf2985
commit a86b1c3d58
5 changed files with 105 additions and 5 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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();
}

View File

@ -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();

View File

@ -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