From eca87a63e9215ee6f37f62d5c9bb2389362512ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 4 Feb 2014 22:38:35 -0500 Subject: VOYEUR: Renamings for the fields of the new StateResource class --- engines/voyeur/data.cpp | 31 +++++++++++++++---------------- engines/voyeur/files.cpp | 3 ++- engines/voyeur/files.h | 10 ++++++---- engines/voyeur/files_threads.cpp | 22 +++++++++++----------- engines/voyeur/voyeur.cpp | 2 +- engines/voyeur/voyeur_game.cpp | 22 +++++++++++----------- 6 files changed, 46 insertions(+), 44 deletions(-) (limited to 'engines/voyeur') diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp index 9f528c1a76..f0521d28d2 100644 --- a/engines/voyeur/data.cpp +++ b/engines/voyeur/data.cpp @@ -237,35 +237,34 @@ void SVoy::reviewComputerEvent(int eventIndex) { } bool SVoy::checkForKey() { - _vm->_controlPtr->_state->_v2 = 0; + _vm->_controlPtr->_state->_victimEvidenceIndex = 0; if (_vm->_voy._victimMurdered) return false; for (int eventIdx = 0; eventIdx < _eventCount; ++eventIdx) { VoyeurEvent &e = _events[eventIdx]; - int v1; switch (e._type) { case EVTYPE_VIDEO: - switch (_vm->_controlPtr->_state->_v1) { + switch (_vm->_controlPtr->_state->_victimIndex) { case 1: if (e._audioVideoId == 33 && e._computerOn < 2 && e._computerOff >= 38) - _vm->_controlPtr->_state->_v2 = 1; + _vm->_controlPtr->_state->_victimEvidenceIndex = 1; break; case 2: if (e._audioVideoId == 47 && e._computerOn < 2 && e._computerOff >= 9) - _vm->_controlPtr->_state->_v2 = 2; + _vm->_controlPtr->_state->_victimEvidenceIndex = 2; break; case 3: if (e._audioVideoId == 46 && e._computerOn < 2 && e._computerOff > 2) - _vm->_controlPtr->_state->_v2 = 3; + _vm->_controlPtr->_state->_victimEvidenceIndex = 3; break; case 4: if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 6) - _vm->_controlPtr->_state->_v2 = 4; + _vm->_controlPtr->_state->_victimEvidenceIndex = 4; break; default: @@ -274,17 +273,17 @@ bool SVoy::checkForKey() { break; case EVTYPE_AUDIO: - switch (_vm->_controlPtr->_state->_v1) { + switch (_vm->_controlPtr->_state->_victimIndex) { case 1: if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 26) - _vm->_controlPtr->_state->_v2 = 1; + _vm->_controlPtr->_state->_victimEvidenceIndex = 1; break; case 3: if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 28) - _vm->_controlPtr->_state->_v2 = 3; + _vm->_controlPtr->_state->_victimEvidenceIndex = 3; if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 18) - _vm->_controlPtr->_state->_v2 = 3; + _vm->_controlPtr->_state->_victimEvidenceIndex = 3; break; default: @@ -293,10 +292,10 @@ bool SVoy::checkForKey() { break; case EVTYPE_EVID: - switch (_vm->_controlPtr->_state->_v1) { + switch (_vm->_controlPtr->_state->_victimIndex) { case 4: if (e._audioVideoId == 0x2400 && e._computerOn == 0x4f00 && e._computerOff == 17) - _vm->_controlPtr->_state->_v2 = 4; + _vm->_controlPtr->_state->_victimEvidenceIndex = 4; default: break; @@ -304,10 +303,10 @@ bool SVoy::checkForKey() { break; case EVTYPE_COMPUTER: - switch (_vm->_controlPtr->_state->_v1) { + switch (_vm->_controlPtr->_state->_victimIndex) { case 2: if (e._computerOn == 13 && e._computerOff > 76) - _vm->_controlPtr->_state->_v2 = 2; + _vm->_controlPtr->_state->_victimEvidenceIndex = 2; break; default: @@ -316,7 +315,7 @@ bool SVoy::checkForKey() { break; } - if (_vm->_controlPtr->_state->_v2 == _vm->_controlPtr->_state->_v1) + if (_vm->_controlPtr->_state->_victimEvidenceIndex == _vm->_controlPtr->_state->_victimIndex) return true; } diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index e39c1613de..1f83eb6622 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -1645,7 +1645,8 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) { /*------------------------------------------------------------------------*/ StateResource::StateResource(BoltFilesState &state, const byte *src): - _v0(_vals[0]), _v1(_vals[1]), _v2(_vals[2]), _v3(_vals[3]) { + _victimIndex(_vals[1]), _victimEvidenceIndex(_vals[2]), + _victimMurderIndex(_vals[3]) { for (int i = 0; i < 4; ++i) _vals[i] = READ_LE_UINT32(src + i * 4); } diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index a0d66550b9..476014815a 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -494,13 +494,15 @@ public: virtual ~ControlResource() {} }; +/** + * Stores data about the intended victim + */ class StateResource { public: int _vals[4]; - int &_v0; - int &_v1; - int &_v2; - int &_v3; + int &_victimIndex; + int &_victimEvidenceIndex; + int &_victimMurderIndex; StateResource(BoltFilesState &state, const byte *src); virtual ~StateResource() {} diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 57d878f9cd..ba85ec2e80 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -370,7 +370,7 @@ void ThreadResource::parsePlayCommands() { // Play an audio event v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { _vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1; _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); @@ -401,7 +401,7 @@ void ThreadResource::parsePlayCommands() { // Play a video event v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { _vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1; _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); @@ -512,7 +512,7 @@ void ThreadResource::parsePlayCommands() { // Check whether transition to a given time period is allowed, and // if so, load the time information for the new time period v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { _vm->_voy._field470 = 5; int count = READ_LE_UINT16(dataP + 2); _vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4); @@ -547,7 +547,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; - if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { int idx = 0; while (_vm->_voy._videoHotspotTimes._min[idx][v3] != 9999) ++idx; @@ -565,7 +565,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; - if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { int idx = 0; while (_vm->_voy._audioHotspotTimes._min[idx][v3] != 9999) ++idx; @@ -583,7 +583,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; - if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { int idx = 0; while (_vm->_voy._evidenceHotspotTimes._min[idx][v3] != 9999) ++idx; @@ -608,11 +608,11 @@ void ThreadResource::parsePlayCommands() { } while (randomVal == _vm->_voy._victimNumber); _vm->_voy._victimNumber = randomVal; - _vm->_controlPtr->_state->_v1 = randomVal; + _vm->_controlPtr->_state->_victimIndex = randomVal; } else { // Player has seen something that locks in the character to die _vm->_voy._victimNumber = _vm->_iForceDeath; - _vm->_controlPtr->_state->_v1 = _vm->_iForceDeath; + _vm->_controlPtr->_state->_victimIndex = _vm->_iForceDeath; } _vm->saveLastInplay(); @@ -625,7 +625,7 @@ void ThreadResource::parsePlayCommands() { case 12: v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { _vm->_voy._boltGroupId2 = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)]; _vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true; } @@ -636,7 +636,7 @@ void ThreadResource::parsePlayCommands() { case 13: v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { _vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2); _vm->_voy._computerTimeMin = READ_LE_UINT16(dataP + 4); _vm->_voy._computerTimeMax = READ_LE_UINT16(dataP + 6); @@ -673,7 +673,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2); - if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) + if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) _vm->_voy._murderThreshold = v3; dataP += 4; diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 890229762b..286b97ea1a 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -696,7 +696,7 @@ void VoyeurEngine::flipPageAndWaitForFade() { void VoyeurEngine::showEndingNews() { _playStampGroupId = (_voy._field4382 - 1) * 256 + 0x7700; - _voy._boltGroupId2 = (_controlPtr->_state->_v1 - 1) * 256 + 0x7B00; + _voy._boltGroupId2 = (_controlPtr->_state->_victimIndex - 1) * 256 + 0x7B00; _bVoy->getBoltGroup(_playStampGroupId); _bVoy->getBoltGroup(_voy._boltGroupId2); diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index 747e0edac3..4577fe28c9 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -643,7 +643,7 @@ void VoyeurEngine::reviewTape() { pt = _eventsManager.getMousePos(); if (_eventsManager._mouseClicked && _voy._viewBounds->left == pt.x && (_voy._eventFlags & EVTFLAG_40) && _eventsManager._rightClick) { - _controlPtr->_state->_v1 = (pt.y / 60) + 1; + _controlPtr->_state->_victimIndex = (pt.y / 60) + 1; foundIndex = -1; _eventsManager._rightClick = 0; } @@ -809,38 +809,38 @@ void VoyeurEngine::doTapePlaying() { } bool VoyeurEngine::checkForMurder() { - int v = _controlPtr->_state->_v3; + int v = _controlPtr->_state->_victimMurderIndex; for (int idx = 0; idx < _voy._eventCount; ++idx) { VoyeurEvent &evt = _voy._events[idx]; if (evt._type == EVTYPE_VIDEO) { - switch (_controlPtr->_state->_v1) { + switch (_controlPtr->_state->_victimIndex) { case 1: if (evt._audioVideoId == 41 && evt._computerOn <= 15 && (evt._computerOff + evt._computerOn) >= 16) { - _controlPtr->_state->_v3 = 1; + _controlPtr->_state->_victimMurderIndex = 1; } break; case 2: if (evt._audioVideoId == 53 && evt._computerOn <= 19 && (evt._computerOff + evt._computerOn) >= 21) { - _controlPtr->_state->_v3 = 2; + _controlPtr->_state->_victimMurderIndex = 2; } break; case 3: if (evt._audioVideoId == 50 && evt._computerOn <= 28 && (evt._computerOff + evt._computerOn) >= 29) { - _controlPtr->_state->_v3 = 3; + _controlPtr->_state->_victimMurderIndex = 3; } break; case 4: if (evt._audioVideoId == 43 && evt._computerOn <= 10 && (evt._computerOff + evt._computerOn) >= 14) { - _controlPtr->_state->_v3 = 4; + _controlPtr->_state->_victimMurderIndex = 4; } break; @@ -849,13 +849,13 @@ bool VoyeurEngine::checkForMurder() { } } - if (_controlPtr->_state->_v3 == _controlPtr->_state->_v1) { + if (_controlPtr->_state->_victimMurderIndex == _controlPtr->_state->_victimIndex) { _voy._videoEventId = idx; return true; } } - _controlPtr->_state->_v3 = v; + _controlPtr->_state->_victimMurderIndex = v; _voy._videoEventId = -1; return false; } @@ -894,7 +894,7 @@ bool VoyeurEngine::checkForIncriminate() { } if (_voy._field4382) { - _controlPtr->_state->_v3 = 88; + _controlPtr->_state->_victimMurderIndex = 88; _voy._videoEventId = idx; return true; } @@ -954,7 +954,7 @@ int VoyeurEngine::getChooseButton() { for (uint idx = 0; idx < hotspots.size(); ++idx) { if (hotspots[idx].contains(pt)) { - if (!_voy._victimMurdered || ((int)idx + 1) != _controlPtr->_state->_v1) { + if (!_voy._victimMurdered || ((int)idx + 1) != _controlPtr->_state->_victimIndex) { selectedIndex = idx; if (selectedIndex != prevIndex) { PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource; -- cgit v1.2.3