VOYEUR: Refactored code for showing ending news into separate method

This commit is contained in:
Paul Gilbert 2014-02-02 17:33:42 -05:00
parent d536c0afb2
commit 63a06bc3f7
4 changed files with 92 additions and 50 deletions

View File

@ -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:

View File

@ -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) {

View File

@ -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) {

View File

@ -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