diff options
-rw-r--r-- | engines/voyeur/files.cpp | 27 | ||||
-rw-r--r-- | engines/voyeur/files.h | 7 | ||||
-rw-r--r-- | engines/voyeur/files_threads.cpp | 10 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 18 | ||||
-rw-r--r-- | engines/voyeur/voyeur_game.cpp | 4 |
5 files changed, 39 insertions, 27 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index 8d0b1a63a4..a9473d4b70 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -242,7 +242,7 @@ BoltFile::~BoltFile() { _state._curFd = NULL; } -BoltGroup *BoltFile::getBoltGroup(uint32 id) { +BoltGroup *BoltFile::getBoltGroup(uint16 id, bool process) { ++_state._fromGroupFlag; _state._curLibPtr = this; _state._curGroupPtr = &_groups[(id >> 8) & 0xff]; @@ -255,7 +255,8 @@ BoltGroup *BoltFile::getBoltGroup(uint32 id) { if (_state._curGroupPtr->_callInitGro) initGro(); - if ((id >> 8) != 0) { + if (process) { + // Pre-process the resources id &= 0xff00; for (int idx = 0; idx < _state._curGroupPtr->_count; ++idx, ++id) { byte *member = getBoltMember(id); @@ -272,7 +273,9 @@ BoltGroup *BoltFile::getBoltGroup(uint32 id) { return _state._curGroupPtr; } -void BoltFile::freeBoltGroup(uint32 id) { +void BoltFile::freeBoltGroup(uint16 id, bool freeEntries) { + // TODO: I currently ignore freeEntries flag, in favour of always + // freeing. Need to check whether this can really ever be false. _state._curLibPtr = this; _state._curGroupPtr = &_groups[(id >> 8) & 0xff]; @@ -691,9 +694,13 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) { _imgData = NULL; int nbytes = _bounds.width() * _bounds.height(); - if (_flags & 0x20) { - error("TODO: sInitPic flags&0x20"); - } else if (_flags & 8) { + if (_flags & PICFLAG_20) { + if (_flags & (PICFLAG_80 | PICFLAG_40)) { + error("TODO: sInitPic"); + } else { + error("TODO: sInitPic"); + } + } else if (_flags & PICFLAG_8) { int mode = 0; if (_bounds.width() == 320) { mode = 147; @@ -724,15 +731,15 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) { } // byte *imgData = _imgData; - if (_flags & 0x10) { + if (_flags & PICFLAG_10) { // TODO: Figure out what it's doing. Looks like a direct clearing // of the screen directly } else { // TODO: Figure out direct screen loading } } else { - if (_flags & 0x1000) { - if (!(_flags & 0x10)) + if (_flags & PICFLAG_1000) { + if (!(_flags & PICFLAG_10)) nbytes = state._curMemberPtr->_size - 24; int mask = (nbytes + 0x3FFF) >> 14; @@ -753,7 +760,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) { } } - if (_flags & 0x10) { + if (_flags & PICFLAG_10) { _imgData = new byte[nbytes]; Common::fill(_imgData, _imgData + nbytes, 0); } else { diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index c81761af17..28c77bb5f1 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -119,8 +119,8 @@ public: BoltFile(const Common::String &filename, BoltFilesState &state); virtual ~BoltFile(); - BoltGroup *getBoltGroup(uint32 id); - void freeBoltGroup(uint32 id); + BoltGroup *getBoltGroup(uint16 id, bool process = true); + void freeBoltGroup(uint16 id, bool freeEntries = true); void freeBoltMember(uint32 id); byte *memberAddr(uint32 id); byte *memberAddrOffset(uint32 id); @@ -241,6 +241,9 @@ public: /* bvoy.blt resource types */ +enum PictureFlag { PICFLAG_8 = 8, PICFLAG_10 = 0x10, PICFLAG_20 = 0x20, + PICFLAG_40 = 0x40, PICFLAG_80 = 0x80, PICFLAG_1000 = 0x1000 }; + class PictureResource: public DisplayResource { public: byte _select; diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 0143084645..944fbc0c6e 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -421,7 +421,7 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager.incrementTime(1); _vm->_eventsManager.incrementTime(1); - _vm->_bVoy->freeBoltGroup(0x17F00); + _vm->_bVoy->freeBoltGroup(0x7F00); _vm->_voy._field478 = -17; _vm->_eventsManager._videoComputerBut4 = -1; _vm->_voy._field470 = 129; @@ -459,7 +459,7 @@ void ThreadResource::parsePlayCommands() { _vm->_playStamp1 = -1; if (_vm->_eventsManager._videoDead != -1) { - _vm->_bVoy->freeBoltGroup(0x10E00); + _vm->_bVoy->freeBoltGroup(0xE00); _vm->_eventsManager._videoDead = -1; (*_vm->_graphicsManager._vPort)->_flags |= 8; @@ -1434,8 +1434,9 @@ void ThreadResource::freeTheApt() { } void ThreadResource::doAptAnim(int mode) { - _vm->_bVoy->freeBoltGroup(0x10100); + _vm->_bVoy->freeBoltGroup(0x100, true); + // Figure out the resource to use int id = 0; switch (_vm->_voy._field472) { case 140: @@ -1479,6 +1480,7 @@ void ThreadResource::doAptAnim(int mode) { if (mode) id += 0x100; + // Do the display if (_vm->_bVoy->getBoltGroup(id)) { CMapResource *pal = _vm->_bVoy->boltEntry(id)._cMapResource; pal->_steps = 1; @@ -1497,7 +1499,7 @@ void ThreadResource::doAptAnim(int mode) { _vm->_bVoy->freeBoltGroup(id); } - _vm->_bVoy->getBoltGroup(0x10100); + _vm->_bVoy->getBoltGroup(0x100); } } // End of namespace Voyeur diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index f143b0d643..bb8b137b3e 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -124,8 +124,8 @@ void VoyeurEngine::globalInitBolt() { initBolt(); _filesManager.openBoltLib("bvoy.blt", _bVoy); - _bVoy->getBoltGroup(0x10000); - _bVoy->getBoltGroup(0x10100); + _bVoy->getBoltGroup(0x000); + _bVoy->getBoltGroup(0x100); _graphicsManager._fontPtr = &_defaultFontInfo; _graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource; @@ -163,7 +163,7 @@ bool VoyeurEngine::doHeadTitle() { _eventsManager.startMainClockInt(); // Show starting screen -// if (_bVoy->getBoltGroup(0x10500)) +// if (_bVoy->getBoltGroup(0x500)) // showConversionScreen(); if (shouldQuit()) return false; @@ -236,7 +236,7 @@ void VoyeurEngine::showConversionScreen() { _eventsManager.delay(1); _graphicsManager.screenReset(); - _bVoy->freeBoltGroup(0x10500); + _bVoy->freeBoltGroup(0x500); } @@ -253,7 +253,7 @@ bool VoyeurEngine::doLock() { int keyCount; int key; - if (_bVoy->getBoltGroup(0x10700)) { + if (_bVoy->getBoltGroup(0x700)) { lock.getSysDate(); lock.getThePassword(); @@ -416,7 +416,7 @@ bool VoyeurEngine::doLock() { lock.saveThePassword(); _voy._field4386 = NULL; - _bVoy->freeBoltGroup(0x10700); + _bVoy->freeBoltGroup(0x700); } _eventsManager.mouseOff(); @@ -428,7 +428,7 @@ bool VoyeurEngine::doLock() { } void VoyeurEngine::showTitleScreen() { - if (_bVoy->getBoltGroup(0x10500)) { + if (_bVoy->getBoltGroup(0x500)) { _graphicsManager._backgroundPage = _bVoy->getPictureResource(0x500); (*_graphicsManager._vPort)->setupViewPort(); @@ -468,7 +468,7 @@ void VoyeurEngine::showTitleScreen() { playRL2Video("a1100100.rl2"); _graphicsManager.screenReset(); - _bVoy->freeBoltGroup(0x10500); + _bVoy->freeBoltGroup(0x500); } } @@ -476,7 +476,7 @@ void VoyeurEngine::doOpening() { /* _graphicsManager.screenReset(); - if (!_bVoy->getBoltGroup(0x10200)) + if (!_bVoy->getBoltGroup(0x200, true)) return; byte *frameTable = _bVoy->memberAddr(0x215); diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index 93bb9d95b6..172150360d 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -39,7 +39,7 @@ void VoyeurEngine::playStamp() { _stampLibPtr = NULL; _filesManager.openBoltLib("stampblt.blt", _stampLibPtr); - _stampLibPtr->getBoltGroup(0x10000); + _stampLibPtr->getBoltGroup(0); _resolvePtr = &RESOLVE_TABLE[0]; initStamp(); @@ -210,7 +210,7 @@ void VoyeurEngine::playStamp() { _voy._field4386 = 0; closeStamp(); - _stampLibPtr->freeBoltGroup(0x10000); + _stampLibPtr->freeBoltGroup(0); delete _stampLibPtr; } |