diff options
author | Paul Gilbert | 2014-02-03 22:02:28 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-02-03 22:02:28 -0500 |
commit | d3f4156e6a7c4aac33224bbfc8e0f859401b51ed (patch) | |
tree | 8d9947ddc9b68a6e8cc7bdd4d4bbcc8436c08d20 /engines | |
parent | 683ef9d50f49c989c6bb4df15e16bcb7c33e1980 (diff) | |
download | scummvm-rg350-d3f4156e6a7c4aac33224bbfc8e0f859401b51ed.tar.gz scummvm-rg350-d3f4156e6a7c4aac33224bbfc8e0f859401b51ed.tar.bz2 scummvm-rg350-d3f4156e6a7c4aac33224bbfc8e0f859401b51ed.zip |
VOYEUR: Clean up, commenting, and bugfixes for checking for murder
Diffstat (limited to 'engines')
-rw-r--r-- | engines/voyeur/data.cpp | 26 | ||||
-rw-r--r-- | engines/voyeur/data.h | 8 | ||||
-rw-r--r-- | engines/voyeur/events.cpp | 6 | ||||
-rw-r--r-- | engines/voyeur/files_threads.cpp | 22 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 12 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 2 | ||||
-rw-r--r-- | engines/voyeur/voyeur_game.cpp | 2 |
7 files changed, 46 insertions, 32 deletions
diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp index ef072e8737..ed308f4c2a 100644 --- a/engines/voyeur/data.cpp +++ b/engines/voyeur/data.cpp @@ -41,6 +41,12 @@ void VoyeurEvent::synchronize(Common::Serializer &s) { SVoy::SVoy() { // Initialise all the data fields of SVoy to empty values Common::fill((byte *)this, (byte *)this + sizeof(SVoy), 0); + + _eventFlags = EVTFLAG_TIME_DISABLED; + _field4376 = _field4378 = 127; + _murderThreshold = 9999; + _aptLoadMode = -1; + _eventFlags |= EVTFLAG_100; } void SVoy::setVm(VoyeurEngine *vm) { @@ -90,8 +96,8 @@ void SVoy::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_computerTextId); s.syncAsSint16LE(_computerTimeMin); s.syncAsSint16LE(_computerTimeMax); - s.syncAsSint16LE(_field4F0); - s.syncAsSint16LE(_field4F2); + s.syncAsSint16LE(_victimMurdered); + s.syncAsSint16LE(_murderThreshold); // Events s.syncAsUint16LE(_eventCount); @@ -103,7 +109,7 @@ void SVoy::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_field437A); s.syncAsSint16LE(_field437C); s.syncAsSint16LE(_field437E); - s.syncAsSint16LE(_field4380); + s.syncAsSint16LE(_victimNumber); s.syncAsSint16LE(_field4382); s.syncAsSint16LE(_videoEventId); @@ -232,7 +238,7 @@ void SVoy::reviewComputerEvent(int eventIndex) { bool SVoy::checkForKey() { WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 0); - if (_vm->_voy._field4F0) + if (_vm->_voy._victimMurdered) return false; for (int eventIdx = 0; eventIdx < _eventCount; ++eventIdx) { @@ -243,12 +249,12 @@ bool SVoy::checkForKey() { case EVTYPE_VIDEO: switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) { case 1: - if (e._audioVideoId == 33 && e._computerOn < 1 && e._computerOff > 40) + if (e._audioVideoId == 33 && e._computerOn < 2 && e._computerOff >= 38) WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1); break; case 2: - if (e._audioVideoId == 47 && e._computerOn < 1 && e._computerOff > 11) + if (e._audioVideoId == 47 && e._computerOn < 2 && e._computerOff >= 9) WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 2); break; @@ -258,7 +264,7 @@ bool SVoy::checkForKey() { break; case 4: - if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 7) + if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 6) WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 4); break; @@ -270,14 +276,14 @@ bool SVoy::checkForKey() { case EVTYPE_AUDIO: switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) { case 1: - if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 28) + if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 26) WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1); break; case 3: - if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 30) + if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 28) WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3); - if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 20) + if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 18) WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3); break; diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h index c21fcf01fd..d9c62bc7ca 100644 --- a/engines/voyeur/data.h +++ b/engines/voyeur/data.h @@ -35,7 +35,7 @@ enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3, EVTYPE_COMPUTER = 4 }; enum EventFlag { EVTFLAG_TIME_DISABLED = 1, EVTFLAG_2 = 2, EVTFLAG_8 = 8, EVTFLAG_RECORDING = 0x10, - EVTFLAG_40 = 0x40, EVTFLAG_100 = 0x100 }; + EVTFLAG_40 = 0x40, EVTFLAG_VICTIM_PRESET = 0x80, EVTFLAG_100 = 0x100 }; struct VoyeurEvent { int _hour; @@ -133,15 +133,15 @@ public: Common::Rect _rect4E4; int _computerTimeMin; int _computerTimeMax; - int _field4F0; - int _field4F2; + bool _victimMurdered; + int _murderThreshold; int _field4376; int _field4378; int _field437A; int _field437C; int _field437E; - int _field4380; + int _victimNumber; int _field4382; int _videoEventId; RectResource *_viewBounds; diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index c0f0eb5c68..32ffa1584e 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -111,8 +111,10 @@ void EventsManager::mainVoyeurIntFunc() { // Increase camera discharge ++_vm->_voy._RTVNum; - if (_vm->_voy._RTVNum >= _vm->_voy._field4F2) - _vm->_voy._field4F0 = 1; + // If the murder threshold has been set, and is passed, then flag the victim + // as murdered, which prevents sending the tape from succeeding + if (_vm->_voy._RTVNum >= _vm->_voy._murderThreshold) + _vm->_voy._victimMurdered = true; } } } diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index c77cdd4fe5..b766733699 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -367,6 +367,7 @@ void ThreadResource::parsePlayCommands() { break; case 2: + // Play an audio event v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { @@ -397,6 +398,7 @@ void ThreadResource::parsePlayCommands() { break; case 3: + // Play a video event v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { @@ -443,6 +445,7 @@ void ThreadResource::parsePlayCommands() { case 4: case 22: + // Case 22: Endgame news reports _vm->_audioVideoId = READ_LE_UINT16(dataP) - 1; dataP += 2; @@ -462,7 +465,7 @@ void ThreadResource::parsePlayCommands() { _vm->_audioVideoId = -1; parseIndex = 999; } else { - int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size(); + int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size() / 2; _vm->_soundManager.stopVOCPlay(); _vm->_eventsManager.getMouseInfo(); @@ -492,7 +495,7 @@ void ThreadResource::parsePlayCommands() { _vm->_soundManager.stopVOCPlay(); if (i == (count - 1)) - _vm->_eventsManager.delay(480); + _vm->_eventsManager.delayClick(480); if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked) break; @@ -594,16 +597,21 @@ void ThreadResource::parsePlayCommands() { break; case 10: + // Pick the person who is to die, during startup if (_vm->_iForceDeath == -1) { + // No specific person has been preset to be killed, so pick one randomly. + // The loop below was used because the victim was persisted from the previous + // play-through, so it ensured that a different victim is picked. int randomVal; do { randomVal = _vm->getRandomNumber(3) + 1; - } while (randomVal == _vm->_voy._field4380); + } while (randomVal == _vm->_voy._victimNumber); - _vm->_voy._field4380 = randomVal; + _vm->_voy._victimNumber = randomVal; WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, randomVal); } else { - _vm->_voy._field4380 = _vm->_iForceDeath; + // Player has seen something that locks in the character to die + _vm->_voy._victimNumber = _vm->_iForceDeath; WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, _vm->_iForceDeath); } @@ -660,11 +668,13 @@ void ThreadResource::parsePlayCommands() { break; case 18: + // Called during the murder (Sunday 10:30PM) time period, to specify the + // time expired point at which the murder takes place v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) - _vm->_voy._field4F2 = v3; + _vm->_voy._murderThreshold = v3; dataP += 4; break; diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index b3b920c799..ce7da49b2d 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -70,8 +70,11 @@ Common::Error VoyeurEngine::run() { _eventsManager.resetMouse(); if (doHeadTitle()) { + // The original allows the victim to be explicitly specified via the command line. + // We don't currently support this in ScummVM, but I'm leaving the code below + // in case we ever want to make use of it. if (_iForceDeath >= 1 && _iForceDeath <= 4) - _voy._eventFlags |= 0x80; + _voy._eventFlags |= EVTFLAG_VICTIM_PRESET; playStamp(); if (!shouldQuit()) @@ -116,12 +119,6 @@ void VoyeurEngine::globalInitBolt() { assert(_graphicsManager._fontPtr->_curFont); // Setup default flags - _voy._eventFlags = EVTFLAG_TIME_DISABLED; - _voy._field4376 = _voy._field4378 = 127; - _voy._field4F2 = 9999; - _voy._aptLoadMode = -1; - _voy._eventFlags |= EVTFLAG_100; - _voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; _eventsManager.addFadeInt(); } @@ -240,7 +237,6 @@ bool VoyeurEngine::doLock() { byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize); if (_bVoy->getBoltGroup(0x700)) { - _voy._field4380 = 0; _voy._viewBounds = _bVoy->boltEntry(0x704)._rectResource; Common::String password = "3333"; diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index 08c0a27bef..16c2c400b6 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -177,7 +177,7 @@ public: int _audioVideoId; const int *_resolvePtr; - int _iForceDeath; // CHECKME: The original initializes it in ESP_init() + int _iForceDeath; int _checkTransitionId; int _gameHour; int _gameMinute; diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index 826c4d14cd..3e3239749d 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -951,7 +951,7 @@ int VoyeurEngine::getChooseButton() { for (uint idx = 0; idx < hotspots.size(); ++idx) { if (hotspots[idx].contains(pt)) { - if (!_voy._field4F0 || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) { + if (!_voy._victimMurdered || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) { selectedIndex = idx; if (selectedIndex != prevIndex) { PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource; |