diff options
-rw-r--r-- | engines/voyeur/events.cpp | 14 | ||||
-rw-r--r-- | engines/voyeur/events.h | 13 | ||||
-rw-r--r-- | engines/voyeur/files.cpp | 53 | ||||
-rw-r--r-- | engines/voyeur/files.h | 19 | ||||
-rw-r--r-- | engines/voyeur/graphics.cpp | 37 | ||||
-rw-r--r-- | engines/voyeur/graphics.h | 16 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 35 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 10 |
8 files changed, 159 insertions, 38 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index f84172f559..2fb41475e7 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -21,10 +21,22 @@ */ #include "voyeur/events.h" +#include "voyeur/voyeur.h" namespace Voyeur { -void EventManager::resetMouse() { +void EventsManager::resetMouse() { + // No implementation +} + +void EventsManager::startMainClockInt() { + _mainIntNode._intFunc = mainVoyeurIntFunc; + _mainIntNode._flags = 0; + _mainIntNode._curTime = 0; + _mainIntNode._timeReset = _vm->_graphicsManager._palFlag ? 50 : 60; +} + +void EventsManager::mainVoyeurIntFunc() { } diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index 1588cac35d..0acdc73908 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -24,19 +24,28 @@ #define VOYEUR_EVENTS_H #include "common/scummsys.h" +#include "voyeur/game.h" namespace Voyeur { class VoyeurEngine; -class EventManager { +class EventsManager { private: VoyeurEngine *_vm; + + static void mainVoyeurIntFunc(); +public: + IntNode _fadeIntNode; + IntNode _cycleIntNode; + IntNode _evintnode; + IntNode _mainIntNode; public: - EventManager() {} + EventsManager() {} void setVm(VoyeurEngine *vm) { _vm = vm; } void resetMouse(); + void startMainClockInt(); }; } // End of namespace Voyeur diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index ca54a89074..32b8917d0a 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -67,6 +67,16 @@ int BoltFile::_runType; int BoltFile::_runValue; int BoltFile::_runOffset; +const BoltMethodPtr BoltFile::_fnInitType[25] = { + &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, + &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, + &BoltFile::sInitPic, &BoltFile::initDefault, &BoltFile::vInitCMap, &BoltFile::vInitCycl, + &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initViewPort, + &BoltFile::initViewPortList, &BoltFile::initDefault, &BoltFile::initFontInfo, + &BoltFile::initSoundMap, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, + &BoltFile::initDefault, &BoltFile::initDefault +}; + BoltFile::BoltFile() { if (!_curFd.open("bvoy.blt")) error("Could not open buoy.blt"); @@ -167,13 +177,12 @@ byte *BoltFile::getBoltMember(uint32 id) { _decompState = 0; _historyIndex = 0; - initType(); - return _curMemberPtr->_data; -} + // Initialise the resource + assert(_curMemberPtr->_initMethod < 25); + (this->*_fnInitType[_curMemberPtr->_initMethod])(); -void BoltFile::initType() { - _curMemberPtr->_data = decompress(0, _curMemberPtr->_size, _curMemberPtr->_mode); + return _curMemberPtr->_data; } #define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock() @@ -287,6 +296,38 @@ void BoltFile::nextBlock() { _bufPos = _bufStart; } +void BoltFile::initDefault() { + _curMemberPtr->_data = decompress(0, _curMemberPtr->_size, _curMemberPtr->_mode); +} + +void BoltFile::sInitPic() { + error("TODO: sInitPic not implemented"); +} + +void BoltFile::vInitCMap() { + error("TODO: vInitCMap not implemented"); +} + +void BoltFile::vInitCycl() { + error("TODO: vInitCycl not implemented"); +} + +void BoltFile::initViewPort() { + error("TODO: initViewPort not implemented"); +} + +void BoltFile::initViewPortList() { + error("TODO: initViewPortList not implemented"); +} + +void BoltFile::initFontInfo() { + error("TODO: initFontInfo not implemented"); +} + +void BoltFile::initSoundMap() { + error("TODO: initSoundMap not implemented"); +} + /*------------------------------------------------------------------------*/ BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) { @@ -320,7 +361,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) { _file->read(&buffer[0], 16); _mode = buffer[0]; _field1 = buffer[1]; - _field3 = buffer[3]; + _initMethod = buffer[3]; _xorMask = buffer[4] & 0xff; // TODO: Is this right?? _size = READ_LE_UINT32(&buffer[4]); _fileOffset = READ_LE_UINT32(&buffer[8]); diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 1503ddf15a..095d3eacab 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -30,10 +30,13 @@ namespace Voyeur { class VoyeurEngine; +class BoltFile; class BoltGroup; class BoltEntry; #define DECOMPRESS_SIZE 0x7000 +typedef void (BoltFile::*BoltMethodPtr)(); + class BoltFile { private: static BoltFile *_curLibPtr; @@ -59,10 +62,21 @@ private: static int _runType; static int _runValue; static int _runOffset; + static const BoltMethodPtr _fnInitType[25]; private: Common::File _curFd; Common::Array<BoltGroup> _groups; + // initType method table + void initDefault(); + void sInitPic(); + void vInitCMap(); + void vInitCycl(); + void initViewPort(); + void initViewPortList(); + void initFontInfo(); + void initSoundMap(); + // Decompression byte *decompress(byte *buf, int size, int mode); void nextBlock(); @@ -70,8 +84,7 @@ private: void resolveAll() {} byte *getBoltMember(uint32 id); - // Methods copied into bolt virtual table - void initType(); + void initType() {} void termType() {} void initMem(int id) {} void termMem() {} @@ -108,7 +121,7 @@ private: public: byte _mode; byte _field1; - byte _field3; + byte _initMethod; int _fileOffset; byte _xorMask; int _size; diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp index 4b1e05c9ff..2261b4f73b 100644 --- a/engines/voyeur/graphics.cpp +++ b/engines/voyeur/graphics.cpp @@ -37,17 +37,18 @@ void GraphicsManager::sInitGraphics() { } void GraphicsManager::addFadeInt() { - _fadeIntNode._intFunc = fadeIntFunc; - _fadeIntNode._flags = 0; - _fadeIntNode._curTime = 0; - _fadeIntNode._timeReset = 1; + IntNode &node = _vm->_eventsManager._fadeIntNode; + node._intFunc = fadeIntFunc; + node._flags = 0; + node._curTime = 0; + node._timeReset = 1; - _vm->_intPtr.addIntNode(&_fadeIntNode); + _vm->_intPtr.addIntNode(&node); } void GraphicsManager::vInitColor() { - _fadeIntNode._intFunc = vDoFadeInt; - _cycleIntNode._intFunc = vDoCycleInt; + _vm->_eventsManager._fadeIntNode._intFunc = vDoFadeInt; + _vm->_eventsManager._cycleIntNode._intFunc = vDoCycleInt; // TODO: more } @@ -63,4 +64,26 @@ void GraphicsManager::vDoCycleInt() { } +void GraphicsManager::setupViewPort() { + setupViewPort(&GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect, + &GraphicsManager::restoreMCGASaveRect); +} + +void GraphicsManager::setupViewPort(GraphicMethodPtr setupFn, + GraphicMethodPtr addRectFn, GraphicMethodPtr restoreFn) { + +} + +void GraphicsManager::setupMCGASaveRect() { + +} + +void GraphicsManager::restoreMCGASaveRect() { + +} + +void GraphicsManager::addRectOptSaveRect() { + +} + } // End of namespace Voyeur diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h index d92a6b6268..a0f01dfc63 100644 --- a/engines/voyeur/graphics.h +++ b/engines/voyeur/graphics.h @@ -36,22 +36,29 @@ namespace Voyeur { #define PALETTE_SIZE (256 * 3) class VoyeurEngine; +class GraphicsManager; + +typedef void (GraphicsManager::*GraphicMethodPtr)(); class GraphicsManager { public: VoyeurEngine *_vm; bool _palFlag; - IntNode _fadeIntNode; - IntNode _cycleIntNode; - IntNode _evintnode; - IntNode _mainintnode; byte _VGAColors[PALETTE_SIZE]; Common::Array<byte *> _colorChain; + byte *_backgroundPage; private: static void fadeIntFunc(); static void vDoFadeInt(); static void vDoCycleInt(); + + void setupMCGASaveRect(); + void restoreMCGASaveRect(); + void addRectOptSaveRect(); + void addIntNode(IntNode *node); + void setupViewPort(GraphicMethodPtr setupFn, GraphicMethodPtr addRectFn, + GraphicMethodPtr restoreFn); public: GraphicsManager(); void setVm(VoyeurEngine *vm) { _vm = vm; } @@ -59,6 +66,7 @@ public: void vInitColor(); void addFadeInt(); + void setupViewPort(); }; } // End of namespace Voyeur diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index ac1105e4c7..beded3e6fd 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -33,11 +33,13 @@ VoyeurEngine *g_vm; VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _randomSource("Voyeur") { DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); - _bVoyBoltFile = NULL; + _bVoy = NULL; + + initialiseManagers(); } VoyeurEngine::~VoyeurEngine() { - delete _bVoyBoltFile; + delete _bVoy; } Common::String VoyeurEngine::generateSaveName(int slot) { @@ -77,7 +79,8 @@ Common::Error VoyeurEngine::run() { ESP_Init(); globalInitBolt(); - _eventManager.resetMouse(); + _eventsManager.resetMouse(); + doHeadTitle(); //doHeadTitle(); @@ -90,7 +93,7 @@ int VoyeurEngine::getRandomNumber(int maxNumber) { } void VoyeurEngine::initialiseManagers() { - _eventManager.setVm(this); + _eventsManager.setVm(this); _graphicsManager.setVm(this); } @@ -100,22 +103,22 @@ void VoyeurEngine::ESP_Init() { void VoyeurEngine::globalInitBolt() { initBolt(); - _filesManager.openBoltLib("bvoy.blt", _bVoyBoltFile); - _bVoyBoltFile->getBoltGroup(0x10000); - _bVoyBoltFile->getBoltGroup(0x10100); - _fontPtr = _bVoyBoltFile->memberAddr(0x101); + _filesManager.openBoltLib("bvoy.blt", _bVoy); + _bVoy->getBoltGroup(0x10000); + _bVoy->getBoltGroup(0x10100); + _fontPtr = _bVoy->memberAddr(0x101); // Setup default flags Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0); _voy._eCursorOff[0x74 / 2] = 1; _voy._eCursorOff[0x68 / 2] = 0; - _voy._eventTable[0x3e6]._data3 = 63; - _voy._eventTable[0x3e6]._data4 = 63; + _voy._eventTable[998]._data3 = 63; + _voy._eventTable[998]._data4 = 63; _voy._evidence[19] = 0; _voy._evidence[17] = 0; _voy._evidence[18] = 9999; - _voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; + _voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; _graphicsManager.addFadeInt(); } @@ -133,4 +136,14 @@ void VoyeurEngine::vInitInterrupts() { void VoyeurEngine::initInput() { } +void VoyeurEngine::doHeadTitle() { + char dest[144]; + + _eventsManager.startMainClockInt(); + if (_bVoy->getBoltGroup(0x10500)) { + _graphicsManager._backgroundPage = _bVoy->memberAddr(0x502); +// _graphicsManager._vPort.setupViewPort(); + } +} + } // End of namespace Voyeur diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index 6676b1c742..d8fb4ad711 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -62,11 +62,8 @@ class VoyeurEngine : public Engine { private: const VoyeurGameDescription *_gameDescription; Common::RandomSource _randomSource; - EventManager _eventManager; - FilesManager _filesManager; - GraphicsManager _graphicsManager; - BoltFile *_bVoyBoltFile; + BoltFile *_bVoy; byte *_fontPtr; SVoy _voy; Common::Array<int> _resolves; @@ -83,6 +80,9 @@ protected: virtual bool hasFeature(EngineFeature f) const; public: IntData _intPtr; + EventsManager _eventsManager; + FilesManager _filesManager; + GraphicsManager _graphicsManager; public: VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc); virtual ~VoyeurEngine(); @@ -100,6 +100,8 @@ public: virtual bool canSaveGameStateCurrently(); virtual Common::Error loadGameState(int slot); virtual Common::Error saveGameState(int slot, const Common::String &desc); + + void doHeadTitle(); }; } // End of namespace Voyeur |