diff options
author | Paul Gilbert | 2013-12-14 22:27:16 -0500 |
---|---|---|
committer | Paul Gilbert | 2013-12-14 22:27:16 -0500 |
commit | e44fa657e4cfc3c27b4eb607ba1d1cb11aade053 (patch) | |
tree | 70fb63c53bb8b16224c263f86300309a5aeba8e5 | |
parent | 798a93d8995011a5cc2cc2a611fb2c6f774d9600 (diff) | |
download | scummvm-rg350-e44fa657e4cfc3c27b4eb607ba1d1cb11aade053.tar.gz scummvm-rg350-e44fa657e4cfc3c27b4eb607ba1d1cb11aade053.tar.bz2 scummvm-rg350-e44fa657e4cfc3c27b4eb607ba1d1cb11aade053.zip |
VOYEUR: Implemented support methods needed for doApt
-rw-r--r-- | engines/voyeur/events.h | 2 | ||||
-rw-r--r-- | engines/voyeur/files.h | 5 | ||||
-rw-r--r-- | engines/voyeur/files_threads.cpp | 199 | ||||
-rw-r--r-- | engines/voyeur/graphics.cpp | 43 | ||||
-rw-r--r-- | engines/voyeur/graphics.h | 3 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 2 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 3 | ||||
-rw-r--r-- | engines/voyeur/voyeur_game.cpp | 15 |
8 files changed, 244 insertions, 28 deletions
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index decd23341e..9fe3464431 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -110,7 +110,7 @@ public: int _evidence[20]; Common::Array<VoyeurEvent> _events; - byte *_field4376; + int _field4376; int _field4378; int _field437A; int _field437C; diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 03862838cc..c81761af17 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -423,6 +423,8 @@ public: static void unloadAllStacks(VoyeurEngine *vm); static int _currentMouseX; static int _currentMouseY; + static int _doAptState1; + static int _doAptState2; static void init(); private: @@ -449,6 +451,9 @@ private: void savePrevious(); void setButtonFlag(int idx, byte bits); void clearButtonFlag(int idx, byte bits); + void loadTheApt(); + void freeTheApt(); + void doAptAnim(int mode); public: VoyeurEngine *_vm; diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index a8cf28841e..0143084645 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -33,6 +33,8 @@ byte *ThreadResource::_threadDataPtr; CMapResource *ThreadResource::_cmd14Pal; int ThreadResource::_currentMouseX; int ThreadResource::_currentMouseY; +int ThreadResource::_doAptState1; +int ThreadResource::_doAptState2; void ThreadResource::init() { _stampFlags = 0; @@ -41,6 +43,8 @@ void ThreadResource::init() { _cmd14Pal = nullptr; _currentMouseX = 392; _currentMouseY = 57; + _doAptState1 = -1; + _doAptState2 = -1; } ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): @@ -764,31 +768,31 @@ void ThreadResource::parsePlayCommands() { case 19: _vm->_voy._field472 = 140; - _vm->loadTheApt(); + loadTheApt(); _vm->_voy._field472 = 141; - _vm->freeTheApt(); + freeTheApt(); break; case 20: _vm->_voy._field472 = -1; - _vm->loadTheApt(); + loadTheApt(); _vm->_voy._field472 = 141; - _vm->freeTheApt(); + freeTheApt(); break; case 21: _vm->_voy._field472 = -1; - _vm->loadTheApt(); + loadTheApt(); _vm->_voy._field472 = 140; - _vm->freeTheApt(); + freeTheApt(); break; case 23: _vm->_voy._field474 = 17; _vm->_voy._field472 = -1; - _vm->loadTheApt(); + loadTheApt(); _vm->_voy._field472 = 144; - _vm->freeTheApt(); + freeTheApt(); break; default: @@ -1050,7 +1054,24 @@ bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) { } int ThreadResource::doApt() { - warning("TODO: doApt"); + int varC = -1; + loadTheApt(); + + _vm->_playStamp2 = 151; + byte *dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1); + PictureResource *srcPic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 3)._picResource; + _vm->_eventsManager.getMouseInfo(); + + if (_doAptState1 == -1) { + _doAptState1 = READ_LE_UINT16(dataP + 18) + 16; + _doAptState2 = READ_LE_UINT16(dataP + 20) + 16; + _vm->_playStamp2 = 153; + } + + if (_vm->_voy._field470 == 16) { + // TODO + } + return 0; } @@ -1319,4 +1340,164 @@ void ThreadResource::clearButtonFlag(int idx, byte bits) { _buttonFlags[idx] &= ~bits; } +void ThreadResource::loadTheApt() { + switch (_vm->_voy._field474) { + case 1: + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 17: + _vm->_playStamp1 = 0x5700; + break; + case 3: + _vm->_playStamp1 = 0x5800; + break; + case 4: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + _vm->_playStamp1 = 0x5900; + break; + default: + break; + } + + if (_vm->_voy._field472 == 143) + _vm->_voy._field472 = -1; + + if (_vm->_voy._field472 != -1) { + doAptAnim(1); + _vm->_bVoy->getBoltGroup(_vm->_playStamp1); + _vm->_voy._field472 = -1; + _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( + _vm->_playStamp1 + 5)._picResource; + (*_vm->_graphicsManager._vPort)->setupViewPort( + _vm->_graphicsManager._backgroundPage); + } else { + _vm->_bVoy->getBoltGroup(_vm->_playStamp1); + _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( + _vm->_playStamp1 + 5)._picResource; + (*_vm->_graphicsManager._vPort)->setupViewPort( + _vm->_graphicsManager._backgroundPage); + } + + CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 4)._cMapResource; + pal->_steps = 1; + pal->startFade(); + + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) + _vm->_eventsManager.delay(1); +} + +void ThreadResource::freeTheApt() { + _vm->_graphicsManager.fadeDownICF1(5); + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) + _vm->_eventsManager.delay(1); + + _vm->_graphicsManager.fadeUpICF1(0); + + if (_vm->_playStamp2 != -1) { + _vm->_soundManager.stopVOCPlay(); + _vm->_playStamp2 = -1; + } + + if (_vm->_voy._field472 == -1) { + _vm->_graphicsManager.fadeDownICF(6); + } else { + doAptAnim(2); + } + + if (_vm->_voy._field472 == 140) { + _vm->_graphicsManager.screenReset(); + _vm->_graphicsManager.resetPalette(); + } + + (*_vm->_graphicsManager._vPort)->setupViewPort(nullptr); + _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); + _vm->_playStamp1 = -1; + _vm->_voy._field4386 = 0; +} + +void ThreadResource::doAptAnim(int mode) { + _vm->_bVoy->freeBoltGroup(0x10100); + + int id = 0; + switch (_vm->_voy._field472) { + case 140: + id = 0x5A00; + break; + case 141: + id = 0x6000; + break; + case 142: + id = 0x6600; + break; + case 143: + id = 0x6C00; + break; + case 144: + id = 0x6F00; + break; + default: + break; + } + + int id2 = (id == 0x6C00 || id == 0x6F00) ? 1 : 2; + switch (_vm->_voy._field474) { + case 3: + id += id2 << 8; + break; + case 4: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + id += id2 << 9; + break; + default: + break; + } + + if (mode) + id += 0x100; + + if (_vm->_bVoy->getBoltGroup(id)) { + CMapResource *pal = _vm->_bVoy->boltEntry(id)._cMapResource; + pal->_steps = 1; + + for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) { + PictureResource *pic = _vm->_bVoy->boltEntry(id + idx)._picResource; + (*_vm->_graphicsManager._vPort)->setupViewPort(pic); + + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + _vm->_eventsManager.delay(5); + } + + _vm->_bVoy->freeBoltGroup(id); + } + + _vm->_bVoy->getBoltGroup(0x10100); +} + } // End of namespace Voyeur diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp index fbf671c408..96214b7779 100644 --- a/engines/voyeur/graphics.cpp +++ b/engines/voyeur/graphics.cpp @@ -663,4 +663,47 @@ void GraphicsManager::doScroll(const Common::Point &pt) { error("TODO: doScroll"); } +void GraphicsManager::fadeDownICF1(int steps) { + if (steps > 0) { + int stepAmount = _vm->_voy._field4378 / steps; + + for (int idx = 0; idx < steps; ++idx) { + _vm->_voy._field4378 -= stepAmount; + _vm->_eventsManager.delay(1); + } + } + + _vm->_voy._field4378 = 0; +} + +void GraphicsManager::fadeUpICF1(int steps) { + if (steps > 0) { + int stepAmount = (63 - _vm->_voy._field4378) / steps; + + for (int idx = 0; idx < steps; ++idx) { + _vm->_voy._field4378 += stepAmount; + _vm->_eventsManager.delay(1); + } + } + + _vm->_voy._field4378 = 63; +} + +void GraphicsManager::fadeDownICF(int steps) { + if (steps > 0) { + _vm->_eventsManager.mouseOff(); + int stepAmount1 = _vm->_voy._field4376 / steps; + int stepAmount2 = _vm->_voy._field4378 / steps; + + for (int idx = 0; idx < steps; ++idx) { + _vm->_voy._field4376 -= stepAmount1; + _vm->_voy._field4378 -= stepAmount2; + _vm->_eventsManager.delay(1); + } + } + + _vm->_voy._field4376 = 0; + _vm->_voy._field4378 = 0; +} + } // End of namespace Voyeur diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h index 4c31a449cf..cdd582873a 100644 --- a/engines/voyeur/graphics.h +++ b/engines/voyeur/graphics.h @@ -112,6 +112,9 @@ public: void setColor(int idx, byte r, byte g, byte b); void screenReset(); void doScroll(const Common::Point &pt); + void fadeDownICF1(int steps); + void fadeUpICF1(int steps); + void fadeDownICF(int steps); }; } // End of namespace Voyeur diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 6c4e841243..f143b0d643 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -134,7 +134,7 @@ void VoyeurEngine::globalInitBolt() { // Setup default flags Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0); _voy._field478 = 1; - _voy._field4376 = nullptr; // Original set 63h:63h + _voy._field4376 = _voy._field4378 = 127; _voy._field4F2 = 9999; _voy._field472 = -1; _voy._field478 = 256; diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index 1fd6b24ed2..5d0c26787d 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -87,7 +87,6 @@ private: void closeStamp(); void reviewTape(); bool doGossip(); - int doApt(); void doTapePlaying(); bool checkForMurder(); void checkForIncriminate(); @@ -144,8 +143,6 @@ public: * Saves the last time the game was played */ void saveLastInplay(); - void loadTheApt(); - void freeTheApt(); void makeViewFinder(); void initIFace(); void checkTransition(); diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index ff532084be..93bb9d95b6 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -69,7 +69,7 @@ void VoyeurEngine::playStamp() { buttonId = threadP->doInterface(); if (buttonId == -2) { - switch (doApt()) { + switch (threadP->doApt()) { case 0: _voy._field472 = 140; break; @@ -237,11 +237,6 @@ bool VoyeurEngine::doGossip() { return false; } -int VoyeurEngine::doApt() { - warning("TODO"); - return 0; -} - void VoyeurEngine::doTapePlaying() { warning("TODO"); } @@ -264,14 +259,6 @@ int VoyeurEngine::getChooseButton() { return 0; } -void VoyeurEngine::loadTheApt() { - error("TODO: loadTheApt"); -} - -void VoyeurEngine::freeTheApt() { - error("TODO: freeTheApt"); -} - void VoyeurEngine::makeViewFinder() { error("TODO:makeViewFinder"); } |