diff options
author | Paul Gilbert | 2014-02-02 17:33:42 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-02-02 17:33:42 -0500 |
commit | 63a06bc3f74f4951d7a0c12601a54367f15af36f (patch) | |
tree | 443732d87ccbd71cf6e2d0c7bccbca60c2efa91c /engines/voyeur | |
parent | d536c0afb2e09e106b94554d484e2930e421d472 (diff) | |
download | scummvm-rg350-63a06bc3f74f4951d7a0c12601a54367f15af36f.tar.gz scummvm-rg350-63a06bc3f74f4951d7a0c12601a54367f15af36f.tar.bz2 scummvm-rg350-63a06bc3f74f4951d7a0c12601a54367f15af36f.zip |
VOYEUR: Refactored code for showing ending news into separate method
Diffstat (limited to 'engines/voyeur')
-rw-r--r-- | engines/voyeur/files_threads.cpp | 48 | ||||
-rw-r--r-- | engines/voyeur/graphics.cpp | 29 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 60 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 5 |
4 files changed, 92 insertions, 50 deletions
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 409031d6e0..36b3376c32 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -647,53 +647,7 @@ void ThreadResource::parsePlayCommands() { break; case 15: - _vm->_playStampGroupId = (_vm->_voy._field4382 - 1) * 8 + 0x7700; - _vm->_voy._field47A = ((READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) - - 1) << 8) + 0x7B00; - - pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource; - _cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource; - - (*_vm->_graphicsManager._vPort)->setupViewPort(pic); - _cmd14Pal->startFade(); - _vm->flipPageAndWaitForFade(); - - _vm->_eventsManager.getMouseInfo(); - - for (int idx = 1; idx < 4; ++idx) { - if (idx == 3) { - pic = _vm->_bVoy->boltEntry(_vm->_voy._field47A)._picResource; - _cmd14Pal = _vm->_bVoy->boltEntry(_vm->_voy._field47A + 1)._cMapResource; - } else { - pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + idx * 2)._picResource; - _cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + idx * 2 + 1)._cMapResource; - } - - (*_vm->_graphicsManager._vPort)->setupViewPort(pic); - _cmd14Pal->startFade(); - _vm->flipPageAndWaitForFade(); - - _vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + (idx - 1) * 2); - _vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + (idx - 1) * 2 + 1); - - Common::String fname = Common::String::format("news%d.voc", idx); - - while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && - _vm->_soundManager.getVOCStatus()) - _vm->_eventsManager.delay(1); - - _vm->_soundManager.stopVOCPlay(); - if (idx == 3) - _vm->_eventsManager.delay(3); - - if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked) - break; - } - - _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); - _vm->_bVoy->freeBoltGroup(_vm->_voy._field47A); - _vm->_playStampGroupId = -1; - _vm->_voy._field47A = -1; + _vm->showEndingNews(); break; case 16: diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp index bf73822c52..958eb3103b 100644 --- a/engines/voyeur/graphics.cpp +++ b/engines/voyeur/graphics.cpp @@ -460,9 +460,34 @@ error("TODO: var22/var24/var2C not initialised before use?"); srcP = srcImgData; if (isClipped) { - // loc_26424 - error("TODO: sDrawPic"); + var22 = (var22 < 0) ? -var22 : 0; + var26 = var22 + width2; + var24 = (var24 < 0) ? -var24 : 0; + width2 = srcPic->_bounds.width(); + height1 = var24 + height1; + + for (int yp = 0; yp < height1; ++yp) { + byteVal2 = 0; + for (int xp = 0; xp < width2; ++xp) { + if (!byteVal2) { + pixel = *srcP++; + if (pixel & 0x80) { + pixel = 0x7F; + byteVal2 = *srcP++; + if (!byteVal2) + byteVal2 = width2; + } + } + + if (yp >= var24 && xp >= var22 && xp < var26) { + *destP++ = pixel; + } + } + + if (yp >= var24) + destP += widthDiff2; + } } else { // loc_26543 for (int yp = 0; yp < height1; ++yp) { diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 2c6e5eb15f..d4a947555c 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -562,7 +562,8 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) { Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200, (byte *)_graphicsManager._screenSurface.getPixels()); - _graphicsManager.drawDot(); + if (_voy._eventFlags & EVTFLAG_RECORDING) + _graphicsManager.drawDot(); } if (decoder.hasDirtyPalette()) { @@ -675,6 +676,63 @@ void VoyeurEngine::flipPageAndWaitForFade() { _eventsManager.delay(1); } +void VoyeurEngine::showEndingNews() { + _playStampGroupId = (_voy._field4382 - 1) * 256 + 0x7700; + _voy._field47A = (READ_LE_UINT16(_controlPtr->_ptr + 4) + - 1) * 256 + 0x7B00; + + _bVoy->getBoltGroup(_playStampGroupId); + _bVoy->getBoltGroup(_voy._field47A); + + PictureResource *pic = _bVoy->boltEntry(_playStampGroupId)._picResource; + CMapResource *pal = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource; + + (*_graphicsManager._vPort)->setupViewPort(pic); + pal->startFade(); + flipPageAndWaitForFade(); + + _eventsManager.getMouseInfo(); + + for (int idx = 1; idx < 4; ++idx) { + if (idx == 3) { + pic = _bVoy->boltEntry(_voy._field47A)._picResource; + pal = _bVoy->boltEntry(_voy._field47A + 1)._cMapResource; + } else { + pic = _bVoy->boltEntry(_playStampGroupId + idx * 2)._picResource; + pal = _bVoy->boltEntry(_playStampGroupId + idx * 2 + 1)._cMapResource; + } + + (*_graphicsManager._vPort)->setupViewPort(pic); + pal->startFade(); + flipPageAndWaitForFade(); + + _bVoy->freeBoltMember(_playStampGroupId + (idx - 1) * 2); + _bVoy->freeBoltMember(_playStampGroupId + (idx - 1) * 2 + 1); + + Common::String fname = Common::String::format("news%d.voc", idx); + _soundManager.startVOCPlay(fname); + + _eventsManager.getMouseInfo(); + while (!shouldQuit() && !_eventsManager._mouseClicked && + _soundManager.getVOCStatus()) { + _eventsManager.delay(1); + _eventsManager.getMouseInfo(); + } + + _soundManager.stopVOCPlay(); + if (idx == 3) + _eventsManager.delay(3); + + if (shouldQuit() || _eventsManager._mouseClicked) + break; + } + + _bVoy->freeBoltGroup(_playStampGroupId); + _bVoy->freeBoltGroup(_voy._field47A); + _playStampGroupId = -1; + _voy._field47A = -1; +} + /*------------------------------------------------------------------------*/ Common::String VoyeurEngine::generateSaveName(int slot) { diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index 907ebcf07f..a0d2e95948 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -286,6 +286,11 @@ public: * Returns the string for the current in-game time of day */ Common::String getTimeOfDay(); + + /** + * Show the ending sequence of the arrest + */ + void showEndingNews(); }; #define VOYEUR_SAVEGAME_VERSION 1 |