From 83524863d744c71eb5083fc4f9ce32d576f7810d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 May 2013 23:01:15 -0400 Subject: [PATCH] VOYEUR: Implemented remaining Bolt init methods --- engines/voyeur/events.cpp | 9 +++++++ engines/voyeur/events.h | 4 ++- engines/voyeur/files.cpp | 56 ++++++++++++++++++++++++++++++++++----- engines/voyeur/files.h | 32 ++++++++++++++++++++++ 4 files changed, 94 insertions(+), 7 deletions(-) diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index 2fb41475e7b..f84c97879a3 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -25,6 +25,10 @@ namespace Voyeur { +EventsManager::EventsManager() { + _cycleStatus = 0; +} + void EventsManager::resetMouse() { // No implementation } @@ -40,4 +44,9 @@ void EventsManager::mainVoyeurIntFunc() { } +void EventsManager::vStopCycle() { + _cycleIntNode._flags = 1; + _cycleStatus &= 2; +} + } // End of namespace Voyeur diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index 0acdc73908a..a3696a95681 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -40,12 +40,14 @@ public: IntNode _cycleIntNode; IntNode _evintnode; IntNode _mainIntNode; + int _cycleStatus; public: - EventsManager() {} + EventsManager(); void setVm(VoyeurEngine *vm) { _vm = vm; } void resetMouse(); void startMainClockInt(); + void vStopCycle(); }; } // End of namespace Voyeur diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index 811bdf600ba..74c2f17103b 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -365,11 +365,16 @@ void BoltFile::sInitPic() { } void BoltFile::vInitCMap() { - error("TODO: vInitCMap not implemented"); + initDefault(); + _state._curMemberPtr->_cMapResource = new CMapResource( + _state, _state._curMemberPtr->_data); } void BoltFile::vInitCycl() { - error("TODO: vInitCycl not implemented"); + initDefault(); + _state._vm->_eventsManager.vStopCycle(); + _state._curMemberPtr->_vInitCyclResource = new VInitCyclResource( + _state, _state._curMemberPtr->_data); } void BoltFile::initViewPort() { @@ -385,11 +390,13 @@ void BoltFile::initViewPortList() { } void BoltFile::initFontInfo() { - error("TODO: initFontInfo not implemented"); + initDefault(); + _state._curMemberPtr->_fontResource = new FontResource( + _state, _state._curMemberPtr->_data); } void BoltFile::initSoundMap() { - error("TODO: initSoundMap not implemented"); + initDefault(); } /*------------------------------------------------------------------------*/ @@ -422,6 +429,10 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) { _data = NULL; _picResource = NULL; _viewPortResource = NULL; + _viewPortListResource = NULL; + _fontResource = NULL; + _cMapResource = NULL; + _vInitCyclResource = NULL; byte buffer[16]; _file->read(&buffer[0], 16); @@ -438,6 +449,9 @@ BoltEntry::~BoltEntry() { delete _picResource; delete _viewPortResource; delete _viewPortListResource; + delete _fontResource; + delete _cMapResource; + delete _vInitCyclResource; } void BoltEntry::load() { @@ -561,8 +575,9 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src) { /*------------------------------------------------------------------------*/ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) { - uint32 *idP = (uint32 *)&src[0]; - uint count = READ_LE_UINT32(idP++); + uint count = READ_LE_UINT16(src); + + uint32 *idP = (uint32 *)&src[8]; for (uint i = 0; i < count; ++i, ++idP) { uint32 id = READ_LE_UINT32(idP); @@ -574,4 +589,33 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr state._curLibPtr->resolveIt(READ_LE_UINT32(&src[4]), &_field4); } +/*------------------------------------------------------------------------*/ + +FontResource::FontResource(BoltFilesState &state, const byte *src) { + state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0xC), &_fieldC); +} + +/*------------------------------------------------------------------------*/ + +CMapResource::CMapResource(BoltFilesState &state, const byte *src) { + _start = READ_LE_UINT16(src + 2); + _end = READ_LE_UINT16(src + 4); + + int count = _end - _start; + _palette = new byte[count * 3]; + Common::copy(src + 6, src + 6 + 3 * count, _palette); +} + +CMapResource::~CMapResource() { + delete[] _palette; +} + +/*------------------------------------------------------------------------*/ + +VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) { + for (int i = 0; i < 4; ++i) { + state._curLibPtr->resolveIt(READ_LE_UINT32(src + 8 + i * 4), &_ptr[i]); + } +} + } // End of namespace Voyeur diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 47ef5a1f460..eb0c313c3b2 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -37,6 +37,9 @@ class BoltEntry; class PictureResource; class ViewPortResource; class ViewPortListResource; +class FontResource; +class CMapResource; +class VInitCyclResource; #define DECOMPRESS_SIZE 0x7000 @@ -163,6 +166,9 @@ public: PictureResource *_picResource; ViewPortResource *_viewPortResource; ViewPortListResource *_viewPortListResource; + FontResource *_fontResource; + CMapResource *_cMapResource; + VInitCyclResource *_vInitCyclResource; public: BoltEntry(Common::SeekableReadStream *f); virtual ~BoltEntry(); @@ -231,6 +237,32 @@ public: virtual ~ViewPortListResource() {} }; +class FontResource { +public: + byte *_fieldC; + + FontResource(BoltFilesState &state, const byte *src); + virtual ~FontResource() {} +}; + +class CMapResource { +public: + int _start; + int _end; + byte *_palette; +public: + CMapResource(BoltFilesState &state, const byte *src); + virtual ~CMapResource(); +}; + +class VInitCyclResource { +public: + byte *_ptr[4]; +public: + VInitCyclResource(BoltFilesState &state, const byte *src); + virtual ~VInitCyclResource() {} +}; + } // End of namespace Voyeur #endif /* VOYEUR_FILES_H */