diff options
-rw-r--r-- | engines/voyeur/events.cpp | 84 | ||||
-rw-r--r-- | engines/voyeur/events.h | 24 | ||||
-rw-r--r-- | engines/voyeur/files.cpp | 9 | ||||
-rw-r--r-- | engines/voyeur/files.h | 5 | ||||
-rw-r--r-- | engines/voyeur/game.cpp | 13 | ||||
-rw-r--r-- | engines/voyeur/game.h | 15 | ||||
-rw-r--r-- | engines/voyeur/graphics.cpp | 28 | ||||
-rw-r--r-- | engines/voyeur/graphics.h | 6 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 6 |
9 files changed, 109 insertions, 81 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index a59d11ca45..88a0be879f 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -26,9 +26,19 @@ namespace Voyeur { +IntNode::IntNode() { + _intFunc = NULL; + _curTime = 0; + _timeReset = 0; + _flags = 0; +} + +/*------------------------------------------------------------------------*/ + EventsManager::EventsManager(): _intPtr(_audioStruc) { _cycleStatus = 0; _mouseButton = 0; + _fadeStatus = 0; _priorFrameTime = g_system->getMillis(); Common::fill(&_keyState[0], &_keyState[256], false); } @@ -38,14 +48,14 @@ void EventsManager::resetMouse() { } void EventsManager::startMainClockInt() { - _mainIntNode._intFunc = mainVoyeurIntFunc; + _mainIntNode._intFunc = &EventsManager::mainVoyeurIntFunc; _mainIntNode._flags = 0; _mainIntNode._curTime = 0; _mainIntNode._timeReset = _vm->_graphicsManager._palFlag ? 50 : 60; } void EventsManager::mainVoyeurIntFunc() { - + // TODO } void EventsManager::vStopCycle() { @@ -159,7 +169,7 @@ void EventsManager::startFade(CMapResource *cMap) { _fadeCount = cMap->_steps + 1; if (cMap->_steps > 0) { - _vm->_graphicsManager._fadeStatus = cMap->_fadeStatus | 1; + _fadeStatus = cMap->_fadeStatus |= 1; byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3]; int mapIndex = 0; @@ -167,16 +177,16 @@ void EventsManager::startFade(CMapResource *cMap) { ViewPortPalEntry &palEntry = _vm->_graphicsManager._viewPortListPtr->_palette[idx]; palEntry._rEntry = vgaP[0] << 8; uint32 rComp = (uint16)((cMap->_entries[mapIndex * 3] << 8) - palEntry._rEntry) | 0x80; - palEntry.field6 = rComp / cMap->_steps; + palEntry._rChange = rComp / cMap->_steps; palEntry._gEntry = vgaP[1] << 8; uint32 gComp = (uint16)((cMap->_entries[mapIndex * 3 + 1] << 8) - palEntry._gEntry) | 0x80; - palEntry.field8 = gComp / cMap->_steps; + palEntry._gChange = gComp / cMap->_steps; palEntry._bEntry = vgaP[2] << 8; uint32 bComp = (uint16)((cMap->_entries[mapIndex * 3 + 2] << 8) -palEntry._bEntry) | 0x80; - palEntry.fieldA = bComp / cMap->_steps; - palEntry.fieldC = bComp % cMap->_steps; + palEntry._bChange = bComp / cMap->_steps; + palEntry._palIndex = bComp % cMap->_steps; if (!(cMap->_fadeStatus & 1)) ++mapIndex; @@ -210,4 +220,64 @@ void EventsManager::startFade(CMapResource *cMap) { _cycleIntNode._flags &= ~1; } +void EventsManager::addIntNode(IntNode *node) { + _intNodes.push_back(node); +} + +void EventsManager::addFadeInt() { + IntNode &node = _fadeIntNode; + node._intFunc = &EventsManager::fadeIntFunc; + node._flags = 0; + node._curTime = 0; + node._timeReset = 1; + + addIntNode(&node); +} + +void EventsManager::vDoFadeInt() { + if (_intPtr._field3B & 1) + return; + if (--_fadeCount == 0) { + _fadeIntNode._flags |= 1; + _fadeStatus &= ~1; + } + + + for (int i = _fadeFirstCol; i <= _fadeLastCol; ++i) { + ViewPortPalEntry &palEntry = _vm->_graphicsManager._viewPortListPtr->_palette[i]; + byte *vgaP = &_vm->_graphicsManager._VGAColors[palEntry._palIndex * 3]; + + palEntry._rEntry += palEntry._rChange; + palEntry._gEntry += palEntry._gChange; + palEntry._bEntry += palEntry._bChange; + + vgaP[0] = palEntry._rEntry >> 8; + vgaP[1] = palEntry._gEntry >> 8; + vgaP[2] = palEntry._bEntry >> 8; + } + + if (_intPtr._palStartIndex > _fadeFirstCol) + _intPtr._palStartIndex = _fadeFirstCol; + if (_intPtr._palEndIndex < _fadeLastCol) + _intPtr._palEndIndex = _fadeLastCol; + + _intPtr._hasPalette = true; + _intPtr._field38 = 1; +} + +void EventsManager::vDoCycleInt() { + // TODO: more +} + + +void EventsManager::fadeIntFunc() { + // TODO: more +} + +void EventsManager::vInitColor() { + _fadeIntNode._intFunc = &EventsManager::vDoFadeInt; + _cycleIntNode._intFunc = &EventsManager::vDoCycleInt; + // TODO: more +} + } // End of namespace Voyeur diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index f19a6ec7c2..1b47109c5c 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -29,11 +29,24 @@ namespace Voyeur { class VoyeurEngine; +class EventsManager; class CMapResource; #define GAME_FRAME_RATE 50 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) +typedef void (EventsManager::*EventMethodPtr)(); + +class IntNode { +public: + EventMethodPtr _intFunc; + uint32 _curTime; + uint32 _timeReset; + uint32 _flags; +public: + IntNode(); +}; + class EventsManager { private: VoyeurEngine *_vm; @@ -41,11 +54,15 @@ private: uint32 _gameCounter; bool _keyState[256]; int _mouseButton; + Common::List<IntNode *> _intNodes; - static void mainVoyeurIntFunc(); + void mainVoyeurIntFunc(); private: void checkForNextFrameCounter(); void videoTimer(); + void vDoFadeInt(); + void vDoCycleInt(); + void fadeIntFunc(); public: IntData _audioStruc; IntData &_intPtr; @@ -56,6 +73,8 @@ public: int _cycleStatus; int _fadeFirstCol, _fadeLastCol; int _fadeCount; + int _fadeStatus; + public: EventsManager(); void setVm(VoyeurEngine *vm) { _vm = vm; } @@ -64,10 +83,13 @@ public: void startMainClockInt(); void vStopCycle(); void sWaitFlip(); + void vInitColor(); void delay(int cycles); void pollEvents(); void startFade(CMapResource *cMap); + void addIntNode(IntNode *node); + void addFadeInt(); }; } // End of namespace Voyeur diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index 3bf0d5174c..383523e149 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -775,11 +775,10 @@ ViewPortPalEntry::ViewPortPalEntry(const byte *src) { _rEntry = READ_LE_UINT16(v++); _gEntry = READ_LE_UINT16(v++); _bEntry = READ_LE_UINT16(v++); - field6 = READ_LE_UINT16(v++); - field8 = READ_LE_UINT16(v++); - fieldA = READ_LE_UINT16(v++); - fieldC = READ_LE_UINT16(v++); - fieldE = READ_LE_UINT16(v++); + _rChange = READ_LE_UINT16(v++); + _gChange = READ_LE_UINT16(v++); + _bChange = READ_LE_UINT16(v++); + _palIndex = READ_LE_UINT16(v++); } diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 4edf1892a7..816813769f 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -258,9 +258,8 @@ public: class ViewPortPalEntry { public: uint16 _rEntry, _gEntry, _bEntry; - uint16 field6, field8, fieldA; - uint16 fieldC; - uint16 fieldE; + uint16 _rChange, _gChange, _bChange; + uint16 _palIndex; public: ViewPortPalEntry(const byte *src); }; diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp index 7c1f49f64f..d6aeb69eb7 100644 --- a/engines/voyeur/game.cpp +++ b/engines/voyeur/game.cpp @@ -39,17 +39,4 @@ void IntData::audioInit() { } -void IntData::addIntNode(IntNode *node) { - _intNodes.push_back(node); -} - -/*------------------------------------------------------------------------*/ - -IntNode::IntNode() { - _intFunc = NULL; - _curTime = 0; - _timeReset = 0; - _flags = 0; -} - } // End of namespace Voyeur diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h index 2b9864cb3e..7acc921096 100644 --- a/engines/voyeur/game.h +++ b/engines/voyeur/game.h @@ -97,18 +97,6 @@ public: int _policeEvent; }; -typedef void (*IntFuncPtr)(); - -class IntNode { -public: - IntFuncPtr _intFunc; - uint32 _curTime; - uint32 _timeReset; - uint32 _flags; -public: - IntNode(); -}; - class IntData { public: bool _field9; @@ -120,13 +108,10 @@ public: int _palStartIndex; int _palEndIndex; byte *_palette; - Common::List<IntNode *> _intNodes; public: IntData(); void audioInit(); - void addIntNode(IntNode *node); - }; } // End of namespace Voyeur diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp index 36184dbd76..a236e8bbd3 100644 --- a/engines/voyeur/graphics.cpp +++ b/engines/voyeur/graphics.cpp @@ -56,34 +56,6 @@ GraphicsManager::~GraphicsManager() { _screenSurface.free(); } -void GraphicsManager::addFadeInt() { - IntNode &node = _vm->_eventsManager._fadeIntNode; - node._intFunc = fadeIntFunc; - node._flags = 0; - node._curTime = 0; - node._timeReset = 1; - - _vm->_eventsManager._intPtr.addIntNode(&node); -} - -void GraphicsManager::vInitColor() { - _vm->_eventsManager._fadeIntNode._intFunc = vDoFadeInt; - _vm->_eventsManager._cycleIntNode._intFunc = vDoCycleInt; - // TODO: more -} - -void GraphicsManager::fadeIntFunc() { - // TODO: more -} - -void GraphicsManager::vDoFadeInt() { - -} - -void GraphicsManager::vDoCycleInt() { - // TODO: more -} - void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) { _MCGAMode = true; diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h index 98f01c3bbe..c1a0adafd1 100644 --- a/engines/voyeur/graphics.h +++ b/engines/voyeur/graphics.h @@ -67,13 +67,10 @@ public: uint _planeSelect; int _sImageShift; Graphics::Surface _screenSurface; - int _fadeStatus; private: static void fadeIntFunc(); - static void vDoFadeInt(); static void vDoCycleInt(); - void addIntNode(IntNode *node); void restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount, PictureResource *srcPic, PictureResource *destPic); public: @@ -82,9 +79,6 @@ public: void setVm(VoyeurEngine *vm) { _vm = vm; } void sInitGraphics(); - void vInitColor(); - void addFadeInt(); - void setupMCGASaveRect(ViewPortResource *viewPort); void addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds); void restoreMCGASaveRect(ViewPortResource *viewPort); diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index aa48ebdd8a..98d88ac75a 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -121,13 +121,13 @@ void VoyeurEngine::globalInitBolt() { _voy._evidence[18] = 9999; _voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; - _graphicsManager.addFadeInt(); + _eventsManager.addFadeInt(); } void VoyeurEngine::initBolt() { vInitInterrupts(); _graphicsManager.sInitGraphics(); - _graphicsManager.vInitColor(); + _eventsManager.vInitColor(); initInput(); } @@ -174,7 +174,7 @@ void VoyeurEngine::doHeadTitle() { _graphicsManager.flipPage(); _eventsManager.sWaitFlip(); - while (!shouldQuit() && (_graphicsManager._fadeStatus & 1)) + while (!shouldQuit() && (_eventsManager._fadeStatus & 1)) _eventsManager.delay(1); _graphicsManager.screenReset(); |