diff options
-rw-r--r-- | engines/voyeur/files_threads.cpp | 7 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 13 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 12 | ||||
-rw-r--r-- | engines/voyeur/voyeur_game.cpp | 78 |
4 files changed, 99 insertions, 11 deletions
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 38a5fab80c..f2b5955b1a 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -513,12 +513,7 @@ void ThreadResource::parsePlayCommands() { (*_vm->_graphicsManager._vPort)->setupViewPort(pic); pal->startFade(); - (*_vm->_graphicsManager._vPort)->_flags |= 8; - _vm->_graphicsManager.flipPage(); - _vm->_eventsManager.sWaitFlip(); - - while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) - _vm->_eventsManager.delay(1); + _vm->flipPageAndWaitForFade(); if (i > 0) { _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2); diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 53698b2702..90ea87339d 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -613,4 +613,17 @@ void VoyeurEngine::saveLastInplay() { lock.saveThePassword(); } +void VoyeurEngine::flipPageAndWait() { + (*_graphicsManager._vPort)->_flags |= 8; + _graphicsManager.flipPage(); + _eventsManager.sWaitFlip(); +} + +void VoyeurEngine::flipPageAndWaitForFade() { + flipPageAndWait(); + + while (!shouldQuit() && (_eventsManager._fadeStatus & 1)) + _eventsManager.delay(1); +} + } // End of namespace Voyeur diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index 7b065e6675..283352ca21 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -85,7 +85,7 @@ private: void initStamp(); void closeStamp(); void reviewTape(); - bool doGossip(); + void doGossip(); void doTapePlaying(); bool checkForMurder(); void checkForIncriminate(); @@ -173,6 +173,16 @@ public: void checkPhoneCall(); void doEvidDisplay(int v1, int v2); + + /** + * Flips the active page and waits until it's drawn + */ + void flipPageAndWait(); + + /** + * Flips the active page and waits until it's drawn and faded in + */ + void flipPageAndWaitForFade(); }; } // End of namespace Voyeur diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index d7cd7e865b..468d6b1387 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -22,6 +22,7 @@ #include "voyeur/voyeur.h" #include "voyeur/staticres.h" +#include "voyeur/animation.h" namespace Voyeur { @@ -221,7 +222,7 @@ void VoyeurEngine::closeStamp() { } void VoyeurEngine::reviewTape() { - int var22 = 0; +// int var22 = 0; int si = 0; int newX = -1; int newY = -1; @@ -496,9 +497,78 @@ void VoyeurEngine::reviewTape() { _eventsManager.sWaitFlip(); } -bool VoyeurEngine::doGossip() { - warning("TODO: doGossip"); - return false; +void VoyeurEngine::doGossip() { + _graphicsManager.resetPalette(); + _graphicsManager.screenReset(); + + if (!_bVoy->getBoltGroup(0x300)) + return; + + PictureResource *pic = _bVoy->boltEntry(0x300)._picResource; + (*_graphicsManager._vPort)->setupViewPort(pic); + CMapResource *pal = _bVoy->boltEntry(0x301)._cMapResource; + pal->startFade(); + + flipPageAndWaitForFade(); + + // Load the gossip animation + ::Video::RL2Decoder decoder; + decoder.loadFile("a2050100.rl2"); + + byte *frameNumsP = _bVoy->memberAddr(0x309); + byte *posP = _bVoy->memberAddr(0x30A); + + // Main playback loop + int picCtr = 0; + decoder.start(); + while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) { + if (decoder.hasDirtyPalette()) { + const byte *palette = decoder.getPalette(); + _graphicsManager.setPalette(palette, 0, 256); + } + + if (decoder.needsUpdate()) { + const Graphics::Surface *frame = decoder.decodeNextFrame(); + + Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200, + (byte *)_graphicsManager._screenSurface.getPixels()); + + if (decoder.getCurFrame() >= READ_LE_UINT16(frameNumsP + picCtr * 4)) { + PictureResource *pic = _bVoy->boltEntry(0x302 + picCtr)._picResource; + Common::Point pt(READ_LE_UINT16(posP + 4 * picCtr + 2), + READ_LE_UINT16(posP + 4 * picCtr)); + _graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, pt); + } + + flipPageAndWait(); + } + + _eventsManager.pollEvents(); + g_system->delayMillis(10); + } + + decoder.loadFile("a2110100.rl2"); + decoder.start(); + + while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) { + if (decoder.hasDirtyPalette()) { + const byte *palette = decoder.getPalette(); + _graphicsManager.setPalette(palette, 0, 256); + } + + if (decoder.needsUpdate()) { + const Graphics::Surface *frame = decoder.decodeNextFrame(); + + Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200, + (byte *)_graphicsManager._screenSurface.getPixels()); + } + + _eventsManager.pollEvents(); + g_system->delayMillis(10); + } + + _bVoy->freeBoltGroup(0x300); + _graphicsManager.screenReset(); } void VoyeurEngine::doTapePlaying() { |