From 10be9a527be4f6a0ac74cb8f916e93da712730c6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 10 Dec 2013 21:34:48 -0500 Subject: VOYEUR: Split ThreadResource into it's own file --- engines/voyeur/files_threads.cpp | 392 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 engines/voyeur/files_threads.cpp (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp new file mode 100644 index 0000000000..bb58bcd7bb --- /dev/null +++ b/engines/voyeur/files_threads.cpp @@ -0,0 +1,392 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "voyeur/files.h" +#include "voyeur/graphics.h" +#include "voyeur/voyeur.h" +#include "voyeur/staticres.h" + +namespace Voyeur { + +int ThreadResource::_stampFlags = 0; +int ThreadResource::_useCount[8]; +byte *ThreadResource::_threadDataPtr = NULL; + +ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): + _vm(state._vm) { + _flags = src[8]; +} + +void ThreadResource::initThreadStruct(int idx, int id) { + _controlIndex = -1; + if (loadAStack(idx)) { + _field4 = _field6 = -1; + _threadId = id; + _field3A = -1; + _field3E = -1; + + doState(); + } +} + +bool ThreadResource::loadAStack(int idx) { + if (_stampFlags & 1) { + unloadAStack(_controlIndex); + if (!_useCount[idx]) { + BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[idx]); + if (!boltEntry._data) + return false; + + _vm->_controlPtr->_entries[idx] = boltEntry._data; + } + + ++_useCount[idx]; + } + + _ctlPtr = _vm->_controlPtr->_entries[idx]; + return true; +} + +void ThreadResource::unloadAStack(int idx) { + if ((_stampFlags & 1) && _useCount[idx]) { + if (--_useCount[idx] == 0) { + _vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[idx]); + } + } +} + +bool ThreadResource::doState() { + _flags |= 1; + + if (!getStateInfo()) + return false; + + getButtonsFlags(); + getField1CE(); + + _vm->_glGoScene = -1; + _vm->_glGoStack = -1; + + performOpenCard(); + if (_field40 & 1) { + return chooseSTAMPButton(_vm->getRandomNumber(_field42 - 1)); + } else { + return true; + } +} + +bool ThreadResource::getStateInfo() { + _field9 = 0; + int id = READ_LE_UINT16(_ctlPtr); + + if (id <= _threadId) { + _field9 |= 0x80; + return false; + } else { + uint32 fld = READ_LE_UINT32(_ctlPtr + 2); + fld += _threadId << 3; + _field46 = READ_LE_UINT32(_ctlPtr + fld + 4); + + fld = READ_LE_UINT32(_ctlPtr + fld); + byte *baseP = _ctlPtr + fld; + _field42 = READ_LE_UINT16(baseP); + _field40 = READ_LE_UINT16(baseP + 2); + _parseCount = READ_LE_UINT16(baseP + 4); + + _field28E = getDataOffset(); + _field28E += READ_LE_UINT32(baseP + 6) / 2; + + _field4A = baseP + 10; + + getButtonsText(); + return true; + } +} + +byte *ThreadResource::getDataOffset() { + uint32 offset = READ_LE_UINT32(_ctlPtr + 10); + _threadDataPtr = _ctlPtr + offset; + return _threadDataPtr; +} + +void ThreadResource::getButtonsText() { + int idx = 0; + + for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + if (*p == 0xC0) { + ++p; + if (*p++ & 0x80) { + assert(idx < 63); + _field8E[idx] = getRecordOffset(p); + p += 4; + } + + ++idx; + _field8E[idx] = NULL; + } + } +} + +void ThreadResource::getButtonsFlags() { + int idx = 0; + + for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + if (*p == 0xC0) { + if (*++p & 0x20) + _field40 |= 2; + + _field4E[idx] = *p++; + _field18E[idx] = *p++; + + if (_field4E[idx] & 0x80) + p += 4; + + ++idx; + } + } +} + +void ThreadResource::getField1CE() { + int idx = 0; + + for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + assert(idx < 47); + _field1CE[idx++] = getRecordOffset(p); + _field1CE[idx] = NULL; + } +} + +void ThreadResource::unloadAllStacks(VoyeurEngine *vm) { + if (_stampFlags & 1) { + for (int i = 0; i < 8; ++i) { + if (_useCount[i]) + vm->_stampLibPtr->freeBoltMember(vm->_controlPtr->_memberIds[i]); + } + } +} + +void ThreadResource::performOpenCard() { + for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + if (*p == 0x47) { + cardAction(p + 1); + return; + } + } +} + +void ThreadResource::initUseCount() { + Common::fill(&_useCount[0], &_useCount[8], 0); +} + +const byte *ThreadResource::getRecordOffset(const byte *p) { + uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(p + 6); + return _ctlPtr + recSize; +} + +const byte *ThreadResource::getNextRecord(const byte *p) { + byte v = *p++; + + switch (v) { + case 2: + case 4: + case 6: + case 8: + case 10: + return p + 8; + case 1: + case 3: + case 5: + case 7: + case 9: + case 11: + case 21: + case 22: + case 25: + case 26: + return p + 5; + case 17: + case 23: + case 24: + case 27: + case 28: + return p + 2; + case 19: + case 41: + return p + 6; + case 18: + case 51: + case 52: + return p + 1; + case 74: + return p + 4; + case 192: + if (*p * 0x80) + p += 4; + return p + 2; + default: + return p; + } +} + +void ThreadResource::cardAction(const byte *p) { + warning("TODO: cardAction"); +} + +bool ThreadResource::chooseSTAMPButton(int idx) { + warning("TODO: chooseSTAMPButton"); + return false; +} + +#define GET_WORD READ_LE_UINT16(dataP); dataP += 2; {} + +void ThreadResource::parsePlayCommands() { + Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0); + Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0); + Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999); + Common::fill(&_vm->_voy._arr4[0][0], &_vm->_voy._arr4[3][20], 0); + Common::fill(&_vm->_voy._arr5[0][0], &_vm->_voy._arr5[3][20], 9999); + Common::fill(&_vm->_voy._arr6[0][0], &_vm->_voy._arr6[3][20], 0); + Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0); + + byte *dataP = _field28E; + int v2; + + for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) { + uint16 id = GET_WORD; + + switch (id) { + case 1: + _vm->_playStamp2 = READ_LE_UINT16(dataP); + dataP += 2; + break; + + case 2: + v2 = GET_WORD; + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP); + _vm->_voy._field468 = READ_LE_UINT16(dataP + 2); + _vm->_voy._field46A = READ_LE_UINT16(dataP + 4); + + if (_vm->_voy._RTVNum < _vm->_voy._field468 || + (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { + _vm->_eventsManager._videoComputerBut4 = -1; + } else { + _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; + addAudioEventStart(); + + assert(_vm->_eventsManager._videoComputerBut4 < 38); + _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( + 0x7F00 + BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._picResource; + _vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + + BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._cMapResource; + + (*_vm->_graphicsManager._vPort)->setupViewPort(); + _vm->_graphicsManager._backColors->startFade(); + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) + _vm->_eventsManager.delay(1); + + _vm->_voy._field478 = -2; + _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025); + Common::String filename = _vm->_soundManager.getVOCFileName( + _vm->_eventsManager._videoComputerBut4 + 159); + _vm->_soundManager.startVOCPlay(filename); + _vm->_voy._field478 |= 16; + _vm->_eventsManager.startCursorBlink(); + + while (!_vm->shouldQuit() && !_vm->_voy._incriminate && + _vm->_soundManager.getVOCStatus()) + _vm->_eventsManager.delay(1); + + _vm->_voy._field478 |= 1; + _vm->_soundManager.stopVOCPlay(); + addAudioEventEnd(); + _vm->_eventsManager.incrementTime(1); + _vm->_eventsManager.incrementTime(1); + + _vm->_bVoy->freeBoltGroup(0x17F00); + _vm->_voy._field478 = -17; + _vm->_eventsManager._videoComputerBut4 = -1; + _vm->_voy._field470 = 129; + parseIndex = 999; + } + } + + dataP += 6; + break; + + case 3: + break; + + case 4: + case 22: + _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1; + dataP += 2; + + // TODO: Original had a block here that would never be executed + + _vm->_voy._vocSecondsOffset = 0; + _vm->_voy._field468 = _vm->_voy._RTVNum; + _vm->_voy._field478 &= ~0x11; + _vm->playAVideo(_vm->_eventsManager._videoComputerBut4); + _vm->_voy._field478 |= 1; + _vm->_eventsManager._videoComputerBut4 = -1; + parseIndex = 999; + break; + + default: + break; + } + } +} + +#undef GET_WORD + +int ThreadResource::doApt() { + warning("TODO: doApt"); + return 0; +} + +void ThreadResource::doRoom() { + warning("TODO: doRoom"); +} + +int ThreadResource::doInterface() { + warning("TODO: doInterface"); + return 0; +} + +void ThreadResource::addAudioEventStart() { + _vm->_voy._events.push_back(VoyeurEvent(_vm->_eventsManager._videoComputerNum, + _vm->_eventsManager._videoComputerBut1, _vm->_voy._delaySecs, 2, + _vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset, + _vm->_eventsManager._videoDead)); +} + +void ThreadResource::addAudioEventEnd() { + error("TODO: addAudioEventEnd"); +} + +} // End of namespace Voyeur -- cgit v1.2.3 From d08953ccd94b00c1e74cfb36fb230649c4e58bae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 Dec 2013 00:11:02 -0500 Subject: VOYEUR: Implemented more of parsePlayCommands --- engines/voyeur/files_threads.cpp | 244 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 240 insertions(+), 4 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index bb58bcd7bb..e89e603a7b 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -268,7 +268,7 @@ void ThreadResource::parsePlayCommands() { Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0); byte *dataP = _field28E; - int v2; + int v2, v3; for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) { uint16 id = GET_WORD; @@ -338,6 +338,50 @@ void ThreadResource::parsePlayCommands() { break; case 3: + v2 = GET_WORD; + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP); + _vm->_voy._field468 = READ_LE_UINT16(dataP + 2); + _vm->_voy._field46A = READ_LE_UINT16(dataP + 4); + + if (_vm->_voy._RTVNum < _vm->_voy._field468 || + (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { + _vm->_eventsManager._videoComputerBut4 = -1; + } else { + _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; + addAudioEventStart(); + _vm->_voy._field478 &= ~1; + _vm->_voy._field478 |= 0x10; + _vm->playAVideo(_vm->_eventsManager._videoComputerBut4); + + _vm->_voy._field478 &= ~0x10; + _vm->_voy._field478 |= 1; + addVideoEventEnd(); + _vm->_eventsManager.incrementTime(1); + + _vm->_eventsManager._videoComputerBut4 = -1; + _vm->_playStamp1 = -1; + + if (_vm->_eventsManager._videoDead != -1) { + _vm->_bVoy->freeBoltGroup(0x10E00); + _vm->_eventsManager._videoDead = -1; + (*_vm->_graphicsManager._vPort)->_flags |= 8; + + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + } + + _vm->_eventsManager._videoDead = -1; + if (_field42 == 2 && _vm->_voy._incriminate == 0) { + _vm->_voy._field470 = 132; + parseIndex = 999; + } else { + _vm->_voy._field470 = 129; + } + } + } + + dataP += 6; break; case 4: @@ -345,17 +389,205 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1; dataP += 2; - // TODO: Original had a block here that would never be executed + if (id == 22) { + int resolveIndex = GET_WORD; + _vm->_playStamp1 = _vm->_resolvePtr[resolveIndex]; + } _vm->_voy._vocSecondsOffset = 0; _vm->_voy._field468 = _vm->_voy._RTVNum; _vm->_voy._field478 &= ~0x11; _vm->playAVideo(_vm->_eventsManager._videoComputerBut4); _vm->_voy._field478 |= 1; - _vm->_eventsManager._videoComputerBut4 = -1; - parseIndex = 999; + + if (id != 2) { + _vm->_eventsManager._videoComputerBut4 = -1; + parseIndex = 999; + } else { + // TODO: Double-check this + int count = _vm->_bVoy->getBoltGroup(_vm->_playStamp1)->_entries.size(); + _vm->_soundManager.stopVOCPlay(); + _vm->_eventsManager.getMouseInfo(); + + for (int i = 0; i < count; ++i) { + PictureResource *pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2)._picResource; + CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2 + 1)._cMapResource; + + (*_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); + + if (i > 0) { + _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2); + _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2 + 1); + } + + Common::String file = Common::String::format("news%d.voc", i + 1); + _vm->_soundManager.startVOCPlay(file); + + while (!_vm->shouldQuit() && !_vm->_voy._incriminate && + _vm->_soundManager.getVOCStatus()) { + _vm->_eventsManager.delay(1); + _vm->_eventsManager.getMouseInfo(); + } + + _vm->_soundManager.stopVOCPlay(); + + if (i == (count - 1)) + _vm->_eventsManager.delay(480); + + if (_vm->shouldQuit() || _vm->_voy._incriminate) + break; + } + + _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); + _vm->_playStamp1 = -1; + _vm->_eventsManager._videoComputerBut4 = -1; + parseIndex = 999; + } break; + case 5: + v2 = READ_LE_UINT16(dataP); + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + _vm->_voy._field470 = 5; + int count = READ_LE_UINT16(dataP + 2); + _vm->_voy._field476 = READ_LE_UINT16(dataP + 4); + + if (_vm->_voy._field474 != count) { + if (_vm->_voy._field474 > 1) + _vm->_voy._field478 &= ~0x100; + + _vm->_voy._field474 = count; + _vm->_eventsManager._videoComputerBut1 = LEVEL_M[count - 1]; + _vm->_eventsManager._videoComputerNum = LEVEL_H[count - 1]; + //_vm->_v2A0A2 = 0; + _vm->_voy._RTVNum = 0; + _vm->_voy._RTANum = 255; + } + + _vm->_voy._delaySecs = (_vm->_voy._field474 == 6) ? 1 : 0; + } + + dataP += 6; + break; + + case 6: + _vm->_voy._field470 = 6; + v2 = GET_WORD; + _vm->_playStamp1 = _vm->_resolvePtr[v2]; + break; + + case 7: + v2 = READ_LE_UINT16(dataP); + v3 = READ_LE_UINT16(dataP + 2) - 1; + + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + int idx = 0; + while (_vm->_voy._arr1[idx][v3] != 9999) + ++idx; + + _vm->_voy._arr1[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6); + _vm->_voy._arr2[idx][v3] = v3; + } + + dataP += 8; + break; + + case 8: + v2 = READ_LE_UINT16(dataP); + v3 = READ_LE_UINT16(dataP + 2) - 1; + + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + int idx = 0; + while (_vm->_voy._arr3[idx][v3] != 9999) + ++idx; + + _vm->_voy._arr3[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6); + _vm->_voy._arr4[idx][v3] = v3; + } + + dataP += 8; + break; + + case 9: + v2 = READ_LE_UINT16(dataP); + v3 = READ_LE_UINT16(dataP + 2) - 1; + + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + int idx = 0; + while (_vm->_voy._arr5[idx][v3] != 9999) + ++idx; + + _vm->_voy._arr5[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6); + _vm->_voy._arr6[idx][v3] = v3; + } + + dataP += 8; + break; + + case 10: + if (_vm->_iForceDeath == -1) { + int randomVal; + do { + randomVal = _vm->getRandomNumber(3); + } while (randomVal == _vm->_voy._field4380); + + _vm->_voy._field4380 = randomVal; + WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, randomVal); + } else { + _vm->_voy._field4380 = _vm->_iForceDeath; + WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, _vm->_iForceDeath); + } + + _vm->saveLastInplay(); + break; + + case 11: + _vm->_voy._field478 = 2; + break; + + case 12: + v2 = READ_LE_UINT16(dataP); + + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + _vm->_voy._field47A = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)]; + _vm->_voy._arr7[READ_LE_UINT16(dataP + 4) - 1] = 1; + } + + dataP += 6; + break; + + case 13: + v2 = READ_LE_UINT16(dataP); + + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + _vm->_voy._field4E2 = READ_LE_UINT16(dataP + 2); + _vm->_voy._field4EC = READ_LE_UINT16(dataP + 4); + _vm->_voy._field4EE = READ_LE_UINT16(dataP + 6); + + _vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4]; + _vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 1]; + _vm->_voy._rect4E4.right = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 2]; + _vm->_voy._rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 3]; + } + + dataP += 8; + break; + + case 14: + _vm->_playStamp1 = 2048; + _vm->_voy._field470 = 130; + break; + + // TODO: More + default: break; } @@ -389,4 +621,8 @@ void ThreadResource::addAudioEventEnd() { error("TODO: addAudioEventEnd"); } +void ThreadResource::addVideoEventEnd() { + error("TODO: addVideoEventEnd"); +} + } // End of namespace Voyeur -- cgit v1.2.3 From 7f5a5606a53ac4e17f4465b0e127dc2a44531cbe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 Dec 2013 21:46:06 -0500 Subject: VOYEUR: Implemented remainder of parsePlayCommands --- engines/voyeur/files_threads.cpp | 115 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 3 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index e89e603a7b..a65710245e 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -30,6 +30,7 @@ namespace Voyeur { int ThreadResource::_stampFlags = 0; int ThreadResource::_useCount[8]; byte *ThreadResource::_threadDataPtr = NULL; +CMapResource *ThreadResource::_cmd14Pal = NULL; ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): _vm(state._vm) { @@ -269,6 +270,8 @@ void ThreadResource::parsePlayCommands() { byte *dataP = _field28E; int v2, v3; + PictureResource *pic; + CMapResource *pal; for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) { uint16 id = GET_WORD; @@ -410,8 +413,8 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager.getMouseInfo(); for (int i = 0; i < count; ++i) { - PictureResource *pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2)._picResource; - CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2 + 1)._cMapResource; + pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2)._picResource; + pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2 + 1)._cMapResource; (*_vm->_graphicsManager._vPort)->setupViewPort(pic); pal->startFade(); @@ -586,7 +589,113 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field470 = 130; break; - // TODO: More + case 15: + _vm->_playStamp1 = (_vm->_voy._field4382 - 1) * 8 + 0x7700; + _vm->_voy._field47A = ((READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) + - 1) << 8) + 0x7B00; + + pic = _vm->_bVoy->boltEntry(_vm->_playStamp1)._picResource; + _cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._cMapResource; + + (*_vm->_graphicsManager._vPort)->setupViewPort(pic); + _cmd14Pal->startFade(); + + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) + _vm->_eventsManager.delay(1); + _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->_playStamp1 + idx * 2)._picResource; + _cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + idx * 2 + 1)._cMapResource; + } + + (*_vm->_graphicsManager._vPort)->setupViewPort(pic); + _cmd14Pal->startFade(); + + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) + _vm->_eventsManager.delay(1); + + _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2); + _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2 + 1); + + Common::String fname = Common::String::format("news%d.voc", idx); + + while (!_vm->shouldQuit() && !_vm->_voy._incriminate && + _vm->_soundManager.getVOCStatus()) + _vm->_eventsManager.delay(1); + + _vm->_soundManager.stopVOCPlay(); + if (idx == 3) + _vm->_eventsManager.delay(3); + + if (_vm->shouldQuit() || _vm->_voy._incriminate) + break; + } + + _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); + _vm->_bVoy->freeBoltGroup(_vm->_voy._field47A); + _vm->_playStamp1 = -1; + _vm->_voy._field47A = -1; + break; + + case 16: + _vm->_voy._field470 = 16; + break; + + case 17: + _vm->_voy._field470 = 17; + break; + + case 18: + v2 = READ_LE_UINT16(dataP); + v3 = READ_LE_UINT16(dataP + 2); + + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) + _vm->_voy._field4F2 = v3; + + dataP += 4; + break; + + case 19: + _vm->_voy._field472 = 140; + _vm->loadTheApt(); + _vm->_voy._field472 = 141; + _vm->freeTheApt(); + break; + + case 20: + _vm->_voy._field472 = -1; + _vm->loadTheApt(); + _vm->_voy._field472 = 141; + _vm->freeTheApt(); + break; + + case 21: + _vm->_voy._field472 = -1; + _vm->loadTheApt(); + _vm->_voy._field472 = 140; + _vm->freeTheApt(); + break; + + case 23: + _vm->_voy._field474 = 17; + _vm->_voy._field472 = -1; + _vm->loadTheApt(); + _vm->_voy._field472 = 144; + _vm->freeTheApt(); + break; default: break; -- cgit v1.2.3 From d5762b5332d0031cd3e4327fb868d8358dcaf7c2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 Dec 2013 21:51:33 -0500 Subject: VOYEUR: Removed use of GET_WORD macro in parsePlayCommands --- engines/voyeur/files_threads.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index a65710245e..dc9d014992 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -257,8 +257,6 @@ bool ThreadResource::chooseSTAMPButton(int idx) { return false; } -#define GET_WORD READ_LE_UINT16(dataP); dataP += 2; {} - void ThreadResource::parsePlayCommands() { Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0); Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0); @@ -274,7 +272,8 @@ void ThreadResource::parsePlayCommands() { CMapResource *pal; for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) { - uint16 id = GET_WORD; + uint16 id = READ_LE_UINT16(dataP); + dataP += 2; switch (id) { case 1: @@ -283,11 +282,12 @@ void ThreadResource::parsePlayCommands() { break; case 2: - v2 = GET_WORD; + v2 = READ_LE_UINT16(dataP); + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP); - _vm->_voy._field468 = READ_LE_UINT16(dataP + 2); - _vm->_voy._field46A = READ_LE_UINT16(dataP + 4); + _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP + 2); + _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); + _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); if (_vm->_voy._RTVNum < _vm->_voy._field468 || (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { @@ -337,15 +337,16 @@ void ThreadResource::parsePlayCommands() { } } - dataP += 6; + dataP += 8; break; case 3: - v2 = GET_WORD; + v2 = READ_LE_UINT16(dataP); + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP); - _vm->_voy._field468 = READ_LE_UINT16(dataP + 2); - _vm->_voy._field46A = READ_LE_UINT16(dataP + 4); + _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP + 2); + _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); + _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); if (_vm->_voy._RTVNum < _vm->_voy._field468 || (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { @@ -384,7 +385,7 @@ void ThreadResource::parsePlayCommands() { } } - dataP += 6; + dataP += 8; break; case 4: @@ -393,7 +394,8 @@ void ThreadResource::parsePlayCommands() { dataP += 2; if (id == 22) { - int resolveIndex = GET_WORD; + int resolveIndex = READ_LE_UINT16(dataP); + dataP += 2; _vm->_playStamp1 = _vm->_resolvePtr[resolveIndex]; } @@ -483,8 +485,9 @@ void ThreadResource::parsePlayCommands() { case 6: _vm->_voy._field470 = 6; - v2 = GET_WORD; + v2 = READ_LE_UINT16(dataP); _vm->_playStamp1 = _vm->_resolvePtr[v2]; + dataP += 2; break; case 7: @@ -703,8 +706,6 @@ void ThreadResource::parsePlayCommands() { } } -#undef GET_WORD - int ThreadResource::doApt() { warning("TODO: doApt"); return 0; -- cgit v1.2.3 From 7f018dafd5e56285e40d834de17447de3894a148 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 Dec 2013 22:20:48 -0500 Subject: VOYEUR: Bugfixes for getField1CE method --- engines/voyeur/files_threads.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index dc9d014992..0c0e9aba9e 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -169,10 +169,11 @@ void ThreadResource::getButtonsFlags() { void ThreadResource::getField1CE() { int idx = 0; - for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + for (const byte *p = _field4A; *p++ != 0x49; p = getNextRecord(p)) { assert(idx < 47); _field1CE[idx++] = getRecordOffset(p); _field1CE[idx] = NULL; + p += 4; } } @@ -199,7 +200,7 @@ void ThreadResource::initUseCount() { } const byte *ThreadResource::getRecordOffset(const byte *p) { - uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(p + 6); + uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(_ctlPtr + 6); return _ctlPtr + recSize; } -- cgit v1.2.3 From ae7bb13f20889c402b55f7d9ef55223b3437da06 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 Dec 2013 22:36:40 -0500 Subject: VOYEUR: Fix loading of ControlResource --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 0c0e9aba9e..a437f012c7 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -543,7 +543,7 @@ void ThreadResource::parsePlayCommands() { if (_vm->_iForceDeath == -1) { int randomVal; do { - randomVal = _vm->getRandomNumber(3); + randomVal = _vm->getRandomNumber(3) + 1; } while (randomVal == _vm->_voy._field4380); _vm->_voy._field4380 = randomVal; -- cgit v1.2.3 From dfd4e765f2072a108308be183427504c2efad643 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 Dec 2013 08:51:13 -0500 Subject: VOYEUR: Implementing code for chooseSTAMPButton and sub-methods --- engines/voyeur/files_threads.cpp | 118 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 114 insertions(+), 4 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index a437f012c7..8176a4f925 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -249,16 +249,88 @@ const byte *ThreadResource::getNextRecord(const byte *p) { } } -void ThreadResource::cardAction(const byte *p) { - warning("TODO: cardAction"); +const byte *ThreadResource::getSTAMPCard(int cardId) { + const byte *p; + int count = 0; + for (p = _field4A; count <= cardId && *p != 0x49; p = getNextRecord(p)) { + if (*p == 0xC0) + ++count; + } + + return p; +} + +int ThreadResource::getStateFromID(uint32 id) { + int count = READ_LE_UINT16(_ctlPtr); + + for (int i = 0; i < count; ++i) { + uint32 sid = getSID(i); + if (sid == id) + return i; + } + + return -1; +} + +uint32 ThreadResource::getSID(int sid) { + uint32 offset = READ_LE_UINT32(_ctlPtr + 2) + (sid << 3) + 4; + return READ_LE_UINT32(_ctlPtr + offset); +} + +void ThreadResource::doSTAMPCardAction() { + for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + if (*p == 0x48) { + cardAction(p + 1); + return; + } + } +} + +void ThreadResource::cardAction(const byte *card) { + _vm->_glGoScene = -1; + _vm->_glGoStack = -1; + + // Loop to perform card commands + while (!_vm->shouldQuit() && *card < 70 && _vm->_glGoScene == -1) { + card = cardPerform(card); + } } -bool ThreadResource::chooseSTAMPButton(int idx) { - warning("TODO: chooseSTAMPButton"); +bool ThreadResource::chooseSTAMPButton(int buttonId) { + _flags &= ~1; + + for (int idx = 0; idx < _field42; ++idx) { + if (_field18E[idx] == buttonId) { + const byte *card = getSTAMPCard(idx); + cardAction(card); + + bool flag = true; + while (!_vm->shouldQuit() && _vm->_glGoStack != -1 && flag) { + doSTAMPCardAction(); + flag = goToStateID(_vm->_glGoStack, _vm->_glGoScene); + } + + while (!_vm->shouldQuit() && _vm->_glGoScene != -1 && flag) { + doSTAMPCardAction(); + flag = goToState(-1, _vm->_glGoScene); + } + + return flag; + } + } + return false; } void ThreadResource::parsePlayCommands() { + _vm->_voy._field470 = -1; + _vm->_voy._field468 = 0; + _vm->_voy._field46A = 0; + _vm->_voy._field47A = -1; + _vm->_voy._field4E2 = -1; + _vm->_voy._field478 &= ~8; + _vm->_eventsManager._videoDead = -1; + Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0); Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0); Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999); @@ -707,6 +779,11 @@ void ThreadResource::parsePlayCommands() { } } +const byte *ThreadResource::cardPerform(const byte *card) { + error("TODO"); + return NULL; +} + int ThreadResource::doApt() { warning("TODO: doApt"); return 0; @@ -736,4 +813,37 @@ void ThreadResource::addVideoEventEnd() { error("TODO: addVideoEventEnd"); } +bool ThreadResource::goToStateID(int stackId, int sceneId) { + // Save current stack + savePrevious(); + + if (_controlIndex == stackId || stackId == -1 || loadAStack(stackId)) { + // Now in the correct state + _threadId = getStateFromID(sceneId); + + if (_threadId != -1) { + return doState(); + } else { + _threadId = _field4; + _controlIndex = _field6; + } + } + + return false; +} + +bool ThreadResource::goToState(int stackId, int sceneId) { + error("TODO: goToState"); +} + +void ThreadResource::savePrevious() { + if (_field4 == _threadId && _controlIndex == _field6) { + _flags &= ~1; + } else { + _flags |= 1; + _field4 = _threadId; + _field6 = _controlIndex; + } +} + } // End of namespace Voyeur -- cgit v1.2.3 From 1187a4fc2516e01f951f0f165f287098f133cfee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 Dec 2013 20:33:59 -0500 Subject: VOYEUR: Implemented goToState method --- engines/voyeur/files_threads.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 8176a4f925..7ba3c5e62d 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -833,7 +833,15 @@ bool ThreadResource::goToStateID(int stackId, int sceneId) { } bool ThreadResource::goToState(int stackId, int sceneId) { - error("TODO: goToState"); + savePrevious(); + if (stackId == -1 || loadAStack(stackId)) { + if (sceneId != -1) + _threadId = sceneId; + + return doState(); + } else { + return false; + } } void ThreadResource::savePrevious() { -- cgit v1.2.3 From c479aed9d1282469656fa74bafd5d99758c03931 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 Dec 2013 23:56:54 -0500 Subject: VOYEUR: Implemented cardPerform and cardPerform2 --- engines/voyeur/files_threads.cpp | 265 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 261 insertions(+), 4 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 7ba3c5e62d..bba87cfda4 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -155,10 +155,10 @@ void ThreadResource::getButtonsFlags() { if (*++p & 0x20) _field40 |= 2; - _field4E[idx] = *p++; + _buttonFlags[idx] = *p++; _field18E[idx] = *p++; - if (_field4E[idx] & 0x80) + if (_buttonFlags[idx] & 0x80) p += 4; ++idx; @@ -780,10 +780,259 @@ void ThreadResource::parsePlayCommands() { } const byte *ThreadResource::cardPerform(const byte *card) { - error("TODO"); - return NULL; + int var7 = 0; + uint32 varC = 0; + const byte *p, *p2; + byte *pDest; + + uint16 id = *card++; + int varD = 5; + uint32 v2; + int v3; + byte bVal; + uint32 idx1, idx2; + + switch (id) { + case 1: + v2 = READ_LE_UINT32(card); + card += 4; + WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card << 2), v2); + ++card; + break; + + case 2: + v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)), + WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2); + break; + + case 3: + v2 = READ_LE_UINT32(card); + card += 4; + WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2); + break; + + case 4: + v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)); + WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2); + break; + + case 5: + v2 = READ_LE_UINT32(card); + card += 4; + pDest = _vm->_controlPtr->_ptr + (*card++ << 2); + WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2); + break; + + case 6: + idx1 = *card++; + idx2 = *card++; + + v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + idx2); + pDest = _vm->_controlPtr->_ptr + idx1; + WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2); + break; + + case 7: + v3 = *card++; + v2 = READ_LE_UINT32(card); + card += 4; + pDest = _vm->_controlPtr->_ptr + (v3 << 2); + WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * v2); + break; + + case 8: + idx1 = *card++; + idx2 = *card++; + + pDest = _vm->_controlPtr->_ptr + (idx1 << 2); + p2 = _vm->_controlPtr->_ptr + (idx2 << 2); + WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * READ_LE_UINT32(p2)); + break; + + case 9: + idx1 = *card++; + v2 = READ_LE_UINT32(card); + card += 4; + + pDest = _vm->_controlPtr->_ptr + (idx1 << 2); + WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / v2); + break; + + case 10: + idx1 = *card++; + idx2 = *card++; + + pDest = _vm->_controlPtr->_ptr + (idx1 << 2); + p2 = _vm->_controlPtr->_ptr + (idx2 << 2); + WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / READ_LE_UINT32(p2)); + break; + + case 11: + v2 = READ_LE_UINT32(card); + card += 4; + v2 = _vm->getRandomNumber(v2 - 1) + 1; + WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2); + break; + + case 17: + _vm->_glGoScene = READ_LE_UINT16(card); + card += 2; + _vm->_glGoStack = -1; + break; + + case 18: + v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)); + _vm->_glGoScene = getStateFromID(v2); + break; + + case 19: + _vm->_glGoScene = READ_LE_UINT32(card); + card += 4; + _vm->_glGoStack = READ_LE_UINT16(card); + card += 2; + break; + + case 22: + case 23: + case 26: + case 27: + varD -= 3; + // Deliberate fall-through + + case 20: + case 21: + case 24: + case 25: + bVal = card[varD]; + if (bVal == 61) { + if (cardPerform2(card, id)) { + card += varD; + while (*card != 30 && *card != 29) + card = cardPerform(card); + + if (*card == 29) { + int count = 1; + while (count > 0) { + card = getNextRecord(card); + if (*card == 30) + --count; + if (*card >= 21 && *card <= 28) + ++count; + } + } + } else { + card += varD; + int count = 1; + while (count > 0) { + card = getNextRecord(card); + if (*card == 29 || *card == 30) + --count; + if (*card < 21 || *card > 28) + continue; + + const byte *nextP = getNextRecord(card + 2); + if (*nextP == 61) + ++count; + } + } + + ++card; + } else { + if (cardPerform2(card, id)) { + card += varD; + card = cardPerform(card); + while (*card++ != 61) ; + } else { + card += varD; + while (*card != 61 && *card != 29) + ++card; + } + } + break; + + case 41: + bVal = *card++; + assert(bVal < 8); + _fieldA[bVal] = READ_LE_UINT32(card); + card += 4; + + _field2A[bVal] = READ_LE_UINT16(card); + card += 2; + + case 45: + _field3A = _field46; + _field3E = _controlIndex; + break; + + case 46: + _vm->_glGoScene = _field3A; + _vm->_glGoStack = _field3E; + _field3A = -1; + _field3E = -1; + break; + + case 51: + setButtonFlag(READ_LE_UINT16(card), 64); + break; + + case 52: + clearButtonFlag(READ_LE_UINT16(card), 64); + break; + + default: + break; + } + + return card; } +bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) { + uint32 vLong, vLong2; + + switch (cardCmdId) { + case 21: + vLong = READ_LE_UINT32(pSrc + 1); + return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) == vLong; + + case 22: + vLong = READ_LE_UINT32(pSrc + 1); + return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) != vLong; + + case 23: + vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); + vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2)); + return vLong == vLong2; + + case 24: + vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); + vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2)); + return vLong != vLong2; + + case 25: + vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); + vLong2 = READ_LE_UINT32(pSrc + 1); + return vLong < vLong2; + + case 26: + vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); + vLong2 = READ_LE_UINT32(pSrc + 1); + return vLong > vLong2; + + case 27: + vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); + vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2)); + return vLong < vLong2; + + case 28: + vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); + vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2)); + return vLong > vLong2; + + default: + return false; + } +} + int ThreadResource::doApt() { warning("TODO: doApt"); return 0; @@ -854,4 +1103,12 @@ void ThreadResource::savePrevious() { } } +void ThreadResource::setButtonFlag(int idx, byte bits) { + _buttonFlags[idx] |= bits; +} + +void ThreadResource::clearButtonFlag(int idx, byte bits) { + _buttonFlags[idx] &= ~bits; +} + } // End of namespace Voyeur -- cgit v1.2.3 From 09b22952ce6d108ae5063c79a2e08bcddda1fc6c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 13 Dec 2013 20:51:06 -0500 Subject: VOYEUR: Minor fix to getNextRecord and added a few debug lines --- engines/voyeur/files_threads.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index bba87cfda4..40febd75ae 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -241,7 +241,7 @@ const byte *ThreadResource::getNextRecord(const byte *p) { case 74: return p + 4; case 192: - if (*p * 0x80) + if (*p & 0x80) p += 4; return p + 2; default: @@ -252,6 +252,7 @@ const byte *ThreadResource::getNextRecord(const byte *p) { const byte *ThreadResource::getSTAMPCard(int cardId) { const byte *p; int count = 0; + for (p = _field4A; count <= cardId && *p != 0x49; p = getNextRecord(p)) { if (*p == 0xC0) ++count; @@ -1063,6 +1064,8 @@ void ThreadResource::addVideoEventEnd() { } bool ThreadResource::goToStateID(int stackId, int sceneId) { + debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, sceneId); + // Save current stack savePrevious(); @@ -1082,6 +1085,8 @@ bool ThreadResource::goToStateID(int stackId, int sceneId) { } bool ThreadResource::goToState(int stackId, int sceneId) { + debugC(DEBUG_BASIC, kDebugScripts, "goToState - %d, %d", stackId, sceneId); + savePrevious(); if (stackId == -1 || loadAStack(stackId)) { if (sceneId != -1) -- cgit v1.2.3 From b80d0e9aa3c6d7fe3706a7e634623559a36e4548 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 13 Dec 2013 22:11:16 -0500 Subject: VOYEUR: Fix field intiialisation in getStateInfo --- engines/voyeur/files_threads.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 40febd75ae..67df87fd78 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -35,6 +35,7 @@ CMapResource *ThreadResource::_cmd14Pal = NULL; ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): _vm(state._vm) { _flags = src[8]; + _ctlPtr = nullptr; } void ThreadResource::initThreadStruct(int idx, int id) { @@ -114,7 +115,7 @@ bool ThreadResource::getStateInfo() { _parseCount = READ_LE_UINT16(baseP + 4); _field28E = getDataOffset(); - _field28E += READ_LE_UINT32(baseP + 6) / 2; + _field28E += (READ_LE_UINT32(baseP + 6) / 2) << 1; _field4A = baseP + 10; -- cgit v1.2.3 From 208c5aa6b75f31135fda7af7484b17ca1b14c82d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 13 Dec 2013 23:03:25 -0500 Subject: VOYEUR: Fix for parsePlayCommands command 9 --- engines/voyeur/files_threads.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 67df87fd78..3880893c29 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -348,6 +348,8 @@ void ThreadResource::parsePlayCommands() { for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) { uint16 id = READ_LE_UINT16(dataP); + debugC(DEBUG_BASIC, kDebugScripts, "parsePlayCommands (%d of %d) - cmd #%d", + parseIndex, _parseCount, id); dataP += 2; switch (id) { @@ -606,8 +608,9 @@ void ThreadResource::parsePlayCommands() { while (_vm->_voy._arr5[idx][v3] != 9999) ++idx; - _vm->_voy._arr5[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6); - _vm->_voy._arr6[idx][v3] = v3; + v2 = READ_LE_UINT16(dataP + 4); + _vm->_voy._arr5[idx][v3] = v2; + _vm->_voy._arr6[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; } dataP += 8; -- cgit v1.2.3 From b9bd380a29cff9e1ad3a11b47dbc273630c740a4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 13 Dec 2013 23:13:35 -0500 Subject: VOYEUR: Fixes for parsePlayCommands command 7 --- engines/voyeur/files_threads.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 3880893c29..195e05d71f 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -333,7 +333,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 &= ~8; _vm->_eventsManager._videoDead = -1; - Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0); + Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 9999); Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0); Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999); Common::fill(&_vm->_voy._arr4[0][0], &_vm->_voy._arr4[3][20], 0); @@ -576,8 +576,9 @@ void ThreadResource::parsePlayCommands() { while (_vm->_voy._arr1[idx][v3] != 9999) ++idx; - _vm->_voy._arr1[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6); - _vm->_voy._arr2[idx][v3] = v3; + v2 = READ_LE_UINT16(dataP + 4); + _vm->_voy._arr1[idx][v3] = v2; + _vm->_voy._arr2[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; } dataP += 8; -- cgit v1.2.3 From 033929d70184eea4f8a0507380f316ea9f27373f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 13 Dec 2013 23:18:59 -0500 Subject: VOYEUR: Fixes for parsePlayCommands command 8 --- engines/voyeur/files_threads.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 195e05d71f..c09293ade5 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -585,7 +585,7 @@ void ThreadResource::parsePlayCommands() { break; case 8: - v2 = READ_LE_UINT16(dataP); + v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { @@ -593,8 +593,9 @@ void ThreadResource::parsePlayCommands() { while (_vm->_voy._arr3[idx][v3] != 9999) ++idx; - _vm->_voy._arr3[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6); - _vm->_voy._arr4[idx][v3] = v3; + v2 = READ_LE_UINT16(dataP + 4); + _vm->_voy._arr3[idx][v3] = v2; + _vm->_voy._arr4[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; } dataP += 8; -- cgit v1.2.3 From 4ffa060832dbf7ad103ae80790e07eac91b329f0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 13 Dec 2013 23:26:51 -0500 Subject: VOYEUR: Make parsePlayCommands debug parse Index be 1-based --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index c09293ade5..893e5e9d58 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -349,7 +349,7 @@ void ThreadResource::parsePlayCommands() { for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) { uint16 id = READ_LE_UINT16(dataP); debugC(DEBUG_BASIC, kDebugScripts, "parsePlayCommands (%d of %d) - cmd #%d", - parseIndex, _parseCount, id); + parseIndex + 1, _parseCount, id); dataP += 2; switch (id) { -- cgit v1.2.3 From 49d50afb4728d6a5773fb8faeac3629bf56953ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 Dec 2013 11:39:15 -0500 Subject: VOYEUR: In progress implementation of doInterface --- engines/voyeur/files_threads.cpp | 88 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 4 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 893e5e9d58..aacc619f6b 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -27,10 +27,21 @@ namespace Voyeur { -int ThreadResource::_stampFlags = 0; +int ThreadResource::_stampFlags; int ThreadResource::_useCount[8]; -byte *ThreadResource::_threadDataPtr = NULL; -CMapResource *ThreadResource::_cmd14Pal = NULL; +byte *ThreadResource::_threadDataPtr; +CMapResource *ThreadResource::_cmd14Pal; +int ThreadResource::_currentMouseX; +int ThreadResource::_currentMouseY; + +void ThreadResource::init() { + _stampFlags = 0; + Common::fill(&_useCount[0], &_useCount[8], 0); + _threadDataPtr = nullptr; + _cmd14Pal = nullptr; + _currentMouseX = 392; + _currentMouseY = 57; +} ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): _vm(state._vm) { @@ -1050,7 +1061,76 @@ void ThreadResource::doRoom() { } int ThreadResource::doInterface() { - warning("TODO: doInterface"); + int varA = -1; + int var8 = 0; + + if (_vm->_voy._field478 != _vm->_voy._field46E) { + _vm->_voy._field46E = 0; + return -1; + } + + _vm->_voy._field478 &= ~0x100; + _vm->_playStamp1 = -1; + _vm->_eventsManager._intPtr.field1E = 1; + _vm->_eventsManager._intPtr.field1A = 0; + + if (_vm->_voy._RTVNum >= _vm->_voy._field476 || _vm->_voy._RTVNum < 0) + _vm->_voy._RTVNum = _vm->_voy._field476 - 1; + + if (_vm->_voy._field474 < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) { + _vm->_voy._RTVNum = _vm->_voy._field476; + _vm->makeViewFinder(); + + _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); + _vm->initIFace(); + _vm->_voy._RTVNum = _vm->_voy._field476 - 4; + _vm->_voy._field478 &= ~1; + + while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._field476) { + _vm->flashTimeBar(); + } + + _vm->_voy._field478 = 1; + chooseSTAMPButton(20); + parsePlayCommands(); + } + + _vm->checkTransition(); + _vm->makeViewFinder(); + _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); + _vm->initIFace(); + + byte *dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1); + _vm->_playStamp2 = 151 - _vm->getRandomNumber(5); + _vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29); + + Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_playStamp2); + _vm->_soundManager.startVOCPlay(fname); + _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); + + _vm->_graphicsManager.setColor(240, 220, 220, 220); + _vm->_eventsManager._intPtr.field38 = true; + _vm->_eventsManager._intPtr._hasPalette = true; + _vm->_voy._field478 &= ~1; + + for (;;) { + _vm->doTimeBar(1); + _vm->_eventsManager.getMouseInfo(); + + const Common::Point &pt = _vm->_eventsManager.getMousePos(); + if (pt.x != _currentMouseX || pt.y != _currentMouseY || var8 != varA) { + varA = var8; + _vm->_graphicsManager.doScroll(pt); + + _currentMouseX = pt.x; + _currentMouseY = pt.y; + } + + // TODO + } + return 0; } -- cgit v1.2.3 From af90a11ff258461cd84dfc89ecfbe54fc720c312 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 Dec 2013 17:38:01 -0500 Subject: VOYEUR: Fix various warnings --- engines/voyeur/files_threads.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index aacc619f6b..f74b7dbb38 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -798,9 +798,7 @@ void ThreadResource::parsePlayCommands() { } const byte *ThreadResource::cardPerform(const byte *card) { - int var7 = 0; - uint32 varC = 0; - const byte *p, *p2; + const byte *p2; byte *pDest; uint16 id = *card++; -- cgit v1.2.3 From 95316a59569b08eb0fb1df7548da500da7948bca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 Dec 2013 20:40:19 -0500 Subject: VOYEUR: Implemented doInterface method --- engines/voyeur/files_threads.cpp | 130 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 124 insertions(+), 6 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index f74b7dbb38..532e7f981c 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1061,10 +1061,12 @@ void ThreadResource::doRoom() { int ThreadResource::doInterface() { int varA = -1; int var8 = 0; + PictureResource *pic; + Common::Point pt; if (_vm->_voy._field478 != _vm->_voy._field46E) { _vm->_voy._field46E = 0; - return -1; + return -2; } _vm->_voy._field478 &= ~0x100; @@ -1113,11 +1115,11 @@ int ThreadResource::doInterface() { _vm->_eventsManager._intPtr._hasPalette = true; _vm->_voy._field478 &= ~1; - for (;;) { + do { _vm->doTimeBar(1); _vm->_eventsManager.getMouseInfo(); - const Common::Point &pt = _vm->_eventsManager.getMousePos(); + pt = _vm->_eventsManager.getMousePos(); if (pt.x != _currentMouseX || pt.y != _currentMouseY || var8 != varA) { varA = var8; _vm->_graphicsManager.doScroll(pt); @@ -1126,10 +1128,126 @@ int ThreadResource::doInterface() { _currentMouseY = pt.y; } - // TODO - } + _vm->checkPhoneCall(); + if (!_vm->_soundManager.getVOCStatus()) { + _vm->_playStamp2 = 151 - _vm->getRandomNumber(5); + _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); + } - return 0; + Common::Point pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75); + + for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) { + if (READ_LE_UINT16(dataP + (idx * 8 + 2)) <= pt.x && + READ_LE_UINT16(dataP + (idx * 8 + 6)) >= pt.x && + READ_LE_UINT16(dataP + (idx * 8 + 4)) <= pt.y && + READ_LE_UINT16(dataP + (idx * 8 + 8)) >= pt.y) { + // Rect check done + for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { + if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum && + _vm->_voy._arr4[arrIndex][idx] > _vm->_voy._RTVNum) { + // Draw the picture + pic = _vm->_bVoy->boltEntry(276)._picResource; + _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, + Common::Point(178, 108)); + var8 = idx; + } + + if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum && + _vm->_voy._arr6[idx][idx] > _vm->_voy._RTVNum) { + // Draw the picture + pic = _vm->_bVoy->boltEntry(277)._picResource; + _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, + Common::Point(178, 108)); + var8 = idx; + } + } + + for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { + if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum && + _vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) { + // Draw the picture + pic = _vm->_bVoy->boltEntry(375)._picResource; + _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, + Common::Point(178, 108)); + var8 = idx; + } + } + } + } + + if (var8 == -1) { + // Draw the default picture + pic = _vm->_bVoy->boltEntry(274)._picResource; + _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, + Common::Point(178, 108)); + } + + if (_vm->_voy._RTVNum & 2) { + _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, + 10 / _vm->_eventsManager._videoComputerBut1, 0x1900BE); + _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, + 10 % _vm->_eventsManager._videoComputerBut1, 0x1900BE); + + if (_vm->_voy._RTANum & 4) { + int v = 10 / _vm->_eventsManager._videoComputerNum; + _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, + v == 0 ? 10 : v, 0x1900BE); + _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, + _vm->_eventsManager._videoComputerNum % 10, 0x1900AC); + + pic = _vm->_bVoy->boltEntry(274)._picResource; + _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, + Common::Point(215, 27)); + } + } + + _vm->_voy._RTANum = 0; + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + pt = _vm->_eventsManager.getMousePos(); + if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) && + (_vm->_voy._fadeFunc != NULL) && (pt.x == 0))) { + _vm->_eventsManager.getMouseInfo(); + + if (_vm->_voy._field474 == 15) { + var8 = 20; + _vm->_voy._field474 = 17; + _vm->_soundManager.stopVOCPlay(); + _vm->checkTransition(); + _vm->_voy._lastInplay = true; + } else { + _vm->_voy._field478 = 1; + _currentMouseX = pt.x; + _currentMouseY = pt.y; + + chooseSTAMPButton(20); + parsePlayCommands(); + _vm->checkTransition(); + _vm->makeViewFinder(); + + _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); + _vm->initIFace(); + + dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1); + _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); + + _vm->_voy._field478 &= ~2; + _vm->_eventsManager._intPtr.field1E = 1; + _vm->_eventsManager._intPtr.field1A = 0; + } + } + } while (!_vm->_voy._fadeFunc && !_vm->shouldQuit() && + (!_vm->_voy._lastInplay || var8 == -1)); + + _vm->_voy._field478 |= 1; + _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); + if (_vm->_playStamp2 != -1) + _vm->_soundManager.stopVOCPlay(); + + return !_vm->_voy._fadeFunc ? var8 : -2; } void ThreadResource::addAudioEventStart() { -- cgit v1.2.3 From fc757c3169c2ec9df8064ae9e901fae79105be3a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 Dec 2013 20:42:16 -0500 Subject: VOYEUR: Fix shadowed variable in doInterface --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 532e7f981c..12314df731 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1134,7 +1134,7 @@ int ThreadResource::doInterface() { _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); } - Common::Point pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75); + pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75); for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) { if (READ_LE_UINT16(dataP + (idx * 8 + 2)) <= pt.x && -- cgit v1.2.3 From 798a93d8995011a5cc2cc2a611fb2c6f774d9600 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 Dec 2013 21:08:56 -0500 Subject: VOYEUR: Slight fix to doInterface method --- engines/voyeur/files_threads.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 12314df731..a8cf28841e 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1064,7 +1064,8 @@ int ThreadResource::doInterface() { PictureResource *pic; Common::Point pt; - if (_vm->_voy._field478 != _vm->_voy._field46E) { + _vm->_voy._field478 |= 1; + if (_vm->_voy._field46E) { _vm->_voy._field46E = 0; return -2; } -- cgit v1.2.3 From e44fa657e4cfc3c27b4eb607ba1d1cb11aade053 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 Dec 2013 22:27:16 -0500 Subject: VOYEUR: Implemented support methods needed for doApt --- engines/voyeur/files_threads.cpp | 199 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 190 insertions(+), 9 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index a8cf28841e..0143084645 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -33,6 +33,8 @@ byte *ThreadResource::_threadDataPtr; CMapResource *ThreadResource::_cmd14Pal; int ThreadResource::_currentMouseX; int ThreadResource::_currentMouseY; +int ThreadResource::_doAptState1; +int ThreadResource::_doAptState2; void ThreadResource::init() { _stampFlags = 0; @@ -41,6 +43,8 @@ void ThreadResource::init() { _cmd14Pal = nullptr; _currentMouseX = 392; _currentMouseY = 57; + _doAptState1 = -1; + _doAptState2 = -1; } ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): @@ -764,31 +768,31 @@ void ThreadResource::parsePlayCommands() { case 19: _vm->_voy._field472 = 140; - _vm->loadTheApt(); + loadTheApt(); _vm->_voy._field472 = 141; - _vm->freeTheApt(); + freeTheApt(); break; case 20: _vm->_voy._field472 = -1; - _vm->loadTheApt(); + loadTheApt(); _vm->_voy._field472 = 141; - _vm->freeTheApt(); + freeTheApt(); break; case 21: _vm->_voy._field472 = -1; - _vm->loadTheApt(); + loadTheApt(); _vm->_voy._field472 = 140; - _vm->freeTheApt(); + freeTheApt(); break; case 23: _vm->_voy._field474 = 17; _vm->_voy._field472 = -1; - _vm->loadTheApt(); + loadTheApt(); _vm->_voy._field472 = 144; - _vm->freeTheApt(); + freeTheApt(); break; default: @@ -1050,7 +1054,24 @@ bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) { } int ThreadResource::doApt() { - warning("TODO: doApt"); + int varC = -1; + loadTheApt(); + + _vm->_playStamp2 = 151; + byte *dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1); + PictureResource *srcPic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 3)._picResource; + _vm->_eventsManager.getMouseInfo(); + + if (_doAptState1 == -1) { + _doAptState1 = READ_LE_UINT16(dataP + 18) + 16; + _doAptState2 = READ_LE_UINT16(dataP + 20) + 16; + _vm->_playStamp2 = 153; + } + + if (_vm->_voy._field470 == 16) { + // TODO + } + return 0; } @@ -1319,4 +1340,164 @@ void ThreadResource::clearButtonFlag(int idx, byte bits) { _buttonFlags[idx] &= ~bits; } +void ThreadResource::loadTheApt() { + switch (_vm->_voy._field474) { + case 1: + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 17: + _vm->_playStamp1 = 0x5700; + break; + case 3: + _vm->_playStamp1 = 0x5800; + break; + case 4: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + _vm->_playStamp1 = 0x5900; + break; + default: + break; + } + + if (_vm->_voy._field472 == 143) + _vm->_voy._field472 = -1; + + if (_vm->_voy._field472 != -1) { + doAptAnim(1); + _vm->_bVoy->getBoltGroup(_vm->_playStamp1); + _vm->_voy._field472 = -1; + _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( + _vm->_playStamp1 + 5)._picResource; + (*_vm->_graphicsManager._vPort)->setupViewPort( + _vm->_graphicsManager._backgroundPage); + } else { + _vm->_bVoy->getBoltGroup(_vm->_playStamp1); + _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( + _vm->_playStamp1 + 5)._picResource; + (*_vm->_graphicsManager._vPort)->setupViewPort( + _vm->_graphicsManager._backgroundPage); + } + + CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 4)._cMapResource; + pal->_steps = 1; + pal->startFade(); + + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) + _vm->_eventsManager.delay(1); +} + +void ThreadResource::freeTheApt() { + _vm->_graphicsManager.fadeDownICF1(5); + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) + _vm->_eventsManager.delay(1); + + _vm->_graphicsManager.fadeUpICF1(0); + + if (_vm->_playStamp2 != -1) { + _vm->_soundManager.stopVOCPlay(); + _vm->_playStamp2 = -1; + } + + if (_vm->_voy._field472 == -1) { + _vm->_graphicsManager.fadeDownICF(6); + } else { + doAptAnim(2); + } + + if (_vm->_voy._field472 == 140) { + _vm->_graphicsManager.screenReset(); + _vm->_graphicsManager.resetPalette(); + } + + (*_vm->_graphicsManager._vPort)->setupViewPort(nullptr); + _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); + _vm->_playStamp1 = -1; + _vm->_voy._field4386 = 0; +} + +void ThreadResource::doAptAnim(int mode) { + _vm->_bVoy->freeBoltGroup(0x10100); + + int id = 0; + switch (_vm->_voy._field472) { + case 140: + id = 0x5A00; + break; + case 141: + id = 0x6000; + break; + case 142: + id = 0x6600; + break; + case 143: + id = 0x6C00; + break; + case 144: + id = 0x6F00; + break; + default: + break; + } + + int id2 = (id == 0x6C00 || id == 0x6F00) ? 1 : 2; + switch (_vm->_voy._field474) { + case 3: + id += id2 << 8; + break; + case 4: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + id += id2 << 9; + break; + default: + break; + } + + if (mode) + id += 0x100; + + if (_vm->_bVoy->getBoltGroup(id)) { + CMapResource *pal = _vm->_bVoy->boltEntry(id)._cMapResource; + pal->_steps = 1; + + for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) { + PictureResource *pic = _vm->_bVoy->boltEntry(id + idx)._picResource; + (*_vm->_graphicsManager._vPort)->setupViewPort(pic); + + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + _vm->_eventsManager.delay(5); + } + + _vm->_bVoy->freeBoltGroup(id); + } + + _vm->_bVoy->getBoltGroup(0x10100); +} + } // End of namespace Voyeur -- cgit v1.2.3 From 28ecf5ba53c81389dfd3ef8f7f4ee25d00ced39e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 15 Dec 2013 15:08:25 -0500 Subject: VOYEUR: Fix extra flag parameters for getBoltGroup and freeBoltGroup --- engines/voyeur/files_threads.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 0143084645..944fbc0c6e 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -421,7 +421,7 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager.incrementTime(1); _vm->_eventsManager.incrementTime(1); - _vm->_bVoy->freeBoltGroup(0x17F00); + _vm->_bVoy->freeBoltGroup(0x7F00); _vm->_voy._field478 = -17; _vm->_eventsManager._videoComputerBut4 = -1; _vm->_voy._field470 = 129; @@ -459,7 +459,7 @@ void ThreadResource::parsePlayCommands() { _vm->_playStamp1 = -1; if (_vm->_eventsManager._videoDead != -1) { - _vm->_bVoy->freeBoltGroup(0x10E00); + _vm->_bVoy->freeBoltGroup(0xE00); _vm->_eventsManager._videoDead = -1; (*_vm->_graphicsManager._vPort)->_flags |= 8; @@ -1434,8 +1434,9 @@ void ThreadResource::freeTheApt() { } void ThreadResource::doAptAnim(int mode) { - _vm->_bVoy->freeBoltGroup(0x10100); + _vm->_bVoy->freeBoltGroup(0x100, true); + // Figure out the resource to use int id = 0; switch (_vm->_voy._field472) { case 140: @@ -1479,6 +1480,7 @@ void ThreadResource::doAptAnim(int mode) { if (mode) id += 0x100; + // Do the display if (_vm->_bVoy->getBoltGroup(id)) { CMapResource *pal = _vm->_bVoy->boltEntry(id)._cMapResource; pal->_steps = 1; @@ -1497,7 +1499,7 @@ void ThreadResource::doAptAnim(int mode) { _vm->_bVoy->freeBoltGroup(id); } - _vm->_bVoy->getBoltGroup(0x10100); + _vm->_bVoy->getBoltGroup(0x100); } } // End of namespace Voyeur -- cgit v1.2.3 From e132e8b7c1c99c503a9e369dbe9bb7383fd0c221 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 15 Dec 2013 19:01:44 -0500 Subject: VOYEUR: Implemented doApt --- engines/voyeur/files_threads.cpp | 105 +++++++++++++++++++++++++++++++++++---- 1 file changed, 96 insertions(+), 9 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 944fbc0c6e..3411d7e064 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -33,8 +33,8 @@ byte *ThreadResource::_threadDataPtr; CMapResource *ThreadResource::_cmd14Pal; int ThreadResource::_currentMouseX; int ThreadResource::_currentMouseY; -int ThreadResource::_doAptState1; -int ThreadResource::_doAptState2; +int ThreadResource::_doAptPosX; +int ThreadResource::_doAptPosY; void ThreadResource::init() { _stampFlags = 0; @@ -43,8 +43,8 @@ void ThreadResource::init() { _cmd14Pal = nullptr; _currentMouseX = 392; _currentMouseY = 57; - _doAptState1 = -1; - _doAptState2 = -1; + _doAptPosX = -1; + _doAptPosY = -1; } ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): @@ -1062,17 +1062,104 @@ int ThreadResource::doApt() { PictureResource *srcPic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 3)._picResource; _vm->_eventsManager.getMouseInfo(); - if (_doAptState1 == -1) { - _doAptState1 = READ_LE_UINT16(dataP + 18) + 16; - _doAptState2 = READ_LE_UINT16(dataP + 20) + 16; + if (_doAptPosX == -1) { + _doAptPosX = READ_LE_UINT16(dataP + 18) + 16; + _doAptPosY = READ_LE_UINT16(dataP + 20) + 16; _vm->_playStamp2 = 153; } if (_vm->_voy._field470 == 16) { - // TODO + WRITE_LE_UINT16(dataP + 2, 999); + WRITE_LE_UINT16(dataP + 26, 999); + _doAptPosX = READ_LE_UINT16(dataP + 34) + 28; + _doAptPosY = READ_LE_UINT16(dataP + 36) + 28; } - return 0; + _vm->_eventsManager.setMousePos(Common::Point(_doAptPosX, _doAptPosY)); + _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); + _vm->_playStamp2 = 151; + + _vm->_graphicsManager.setColor(129, 82, 82, 82); + _vm->_graphicsManager.setColor(130, 112, 112, 112); + _vm->_graphicsManager.setColor(131, 215, 215, 215); + _vm->_graphicsManager.setColor(132, 235, 235, 235); + + _vm->_eventsManager._intPtr.field38 = true; + _vm->_eventsManager._intPtr._hasPalette = true; + + int result; + Common::Point pt; + PictureResource *pic; + do { + _vm->_eventsManager.getMouseInfo(); + if (_vm->_soundManager.getVOCStatus()) { + _vm->_playStamp2 = _vm->getRandomNumber(4) + 151; + _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); + } + + result = -1; + pt = _vm->_eventsManager.getMousePos(); + for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) { + if (READ_LE_UINT16(dataP + idx * 8 + 2) <= pt.x && + READ_LE_UINT16(dataP + idx * 8 + 6) >= pt.x && + READ_LE_UINT16(dataP + idx * 8 + 4) <= pt.y && + READ_LE_UINT16(dataP + idx * 8 + 8) >= pt.y) { + // Found entry + result = idx; + + if (idx != varC) { + if ((_vm->_voy._field478 & 0x100) && (result == 2)) + result = 5; + + pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + + result + 6)._picResource; + _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, + Common::Point(106, 200)); + } + + break; + } + } + + pic = _vm->_bVoy->boltEntry((result == -1) ? _vm->_playStamp1 + 2 : + _vm->_playStamp1 + 3)._picResource; + _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, pt); + + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + } while (!_vm->shouldQuit() && !_vm->_voy._lastInplay && result == -1); + + pt = _vm->_eventsManager.getMousePos(); + _doAptPosX = pt.x; + _doAptPosY = pt.y; + + switch (result) { + case 0: + _vm->_voy._field472 = 140; + break; + case 1: + _vm->_voy._field472 = 143; + break; + case 2: + _vm->_voy._field472 = 142; + case 5: + _vm->_voy._field472 = 141; + break; + default: + _vm->_voy._field472 = -1; + break; + } + + freeTheApt(); + if (_vm->_voy._field474 == 1 && result == 0) + _vm->checkTransition(); + + if (!result) + _vm->makeViewFinder(); + + return result; } void ThreadResource::doRoom() { -- cgit v1.2.3 From 2346671e7c9d8034d79e72549e3e468deadefdbd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 16 Dec 2013 22:21:41 -0500 Subject: VOYEUR: Resource fix in doAptAnim --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 3411d7e064..903ff4fbbe 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1573,7 +1573,7 @@ void ThreadResource::doAptAnim(int mode) { pal->_steps = 1; for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) { - PictureResource *pic = _vm->_bVoy->boltEntry(id + idx)._picResource; + PictureResource *pic = _vm->_bVoy->boltEntry(id + idx + 1)._picResource; (*_vm->_graphicsManager._vPort)->setupViewPort(pic); (*_vm->_graphicsManager._vPort)->_flags |= 8; -- cgit v1.2.3 From b99176fee6f8f3f78783f19ba760fbb35647044b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 Dec 2013 20:18:01 -0500 Subject: VOYEUR: Fix for sound playback in the apartment --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 903ff4fbbe..eb9f27d0e5 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1092,7 +1092,7 @@ int ThreadResource::doApt() { PictureResource *pic; do { _vm->_eventsManager.getMouseInfo(); - if (_vm->_soundManager.getVOCStatus()) { + if (!_vm->_soundManager.getVOCStatus()) { _vm->_playStamp2 = _vm->getRandomNumber(4) + 151; _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); } -- cgit v1.2.3 From 23f9cb19b4e4d36b2a1c52847a54a8ae9c430f32 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Dec 2013 08:53:44 -0500 Subject: VOYEUR: In progress work on fixing initial apartment animation --- engines/voyeur/files_threads.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index eb9f27d0e5..c8080641f1 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1575,12 +1575,13 @@ void ThreadResource::doAptAnim(int mode) { for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) { PictureResource *pic = _vm->_bVoy->boltEntry(id + idx + 1)._picResource; (*_vm->_graphicsManager._vPort)->setupViewPort(pic); + pal->startFade(); (*_vm->_graphicsManager._vPort)->_flags |= 8; _vm->_graphicsManager.flipPage(); _vm->_eventsManager.sWaitFlip(); - _vm->_eventsManager.delay(5); + _vm->_eventsManager.delay(50); } _vm->_bVoy->freeBoltGroup(id); -- cgit v1.2.3 From 1a4c6d46ace615ec82893dcd11b6e5a4260496a4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Dec 2013 09:17:47 -0500 Subject: VOYEUR: Reset doAptAnim frame delay back to what it should be --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index c8080641f1..bf68659b35 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1581,7 +1581,7 @@ void ThreadResource::doAptAnim(int mode) { _vm->_graphicsManager.flipPage(); _vm->_eventsManager.sWaitFlip(); - _vm->_eventsManager.delay(50); + _vm->_eventsManager.delay(5); } _vm->_bVoy->freeBoltGroup(id); -- cgit v1.2.3 From 6cd2d0139797e47527190d670cbf6453277046f0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Dec 2013 09:34:48 -0500 Subject: VOYEUR: Fixes for doApt mouse handling --- engines/voyeur/files_threads.cpp | 64 ++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 29 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index bf68659b35..c4e4708391 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1054,25 +1054,25 @@ bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) { } int ThreadResource::doApt() { - int varC = -1; loadTheApt(); _vm->_playStamp2 = 151; - byte *dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1); + _vm->_voy._field4386 = _vm->_bVoy->memberAddr(_vm->_playStamp1); + byte *hotspotsP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1); PictureResource *srcPic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 3)._picResource; _vm->_eventsManager.getMouseInfo(); if (_doAptPosX == -1) { - _doAptPosX = READ_LE_UINT16(dataP + 18) + 16; - _doAptPosY = READ_LE_UINT16(dataP + 20) + 16; + _doAptPosX = READ_LE_UINT16(hotspotsP + 18) + 16; + _doAptPosY = READ_LE_UINT16(hotspotsP + 20) + 16; _vm->_playStamp2 = 153; } if (_vm->_voy._field470 == 16) { - WRITE_LE_UINT16(dataP + 2, 999); - WRITE_LE_UINT16(dataP + 26, 999); - _doAptPosX = READ_LE_UINT16(dataP + 34) + 28; - _doAptPosY = READ_LE_UINT16(dataP + 36) + 28; + WRITE_LE_UINT16(hotspotsP + 2, 999); + WRITE_LE_UINT16(hotspotsP + 26, 999); + _doAptPosX = READ_LE_UINT16(hotspotsP + 34) + 28; + _doAptPosY = READ_LE_UINT16(hotspotsP + 36) + 28; } _vm->_eventsManager.setMousePos(Common::Point(_doAptPosX, _doAptPosY)); @@ -1087,32 +1087,37 @@ int ThreadResource::doApt() { _vm->_eventsManager._intPtr.field38 = true; _vm->_eventsManager._intPtr._hasPalette = true; - int result; + // Main loop to allow users to move the cursor and select hotspots + int hotspotId; + int prevHotspotId = -1; Common::Point pt; PictureResource *pic; do { _vm->_eventsManager.getMouseInfo(); if (!_vm->_soundManager.getVOCStatus()) { + // Previous sound ended, so start up a new one _vm->_playStamp2 = _vm->getRandomNumber(4) + 151; _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); } - result = -1; + // Loop through the hotspot list + hotspotId = -1; pt = _vm->_eventsManager.getMousePos(); - for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) { - if (READ_LE_UINT16(dataP + idx * 8 + 2) <= pt.x && - READ_LE_UINT16(dataP + idx * 8 + 6) >= pt.x && - READ_LE_UINT16(dataP + idx * 8 + 4) <= pt.y && - READ_LE_UINT16(dataP + idx * 8 + 8) >= pt.y) { - // Found entry - result = idx; - - if (idx != varC) { - if ((_vm->_voy._field478 & 0x100) && (result == 2)) - result = 5; - + for (int idx = 0; idx < READ_LE_UINT16(hotspotsP); ++idx) { + if (pt.x > READ_LE_UINT16(hotspotsP + idx * 8 + 2) && + pt.x < READ_LE_UINT16(hotspotsP + idx * 8 + 6) && + pt.y > READ_LE_UINT16(hotspotsP + idx * 8 + 4) && + pt.y < READ_LE_UINT16(hotspotsP + idx * 8 + 8)) { + // Cursor is within hotspot area + hotspotId = idx; + + if (idx != prevHotspotId) { + if ((_vm->_voy._field478 & 0x100) && (hotspotId == 2)) + hotspotId = 5; + + // Draw the text description for the highlighted hotspot pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + - result + 6)._picResource; + hotspotId + 6)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, Common::Point(106, 200)); } @@ -1121,7 +1126,8 @@ int ThreadResource::doApt() { } } - pic = _vm->_bVoy->boltEntry((result == -1) ? _vm->_playStamp1 + 2 : + // Draw either standard or highlighted eye cursor + pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStamp1 + 2 : _vm->_playStamp1 + 3)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, pt); @@ -1129,13 +1135,13 @@ int ThreadResource::doApt() { _vm->_graphicsManager.flipPage(); _vm->_eventsManager.sWaitFlip(); - } while (!_vm->shouldQuit() && !_vm->_voy._lastInplay && result == -1); + } while (!_vm->shouldQuit() && (!_vm->_voy._lastInplay || hotspotId == -1)); pt = _vm->_eventsManager.getMousePos(); _doAptPosX = pt.x; _doAptPosY = pt.y; - switch (result) { + switch (hotspotId) { case 0: _vm->_voy._field472 = 140; break; @@ -1153,13 +1159,13 @@ int ThreadResource::doApt() { } freeTheApt(); - if (_vm->_voy._field474 == 1 && result == 0) + if (_vm->_voy._field474 == 1 && hotspotId == 0) _vm->checkTransition(); - if (!result) + if (!hotspotId) _vm->makeViewFinder(); - return result; + return hotspotId; } void ThreadResource::doRoom() { -- cgit v1.2.3 From 13b4c9ca68b5505f4b851d3d36f3f9cb9a333f95 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Dec 2013 20:13:34 -0500 Subject: VOYEUR: Renaming of mouse click fields --- engines/voyeur/files_threads.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index c4e4708391..70bbf32b4b 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1135,7 +1135,7 @@ int ThreadResource::doApt() { _vm->_graphicsManager.flipPage(); _vm->_eventsManager.sWaitFlip(); - } while (!_vm->shouldQuit() && (!_vm->_voy._lastInplay || hotspotId == -1)); + } while (!_vm->shouldQuit() && (!_vm->_voy._mouseClicked || hotspotId == -1)); pt = _vm->_eventsManager.getMousePos(); _doAptPosX = pt.x; @@ -1331,7 +1331,7 @@ int ThreadResource::doInterface() { _vm->_voy._field474 = 17; _vm->_soundManager.stopVOCPlay(); _vm->checkTransition(); - _vm->_voy._lastInplay = true; + _vm->_voy._mouseClicked = true; } else { _vm->_voy._field478 = 1; _currentMouseX = pt.x; @@ -1355,7 +1355,7 @@ int ThreadResource::doInterface() { } } } while (!_vm->_voy._fadeFunc && !_vm->shouldQuit() && - (!_vm->_voy._lastInplay || var8 == -1)); + (!_vm->_voy._mouseClicked || var8 == -1)); _vm->_voy._field478 |= 1; _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); -- cgit v1.2.3 From f588211815d6383665072cb7637d40c8c4b5582a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Dec 2013 21:26:26 -0500 Subject: VOYEUR: Implemented checkTransition --- engines/voyeur/files_threads.cpp | 41 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 70bbf32b4b..e774674351 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -557,19 +557,19 @@ void ThreadResource::parsePlayCommands() { int count = READ_LE_UINT16(dataP + 2); _vm->_voy._field476 = READ_LE_UINT16(dataP + 4); - if (_vm->_voy._field474 != count) { - if (_vm->_voy._field474 > 1) + if (_vm->_voy._checkTransitionId != count) { + if (_vm->_voy._checkTransitionId > 1) _vm->_voy._field478 &= ~0x100; - _vm->_voy._field474 = count; - _vm->_eventsManager._videoComputerBut1 = LEVEL_M[count - 1]; - _vm->_eventsManager._videoComputerNum = LEVEL_H[count - 1]; + _vm->_voy._checkTransitionId = count; + _vm->_gameMinute = LEVEL_M[count - 1]; + _vm->_gameHour = LEVEL_H[count - 1]; //_vm->_v2A0A2 = 0; _vm->_voy._RTVNum = 0; _vm->_voy._RTANum = 255; } - _vm->_voy._delaySecs = (_vm->_voy._field474 == 6) ? 1 : 0; + _vm->_voy._isAM = (_vm->_voy._checkTransitionId == 6) ? 1 : 0; } dataP += 6; @@ -788,7 +788,7 @@ void ThreadResource::parsePlayCommands() { break; case 23: - _vm->_voy._field474 = 17; + _vm->_voy._checkTransitionId = 17; _vm->_voy._field472 = -1; loadTheApt(); _vm->_voy._field472 = 144; @@ -1059,7 +1059,6 @@ int ThreadResource::doApt() { _vm->_playStamp2 = 151; _vm->_voy._field4386 = _vm->_bVoy->memberAddr(_vm->_playStamp1); byte *hotspotsP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1); - PictureResource *srcPic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 3)._picResource; _vm->_eventsManager.getMouseInfo(); if (_doAptPosX == -1) { @@ -1159,7 +1158,7 @@ int ThreadResource::doApt() { } freeTheApt(); - if (_vm->_voy._field474 == 1 && hotspotId == 0) + if (_vm->_voy._checkTransitionId == 1 && hotspotId == 0) _vm->checkTransition(); if (!hotspotId) @@ -1192,7 +1191,7 @@ int ThreadResource::doInterface() { if (_vm->_voy._RTVNum >= _vm->_voy._field476 || _vm->_voy._RTVNum < 0) _vm->_voy._RTVNum = _vm->_voy._field476 - 1; - if (_vm->_voy._field474 < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) { + if (_vm->_voy._checkTransitionId < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) { _vm->_voy._RTVNum = _vm->_voy._field476; _vm->makeViewFinder(); @@ -1299,16 +1298,16 @@ int ThreadResource::doInterface() { if (_vm->_voy._RTVNum & 2) { _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - 10 / _vm->_eventsManager._videoComputerBut1, 0x1900BE); + 10 / _vm->_gameMinute, 0x1900BE); _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - 10 % _vm->_eventsManager._videoComputerBut1, 0x1900BE); + 10 % _vm->_gameMinute, 0x1900BE); if (_vm->_voy._RTANum & 4) { - int v = 10 / _vm->_eventsManager._videoComputerNum; + int v = 10 / _vm->_gameHour; _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, v == 0 ? 10 : v, 0x1900BE); _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - _vm->_eventsManager._videoComputerNum % 10, 0x1900AC); + _vm->_gameHour % 10, 0x1900AC); pic = _vm->_bVoy->boltEntry(274)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, @@ -1326,9 +1325,9 @@ int ThreadResource::doInterface() { (_vm->_voy._fadeFunc != NULL) && (pt.x == 0))) { _vm->_eventsManager.getMouseInfo(); - if (_vm->_voy._field474 == 15) { + if (_vm->_voy._checkTransitionId == 15) { var8 = 20; - _vm->_voy._field474 = 17; + _vm->_voy._checkTransitionId = 17; _vm->_soundManager.stopVOCPlay(); _vm->checkTransition(); _vm->_voy._mouseClicked = true; @@ -1366,8 +1365,8 @@ int ThreadResource::doInterface() { } void ThreadResource::addAudioEventStart() { - _vm->_voy._events.push_back(VoyeurEvent(_vm->_eventsManager._videoComputerNum, - _vm->_eventsManager._videoComputerBut1, _vm->_voy._delaySecs, 2, + _vm->_voy._events.push_back(VoyeurEvent(_vm->_gameHour, + _vm->_gameMinute, _vm->_voy._isAM, 2, _vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset, _vm->_eventsManager._videoDead)); } @@ -1434,7 +1433,7 @@ void ThreadResource::clearButtonFlag(int idx, byte bits) { } void ThreadResource::loadTheApt() { - switch (_vm->_voy._field474) { + switch (_vm->_voy._checkTransitionId) { case 1: case 2: case 5: @@ -1552,7 +1551,7 @@ void ThreadResource::doAptAnim(int mode) { } int id2 = (id == 0x6C00 || id == 0x6F00) ? 1 : 2; - switch (_vm->_voy._field474) { + switch (_vm->_voy._checkTransitionId) { case 3: id += id2 << 8; break; @@ -1570,7 +1569,7 @@ void ThreadResource::doAptAnim(int mode) { break; } - if (mode) + if (mode == 1) id += 0x100; // Do the display -- cgit v1.2.3 From 72c21cf0a77519e71febcfe0a2aef0fc44a3af87 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Dec 2013 22:01:16 -0500 Subject: VOYEUR: Implemented drawIfaceTime --- engines/voyeur/files_threads.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index e774674351..3aada4c89a 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -557,11 +557,11 @@ void ThreadResource::parsePlayCommands() { int count = READ_LE_UINT16(dataP + 2); _vm->_voy._field476 = READ_LE_UINT16(dataP + 4); - if (_vm->_voy._checkTransitionId != count) { - if (_vm->_voy._checkTransitionId > 1) + if (_vm->_voy._transitionId != count) { + if (_vm->_voy._transitionId > 1) _vm->_voy._field478 &= ~0x100; - _vm->_voy._checkTransitionId = count; + _vm->_voy._transitionId = count; _vm->_gameMinute = LEVEL_M[count - 1]; _vm->_gameHour = LEVEL_H[count - 1]; //_vm->_v2A0A2 = 0; @@ -569,7 +569,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._RTANum = 255; } - _vm->_voy._isAM = (_vm->_voy._checkTransitionId == 6) ? 1 : 0; + _vm->_voy._isAM = (_vm->_voy._transitionId == 6) ? 1 : 0; } dataP += 6; @@ -788,7 +788,7 @@ void ThreadResource::parsePlayCommands() { break; case 23: - _vm->_voy._checkTransitionId = 17; + _vm->_voy._transitionId = 17; _vm->_voy._field472 = -1; loadTheApt(); _vm->_voy._field472 = 144; @@ -1158,7 +1158,7 @@ int ThreadResource::doApt() { } freeTheApt(); - if (_vm->_voy._checkTransitionId == 1 && hotspotId == 0) + if (_vm->_voy._transitionId == 1 && hotspotId == 0) _vm->checkTransition(); if (!hotspotId) @@ -1191,7 +1191,7 @@ int ThreadResource::doInterface() { if (_vm->_voy._RTVNum >= _vm->_voy._field476 || _vm->_voy._RTVNum < 0) _vm->_voy._RTVNum = _vm->_voy._field476 - 1; - if (_vm->_voy._checkTransitionId < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) { + if (_vm->_voy._transitionId < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) { _vm->_voy._RTVNum = _vm->_voy._field476; _vm->makeViewFinder(); @@ -1298,16 +1298,16 @@ int ThreadResource::doInterface() { if (_vm->_voy._RTVNum & 2) { _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - 10 / _vm->_gameMinute, 0x1900BE); + 10 / _vm->_gameMinute, Common::Point(190, 25)); _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - 10 % _vm->_gameMinute, 0x1900BE); + 10 % _vm->_gameMinute, Common::Point(190, 25)); if (_vm->_voy._RTANum & 4) { int v = 10 / _vm->_gameHour; _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - v == 0 ? 10 : v, 0x1900BE); + v == 0 ? 10 : v, Common::Point(190, 25)); _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - _vm->_gameHour % 10, 0x1900AC); + _vm->_gameHour % 10, Common::Point(172, 25)); pic = _vm->_bVoy->boltEntry(274)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, @@ -1325,9 +1325,9 @@ int ThreadResource::doInterface() { (_vm->_voy._fadeFunc != NULL) && (pt.x == 0))) { _vm->_eventsManager.getMouseInfo(); - if (_vm->_voy._checkTransitionId == 15) { + if (_vm->_voy._transitionId == 15) { var8 = 20; - _vm->_voy._checkTransitionId = 17; + _vm->_voy._transitionId = 17; _vm->_soundManager.stopVOCPlay(); _vm->checkTransition(); _vm->_voy._mouseClicked = true; @@ -1433,7 +1433,7 @@ void ThreadResource::clearButtonFlag(int idx, byte bits) { } void ThreadResource::loadTheApt() { - switch (_vm->_voy._checkTransitionId) { + switch (_vm->_voy._transitionId) { case 1: case 2: case 5: @@ -1551,7 +1551,7 @@ void ThreadResource::doAptAnim(int mode) { } int id2 = (id == 0x6C00 || id == 0x6F00) ? 1 : 2; - switch (_vm->_voy._checkTransitionId) { + switch (_vm->_voy._transitionId) { case 3: id += id2 << 8; break; -- cgit v1.2.3 From a73ea5c3dc0bfd8c5ad6909fcf74cb51fffe3702 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 Dec 2013 09:25:40 -0500 Subject: VOYEUR: Beginnings of camera spy screen --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 3aada4c89a..16924056e0 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1230,7 +1230,7 @@ int ThreadResource::doInterface() { _vm->_voy._field478 &= ~1; do { - _vm->doTimeBar(1); + _vm->doTimeBar(true); _vm->_eventsManager.getMouseInfo(); pt = _vm->_eventsManager.getMousePos(); -- cgit v1.2.3 From 171d1594899e7064f2ebbbafd0f7b7858aaa2444 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Dec 2013 22:51:31 -0500 Subject: VOYEUR: Implemented doRoom method --- engines/voyeur/files_threads.cpp | 205 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 204 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 16924056e0..ef6022a7bd 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1168,7 +1168,210 @@ int ThreadResource::doApt() { } void ThreadResource::doRoom() { - warning("TODO: doRoom"); + VoyeurEngine &vm = *_vm; + SVoy &voy = vm._voy; + + vm.makeViewFinderP(); + voy._field437E = 0; + int varE = 0; + + if (!vm._bVoy->getBoltGroup(vm._playStamp1, true)) + return; + + vm._graphicsManager._backColors = vm._bVoy->boltEntry(vm._playStamp1 + 1)._cMapResource; + vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(vm._playStamp1)._picResource; + (*vm._graphicsManager._vPort)->setupViewPort(vm._graphicsManager._backgroundPage); + vm._graphicsManager._backColors->startFade(); + + voy._field437A = 2; + voy._field437C = 0; + voy._field437E = 1; + + byte *dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4); + int count = READ_LE_UINT16(dataP); + int i4e4 = -1; + + PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource; + PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource; + + byte arr[10]; + strcpy((char *)&arr[0], "0"); + voy._field4386 = &arr[0]; + + vm._eventsManager.getMouseInfo(); + vm._eventsManager.setMousePos(Common::Point(192, 120)); + voy._field437E = 0; + vm._playStamp2 = 146; + voy._field4AC = voy._RTVNum; + + voy._vocSecondsOffset = 0; + vm._soundManager.startVOCPlay(vm._playStamp2); + voy._field478 &= ~1; + + bool breakFlag = false; + while (!breakFlag) { + vm._graphicsManager.setColor(128, 0, 255, 0); + vm._eventsManager._intPtr.field38 = 1; + vm._eventsManager._intPtr._hasPalette = true; + + do { + if (vm._playStamp2 != -1 && !vm._soundManager.getVOCStatus()) { + voy._field4AC = voy._RTVNum; + voy._vocSecondsOffset = 0; + vm._soundManager.startVOCPlay(vm._playStamp2); + } + + vm._eventsManager.getMouseInfo(); + Common::Point pt = vm._eventsManager.getMousePos(); + i4e4 = -1; + if (voy._field4E2 != -1 && voy._rect4E4.contains(pt)) + i4e4 = 999; + + for (int idx = 0; idx < count; ++idx) { + if (pt.x > READ_LE_UINT16(dataP + idx * 12 + 6) && + pt.x < READ_LE_UINT16(dataP + idx * 12 + 10) && + pt.y > READ_LE_UINT16(dataP + idx * 12 + 8) && + pt.y < READ_LE_UINT16(dataP + idx * 12 + 12)) { + int arrIndex = READ_LE_UINT16(dataP + idx * 12 + 2); + if (voy._arr7[arrIndex - 1] == 1) { + i4e4 = idx; + break; + } + } + } + + if (i4e4 == -1) { + vm._graphicsManager.sDrawPic(pic1, *vm._graphicsManager._vPort, + Common::Point(pt.x - 9, pt.y - 9)); + vm._eventsManager.setCursorColor(128, 0); + } else if (i4e4 != 999 || voy._RTVNum < voy._field4EC || + (voy._field4EE - 2) < voy._RTVNum) { + vm._graphicsManager.sDrawPic(pic2, *vm._graphicsManager._vPort, + Common::Point(pt.x - 12, pt.y - 9)); + vm._eventsManager.setCursorColor(128, 1); + } else { + vm._graphicsManager.sDrawPic(pic2, + *vm._graphicsManager._vPort, + Common::Point(pt.x - 12, pt.y - 9)); + vm._eventsManager.setCursorColor(128, 2); + } + + vm._eventsManager._intPtr.field38 = 1; + vm._eventsManager._intPtr._hasPalette = true; + vm._graphicsManager.flipPage(); + vm._eventsManager.sWaitFlip(); + } while (!vm.shouldQuit() && !voy._incriminate); + + if (!voy._mouseClicked || i4e4 == -1) { + if (voy._fadeFunc) + breakFlag = true; + + Common::Point pt = vm._eventsManager.getMousePos(); + vm._eventsManager.getMouseInfo(); + vm._eventsManager.setMousePos(pt); + } else { + voy._field478 |= 16; + vm._eventsManager.startCursorBlink(); + + if (i4e4 == 999) { + (*_vm->_graphicsManager._vPort)->_flags |= 8; + _vm->_graphicsManager.flipPage(); + _vm->_eventsManager.sWaitFlip(); + + if (vm._playStamp2 != -1) { + voy._vocSecondsOffset = voy._RTVNum - + voy._field4AC; + vm._soundManager.stopVOCPlay(); + } + + vm.getComputerBrush(); + + (*vm._graphicsManager._vPort)->_flags |= 8; + vm._graphicsManager.flipPage(); + vm._eventsManager.sWaitFlip(); + vm.addPlainEvent(); + + voy._incriminate = false; + vm._eventsManager.startCursorBlink(); + + if (vm.doComputerText(9999)) + vm.addComputerEventEnd(); + + vm._bVoy->freeBoltGroup(0x4900); + } else { + vm.doEvidDisplay(i4e4, 999); + } + + voy._field478 &= ~0x10; + if (!voy._incriminate) + vm._eventsManager.delay(18000); + + vm._bVoy->freeBoltGroup(vm._playStamp1); + vm._bVoy->getBoltGroup(vm._playStamp1); + dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4); + pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource; + pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource; + vm._graphicsManager._backColors = vm._bVoy->boltEntry( + vm._playStamp1 + 2)._cMapResource; + vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry( + vm._playStamp1)._picResource; + + vm._graphicsManager._backColors->startFade(); + (*vm._graphicsManager._vPort)->_flags |= 8; + vm._graphicsManager.flipPage(); + vm._eventsManager.sWaitFlip(); + + while (!vm.shouldQuit() && (vm._eventsManager._fadeStatus & 1)) + vm._eventsManager.delay(1); + vm._eventsManager.hideCursor(); + + while (!vm.shouldQuit() && voy._field4378 > 0) { + if (voy._field4376 < 63) { + voy._field4376 += 4; + if (voy._field4376 > 63) + voy._field4376 = 63; + } + + if (voy._field4378 > 0) { + voy._field4378 -= 8; + if (voy._field4378 < 0) + voy._field4378 = 0; + } + + vm._eventsManager.delay(1); + } + + (*vm._graphicsManager._vPort)->_flags |= 8; + vm._graphicsManager.flipPage(); + vm._eventsManager.sWaitFlip(); + + vm._graphicsManager.fadeUpICF1(0); + voy._field478 &= 0x10; + } + } + + voy._field478 = 1; + vm._eventsManager.incrementTime(1); + voy._field4386 = 0; + voy._field437E = 0; + vm.makeViewFinderP(); + + if (voy._field47A != -1) { + vm._bVoy->freeBoltGroup(voy._field47A, 1); + voy._field47A = -1; + } + + if (vm._playStamp1 != -1) { + vm._bVoy->freeBoltGroup(vm._playStamp1); + vm._playStamp1 = -1; + } + + if (vm._playStamp2 != -1) { + vm._soundManager.stopVOCPlay(); + vm._playStamp2 = -1; + } + + chooseSTAMPButton(0); } int ThreadResource::doInterface() { -- cgit v1.2.3 From 537ec24e1ee3d7c9e4dd082d2ebec5e6880a869f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Dec 2013 23:03:17 -0500 Subject: VOYEUR: Renamed a couple of event fields --- engines/voyeur/files_threads.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index ef6022a7bd..229d4c3fb5 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1170,10 +1170,9 @@ int ThreadResource::doApt() { void ThreadResource::doRoom() { VoyeurEngine &vm = *_vm; SVoy &voy = vm._voy; - + vm.makeViewFinderP(); voy._field437E = 0; - int varE = 0; if (!vm._bVoy->getBoltGroup(vm._playStamp1, true)) return; -- cgit v1.2.3 From 4f9c900a039c2be64847720122382ef11090df2d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 24 Dec 2013 07:38:39 +1100 Subject: VOYEUR: Fixes for video camera battery countdown --- engines/voyeur/files_threads.cpp | 42 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 229d4c3fb5..be35143932 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1208,7 +1208,7 @@ void ThreadResource::doRoom() { voy._field478 &= ~1; bool breakFlag = false; - while (!breakFlag) { + while (!vm.shouldQuit() && !breakFlag) { vm._graphicsManager.setColor(128, 0, 255, 0); vm._eventsManager._intPtr.field38 = 1; vm._eventsManager._intPtr._hasPalette = true; @@ -1374,8 +1374,6 @@ void ThreadResource::doRoom() { } int ThreadResource::doInterface() { - int varA = -1; - int var8 = 0; PictureResource *pic; Common::Point pt; @@ -1431,13 +1429,15 @@ int ThreadResource::doInterface() { _vm->_eventsManager._intPtr._hasPalette = true; _vm->_voy._field478 &= ~1; + int priorRegionIndex = -1; + int regionIndex = 0; do { _vm->doTimeBar(true); _vm->_eventsManager.getMouseInfo(); pt = _vm->_eventsManager.getMousePos(); - if (pt.x != _currentMouseX || pt.y != _currentMouseY || var8 != varA) { - varA = var8; + if (pt.x != _currentMouseX || pt.y != _currentMouseY || regionIndex != priorRegionIndex) { + priorRegionIndex = regionIndex; _vm->_graphicsManager.doScroll(pt); _currentMouseX = pt.x; @@ -1451,6 +1451,7 @@ int ThreadResource::doInterface() { } pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75); + regionIndex = -1; for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) { if (READ_LE_UINT16(dataP + (idx * 8 + 2)) <= pt.x && @@ -1465,7 +1466,7 @@ int ThreadResource::doInterface() { pic = _vm->_bVoy->boltEntry(276)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, Common::Point(178, 108)); - var8 = idx; + regionIndex = idx; } if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum && @@ -1474,44 +1475,45 @@ int ThreadResource::doInterface() { pic = _vm->_bVoy->boltEntry(277)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, Common::Point(178, 108)); - var8 = idx; + regionIndex = idx; } } - for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { + for (int arrIndex = 0; arrIndex < 8; ++arrIndex) { if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum && _vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) { // Draw the picture pic = _vm->_bVoy->boltEntry(375)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, Common::Point(178, 108)); - var8 = idx; + regionIndex = idx; } } } } - if (var8 == -1) { - // Draw the default picture + if (regionIndex == -1) { + // Draw the crosshairs cursor in the center of the screen pic = _vm->_bVoy->boltEntry(274)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, Common::Point(178, 108)); } - if (_vm->_voy._RTVNum & 2) { + // Regularly update the time display + if (_vm->_voy._RTANum & 2) { _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - 10 / _vm->_gameMinute, Common::Point(190, 25)); + _vm->_gameMinute / 10, Common::Point(190, 25)); _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - 10 % _vm->_gameMinute, Common::Point(190, 25)); + _vm->_gameMinute % 10, Common::Point(201, 25)); if (_vm->_voy._RTANum & 4) { - int v = 10 / _vm->_gameHour; + int v = _vm->_gameHour / 10; _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, - v == 0 ? 10 : v, Common::Point(190, 25)); + v == 0 ? 10 : v, Common::Point(161, 25)); _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, _vm->_gameHour % 10, Common::Point(172, 25)); - pic = _vm->_bVoy->boltEntry(274)._picResource; + pic = _vm->_bVoy->boltEntry(_vm->_voy._isAM ? 272 : 273)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, Common::Point(215, 27)); } @@ -1528,7 +1530,7 @@ int ThreadResource::doInterface() { _vm->_eventsManager.getMouseInfo(); if (_vm->_voy._transitionId == 15) { - var8 = 20; + regionIndex = 20; _vm->_voy._transitionId = 17; _vm->_soundManager.stopVOCPlay(); _vm->checkTransition(); @@ -1556,14 +1558,14 @@ int ThreadResource::doInterface() { } } } while (!_vm->_voy._fadeFunc && !_vm->shouldQuit() && - (!_vm->_voy._mouseClicked || var8 == -1)); + (!_vm->_voy._mouseClicked || regionIndex == -1)); _vm->_voy._field478 |= 1; _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); if (_vm->_playStamp2 != -1) _vm->_soundManager.stopVOCPlay(); - return !_vm->_voy._fadeFunc ? var8 : -2; + return !_vm->_voy._fadeFunc ? regionIndex : -2; } void ThreadResource::addAudioEventStart() { -- cgit v1.2.3 From 156f78e7cdb4c49b437c378d7239806784bcee54 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 24 Dec 2013 10:32:41 +1100 Subject: VOYEUR: Bugfixes and move for doScroll method --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index be35143932..4432d7eb84 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1438,7 +1438,7 @@ int ThreadResource::doInterface() { pt = _vm->_eventsManager.getMousePos(); if (pt.x != _currentMouseX || pt.y != _currentMouseY || regionIndex != priorRegionIndex) { priorRegionIndex = regionIndex; - _vm->_graphicsManager.doScroll(pt); + _vm->doScroll(pt); _currentMouseX = pt.x; _currentMouseY = pt.y; -- cgit v1.2.3 From fa6eb76d6607608edc2415a827aac787915ca11f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 24 Dec 2013 16:32:50 +1100 Subject: VOYEUR: Implemented further event methods, and miscellaneous --- engines/voyeur/files_threads.cpp | 44 ++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 4432d7eb84..38a5fab80c 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -344,7 +344,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field468 = 0; _vm->_voy._field46A = 0; _vm->_voy._field47A = -1; - _vm->_voy._field4E2 = -1; + _vm->_voy._computerTextId = -1; _vm->_voy._field478 &= ~8; _vm->_eventsManager._videoDead = -1; @@ -386,7 +386,7 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager._videoComputerBut4 = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; - addAudioEventStart(); + _vm->_eventsManager.addAudioEventStart(); assert(_vm->_eventsManager._videoComputerBut4 < 38); _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( @@ -417,7 +417,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 |= 1; _vm->_soundManager.stopVOCPlay(); - addAudioEventEnd(); + _vm->_eventsManager.addAudioEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_eventsManager.incrementTime(1); @@ -445,14 +445,14 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager._videoComputerBut4 = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; - addAudioEventStart(); + _vm->_eventsManager.addAudioEventStart(); _vm->_voy._field478 &= ~1; _vm->_voy._field478 |= 0x10; _vm->playAVideo(_vm->_eventsManager._videoComputerBut4); _vm->_voy._field478 &= ~0x10; _vm->_voy._field478 |= 1; - addVideoEventEnd(); + _vm->_eventsManager.addVideoEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_eventsManager._videoComputerBut4 = -1; @@ -669,14 +669,14 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_voy._field4E2 = READ_LE_UINT16(dataP + 2); + _vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2); _vm->_voy._field4EC = READ_LE_UINT16(dataP + 4); _vm->_voy._field4EE = READ_LE_UINT16(dataP + 6); - _vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4]; - _vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 1]; - _vm->_voy._rect4E4.right = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 2]; - _vm->_voy._rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 3]; + _vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4]; + _vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 1]; + _vm->_voy._rect4E4.right = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 2]; + _vm->_voy._rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 3]; } dataP += 8; @@ -1223,7 +1223,7 @@ void ThreadResource::doRoom() { vm._eventsManager.getMouseInfo(); Common::Point pt = vm._eventsManager.getMousePos(); i4e4 = -1; - if (voy._field4E2 != -1 && voy._rect4E4.contains(pt)) + if (voy._computerTextId != -1 && voy._rect4E4.contains(pt)) i4e4 = 999; for (int idx = 0; idx < count; ++idx) { @@ -1288,13 +1288,14 @@ void ThreadResource::doRoom() { (*vm._graphicsManager._vPort)->_flags |= 8; vm._graphicsManager.flipPage(); vm._eventsManager.sWaitFlip(); - vm.addPlainEvent(); + vm._eventsManager.addComputerEventStart(); voy._incriminate = false; vm._eventsManager.startCursorBlink(); - if (vm.doComputerText(9999)) - vm.addComputerEventEnd(); + int v = vm.doComputerText(9999); + if (v) + vm._eventsManager.addComputerEventEnd(v); vm._bVoy->freeBoltGroup(0x4900); } else { @@ -1568,21 +1569,6 @@ int ThreadResource::doInterface() { return !_vm->_voy._fadeFunc ? regionIndex : -2; } -void ThreadResource::addAudioEventStart() { - _vm->_voy._events.push_back(VoyeurEvent(_vm->_gameHour, - _vm->_gameMinute, _vm->_voy._isAM, 2, - _vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset, - _vm->_eventsManager._videoDead)); -} - -void ThreadResource::addAudioEventEnd() { - error("TODO: addAudioEventEnd"); -} - -void ThreadResource::addVideoEventEnd() { - error("TODO: addVideoEventEnd"); -} - bool ThreadResource::goToStateID(int stackId, int sceneId) { debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, sceneId); -- cgit v1.2.3 From c5f9cf913440cfdaeb7d7798cc0c490a2ea0d067 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 25 Dec 2013 15:43:18 +1100 Subject: VOYEUR: Implemented doGossip --- engines/voyeur/files_threads.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') 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); -- cgit v1.2.3 From 754601bbab9e08daca0f9bb43776a50cecc70520 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 25 Dec 2013 16:40:46 +1100 Subject: VOYEUR: Better implementation of rect resources --- engines/voyeur/files_threads.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index f2b5955b1a..43bebf3564 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1052,7 +1052,7 @@ int ThreadResource::doApt() { loadTheApt(); _vm->_playStamp2 = 151; - _vm->_voy._field4386 = _vm->_bVoy->memberAddr(_vm->_playStamp1); + _vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStamp1)._rectResource; byte *hotspotsP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1); _vm->_eventsManager.getMouseInfo(); @@ -1188,9 +1188,8 @@ void ThreadResource::doRoom() { PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource; PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource; - byte arr[10]; - strcpy((char *)&arr[0], "0"); - voy._field4386 = &arr[0]; + RectResource viewBounds(48, 38, 336, 202); + voy._viewBounds = &viewBounds; vm._eventsManager.getMouseInfo(); vm._eventsManager.setMousePos(Common::Point(192, 120)); @@ -1347,7 +1346,7 @@ void ThreadResource::doRoom() { voy._field478 = 1; vm._eventsManager.incrementTime(1); - voy._field4386 = 0; + voy._viewBounds = nullptr; voy._field437E = 0; vm.makeViewFinderP(); @@ -1707,7 +1706,7 @@ void ThreadResource::freeTheApt() { (*_vm->_graphicsManager._vPort)->setupViewPort(nullptr); _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); _vm->_playStamp1 = -1; - _vm->_voy._field4386 = 0; + _vm->_voy._viewBounds = nullptr; } void ThreadResource::doAptAnim(int mode) { -- cgit v1.2.3 From 6e801e246be36d8efa9003a316bbd1424d51d4ae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 25 Dec 2013 17:07:05 +1100 Subject: VOYEUR: Enhance RectResource to handle rect sets --- engines/voyeur/files_threads.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 43bebf3564..15f2e96125 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1053,20 +1053,21 @@ int ThreadResource::doApt() { _vm->_playStamp2 = 151; _vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStamp1)._rectResource; - byte *hotspotsP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1); + Common::Array &hotspots = _vm->_bVoy->boltEntry( + _vm->_playStamp1 + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); if (_doAptPosX == -1) { - _doAptPosX = READ_LE_UINT16(hotspotsP + 18) + 16; - _doAptPosY = READ_LE_UINT16(hotspotsP + 20) + 16; + _doAptPosX = hotspots[2].left; + _doAptPosY = hotspots[2].top; _vm->_playStamp2 = 153; } if (_vm->_voy._field470 == 16) { - WRITE_LE_UINT16(hotspotsP + 2, 999); - WRITE_LE_UINT16(hotspotsP + 26, 999); - _doAptPosX = READ_LE_UINT16(hotspotsP + 34) + 28; - _doAptPosY = READ_LE_UINT16(hotspotsP + 36) + 28; + hotspots[0].left = 999; + hotspots[3].left = 999; + _doAptPosX = hotspots[4].left + 28; + _doAptPosY = hotspots[4].top + 28; } _vm->_eventsManager.setMousePos(Common::Point(_doAptPosX, _doAptPosY)); @@ -1097,11 +1098,9 @@ int ThreadResource::doApt() { // Loop through the hotspot list hotspotId = -1; pt = _vm->_eventsManager.getMousePos(); - for (int idx = 0; idx < READ_LE_UINT16(hotspotsP); ++idx) { - if (pt.x > READ_LE_UINT16(hotspotsP + idx * 8 + 2) && - pt.x < READ_LE_UINT16(hotspotsP + idx * 8 + 6) && - pt.y > READ_LE_UINT16(hotspotsP + idx * 8 + 4) && - pt.y < READ_LE_UINT16(hotspotsP + idx * 8 + 8)) { + for (int idx = 0; idx < hotspots.size(); ++idx) { + if (pt.x > hotspots[idx].left && pt.x < hotspots[idx].right && + pt.y > hotspots[idx].top && pt.y < hotspots[idx].bottom) { // Cursor is within hotspot area hotspotId = idx; -- cgit v1.2.3 From 88c9dac8c0695ad328bf354ad54e5bb3fa5ba1de Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 26 Dec 2013 07:30:46 +1100 Subject: VOYEUR: Implemented playAVideoDuration --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 15f2e96125..26e4b5987b 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1098,7 +1098,7 @@ int ThreadResource::doApt() { // Loop through the hotspot list hotspotId = -1; pt = _vm->_eventsManager.getMousePos(); - for (int idx = 0; idx < hotspots.size(); ++idx) { + for (int idx = 0; idx < (int)hotspots.size(); ++idx) { if (pt.x > hotspots[idx].left && pt.x < hotspots[idx].right && pt.y > hotspots[idx].top && pt.y < hotspots[idx].bottom) { // Cursor is within hotspot area -- cgit v1.2.3 From 8ed1171ca07e5857c1ab4862052bc7451f8728e7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 27 Dec 2013 20:42:05 +1100 Subject: VOYEUR: Convert doInterface to use new rects resource type --- engines/voyeur/files_threads.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 26e4b5987b..8d0ad00c34 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1409,7 +1409,8 @@ int ThreadResource::doInterface() { _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); _vm->initIFace(); - byte *dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1); + Common::Array &hotspots = _vm->_bVoy->boltEntry( + _vm->_playStamp1)._rectResource->_entries; _vm->_playStamp2 = 151 - _vm->getRandomNumber(5); _vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29); @@ -1447,11 +1448,8 @@ int ThreadResource::doInterface() { pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75); regionIndex = -1; - for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) { - if (READ_LE_UINT16(dataP + (idx * 8 + 2)) <= pt.x && - READ_LE_UINT16(dataP + (idx * 8 + 6)) >= pt.x && - READ_LE_UINT16(dataP + (idx * 8 + 4)) <= pt.y && - READ_LE_UINT16(dataP + (idx * 8 + 8)) >= pt.y) { + for (int idx = 0; idx < (int)hotspots.size(); ++idx) { + if (hotspots[idx].contains(pt)) { // Rect check done for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum && @@ -1542,7 +1540,7 @@ int ThreadResource::doInterface() { _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); _vm->initIFace(); - dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1); + hotspots = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); -- cgit v1.2.3 From 19c208a05d47562181c64833f25ada59751e5c88 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 Dec 2013 15:02:54 +1100 Subject: VOYEUR: Refactored code fragments to use flipPageAndWaitForFade method --- engines/voyeur/files_threads.cpp | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 8d0ad00c34..3a626d4801 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -396,12 +396,7 @@ void ThreadResource::parsePlayCommands() { (*_vm->_graphicsManager._vPort)->setupViewPort(); _vm->_graphicsManager._backColors->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(); _vm->_voy._field478 = -2; _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025); @@ -692,13 +687,8 @@ void ThreadResource::parsePlayCommands() { (*_vm->_graphicsManager._vPort)->setupViewPort(pic); _cmd14Pal->startFade(); + _vm->flipPageAndWaitForFade(); - (*_vm->_graphicsManager._vPort)->_flags |= 8; - _vm->_graphicsManager.flipPage(); - _vm->_eventsManager.sWaitFlip(); - - while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) - _vm->_eventsManager.delay(1); _vm->_eventsManager.getMouseInfo(); for (int idx = 1; idx < 4; ++idx) { @@ -712,13 +702,7 @@ void ThreadResource::parsePlayCommands() { (*_vm->_graphicsManager._vPort)->setupViewPort(pic); _cmd14Pal->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(); _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2); _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2 + 1); @@ -1664,23 +1648,12 @@ void ThreadResource::loadTheApt() { CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 4)._cMapResource; pal->_steps = 1; 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(); } void ThreadResource::freeTheApt() { _vm->_graphicsManager.fadeDownICF1(5); - (*_vm->_graphicsManager._vPort)->_flags |= 8; - _vm->_graphicsManager.flipPage(); - _vm->_eventsManager.sWaitFlip(); - - while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1)) - _vm->_eventsManager.delay(1); + _vm->flipPageAndWaitForFade(); _vm->_graphicsManager.fadeUpICF1(0); -- cgit v1.2.3 From 84752aa27227bc3dde6005f818d4b2a9b21b8b5b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 Dec 2013 15:09:44 +1100 Subject: VOYEUR: Refactored code fragments to use flipPageAndWait --- engines/voyeur/files_threads.cpp | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 3a626d4801..2d389c014c 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -456,10 +456,7 @@ void ThreadResource::parsePlayCommands() { if (_vm->_eventsManager._videoDead != -1) { _vm->_bVoy->freeBoltGroup(0xE00); _vm->_eventsManager._videoDead = -1; - (*_vm->_graphicsManager._vPort)->_flags |= 8; - - _vm->_graphicsManager.flipPage(); - _vm->_eventsManager.sWaitFlip(); + _vm->flipPageAndWait(); } _vm->_eventsManager._videoDead = -1; @@ -1108,9 +1105,7 @@ int ThreadResource::doApt() { _vm->_playStamp1 + 3)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, pt); - (*_vm->_graphicsManager._vPort)->_flags |= 8; - _vm->_graphicsManager.flipPage(); - _vm->_eventsManager.sWaitFlip(); + _vm->flipPageAndWait(); } while (!_vm->shouldQuit() && (!_vm->_voy._mouseClicked || hotspotId == -1)); @@ -1250,9 +1245,7 @@ void ThreadResource::doRoom() { vm._eventsManager.startCursorBlink(); if (i4e4 == 999) { - (*_vm->_graphicsManager._vPort)->_flags |= 8; - _vm->_graphicsManager.flipPage(); - _vm->_eventsManager.sWaitFlip(); + _vm->flipPageAndWait(); if (vm._playStamp2 != -1) { voy._vocSecondsOffset = voy._RTVNum - @@ -1261,10 +1254,8 @@ void ThreadResource::doRoom() { } vm.getComputerBrush(); + _vm->flipPageAndWait(); - (*vm._graphicsManager._vPort)->_flags |= 8; - vm._graphicsManager.flipPage(); - vm._eventsManager.sWaitFlip(); vm._eventsManager.addComputerEventStart(); voy._incriminate = false; @@ -1294,9 +1285,7 @@ void ThreadResource::doRoom() { vm._playStamp1)._picResource; vm._graphicsManager._backColors->startFade(); - (*vm._graphicsManager._vPort)->_flags |= 8; - vm._graphicsManager.flipPage(); - vm._eventsManager.sWaitFlip(); + _vm->flipPageAndWait(); while (!vm.shouldQuit() && (vm._eventsManager._fadeStatus & 1)) vm._eventsManager.delay(1); @@ -1318,9 +1307,7 @@ void ThreadResource::doRoom() { vm._eventsManager.delay(1); } - (*vm._graphicsManager._vPort)->_flags |= 8; - vm._graphicsManager.flipPage(); - vm._eventsManager.sWaitFlip(); + _vm->flipPageAndWait(); vm._graphicsManager.fadeUpICF1(0); voy._field478 &= 0x10; @@ -1496,9 +1483,7 @@ int ThreadResource::doInterface() { } _vm->_voy._RTANum = 0; - (*_vm->_graphicsManager._vPort)->_flags |= 8; - _vm->_graphicsManager.flipPage(); - _vm->_eventsManager.sWaitFlip(); + _vm->flipPageAndWait(); pt = _vm->_eventsManager.getMousePos(); if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) && @@ -1736,10 +1721,7 @@ void ThreadResource::doAptAnim(int mode) { (*_vm->_graphicsManager._vPort)->setupViewPort(pic); pal->startFade(); - (*_vm->_graphicsManager._vPort)->_flags |= 8; - _vm->_graphicsManager.flipPage(); - _vm->_eventsManager.sWaitFlip(); - + _vm->flipPageAndWait(); _vm->_eventsManager.delay(5); } -- cgit v1.2.3 From b08e80cd6643b366774551360c7ba9ed611d48e6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 Dec 2013 18:37:37 +1100 Subject: VOYEUR: Implemented evidence display code --- engines/voyeur/files_threads.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 2d389c014c..944c9db558 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -408,7 +408,7 @@ void ThreadResource::parsePlayCommands() { while (!_vm->shouldQuit() && !_vm->_voy._incriminate && _vm->_soundManager.getVOCStatus()) - _vm->_eventsManager.delay(1); + _vm->_eventsManager.delayClick(1); _vm->_voy._field478 |= 1; _vm->_soundManager.stopVOCPlay(); @@ -517,7 +517,7 @@ void ThreadResource::parsePlayCommands() { while (!_vm->shouldQuit() && !_vm->_voy._incriminate && _vm->_soundManager.getVOCStatus()) { - _vm->_eventsManager.delay(1); + _vm->_eventsManager.delayClick(1); _vm->_eventsManager.getMouseInfo(); } @@ -1272,7 +1272,7 @@ void ThreadResource::doRoom() { voy._field478 &= ~0x10; if (!voy._incriminate) - vm._eventsManager.delay(18000); + vm._eventsManager.delayClick(18000); vm._bVoy->freeBoltGroup(vm._playStamp1); vm._bVoy->getBoltGroup(vm._playStamp1); @@ -1722,7 +1722,7 @@ void ThreadResource::doAptAnim(int mode) { pal->startFade(); _vm->flipPageAndWait(); - _vm->_eventsManager.delay(5); + _vm->_eventsManager.delayClick(5); } _vm->_bVoy->freeBoltGroup(id); -- cgit v1.2.3 From f88c4727781b6e6eea4a8a5a7dd09ae90e55ba68 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 Dec 2013 19:53:00 +1100 Subject: VOYEUR: Fixed naming of mouse state flags --- engines/voyeur/files_threads.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 944c9db558..49b271e79c 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -406,7 +406,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 |= 16; _vm->_eventsManager.startCursorBlink(); - while (!_vm->shouldQuit() && !_vm->_voy._incriminate && + while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && _vm->_soundManager.getVOCStatus()) _vm->_eventsManager.delayClick(1); @@ -460,7 +460,7 @@ void ThreadResource::parsePlayCommands() { } _vm->_eventsManager._videoDead = -1; - if (_field42 == 2 && _vm->_voy._incriminate == 0) { + if (_field42 == 2 && _vm->_voy._mouseClicked == 0) { _vm->_voy._field470 = 132; parseIndex = 999; } else { @@ -515,7 +515,7 @@ void ThreadResource::parsePlayCommands() { Common::String file = Common::String::format("news%d.voc", i + 1); _vm->_soundManager.startVOCPlay(file); - while (!_vm->shouldQuit() && !_vm->_voy._incriminate && + while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && _vm->_soundManager.getVOCStatus()) { _vm->_eventsManager.delayClick(1); _vm->_eventsManager.getMouseInfo(); @@ -526,7 +526,7 @@ void ThreadResource::parsePlayCommands() { if (i == (count - 1)) _vm->_eventsManager.delay(480); - if (_vm->shouldQuit() || _vm->_voy._incriminate) + if (_vm->shouldQuit() || _vm->_voy._mouseClicked) break; } @@ -706,7 +706,7 @@ void ThreadResource::parsePlayCommands() { Common::String fname = Common::String::format("news%d.voc", idx); - while (!_vm->shouldQuit() && !_vm->_voy._incriminate && + while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && _vm->_soundManager.getVOCStatus()) _vm->_eventsManager.delay(1); @@ -714,7 +714,7 @@ void ThreadResource::parsePlayCommands() { if (idx == 3) _vm->_eventsManager.delay(3); - if (_vm->shouldQuit() || _vm->_voy._incriminate) + if (_vm->shouldQuit() || _vm->_voy._mouseClicked) break; } @@ -1107,7 +1107,7 @@ int ThreadResource::doApt() { _vm->flipPageAndWait(); - } while (!_vm->shouldQuit() && (!_vm->_voy._mouseClicked || hotspotId == -1)); + } while (!_vm->shouldQuit() && (!_vm->_voy._leftClick || hotspotId == -1)); pt = _vm->_eventsManager.getMousePos(); _doAptPosX = pt.x; @@ -1231,10 +1231,10 @@ void ThreadResource::doRoom() { vm._eventsManager._intPtr._hasPalette = true; vm._graphicsManager.flipPage(); vm._eventsManager.sWaitFlip(); - } while (!vm.shouldQuit() && !voy._incriminate); + } while (!vm.shouldQuit() && !voy._mouseClicked); - if (!voy._mouseClicked || i4e4 == -1) { - if (voy._fadeFunc) + if (!voy._leftClick || i4e4 == -1) { + if (voy._rightClick) breakFlag = true; Common::Point pt = vm._eventsManager.getMousePos(); @@ -1258,7 +1258,7 @@ void ThreadResource::doRoom() { vm._eventsManager.addComputerEventStart(); - voy._incriminate = false; + voy._mouseClicked = false; vm._eventsManager.startCursorBlink(); int v = vm.doComputerText(9999); @@ -1271,7 +1271,7 @@ void ThreadResource::doRoom() { } voy._field478 &= ~0x10; - if (!voy._incriminate) + if (!voy._mouseClicked) vm._eventsManager.delayClick(18000); vm._bVoy->freeBoltGroup(vm._playStamp1); @@ -1487,7 +1487,7 @@ int ThreadResource::doInterface() { pt = _vm->_eventsManager.getMousePos(); if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) && - (_vm->_voy._fadeFunc != NULL) && (pt.x == 0))) { + (_vm->_voy._rightClick != NULL) && (pt.x == 0))) { _vm->_eventsManager.getMouseInfo(); if (_vm->_voy._transitionId == 15) { @@ -1495,7 +1495,7 @@ int ThreadResource::doInterface() { _vm->_voy._transitionId = 17; _vm->_soundManager.stopVOCPlay(); _vm->checkTransition(); - _vm->_voy._mouseClicked = true; + _vm->_voy._leftClick = true; } else { _vm->_voy._field478 = 1; _currentMouseX = pt.x; @@ -1518,15 +1518,15 @@ int ThreadResource::doInterface() { _vm->_eventsManager._intPtr.field1A = 0; } } - } while (!_vm->_voy._fadeFunc && !_vm->shouldQuit() && - (!_vm->_voy._mouseClicked || regionIndex == -1)); + } while (!_vm->_voy._rightClick && !_vm->shouldQuit() && + (!_vm->_voy._leftClick || regionIndex == -1)); _vm->_voy._field478 |= 1; _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); if (_vm->_playStamp2 != -1) _vm->_soundManager.stopVOCPlay(); - return !_vm->_voy._fadeFunc ? regionIndex : -2; + return !_vm->_voy._rightClick ? regionIndex : -2; } bool ThreadResource::goToStateID(int stackId, int sceneId) { -- cgit v1.2.3 From d763f838622c010a4ebd8ecfc2be183b1eb5271f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 Dec 2013 20:53:33 +1100 Subject: VOYEUR: Fixes for mouse cursor calls --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 49b271e79c..6b2b26860d 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1280,7 +1280,7 @@ void ThreadResource::doRoom() { pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource; pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource; vm._graphicsManager._backColors = vm._bVoy->boltEntry( - vm._playStamp1 + 2)._cMapResource; + vm._playStamp1 + 1)._cMapResource; vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry( vm._playStamp1)._picResource; -- cgit v1.2.3 From 10af04da6a9a01d2f1ff5febed86c4c5ca6cfb8d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 Dec 2013 09:58:43 +1100 Subject: VOYEUR: Mouse flags cleanup and in progress work on doGossip --- engines/voyeur/files_threads.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 6b2b26860d..1d04ddc44e 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -406,7 +406,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 |= 16; _vm->_eventsManager.startCursorBlink(); - while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && + while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && _vm->_soundManager.getVOCStatus()) _vm->_eventsManager.delayClick(1); @@ -460,7 +460,7 @@ void ThreadResource::parsePlayCommands() { } _vm->_eventsManager._videoDead = -1; - if (_field42 == 2 && _vm->_voy._mouseClicked == 0) { + if (_field42 == 2 && _vm->_eventsManager._mouseClicked == 0) { _vm->_voy._field470 = 132; parseIndex = 999; } else { @@ -515,7 +515,7 @@ void ThreadResource::parsePlayCommands() { Common::String file = Common::String::format("news%d.voc", i + 1); _vm->_soundManager.startVOCPlay(file); - while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && + while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && _vm->_soundManager.getVOCStatus()) { _vm->_eventsManager.delayClick(1); _vm->_eventsManager.getMouseInfo(); @@ -526,7 +526,7 @@ void ThreadResource::parsePlayCommands() { if (i == (count - 1)) _vm->_eventsManager.delay(480); - if (_vm->shouldQuit() || _vm->_voy._mouseClicked) + if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked) break; } @@ -706,7 +706,7 @@ void ThreadResource::parsePlayCommands() { Common::String fname = Common::String::format("news%d.voc", idx); - while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && + while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && _vm->_soundManager.getVOCStatus()) _vm->_eventsManager.delay(1); @@ -714,7 +714,7 @@ void ThreadResource::parsePlayCommands() { if (idx == 3) _vm->_eventsManager.delay(3); - if (_vm->shouldQuit() || _vm->_voy._mouseClicked) + if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked) break; } @@ -1107,7 +1107,7 @@ int ThreadResource::doApt() { _vm->flipPageAndWait(); - } while (!_vm->shouldQuit() && (!_vm->_voy._leftClick || hotspotId == -1)); + } while (!_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || hotspotId == -1)); pt = _vm->_eventsManager.getMousePos(); _doAptPosX = pt.x; @@ -1231,10 +1231,10 @@ void ThreadResource::doRoom() { vm._eventsManager._intPtr._hasPalette = true; vm._graphicsManager.flipPage(); vm._eventsManager.sWaitFlip(); - } while (!vm.shouldQuit() && !voy._mouseClicked); + } while (!vm.shouldQuit() && !vm._eventsManager._mouseClicked); - if (!voy._leftClick || i4e4 == -1) { - if (voy._rightClick) + if (!vm._eventsManager._leftClick || i4e4 == -1) { + if (vm._eventsManager._rightClick) breakFlag = true; Common::Point pt = vm._eventsManager.getMousePos(); @@ -1258,7 +1258,7 @@ void ThreadResource::doRoom() { vm._eventsManager.addComputerEventStart(); - voy._mouseClicked = false; + vm._eventsManager._mouseClicked = false; vm._eventsManager.startCursorBlink(); int v = vm.doComputerText(9999); @@ -1271,7 +1271,7 @@ void ThreadResource::doRoom() { } voy._field478 &= ~0x10; - if (!voy._mouseClicked) + if (!vm._eventsManager._mouseClicked) vm._eventsManager.delayClick(18000); vm._bVoy->freeBoltGroup(vm._playStamp1); @@ -1487,7 +1487,7 @@ int ThreadResource::doInterface() { pt = _vm->_eventsManager.getMousePos(); if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) && - (_vm->_voy._rightClick != NULL) && (pt.x == 0))) { + (_vm->_eventsManager._rightClick != NULL) && (pt.x == 0))) { _vm->_eventsManager.getMouseInfo(); if (_vm->_voy._transitionId == 15) { @@ -1495,7 +1495,7 @@ int ThreadResource::doInterface() { _vm->_voy._transitionId = 17; _vm->_soundManager.stopVOCPlay(); _vm->checkTransition(); - _vm->_voy._leftClick = true; + _vm->_eventsManager._leftClick = true; } else { _vm->_voy._field478 = 1; _currentMouseX = pt.x; @@ -1518,15 +1518,15 @@ int ThreadResource::doInterface() { _vm->_eventsManager._intPtr.field1A = 0; } } - } while (!_vm->_voy._rightClick && !_vm->shouldQuit() && - (!_vm->_voy._leftClick || regionIndex == -1)); + } while (!_vm->_eventsManager._rightClick && !_vm->shouldQuit() && + (!_vm->_eventsManager._leftClick || regionIndex == -1)); _vm->_voy._field478 |= 1; _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); if (_vm->_playStamp2 != -1) _vm->_soundManager.stopVOCPlay(); - return !_vm->_voy._rightClick ? regionIndex : -2; + return !_vm->_eventsManager._rightClick ? regionIndex : -2; } bool ThreadResource::goToStateID(int stackId, int sceneId) { -- cgit v1.2.3 From f1686fcf16de1ed3303369f6f3b4c29daeb25d44 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 30 Dec 2013 10:00:26 +1100 Subject: VOYEUR: Fix bugs in police arriving playback --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 1d04ddc44e..ecf564c2ce 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -489,7 +489,7 @@ void ThreadResource::parsePlayCommands() { _vm->playAVideo(_vm->_eventsManager._videoComputerBut4); _vm->_voy._field478 |= 1; - if (id != 2) { + if (id != 22) { _vm->_eventsManager._videoComputerBut4 = -1; parseIndex = 999; } else { -- cgit v1.2.3 From 3e268ca4e0963b95e36d84e506d1d2397fa84ecb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 31 Dec 2013 13:43:47 -1000 Subject: VOYEUR: Fix to cardPerform switch cases --- engines/voyeur/files_threads.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index ecf564c2ce..df6ad3ae75 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -787,6 +787,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { int v3; byte bVal; uint32 idx1, idx2; + debugC(DEBUG_BASIC, kDebugScripts, "cardPerform - %d", id); switch (id) { case 1: @@ -888,17 +889,17 @@ const byte *ThreadResource::cardPerform(const byte *card) { card += 2; break; - case 22: case 23: - case 26: + case 24: case 27: + case 28: varD -= 3; // Deliberate fall-through - case 20: case 21: - case 24: + case 22: case 25: + case 26: bVal = card[varD]; if (bVal == 61) { if (cardPerform2(card, id)) { -- cgit v1.2.3 From 1c3708630bd4e2698704883e1b1aeea94ef8379b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jan 2014 09:20:53 -1000 Subject: VOYEUR: Replaced original game mansion scrolling with a more effective one The original had the cursor fixed in the middle of the screen, and scrolled the mansion view as the mouse moves. Since this doesn't really work for windowed mode nor tablets, I've replaced it with a new version that scrolls when the mouse cursor is near any edge of the screen --- engines/voyeur/files_threads.cpp | 93 ++++++++++++++++++++++++++-------------- 1 file changed, 60 insertions(+), 33 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index df6ad3ae75..2d9ae816eb 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -31,8 +31,6 @@ int ThreadResource::_stampFlags; int ThreadResource::_useCount[8]; byte *ThreadResource::_threadDataPtr; CMapResource *ThreadResource::_cmd14Pal; -int ThreadResource::_currentMouseX; -int ThreadResource::_currentMouseY; int ThreadResource::_doAptPosX; int ThreadResource::_doAptPosY; @@ -41,8 +39,6 @@ void ThreadResource::init() { Common::fill(&_useCount[0], &_useCount[8], 0); _threadDataPtr = nullptr; _cmd14Pal = nullptr; - _currentMouseX = 392; - _currentMouseY = 57; _doAptPosX = -1; _doAptPosY = -1; } @@ -1361,7 +1357,6 @@ int ThreadResource::doInterface() { _vm->_voy._RTVNum = _vm->_voy._field476; _vm->makeViewFinder(); - _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); _vm->initIFace(); _vm->_voy._RTVNum = _vm->_voy._field476 - 4; _vm->_voy._field478 &= ~1; @@ -1378,7 +1373,6 @@ int ThreadResource::doInterface() { _vm->checkTransition(); _vm->makeViewFinder(); _vm->_eventsManager.getMouseInfo(); - _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); _vm->initIFace(); Common::Array &hotspots = _vm->_bVoy->boltEntry( @@ -1389,26 +1383,34 @@ int ThreadResource::doInterface() { Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_playStamp2); _vm->_soundManager.startVOCPlay(fname); _vm->_eventsManager.getMouseInfo(); - _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); _vm->_graphicsManager.setColor(240, 220, 220, 220); _vm->_eventsManager._intPtr.field38 = true; _vm->_eventsManager._intPtr._hasPalette = true; _vm->_voy._field478 &= ~1; + // Set the cusor + PictureResource *crosshairsCursor = _vm->_bVoy->boltEntry(0x112)._picResource; + PictureResource *mangifyCursor = _vm->_bVoy->boltEntry(0x114)._picResource; + PictureResource *unk1Cursor = _vm->_bVoy->boltEntry(0x115)._picResource; + PictureResource *unk2Cursor = _vm->_bVoy->boltEntry(0x113)._picResource; + + _vm->_eventsManager.setCursor(crosshairsCursor); + _vm->_eventsManager.showCursor(); + + // Main loop int priorRegionIndex = -1; int regionIndex = 0; + Common::Rect mansionViewBounds(MANSION_VIEW_X, MANSION_VIEW_Y, + MANSION_VIEW_X + MANSION_VIEW_WIDTH, MANSION_VIEW_Y + MANSION_VIEW_HEIGHT); + do { _vm->doTimeBar(true); _vm->_eventsManager.getMouseInfo(); - pt = _vm->_eventsManager.getMousePos(); - if (pt.x != _currentMouseX || pt.y != _currentMouseY || regionIndex != priorRegionIndex) { + if (checkMansionScroll()) { priorRegionIndex = regionIndex; - _vm->doScroll(pt); - - _currentMouseX = pt.x; - _currentMouseY = pt.y; + _vm->doScroll(_vm->_mansionViewPos); } _vm->checkPhoneCall(); @@ -1417,7 +1419,13 @@ int ThreadResource::doInterface() { _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); } - pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75); + // Calculate the mouse position within the entire mansion + pt = _vm->_eventsManager.getMousePos(); + if (!mansionViewBounds.contains(pt)) + pt = Common::Point(-1, -1); + else + pt = _vm->_mansionViewPos + + Common::Point(pt.x - MANSION_VIEW_X, pt.y - MANSION_VIEW_Y); regionIndex = -1; for (int idx = 0; idx < (int)hotspots.size(); ++idx) { @@ -1426,19 +1434,15 @@ int ThreadResource::doInterface() { for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum && _vm->_voy._arr4[arrIndex][idx] > _vm->_voy._RTVNum) { - // Draw the picture - pic = _vm->_bVoy->boltEntry(276)._picResource; - _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, - Common::Point(178, 108)); + // Found a hotspot - switch to the magnifying glass cursor + _vm->_eventsManager.setCursor(mangifyCursor); regionIndex = idx; } if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum && _vm->_voy._arr6[idx][idx] > _vm->_voy._RTVNum) { - // Draw the picture - pic = _vm->_bVoy->boltEntry(277)._picResource; - _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, - Common::Point(178, 108)); + // Set unk? cursor + _vm->_eventsManager.setCursor(unk1Cursor); regionIndex = idx; } } @@ -1447,9 +1451,7 @@ int ThreadResource::doInterface() { if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum && _vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) { // Draw the picture - pic = _vm->_bVoy->boltEntry(375)._picResource; - _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, - Common::Point(178, 108)); + _vm->_eventsManager.setCursor(unk2Cursor); regionIndex = idx; } } @@ -1457,10 +1459,8 @@ int ThreadResource::doInterface() { } if (regionIndex == -1) { - // Draw the crosshairs cursor in the center of the screen - pic = _vm->_bVoy->boltEntry(274)._picResource; - _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, - Common::Point(178, 108)); + // Reset back to the crosshairs cursor + _vm->_eventsManager.setCursor(crosshairsCursor); } // Regularly update the time display @@ -1499,20 +1499,16 @@ int ThreadResource::doInterface() { _vm->_eventsManager._leftClick = true; } else { _vm->_voy._field478 = 1; - _currentMouseX = pt.x; - _currentMouseY = pt.y; chooseSTAMPButton(20); parsePlayCommands(); _vm->checkTransition(); _vm->makeViewFinder(); - _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); _vm->initIFace(); hotspots = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); - _vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY)); _vm->_voy._field478 &= ~2; _vm->_eventsManager._intPtr.field1E = 1; @@ -1522,6 +1518,7 @@ int ThreadResource::doInterface() { } while (!_vm->_eventsManager._rightClick && !_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || regionIndex == -1)); + _vm->_eventsManager.hideCursor(); _vm->_voy._field478 |= 1; _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); if (_vm->_playStamp2 != -1) @@ -1530,6 +1527,36 @@ int ThreadResource::doInterface() { return !_vm->_eventsManager._rightClick ? regionIndex : -2; } +bool ThreadResource::checkMansionScroll() { + Common::Point pt = _vm->_eventsManager.getMousePos() - + Common::Point(MANSION_VIEW_X, MANSION_VIEW_Y); + Common::Point &viewPos = _vm->_mansionViewPos; + bool result = false; + + // Scroll mansion view if close to any of the mansion edges + if (pt.x >= 0 && pt.x < MANSION_SCROLL_AREA_X && viewPos.x > 0) { + viewPos.x = MAX(viewPos.x - MANSION_SCROLL_INC_X, 0); + result = true; + } + if (pt.x >= (MANSION_VIEW_WIDTH - MANSION_SCROLL_AREA_X) && + pt.x < MANSION_VIEW_WIDTH && viewPos.x < MANSION_MAX_X) { + viewPos.x = MIN(viewPos.x + MANSION_SCROLL_INC_X, MANSION_MAX_X); + result = true; + } + if (pt.y >= 0 && pt.y < MANSION_SCROLL_AREA_Y && viewPos.y > 0) { + viewPos.y = MAX(viewPos.y - MANSION_SCROLL_INC_Y, 0); + result = true; + } + if (pt.y >= (MANSION_VIEW_HEIGHT - MANSION_SCROLL_AREA_Y) && + pt.y < MANSION_VIEW_HEIGHT && viewPos.y < MANSION_MAX_Y) { + viewPos.y = MIN(viewPos.y + MANSION_SCROLL_INC_Y, MANSION_MAX_Y); + result = true; + } + + // Return whether mansion view area has changed + return result; +} + bool ThreadResource::goToStateID(int stackId, int sceneId) { debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, sceneId); -- cgit v1.2.3 From 5b2ad8515e45642bc2829d4f62aaa571b73b1bf1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jan 2014 09:28:40 -1000 Subject: VOYEUR: Fix names of cursor variables in doInterface --- engines/voyeur/files_threads.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 2d9ae816eb..87a8249b53 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1391,9 +1391,9 @@ int ThreadResource::doInterface() { // Set the cusor PictureResource *crosshairsCursor = _vm->_bVoy->boltEntry(0x112)._picResource; - PictureResource *mangifyCursor = _vm->_bVoy->boltEntry(0x114)._picResource; - PictureResource *unk1Cursor = _vm->_bVoy->boltEntry(0x115)._picResource; - PictureResource *unk2Cursor = _vm->_bVoy->boltEntry(0x113)._picResource; + PictureResource *eyeCursor = _vm->_bVoy->boltEntry(0x113)._picResource; + PictureResource *listenCursor = _vm->_bVoy->boltEntry(0x114)._picResource; + PictureResource *mangifyCursor = _vm->_bVoy->boltEntry(0x115)._picResource; _vm->_eventsManager.setCursor(crosshairsCursor); _vm->_eventsManager.showCursor(); @@ -1435,14 +1435,14 @@ int ThreadResource::doInterface() { if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum && _vm->_voy._arr4[arrIndex][idx] > _vm->_voy._RTVNum) { // Found a hotspot - switch to the magnifying glass cursor - _vm->_eventsManager.setCursor(mangifyCursor); + _vm->_eventsManager.setCursor(listenCursor); regionIndex = idx; } if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum && _vm->_voy._arr6[idx][idx] > _vm->_voy._RTVNum) { // Set unk? cursor - _vm->_eventsManager.setCursor(unk1Cursor); + _vm->_eventsManager.setCursor(mangifyCursor); regionIndex = idx; } } @@ -1451,7 +1451,7 @@ int ThreadResource::doInterface() { if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum && _vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) { // Draw the picture - _vm->_eventsManager.setCursor(unk2Cursor); + _vm->_eventsManager.setCursor(eyeCursor); regionIndex = idx; } } -- cgit v1.2.3 From 795422bb2909bbcc84d259021257cad2ed323522 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jan 2014 09:35:17 -1000 Subject: VOYEUR: Fix loading of correct hotspot list in doInterface --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 87a8249b53..0a11f471fa 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1376,7 +1376,7 @@ int ThreadResource::doInterface() { _vm->initIFace(); Common::Array &hotspots = _vm->_bVoy->boltEntry( - _vm->_playStamp1)._rectResource->_entries; + _vm->_playStamp1 + 1)._rectResource->_entries; _vm->_playStamp2 = 151 - _vm->getRandomNumber(5); _vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29); -- cgit v1.2.3 From ac157b7bc740a1878f22c659fc20a49cf75e9d1f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jan 2014 10:17:40 -1000 Subject: VOYEUR: Workaround for original code causing crash after calling doEvidDisplay --- engines/voyeur/files_threads.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 0a11f471fa..4a4ec61536 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1271,8 +1271,11 @@ void ThreadResource::doRoom() { if (!vm._eventsManager._mouseClicked) vm._eventsManager.delayClick(18000); - vm._bVoy->freeBoltGroup(vm._playStamp1); - vm._bVoy->getBoltGroup(vm._playStamp1); + // WORKAROUND: Done in original, but not now, since freeing and reloading + // the group would invalidate the _backgroundPage picture resource + //vm._bVoy->freeBoltGroup(vm._playStamp1); + //vm._bVoy->getBoltGroup(vm._playStamp1); + dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4); pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource; pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource; -- cgit v1.2.3 From bbecd20818f96b0128dfb0a5fb539fe3bcc4d2d5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jan 2014 11:00:12 -1000 Subject: VOYEUR: Variable renaming for Video Id --- engines/voyeur/files_threads.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 4a4ec61536..4adf4d7216 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -373,22 +373,22 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP + 2); + _vm->_videoId = READ_LE_UINT16(dataP + 2); _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); if (_vm->_voy._RTVNum < _vm->_voy._field468 || (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { - _vm->_eventsManager._videoComputerBut4 = -1; + _vm->_videoId = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; _vm->_eventsManager.addAudioEventStart(); - assert(_vm->_eventsManager._videoComputerBut4 < 38); + assert(_vm->_videoId < 38); _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( - 0x7F00 + BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._picResource; + 0x7F00 + BLIND_TABLE[_vm->_videoId])._picResource; _vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + - BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._cMapResource; + BLIND_TABLE[_vm->_videoId])._cMapResource; (*_vm->_graphicsManager._vPort)->setupViewPort(); _vm->_graphicsManager._backColors->startFade(); @@ -397,7 +397,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 = -2; _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025); Common::String filename = _vm->_soundManager.getVOCFileName( - _vm->_eventsManager._videoComputerBut4 + 159); + _vm->_videoId + 159); _vm->_soundManager.startVOCPlay(filename); _vm->_voy._field478 |= 16; _vm->_eventsManager.startCursorBlink(); @@ -414,7 +414,7 @@ void ThreadResource::parsePlayCommands() { _vm->_bVoy->freeBoltGroup(0x7F00); _vm->_voy._field478 = -17; - _vm->_eventsManager._videoComputerBut4 = -1; + _vm->_videoId = -1; _vm->_voy._field470 = 129; parseIndex = 999; } @@ -427,26 +427,26 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP + 2); + _vm->_videoId = READ_LE_UINT16(dataP + 2); _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); if (_vm->_voy._RTVNum < _vm->_voy._field468 || (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { - _vm->_eventsManager._videoComputerBut4 = -1; + _vm->_videoId = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; _vm->_eventsManager.addAudioEventStart(); _vm->_voy._field478 &= ~1; _vm->_voy._field478 |= 0x10; - _vm->playAVideo(_vm->_eventsManager._videoComputerBut4); + _vm->playAVideo(_vm->_videoId); _vm->_voy._field478 &= ~0x10; _vm->_voy._field478 |= 1; _vm->_eventsManager.addVideoEventEnd(); _vm->_eventsManager.incrementTime(1); - _vm->_eventsManager._videoComputerBut4 = -1; + _vm->_videoId = -1; _vm->_playStamp1 = -1; if (_vm->_eventsManager._videoDead != -1) { @@ -470,7 +470,7 @@ void ThreadResource::parsePlayCommands() { case 4: case 22: - _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1; + _vm->_videoId = READ_LE_UINT16(dataP) - 1; dataP += 2; if (id == 22) { @@ -482,11 +482,11 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._vocSecondsOffset = 0; _vm->_voy._field468 = _vm->_voy._RTVNum; _vm->_voy._field478 &= ~0x11; - _vm->playAVideo(_vm->_eventsManager._videoComputerBut4); + _vm->playAVideo(_vm->_videoId); _vm->_voy._field478 |= 1; if (id != 22) { - _vm->_eventsManager._videoComputerBut4 = -1; + _vm->_videoId = -1; parseIndex = 999; } else { // TODO: Double-check this @@ -528,7 +528,7 @@ void ThreadResource::parsePlayCommands() { _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); _vm->_playStamp1 = -1; - _vm->_eventsManager._videoComputerBut4 = -1; + _vm->_videoId = -1; parseIndex = 999; } break; -- cgit v1.2.3 From 3672e3fa16c976c048e5221790e4e8e7e3627808 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jan 2014 14:40:14 -1000 Subject: VOYEUR: Fix parsePlayCommands case 3 setting Video Id correctly --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 4adf4d7216..2b791c43ab 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -427,7 +427,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_videoId = READ_LE_UINT16(dataP + 2); + _vm->_videoId = READ_LE_UINT16(dataP + 2) - 1; _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); -- cgit v1.2.3 From ce5b8c54a92accf12d43fe1f681d277166b72fb9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jan 2014 20:11:00 -1000 Subject: VOYEUR: Hooked up debugger, and added a 'time' command --- engines/voyeur/files_threads.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 2b791c43ab..b7d1402b35 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -538,7 +538,7 @@ void ThreadResource::parsePlayCommands() { if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { _vm->_voy._field470 = 5; int count = READ_LE_UINT16(dataP + 2); - _vm->_voy._field476 = READ_LE_UINT16(dataP + 4); + _vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4); if (_vm->_voy._transitionId != count) { if (_vm->_voy._transitionId > 1) @@ -552,7 +552,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._RTANum = 255; } - _vm->_voy._isAM = (_vm->_voy._transitionId == 6) ? 1 : 0; + _vm->_voy._isAM = _vm->_voy._transitionId == 6; } dataP += 6; @@ -1353,18 +1353,18 @@ int ThreadResource::doInterface() { _vm->_eventsManager._intPtr.field1E = 1; _vm->_eventsManager._intPtr.field1A = 0; - if (_vm->_voy._RTVNum >= _vm->_voy._field476 || _vm->_voy._RTVNum < 0) - _vm->_voy._RTVNum = _vm->_voy._field476 - 1; + if (_vm->_voy._RTVNum >= _vm->_voy._RTVLimit || _vm->_voy._RTVNum < 0) + _vm->_voy._RTVNum = _vm->_voy._RTVLimit - 1; - if (_vm->_voy._transitionId < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) { - _vm->_voy._RTVNum = _vm->_voy._field476; + if (_vm->_voy._transitionId < 15 && (_vm->_voy._RTVLimit - 3) < _vm->_voy._RTVNum) { + _vm->_voy._RTVNum = _vm->_voy._RTVLimit; _vm->makeViewFinder(); _vm->initIFace(); - _vm->_voy._RTVNum = _vm->_voy._field476 - 4; + _vm->_voy._RTVNum = _vm->_voy._RTVLimit - 4; _vm->_voy._field478 &= ~1; - while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._field476) { + while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._RTVLimit) { _vm->flashTimeBar(); } @@ -1490,8 +1490,9 @@ int ThreadResource::doInterface() { _vm->flipPageAndWait(); pt = _vm->_eventsManager.getMousePos(); - if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) && - (_vm->_eventsManager._rightClick != NULL) && (pt.x == 0))) { + if ((_vm->_voy._RTVNum >= _vm->_voy._RTVLimit) || ((_vm->_voy._field478 & 0x80) && + _vm->_eventsManager._rightClick && (pt.x == 0))) { + // Time to transition to the next time period _vm->_eventsManager.getMouseInfo(); if (_vm->_voy._transitionId == 15) { -- cgit v1.2.3 From 99dc594cb9391fefe4650610c531df44563bf20c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jan 2014 11:29:03 -0500 Subject: VOYEUR: Fix for crash when changing time period --- engines/voyeur/files_threads.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index b7d1402b35..48eee998d5 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1378,7 +1378,7 @@ int ThreadResource::doInterface() { _vm->_eventsManager.getMouseInfo(); _vm->initIFace(); - Common::Array &hotspots = _vm->_bVoy->boltEntry( + Common::Array *hotspots = &_vm->_bVoy->boltEntry( _vm->_playStamp1 + 1)._rectResource->_entries; _vm->_playStamp2 = 151 - _vm->getRandomNumber(5); _vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29); @@ -1399,7 +1399,6 @@ int ThreadResource::doInterface() { PictureResource *mangifyCursor = _vm->_bVoy->boltEntry(0x115)._picResource; _vm->_eventsManager.setCursor(crosshairsCursor); - _vm->_eventsManager.showCursor(); // Main loop int priorRegionIndex = -1; @@ -1431,8 +1430,8 @@ int ThreadResource::doInterface() { Common::Point(pt.x - MANSION_VIEW_X, pt.y - MANSION_VIEW_Y); regionIndex = -1; - for (int idx = 0; idx < (int)hotspots.size(); ++idx) { - if (hotspots[idx].contains(pt)) { + for (int idx = 0; idx < (int)hotspots->size(); ++idx) { + if ((*hotspots)[idx].contains(pt)) { // Rect check done for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum && @@ -1511,7 +1510,7 @@ int ThreadResource::doInterface() { _vm->initIFace(); - hotspots = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries; + hotspots = &_vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); _vm->_voy._field478 &= ~2; -- cgit v1.2.3 From 7c256c491a71feb3dd608e0351072939cb7ac796 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jan 2014 14:15:53 -0500 Subject: VOYEUR: Refactored doAptPosX/Y into a local variable --- engines/voyeur/files_threads.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 48eee998d5..637b8ff65a 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -31,16 +31,12 @@ int ThreadResource::_stampFlags; int ThreadResource::_useCount[8]; byte *ThreadResource::_threadDataPtr; CMapResource *ThreadResource::_cmd14Pal; -int ThreadResource::_doAptPosX; -int ThreadResource::_doAptPosY; void ThreadResource::init() { _stampFlags = 0; Common::fill(&_useCount[0], &_useCount[8], 0); _threadDataPtr = nullptr; _cmd14Pal = nullptr; - _doAptPosX = -1; - _doAptPosY = -1; } ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): @@ -1029,26 +1025,27 @@ bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) { int ThreadResource::doApt() { loadTheApt(); + Common::Point aptPos(-1, -1); _vm->_playStamp2 = 151; _vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStamp1)._rectResource; Common::Array &hotspots = _vm->_bVoy->boltEntry( _vm->_playStamp1 + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); - if (_doAptPosX == -1) { - _doAptPosX = hotspots[2].left; - _doAptPosY = hotspots[2].top; + if (aptPos.x == -1) { + aptPos.x = hotspots[2].left; + aptPos.y = hotspots[2].top; _vm->_playStamp2 = 153; } if (_vm->_voy._field470 == 16) { hotspots[0].left = 999; hotspots[3].left = 999; - _doAptPosX = hotspots[4].left + 28; - _doAptPosY = hotspots[4].top + 28; + aptPos.x = hotspots[4].left + 28; + aptPos.y = hotspots[4].top + 28; } - _vm->_eventsManager.setMousePos(Common::Point(_doAptPosX, _doAptPosY)); + _vm->_eventsManager.setMousePos(Common::Point(aptPos.x, aptPos.y)); _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); _vm->_playStamp2 = 151; @@ -1107,8 +1104,8 @@ int ThreadResource::doApt() { } while (!_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || hotspotId == -1)); pt = _vm->_eventsManager.getMousePos(); - _doAptPosX = pt.x; - _doAptPosY = pt.y; + aptPos.x = pt.x; + aptPos.y = pt.y; switch (hotspotId) { case 0: -- cgit v1.2.3 From 1690ffb2bfc3ddcbbebe755a33f94f62b7ba81a0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jan 2014 14:41:09 -0500 Subject: VOYEUR: Moved _stampFlags to VoyeurEngine --- engines/voyeur/files_threads.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 637b8ff65a..1e4fdb1bc6 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -27,13 +27,11 @@ namespace Voyeur { -int ThreadResource::_stampFlags; int ThreadResource::_useCount[8]; byte *ThreadResource::_threadDataPtr; CMapResource *ThreadResource::_cmd14Pal; void ThreadResource::init() { - _stampFlags = 0; Common::fill(&_useCount[0], &_useCount[8], 0); _threadDataPtr = nullptr; _cmd14Pal = nullptr; @@ -58,7 +56,7 @@ void ThreadResource::initThreadStruct(int idx, int id) { } bool ThreadResource::loadAStack(int idx) { - if (_stampFlags & 1) { + if (_vm->_stampFlags & 1) { unloadAStack(_controlIndex); if (!_useCount[idx]) { BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[idx]); @@ -76,7 +74,7 @@ bool ThreadResource::loadAStack(int idx) { } void ThreadResource::unloadAStack(int idx) { - if ((_stampFlags & 1) && _useCount[idx]) { + if ((_vm->_stampFlags & 1) && _useCount[idx]) { if (--_useCount[idx] == 0) { _vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[idx]); } @@ -186,7 +184,7 @@ void ThreadResource::getField1CE() { } void ThreadResource::unloadAllStacks(VoyeurEngine *vm) { - if (_stampFlags & 1) { + if (vm->_stampFlags & 1) { for (int i = 0; i < 8; ++i) { if (_useCount[i]) vm->_stampLibPtr->freeBoltMember(vm->_controlPtr->_memberIds[i]); -- cgit v1.2.3 From 9c2b761b310fecc098c721676163fa34b96b6666 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jan 2014 14:54:55 -0500 Subject: VOYEUR: Rename the old _playStamp1/2 variables to have better names --- engines/voyeur/files_threads.cpp | 152 +++++++++++++++++++-------------------- 1 file changed, 76 insertions(+), 76 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 1e4fdb1bc6..d412e11566 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -359,7 +359,7 @@ void ThreadResource::parsePlayCommands() { switch (id) { case 1: - _vm->_playStamp2 = READ_LE_UINT16(dataP); + _vm->_currentVocId = READ_LE_UINT16(dataP); dataP += 2; break; @@ -441,7 +441,7 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager.incrementTime(1); _vm->_videoId = -1; - _vm->_playStamp1 = -1; + _vm->_playStampGroupId = -1; if (_vm->_eventsManager._videoDead != -1) { _vm->_bVoy->freeBoltGroup(0xE00); @@ -470,7 +470,7 @@ void ThreadResource::parsePlayCommands() { if (id == 22) { int resolveIndex = READ_LE_UINT16(dataP); dataP += 2; - _vm->_playStamp1 = _vm->_resolvePtr[resolveIndex]; + _vm->_playStampGroupId = _vm->_resolvePtr[resolveIndex]; } _vm->_voy._vocSecondsOffset = 0; @@ -484,13 +484,13 @@ void ThreadResource::parsePlayCommands() { parseIndex = 999; } else { // TODO: Double-check this - int count = _vm->_bVoy->getBoltGroup(_vm->_playStamp1)->_entries.size(); + int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size(); _vm->_soundManager.stopVOCPlay(); _vm->_eventsManager.getMouseInfo(); for (int i = 0; i < count; ++i) { - pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2)._picResource; - pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2 + 1)._cMapResource; + pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2)._picResource; + pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2 + 1)._cMapResource; (*_vm->_graphicsManager._vPort)->setupViewPort(pic); pal->startFade(); @@ -498,8 +498,8 @@ void ThreadResource::parsePlayCommands() { _vm->flipPageAndWaitForFade(); if (i > 0) { - _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2); - _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2 + 1); + _vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + i * 2); + _vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + i * 2 + 1); } Common::String file = Common::String::format("news%d.voc", i + 1); @@ -520,8 +520,8 @@ void ThreadResource::parsePlayCommands() { break; } - _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); - _vm->_playStamp1 = -1; + _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); + _vm->_playStampGroupId = -1; _vm->_videoId = -1; parseIndex = 999; } @@ -555,7 +555,7 @@ void ThreadResource::parsePlayCommands() { case 6: _vm->_voy._field470 = 6; v2 = READ_LE_UINT16(dataP); - _vm->_playStamp1 = _vm->_resolvePtr[v2]; + _vm->_playStampGroupId = _vm->_resolvePtr[v2]; dataP += 2; break; @@ -660,17 +660,17 @@ void ThreadResource::parsePlayCommands() { break; case 14: - _vm->_playStamp1 = 2048; + _vm->_playStampGroupId = 2048; _vm->_voy._field470 = 130; break; case 15: - _vm->_playStamp1 = (_vm->_voy._field4382 - 1) * 8 + 0x7700; + _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->_playStamp1)._picResource; - _cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._cMapResource; + pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource; + _cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource; (*_vm->_graphicsManager._vPort)->setupViewPort(pic); _cmd14Pal->startFade(); @@ -683,16 +683,16 @@ void ThreadResource::parsePlayCommands() { pic = _vm->_bVoy->boltEntry(_vm->_voy._field47A)._picResource; _cmd14Pal = _vm->_bVoy->boltEntry(_vm->_voy._field47A + 1)._cMapResource; } else { - pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + idx * 2)._picResource; - _cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + idx * 2 + 1)._cMapResource; + 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->_playStamp1 + (idx - 1) * 2); - _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2 + 1); + _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); @@ -708,9 +708,9 @@ void ThreadResource::parsePlayCommands() { break; } - _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); + _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); _vm->_bVoy->freeBoltGroup(_vm->_voy._field47A); - _vm->_playStamp1 = -1; + _vm->_playStampGroupId = -1; _vm->_voy._field47A = -1; break; @@ -1024,16 +1024,16 @@ int ThreadResource::doApt() { loadTheApt(); Common::Point aptPos(-1, -1); - _vm->_playStamp2 = 151; - _vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStamp1)._rectResource; + _vm->_currentVocId = 151; + _vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._rectResource; Common::Array &hotspots = _vm->_bVoy->boltEntry( - _vm->_playStamp1 + 1)._rectResource->_entries; + _vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); if (aptPos.x == -1) { aptPos.x = hotspots[2].left; aptPos.y = hotspots[2].top; - _vm->_playStamp2 = 153; + _vm->_currentVocId = 153; } if (_vm->_voy._field470 == 16) { @@ -1044,8 +1044,8 @@ int ThreadResource::doApt() { } _vm->_eventsManager.setMousePos(Common::Point(aptPos.x, aptPos.y)); - _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); - _vm->_playStamp2 = 151; + _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId)); + _vm->_currentVocId = 151; _vm->_graphicsManager.setColor(129, 82, 82, 82); _vm->_graphicsManager.setColor(130, 112, 112, 112); @@ -1064,8 +1064,8 @@ int ThreadResource::doApt() { _vm->_eventsManager.getMouseInfo(); if (!_vm->_soundManager.getVOCStatus()) { // Previous sound ended, so start up a new one - _vm->_playStamp2 = _vm->getRandomNumber(4) + 151; - _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); + _vm->_currentVocId = _vm->getRandomNumber(4) + 151; + _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId)); } // Loop through the hotspot list @@ -1082,7 +1082,7 @@ int ThreadResource::doApt() { hotspotId = 5; // Draw the text description for the highlighted hotspot - pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + + pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + hotspotId + 6)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, Common::Point(106, 200)); @@ -1093,8 +1093,8 @@ int ThreadResource::doApt() { } // Draw either standard or highlighted eye cursor - pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStamp1 + 2 : - _vm->_playStamp1 + 3)._picResource; + pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStampGroupId + 2 : + _vm->_playStampGroupId + 3)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, pt); _vm->flipPageAndWait(); @@ -1139,11 +1139,11 @@ void ThreadResource::doRoom() { vm.makeViewFinderP(); voy._field437E = 0; - if (!vm._bVoy->getBoltGroup(vm._playStamp1, true)) + if (!vm._bVoy->getBoltGroup(vm._playStampGroupId, true)) return; - vm._graphicsManager._backColors = vm._bVoy->boltEntry(vm._playStamp1 + 1)._cMapResource; - vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(vm._playStamp1)._picResource; + vm._graphicsManager._backColors = vm._bVoy->boltEntry(vm._playStampGroupId + 1)._cMapResource; + vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(vm._playStampGroupId)._picResource; (*vm._graphicsManager._vPort)->setupViewPort(vm._graphicsManager._backgroundPage); vm._graphicsManager._backColors->startFade(); @@ -1151,12 +1151,12 @@ void ThreadResource::doRoom() { voy._field437C = 0; voy._field437E = 1; - byte *dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4); + byte *dataP = vm._bVoy->memberAddr(vm._playStampGroupId + 4); int count = READ_LE_UINT16(dataP); int i4e4 = -1; - PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource; - PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource; + PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource; + PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource; RectResource viewBounds(48, 38, 336, 202); voy._viewBounds = &viewBounds; @@ -1164,11 +1164,11 @@ void ThreadResource::doRoom() { vm._eventsManager.getMouseInfo(); vm._eventsManager.setMousePos(Common::Point(192, 120)); voy._field437E = 0; - vm._playStamp2 = 146; + vm._currentVocId = 146; voy._field4AC = voy._RTVNum; voy._vocSecondsOffset = 0; - vm._soundManager.startVOCPlay(vm._playStamp2); + vm._soundManager.startVOCPlay(vm._currentVocId); voy._field478 &= ~1; bool breakFlag = false; @@ -1178,10 +1178,10 @@ void ThreadResource::doRoom() { vm._eventsManager._intPtr._hasPalette = true; do { - if (vm._playStamp2 != -1 && !vm._soundManager.getVOCStatus()) { + if (vm._currentVocId != -1 && !vm._soundManager.getVOCStatus()) { voy._field4AC = voy._RTVNum; voy._vocSecondsOffset = 0; - vm._soundManager.startVOCPlay(vm._playStamp2); + vm._soundManager.startVOCPlay(vm._currentVocId); } vm._eventsManager.getMouseInfo(); @@ -1239,7 +1239,7 @@ void ThreadResource::doRoom() { if (i4e4 == 999) { _vm->flipPageAndWait(); - if (vm._playStamp2 != -1) { + if (vm._currentVocId != -1) { voy._vocSecondsOffset = voy._RTVNum - voy._field4AC; vm._soundManager.stopVOCPlay(); @@ -1268,16 +1268,16 @@ void ThreadResource::doRoom() { // WORKAROUND: Done in original, but not now, since freeing and reloading // the group would invalidate the _backgroundPage picture resource - //vm._bVoy->freeBoltGroup(vm._playStamp1); - //vm._bVoy->getBoltGroup(vm._playStamp1); + //vm._bVoy->freeBoltGroup(vm._playStampGroupId); + //vm._bVoy->getBoltGroup(vm._playStampGroupId); - dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4); - pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource; - pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource; + dataP = vm._bVoy->memberAddr(vm._playStampGroupId + 4); + pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource; + pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource; vm._graphicsManager._backColors = vm._bVoy->boltEntry( - vm._playStamp1 + 1)._cMapResource; + vm._playStampGroupId + 1)._cMapResource; vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry( - vm._playStamp1)._picResource; + vm._playStampGroupId)._picResource; vm._graphicsManager._backColors->startFade(); _vm->flipPageAndWait(); @@ -1320,14 +1320,14 @@ void ThreadResource::doRoom() { voy._field47A = -1; } - if (vm._playStamp1 != -1) { - vm._bVoy->freeBoltGroup(vm._playStamp1); - vm._playStamp1 = -1; + if (vm._playStampGroupId != -1) { + vm._bVoy->freeBoltGroup(vm._playStampGroupId); + vm._playStampGroupId = -1; } - if (vm._playStamp2 != -1) { + if (vm._currentVocId != -1) { vm._soundManager.stopVOCPlay(); - vm._playStamp2 = -1; + vm._currentVocId = -1; } chooseSTAMPButton(0); @@ -1344,7 +1344,7 @@ int ThreadResource::doInterface() { } _vm->_voy._field478 &= ~0x100; - _vm->_playStamp1 = -1; + _vm->_playStampGroupId = -1; _vm->_eventsManager._intPtr.field1E = 1; _vm->_eventsManager._intPtr.field1A = 0; @@ -1374,11 +1374,11 @@ int ThreadResource::doInterface() { _vm->initIFace(); Common::Array *hotspots = &_vm->_bVoy->boltEntry( - _vm->_playStamp1 + 1)._rectResource->_entries; - _vm->_playStamp2 = 151 - _vm->getRandomNumber(5); + _vm->_playStampGroupId + 1)._rectResource->_entries; + _vm->_currentVocId = 151 - _vm->getRandomNumber(5); _vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29); - Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_playStamp2); + Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_currentVocId); _vm->_soundManager.startVOCPlay(fname); _vm->_eventsManager.getMouseInfo(); @@ -1412,8 +1412,8 @@ int ThreadResource::doInterface() { _vm->checkPhoneCall(); if (!_vm->_soundManager.getVOCStatus()) { - _vm->_playStamp2 = 151 - _vm->getRandomNumber(5); - _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2)); + _vm->_currentVocId = 151 - _vm->getRandomNumber(5); + _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId)); } // Calculate the mouse position within the entire mansion @@ -1505,7 +1505,7 @@ int ThreadResource::doInterface() { _vm->initIFace(); - hotspots = &_vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries; + hotspots = &_vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); _vm->_voy._field478 &= ~2; @@ -1518,8 +1518,8 @@ int ThreadResource::doInterface() { _vm->_eventsManager.hideCursor(); _vm->_voy._field478 |= 1; - _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); - if (_vm->_playStamp2 != -1) + _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); + if (_vm->_currentVocId != -1) _vm->_soundManager.stopVOCPlay(); return !_vm->_eventsManager._rightClick ? regionIndex : -2; @@ -1618,10 +1618,10 @@ void ThreadResource::loadTheApt() { case 8: case 9: case 17: - _vm->_playStamp1 = 0x5700; + _vm->_playStampGroupId = 0x5700; break; case 3: - _vm->_playStamp1 = 0x5800; + _vm->_playStampGroupId = 0x5800; break; case 4: case 10: @@ -1631,7 +1631,7 @@ void ThreadResource::loadTheApt() { case 14: case 15: case 16: - _vm->_playStamp1 = 0x5900; + _vm->_playStampGroupId = 0x5900; break; default: break; @@ -1642,21 +1642,21 @@ void ThreadResource::loadTheApt() { if (_vm->_voy._field472 != -1) { doAptAnim(1); - _vm->_bVoy->getBoltGroup(_vm->_playStamp1); + _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId); _vm->_voy._field472 = -1; _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( - _vm->_playStamp1 + 5)._picResource; + _vm->_playStampGroupId + 5)._picResource; (*_vm->_graphicsManager._vPort)->setupViewPort( _vm->_graphicsManager._backgroundPage); } else { - _vm->_bVoy->getBoltGroup(_vm->_playStamp1); + _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId); _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( - _vm->_playStamp1 + 5)._picResource; + _vm->_playStampGroupId + 5)._picResource; (*_vm->_graphicsManager._vPort)->setupViewPort( _vm->_graphicsManager._backgroundPage); } - CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 4)._cMapResource; + CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 4)._cMapResource; pal->_steps = 1; pal->startFade(); _vm->flipPageAndWaitForFade(); @@ -1668,9 +1668,9 @@ void ThreadResource::freeTheApt() { _vm->_graphicsManager.fadeUpICF1(0); - if (_vm->_playStamp2 != -1) { + if (_vm->_currentVocId != -1) { _vm->_soundManager.stopVOCPlay(); - _vm->_playStamp2 = -1; + _vm->_currentVocId = -1; } if (_vm->_voy._field472 == -1) { @@ -1685,8 +1685,8 @@ void ThreadResource::freeTheApt() { } (*_vm->_graphicsManager._vPort)->setupViewPort(nullptr); - _vm->_bVoy->freeBoltGroup(_vm->_playStamp1); - _vm->_playStamp1 = -1; + _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); + _vm->_playStampGroupId = -1; _vm->_voy._viewBounds = nullptr; } -- cgit v1.2.3 From c884d5bf1488db9d05b0afb0088768a97f6b1b52 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jan 2014 16:47:03 -0500 Subject: VOYEUR: Added a state field for current game area --- engines/voyeur/files_threads.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index d412e11566..20d781457d 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1061,6 +1061,7 @@ int ThreadResource::doApt() { Common::Point pt; PictureResource *pic; do { + _vm->_voyeurArea = AREA_APARTMENT; _vm->_eventsManager.getMouseInfo(); if (!_vm->_soundManager.getVOCStatus()) { // Previous sound ended, so start up a new one @@ -1173,6 +1174,7 @@ void ThreadResource::doRoom() { bool breakFlag = false; while (!vm.shouldQuit() && !breakFlag) { + _vm->_voyeurArea = AREA_ROOM; vm._graphicsManager.setColor(128, 0, 255, 0); vm._eventsManager._intPtr.field38 = 1; vm._eventsManager._intPtr._hasPalette = true; @@ -1402,6 +1404,7 @@ int ThreadResource::doInterface() { MANSION_VIEW_X + MANSION_VIEW_WIDTH, MANSION_VIEW_Y + MANSION_VIEW_HEIGHT); do { + _vm->_voyeurArea = AREA_INTERFACE; _vm->doTimeBar(true); _vm->_eventsManager.getMouseInfo(); -- cgit v1.2.3 From 996b2aa43ca5615001d5aa0004a71612cc677eac Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 6 Jan 2014 07:47:47 +0100 Subject: VOYEUR: Use boolean for _isAM instead of int --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 20d781457d..dc46b789ec 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -546,7 +546,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._RTANum = 255; } - _vm->_voy._isAM = _vm->_voy._transitionId == 6; + _vm->_voy._isAM = (_vm->_voy._transitionId == 6); } dataP += 6; -- cgit v1.2.3 From 6dff1574590c60eab526b7dcc4061ec9f15c0821 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 7 Jan 2014 00:06:16 +0100 Subject: VOYEUR: Remove a couple of useless variables, change type of some other to use booleans, add CHECKME --- engines/voyeur/files_threads.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index dc46b789ec..9f694ecaf9 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1176,7 +1176,7 @@ void ThreadResource::doRoom() { while (!vm.shouldQuit() && !breakFlag) { _vm->_voyeurArea = AREA_ROOM; vm._graphicsManager.setColor(128, 0, 255, 0); - vm._eventsManager._intPtr.field38 = 1; + vm._eventsManager._intPtr.field38 = true; vm._eventsManager._intPtr._hasPalette = true; do { @@ -1221,7 +1221,7 @@ void ThreadResource::doRoom() { vm._eventsManager.setCursorColor(128, 2); } - vm._eventsManager._intPtr.field38 = 1; + vm._eventsManager._intPtr.field38 = true; vm._eventsManager._intPtr._hasPalette = true; vm._graphicsManager.flipPage(); vm._eventsManager.sWaitFlip(); @@ -1341,7 +1341,7 @@ int ThreadResource::doInterface() { _vm->_voy._field478 |= 1; if (_vm->_voy._field46E) { - _vm->_voy._field46E = 0; + _vm->_voy._field46E = false; return -2; } -- cgit v1.2.3 From 2a206ebd7f84b41ba93518a2c003ba67bedf72df Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jan 2014 22:01:36 -0500 Subject: VOYEUR: Moved SVoy and game events to their own file --- engines/voyeur/files_threads.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 9f694ecaf9..1764c223d7 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -376,7 +376,7 @@ void ThreadResource::parsePlayCommands() { _vm->_videoId = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; - _vm->_eventsManager.addAudioEventStart(); + _vm->_voy.addAudioEventStart(); assert(_vm->_videoId < 38); _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( @@ -402,7 +402,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 |= 1; _vm->_soundManager.stopVOCPlay(); - _vm->_eventsManager.addAudioEventEnd(); + _vm->_voy.addAudioEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_eventsManager.incrementTime(1); @@ -430,14 +430,14 @@ void ThreadResource::parsePlayCommands() { _vm->_videoId = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; - _vm->_eventsManager.addAudioEventStart(); + _vm->_voy.addAudioEventStart(); _vm->_voy._field478 &= ~1; _vm->_voy._field478 |= 0x10; _vm->playAVideo(_vm->_videoId); _vm->_voy._field478 &= ~0x10; _vm->_voy._field478 |= 1; - _vm->_eventsManager.addVideoEventEnd(); + _vm->_voy.addVideoEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_videoId = -1; @@ -1250,14 +1250,14 @@ void ThreadResource::doRoom() { vm.getComputerBrush(); _vm->flipPageAndWait(); - vm._eventsManager.addComputerEventStart(); + vm._voy.addComputerEventStart(); vm._eventsManager._mouseClicked = false; vm._eventsManager.startCursorBlink(); int v = vm.doComputerText(9999); if (v) - vm._eventsManager.addComputerEventEnd(v); + vm._voy.addComputerEventEnd(v); vm._bVoy->freeBoltGroup(0x4900); } else { -- cgit v1.2.3 From d0703467b42d3636f3d81683efc3e336ab33052f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 7 Jan 2014 08:17:06 +0100 Subject: VOYEUR: Fix some more CppCheck warnings --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 1764c223d7..4348a14896 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1398,11 +1398,11 @@ int ThreadResource::doInterface() { _vm->_eventsManager.setCursor(crosshairsCursor); // Main loop - int priorRegionIndex = -1; int regionIndex = 0; Common::Rect mansionViewBounds(MANSION_VIEW_X, MANSION_VIEW_Y, MANSION_VIEW_X + MANSION_VIEW_WIDTH, MANSION_VIEW_Y + MANSION_VIEW_HEIGHT); + int priorRegionIndex = -1; do { _vm->_voyeurArea = AREA_INTERFACE; _vm->doTimeBar(true); -- cgit v1.2.3 From dfe3d8b4ceab85f3831ad4fe7fb0fa587c1e67fa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 8 Jan 2014 23:31:34 -0500 Subject: VOYEUR: Preliminary savegame functionality --- engines/voyeur/files_threads.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 4348a14896..cee4e46c81 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1062,6 +1062,13 @@ int ThreadResource::doApt() { PictureResource *pic; do { _vm->_voyeurArea = AREA_APARTMENT; + + if (_vm->_loadGameSlot != -1) { + // Load a savegame + _vm->loadGame(_vm->_loadGameSlot); + _vm->_loadGameSlot = -1; + } + _vm->_eventsManager.getMouseInfo(); if (!_vm->_soundManager.getVOCStatus()) { // Previous sound ended, so start up a new one @@ -1760,4 +1767,8 @@ void ThreadResource::doAptAnim(int mode) { _vm->_bVoy->getBoltGroup(0x100); } +void ThreadResource::synchronize(Common::Serializer &s) { + warning("TODO: ThreadResource::synchronize"); +} + } // End of namespace Voyeur -- cgit v1.2.3 From c1657dc2789cf5fd680248850ca9f51c85698498 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 16 Jan 2014 22:11:41 -0500 Subject: VOYEUR: Fix selection of apartment music after initial phone call ends --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index cee4e46c81..8fa2ec7724 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1072,7 +1072,7 @@ int ThreadResource::doApt() { _vm->_eventsManager.getMouseInfo(); if (!_vm->_soundManager.getVOCStatus()) { // Previous sound ended, so start up a new one - _vm->_currentVocId = _vm->getRandomNumber(4) + 151; + _vm->_currentVocId = 151 - _vm->getRandomNumber(4); _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId)); } -- cgit v1.2.3 From 829de693ef90fd6381ab6525158d1a38d9df6d3d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 17 Jan 2014 23:01:41 -0500 Subject: VOYEUR: Fix for video playback when no custom pic list needs to be applied --- engines/voyeur/files_threads.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 8fa2ec7724..4b074720c0 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1086,6 +1086,8 @@ int ThreadResource::doApt() { hotspotId = idx; if (idx != prevHotspotId) { + // Check for whether to replace hotspot Id for "Watch TV" for + // "Review the Tape" if player has already watched the TV if ((_vm->_voy._field478 & 0x100) && (hotspotId == 2)) hotspotId = 5; -- cgit v1.2.3 From 7ad8dfa0a720ea5b7db502424ba73fb7059824b6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 17 Jan 2014 23:19:54 -0500 Subject: VOYEUR: Fix switching TV watch gossip to reviewing the tape --- engines/voyeur/files_threads.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 4b074720c0..850e6dfa06 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -388,7 +388,7 @@ void ThreadResource::parsePlayCommands() { _vm->_graphicsManager._backColors->startFade(); _vm->flipPageAndWaitForFade(); - _vm->_voy._field478 = -2; + _vm->_voy._field478 &= ~1; _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025); Common::String filename = _vm->_soundManager.getVOCFileName( _vm->_videoId + 159); @@ -407,7 +407,7 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager.incrementTime(1); _vm->_bVoy->freeBoltGroup(0x7F00); - _vm->_voy._field478 = -17; + _vm->_voy._field478 &= ~0x10; _vm->_videoId = -1; _vm->_voy._field470 = 129; parseIndex = 999; @@ -628,7 +628,7 @@ void ThreadResource::parsePlayCommands() { break; case 11: - _vm->_voy._field478 = 2; + _vm->_voy._field478 |= 2; break; case 12: @@ -1085,7 +1085,7 @@ int ThreadResource::doApt() { // Cursor is within hotspot area hotspotId = idx; - if (idx != prevHotspotId) { + if (hotspotId != prevHotspotId) { // Check for whether to replace hotspot Id for "Watch TV" for // "Review the Tape" if player has already watched the TV if ((_vm->_voy._field478 & 0x100) && (hotspotId == 2)) -- cgit v1.2.3 From 00873d3124bb2011dda6bfc177ad38585ca9cebf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 18 Jan 2014 23:47:04 -0500 Subject: VOYEUR: Fix for phone message playing every time apartment was shown --- engines/voyeur/files_threads.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 850e6dfa06..58ce373b75 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -41,6 +41,7 @@ ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): _vm(state._vm) { _flags = src[8]; _ctlPtr = nullptr; + _aptPos = Common::Point(-1, -1); } void ThreadResource::initThreadStruct(int idx, int id) { @@ -1023,27 +1024,27 @@ bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) { int ThreadResource::doApt() { loadTheApt(); - Common::Point aptPos(-1, -1); _vm->_currentVocId = 151; _vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._rectResource; Common::Array &hotspots = _vm->_bVoy->boltEntry( _vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); - if (aptPos.x == -1) { - aptPos.x = hotspots[2].left; - aptPos.y = hotspots[2].top; + // Very first time apartment is shown, start the phone message + if (_aptPos.x == -1) { + _aptPos.x = hotspots[2].left; + _aptPos.y = hotspots[2].top; _vm->_currentVocId = 153; } if (_vm->_voy._field470 == 16) { hotspots[0].left = 999; hotspots[3].left = 999; - aptPos.x = hotspots[4].left + 28; - aptPos.y = hotspots[4].top + 28; + _aptPos.x = hotspots[4].left + 28; + _aptPos.y = hotspots[4].top + 28; } - _vm->_eventsManager.setMousePos(Common::Point(aptPos.x, aptPos.y)); + _vm->_eventsManager.setMousePos(Common::Point(_aptPos.x, _aptPos.y)); _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId)); _vm->_currentVocId = 151; @@ -1112,8 +1113,8 @@ int ThreadResource::doApt() { } while (!_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || hotspotId == -1)); pt = _vm->_eventsManager.getMousePos(); - aptPos.x = pt.x; - aptPos.y = pt.y; + _aptPos.x = pt.x; + _aptPos.y = pt.y; switch (hotspotId) { case 0: @@ -1770,7 +1771,8 @@ void ThreadResource::doAptAnim(int mode) { } void ThreadResource::synchronize(Common::Serializer &s) { - warning("TODO: ThreadResource::synchronize"); + s.syncAsSint16LE(_aptPos.x); + s.syncAsSint16LE(_aptPos.y); } } // End of namespace Voyeur -- cgit v1.2.3 From f49a0e3a06822a0cc77d73f3cbd62de86dddca2d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 19 Jan 2014 21:58:55 -0500 Subject: VOYEUR: Some fixes for savegame loading --- engines/voyeur/files_threads.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 58ce373b75..fac44c7fbc 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -734,31 +734,31 @@ void ThreadResource::parsePlayCommands() { break; case 19: - _vm->_voy._field472 = 140; + _vm->_voy._aptLoadMode = 140; loadTheApt(); - _vm->_voy._field472 = 141; + _vm->_voy._aptLoadMode = 141; freeTheApt(); break; case 20: - _vm->_voy._field472 = -1; + _vm->_voy._aptLoadMode = -1; loadTheApt(); - _vm->_voy._field472 = 141; + _vm->_voy._aptLoadMode = 141; freeTheApt(); break; case 21: - _vm->_voy._field472 = -1; + _vm->_voy._aptLoadMode = -1; loadTheApt(); - _vm->_voy._field472 = 140; + _vm->_voy._aptLoadMode = 140; freeTheApt(); break; case 23: _vm->_voy._transitionId = 17; - _vm->_voy._field472 = -1; + _vm->_voy._aptLoadMode = -1; loadTheApt(); - _vm->_voy._field472 = 144; + _vm->_voy._aptLoadMode = 144; freeTheApt(); break; @@ -1118,18 +1118,18 @@ int ThreadResource::doApt() { switch (hotspotId) { case 0: - _vm->_voy._field472 = 140; + _vm->_voy._aptLoadMode = 140; break; case 1: - _vm->_voy._field472 = 143; + _vm->_voy._aptLoadMode = 143; break; case 2: - _vm->_voy._field472 = 142; + _vm->_voy._aptLoadMode = 142; case 5: - _vm->_voy._field472 = 141; + _vm->_voy._aptLoadMode = 141; break; default: - _vm->_voy._field472 = -1; + _vm->_voy._aptLoadMode = -1; break; } @@ -1650,13 +1650,13 @@ void ThreadResource::loadTheApt() { break; } - if (_vm->_voy._field472 == 143) - _vm->_voy._field472 = -1; + if (_vm->_voy._aptLoadMode == 143) + _vm->_voy._aptLoadMode = -1; - if (_vm->_voy._field472 != -1) { + if (_vm->_voy._aptLoadMode != -1) { doAptAnim(1); _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId); - _vm->_voy._field472 = -1; + _vm->_voy._aptLoadMode = -1; _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( _vm->_playStampGroupId + 5)._picResource; (*_vm->_graphicsManager._vPort)->setupViewPort( @@ -1686,13 +1686,13 @@ void ThreadResource::freeTheApt() { _vm->_currentVocId = -1; } - if (_vm->_voy._field472 == -1) { + if (_vm->_voy._aptLoadMode == -1) { _vm->_graphicsManager.fadeDownICF(6); } else { doAptAnim(2); } - if (_vm->_voy._field472 == 140) { + if (_vm->_voy._aptLoadMode == 140) { _vm->_graphicsManager.screenReset(); _vm->_graphicsManager.resetPalette(); } @@ -1708,7 +1708,7 @@ void ThreadResource::doAptAnim(int mode) { // Figure out the resource to use int id = 0; - switch (_vm->_voy._field472) { + switch (_vm->_voy._aptLoadMode) { case 140: id = 0x5A00; break; -- cgit v1.2.3 From b247d8d0a739232820b10d4cf625f2c4b68116ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 20 Jan 2014 22:59:13 -0500 Subject: VOYEUR: Fix for aborting out of sending someoneo the tape --- engines/voyeur/files_threads.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index fac44c7fbc..7cd5e6e624 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -39,6 +39,10 @@ void ThreadResource::init() { ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): _vm(state._vm) { + _threadId = READ_LE_UINT16(&src[0]); + _controlIndex = READ_LE_UINT16(&src[0]); + _field4 = READ_LE_UINT16(&src[0]); + _field6 = READ_LE_UINT16(&src[0]); _flags = src[8]; _ctlPtr = nullptr; _aptPos = Common::Point(-1, -1); @@ -71,6 +75,7 @@ bool ThreadResource::loadAStack(int idx) { } _ctlPtr = _vm->_controlPtr->_entries[idx]; + _controlIndex = idx; return true; } -- cgit v1.2.3 From 3e12562654d1b94365c695bbf6585af63ad71a4c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 21 Jan 2014 21:04:13 -0500 Subject: VOYEUR: Renaming of thread data pointers --- engines/voyeur/files_threads.cpp | 53 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 7cd5e6e624..6ce772922b 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -53,8 +53,8 @@ void ThreadResource::initThreadStruct(int idx, int id) { if (loadAStack(idx)) { _field4 = _field6 = -1; _threadId = id; - _field3A = -1; - _field3E = -1; + _newSceneId = -1; + _newStackId = -1; doState(); } @@ -100,8 +100,8 @@ bool ThreadResource::doState() { _vm->_glGoStack = -1; performOpenCard(); - if (_field40 & 1) { - return chooseSTAMPButton(_vm->getRandomNumber(_field42 - 1)); + if (_stateFlags & 1) { + return chooseSTAMPButton(_vm->getRandomNumber(_stateCount - 1)); } else { return true; } @@ -121,14 +121,14 @@ bool ThreadResource::getStateInfo() { fld = READ_LE_UINT32(_ctlPtr + fld); byte *baseP = _ctlPtr + fld; - _field42 = READ_LE_UINT16(baseP); - _field40 = READ_LE_UINT16(baseP + 2); + _stateCount = READ_LE_UINT16(baseP); + _stateFlags = READ_LE_UINT16(baseP + 2); _parseCount = READ_LE_UINT16(baseP + 4); - _field28E = getDataOffset(); - _field28E += (READ_LE_UINT32(baseP + 6) / 2) << 1; + _playCommandsPtr = getDataOffset(); + _playCommandsPtr += (READ_LE_UINT32(baseP + 6) / 2) << 1; - _field4A = baseP + 10; + _threadInfoPtr = baseP + 10; getButtonsText(); return true; @@ -144,7 +144,7 @@ byte *ThreadResource::getDataOffset() { void ThreadResource::getButtonsText() { int idx = 0; - for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + for (const byte *p = _threadInfoPtr; *p != 0x49; p = getNextRecord(p)) { if (*p == 0xC0) { ++p; if (*p++ & 0x80) { @@ -162,10 +162,10 @@ void ThreadResource::getButtonsText() { void ThreadResource::getButtonsFlags() { int idx = 0; - for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + for (const byte *p = _threadInfoPtr; *p != 0x49; p = getNextRecord(p)) { if (*p == 0xC0) { if (*++p & 0x20) - _field40 |= 2; + _stateFlags |= 2; _buttonFlags[idx] = *p++; _field18E[idx] = *p++; @@ -181,7 +181,7 @@ void ThreadResource::getButtonsFlags() { void ThreadResource::getField1CE() { int idx = 0; - for (const byte *p = _field4A; *p++ != 0x49; p = getNextRecord(p)) { + for (const byte *p = _threadInfoPtr; *p++ != 0x49; p = getNextRecord(p)) { assert(idx < 47); _field1CE[idx++] = getRecordOffset(p); _field1CE[idx] = NULL; @@ -199,7 +199,7 @@ void ThreadResource::unloadAllStacks(VoyeurEngine *vm) { } void ThreadResource::performOpenCard() { - for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + for (const byte *p = _threadInfoPtr; *p != 0x49; p = getNextRecord(p)) { if (*p == 0x47) { cardAction(p + 1); return; @@ -265,7 +265,7 @@ const byte *ThreadResource::getSTAMPCard(int cardId) { const byte *p; int count = 0; - for (p = _field4A; count <= cardId && *p != 0x49; p = getNextRecord(p)) { + for (p = _threadInfoPtr; count <= cardId && *p != 0x49; p = getNextRecord(p)) { if (*p == 0xC0) ++count; } @@ -291,7 +291,7 @@ uint32 ThreadResource::getSID(int sid) { } void ThreadResource::doSTAMPCardAction() { - for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) { + for (const byte *p = _threadInfoPtr; *p != 0x49; p = getNextRecord(p)) { if (*p == 0x48) { cardAction(p + 1); return; @@ -312,7 +312,7 @@ void ThreadResource::cardAction(const byte *card) { bool ThreadResource::chooseSTAMPButton(int buttonId) { _flags &= ~1; - for (int idx = 0; idx < _field42; ++idx) { + for (int idx = 0; idx < _stateCount; ++idx) { if (_field18E[idx] == buttonId) { const byte *card = getSTAMPCard(idx); cardAction(card); @@ -352,7 +352,7 @@ void ThreadResource::parsePlayCommands() { Common::fill(&_vm->_voy._arr6[0][0], &_vm->_voy._arr6[3][20], 0); Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0); - byte *dataP = _field28E; + byte *dataP = _playCommandsPtr; int v2, v3; PictureResource *pic; CMapResource *pal; @@ -456,7 +456,7 @@ void ThreadResource::parsePlayCommands() { } _vm->_eventsManager._videoDead = -1; - if (_field42 == 2 && _vm->_eventsManager._mouseClicked == 0) { + if (_stateCount == 2 && _vm->_eventsManager._mouseClicked == 0) { _vm->_voy._field470 = 132; parseIndex = 999; } else { @@ -953,15 +953,15 @@ const byte *ThreadResource::cardPerform(const byte *card) { card += 2; case 45: - _field3A = _field46; - _field3E = _controlIndex; + _newSceneId = _field46; + _newStackId = _controlIndex; break; case 46: - _vm->_glGoScene = _field3A; - _vm->_glGoStack = _field3E; - _field3A = -1; - _field3E = -1; + _vm->_glGoScene = _newSceneId; + _vm->_glGoStack = _newStackId; + _newSceneId = -1; + _newStackId = -1; break; case 51: @@ -1257,8 +1257,7 @@ void ThreadResource::doRoom() { _vm->flipPageAndWait(); if (vm._currentVocId != -1) { - voy._vocSecondsOffset = voy._RTVNum - - voy._field4AC; + voy._vocSecondsOffset = voy._RTVNum - voy._field4AC; vm._soundManager.stopVOCPlay(); } -- cgit v1.2.3 From 336a02047b1b52f7a052712bcce2b3608958f8b6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 28 Jan 2014 23:22:41 -0500 Subject: VOYEUR: Fixes for flagging video events, and reviewing them in reviewTape --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 6ce772922b..a7e69c90c2 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -436,7 +436,7 @@ void ThreadResource::parsePlayCommands() { _vm->_videoId = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; - _vm->_voy.addAudioEventStart(); + _vm->_voy.addVideoEventStart(); _vm->_voy._field478 &= ~1; _vm->_voy._field478 |= 0x10; _vm->playAVideo(_vm->_videoId); -- cgit v1.2.3 From f2af864c6b76d2d2348bb2d70d7ce738487a3033 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 29 Jan 2014 22:02:00 -0500 Subject: VOYEUR: Bugfixes for initializing audio events --- engines/voyeur/files_threads.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index a7e69c90c2..5920ca0f54 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -373,7 +373,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_videoId = READ_LE_UINT16(dataP + 2); + _vm->_videoId = READ_LE_UINT16(dataP + 2) - 1; _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); @@ -385,6 +385,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy.addAudioEventStart(); assert(_vm->_videoId < 38); + _vm->_bVoy->getBoltGroup(0x7F00); _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( 0x7F00 + BLIND_TABLE[_vm->_videoId])._picResource; _vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + -- cgit v1.2.3 From 55f2b4ea527d93b2f202da0f76838af879fe4eb7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 29 Jan 2014 22:40:00 -0500 Subject: VOYEUR: Fixes for observing audio events --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 5920ca0f54..92b0191dde 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -396,7 +396,7 @@ void ThreadResource::parsePlayCommands() { _vm->flipPageAndWaitForFade(); _vm->_voy._field478 &= ~1; - _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025); + _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset); Common::String filename = _vm->_soundManager.getVOCFileName( _vm->_videoId + 159); _vm->_soundManager.startVOCPlay(filename); -- cgit v1.2.3 From dbc8e6bb31fbb01c88403cfe712a7ecadbcd83b5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 30 Jan 2014 21:31:20 -0500 Subject: VOYEUR: Fix for low battery charge leaving scene when time is turned off --- engines/voyeur/files_threads.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 92b0191dde..0179894254 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1368,7 +1368,8 @@ int ThreadResource::doInterface() { if (_vm->_voy._RTVNum >= _vm->_voy._RTVLimit || _vm->_voy._RTVNum < 0) _vm->_voy._RTVNum = _vm->_voy._RTVLimit - 1; - if (_vm->_voy._transitionId < 15 && (_vm->_voy._RTVLimit - 3) < _vm->_voy._RTVNum) { + if (_vm->_voy._transitionId < 15 && _vm->_debugger._isTimeActive && + (_vm->_voy._RTVLimit - 3) < _vm->_voy._RTVNum) { _vm->_voy._RTVNum = _vm->_voy._RTVLimit; _vm->makeViewFinder(); -- cgit v1.2.3 From 77e86b3d4805603166330c47f47789d7e4d09398 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 30 Jan 2014 22:10:59 -0500 Subject: VOYEUR: Renaming of _videoId to _audioVideoId and extra comments --- engines/voyeur/files_threads.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 0179894254..3746a89a62 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -373,23 +373,23 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_videoId = READ_LE_UINT16(dataP + 2) - 1; + _vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1; _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); if (_vm->_voy._RTVNum < _vm->_voy._field468 || (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { - _vm->_videoId = -1; + _vm->_audioVideoId = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; _vm->_voy.addAudioEventStart(); - assert(_vm->_videoId < 38); + assert(_vm->_audioVideoId < 38); _vm->_bVoy->getBoltGroup(0x7F00); _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( - 0x7F00 + BLIND_TABLE[_vm->_videoId])._picResource; + 0x7F00 + BLIND_TABLE[_vm->_audioVideoId])._picResource; _vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + - BLIND_TABLE[_vm->_videoId])._cMapResource; + BLIND_TABLE[_vm->_audioVideoId])._cMapResource; (*_vm->_graphicsManager._vPort)->setupViewPort(); _vm->_graphicsManager._backColors->startFade(); @@ -398,7 +398,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 &= ~1; _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset); Common::String filename = _vm->_soundManager.getVOCFileName( - _vm->_videoId + 159); + _vm->_audioVideoId + 159); _vm->_soundManager.startVOCPlay(filename); _vm->_voy._field478 |= 16; _vm->_eventsManager.startCursorBlink(); @@ -415,7 +415,7 @@ void ThreadResource::parsePlayCommands() { _vm->_bVoy->freeBoltGroup(0x7F00); _vm->_voy._field478 &= ~0x10; - _vm->_videoId = -1; + _vm->_audioVideoId = -1; _vm->_voy._field470 = 129; parseIndex = 999; } @@ -428,26 +428,26 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_videoId = READ_LE_UINT16(dataP + 2) - 1; + _vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1; _vm->_voy._field468 = READ_LE_UINT16(dataP + 4); _vm->_voy._field46A = READ_LE_UINT16(dataP + 6); if (_vm->_voy._RTVNum < _vm->_voy._field468 || (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { - _vm->_videoId = -1; + _vm->_audioVideoId = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; _vm->_voy.addVideoEventStart(); _vm->_voy._field478 &= ~1; _vm->_voy._field478 |= 0x10; - _vm->playAVideo(_vm->_videoId); + _vm->playAVideo(_vm->_audioVideoId); _vm->_voy._field478 &= ~0x10; _vm->_voy._field478 |= 1; _vm->_voy.addVideoEventEnd(); _vm->_eventsManager.incrementTime(1); - _vm->_videoId = -1; + _vm->_audioVideoId = -1; _vm->_playStampGroupId = -1; if (_vm->_eventsManager._videoDead != -1) { @@ -471,7 +471,7 @@ void ThreadResource::parsePlayCommands() { case 4: case 22: - _vm->_videoId = READ_LE_UINT16(dataP) - 1; + _vm->_audioVideoId = READ_LE_UINT16(dataP) - 1; dataP += 2; if (id == 22) { @@ -483,11 +483,11 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._vocSecondsOffset = 0; _vm->_voy._field468 = _vm->_voy._RTVNum; _vm->_voy._field478 &= ~0x11; - _vm->playAVideo(_vm->_videoId); + _vm->playAVideo(_vm->_audioVideoId); _vm->_voy._field478 |= 1; if (id != 22) { - _vm->_videoId = -1; + _vm->_audioVideoId = -1; parseIndex = 999; } else { // TODO: Double-check this @@ -529,7 +529,7 @@ void ThreadResource::parsePlayCommands() { _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); _vm->_playStampGroupId = -1; - _vm->_videoId = -1; + _vm->_audioVideoId = -1; parseIndex = 999; } break; -- cgit v1.2.3 From 4174c4a2be34242dc7003b4f4a7363caf743bdb5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 31 Jan 2014 08:57:12 -0500 Subject: VOYEUR: Fix hotspot hightlighting in doInterface --- engines/voyeur/files_threads.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 3746a89a62..da4ae551ba 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -601,6 +601,7 @@ void ThreadResource::parsePlayCommands() { break; case 9: + // Load up initial timeframese for third set of hotspots v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; @@ -1456,7 +1457,7 @@ int ThreadResource::doInterface() { } if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum && - _vm->_voy._arr6[idx][idx] > _vm->_voy._RTVNum) { + _vm->_voy._arr6[arrIndex][idx] > _vm->_voy._RTVNum) { // Set unk? cursor _vm->_eventsManager.setCursor(mangifyCursor); regionIndex = idx; -- cgit v1.2.3 From f31a422ddfb97efbdec5d0f69b4c4e81b571b5f7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 31 Jan 2014 21:58:03 -0500 Subject: VOYEUR: Add support for the extended rects used by room displays --- engines/voyeur/files_threads.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index da4ae551ba..03e393936a 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1033,7 +1033,7 @@ int ThreadResource::doApt() { _vm->_currentVocId = 151; _vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._rectResource; - Common::Array &hotspots = _vm->_bVoy->boltEntry( + Common::Array &hotspots = _vm->_bVoy->boltEntry( _vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); @@ -1169,8 +1169,7 @@ void ThreadResource::doRoom() { voy._field437C = 0; voy._field437E = 1; - byte *dataP = vm._bVoy->memberAddr(vm._playStampGroupId + 4); - int count = READ_LE_UINT16(dataP); + Common::Array &hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries; int i4e4 = -1; PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource; @@ -1209,12 +1208,9 @@ void ThreadResource::doRoom() { if (voy._computerTextId != -1 && voy._rect4E4.contains(pt)) i4e4 = 999; - for (int idx = 0; idx < count; ++idx) { - if (pt.x > READ_LE_UINT16(dataP + idx * 12 + 6) && - pt.x < READ_LE_UINT16(dataP + idx * 12 + 10) && - pt.y > READ_LE_UINT16(dataP + idx * 12 + 8) && - pt.y < READ_LE_UINT16(dataP + idx * 12 + 12)) { - int arrIndex = READ_LE_UINT16(dataP + idx * 12 + 2); + for (uint idx = 0; idx < hotspots.size(); ++idx) { + if (hotspots[idx].contains(pt)) { + int arrIndex = hotspots[idx]._arrIndex; if (voy._arr7[arrIndex - 1] == 1) { i4e4 = idx; break; @@ -1289,7 +1285,7 @@ void ThreadResource::doRoom() { //vm._bVoy->freeBoltGroup(vm._playStampGroupId); //vm._bVoy->getBoltGroup(vm._playStampGroupId); - dataP = vm._bVoy->memberAddr(vm._playStampGroupId + 4); + hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries; pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource; pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource; vm._graphicsManager._backColors = vm._bVoy->boltEntry( @@ -1392,7 +1388,7 @@ int ThreadResource::doInterface() { _vm->_eventsManager.getMouseInfo(); _vm->initIFace(); - Common::Array *hotspots = &_vm->_bVoy->boltEntry( + Common::Array *hotspots = &_vm->_bVoy->boltEntry( _vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_currentVocId = 151 - _vm->getRandomNumber(5); _vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29); -- cgit v1.2.3 From 37402e06e5f55896f3bd8a7bf8a62bca16d1c7b1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 11:29:49 -0500 Subject: VOYEUR: Correct mistake in debugger command.. it's time expired, not remaining --- engines/voyeur/files_threads.cpp | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 03e393936a..3e2fa6f7bc 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -384,39 +384,13 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; _vm->_voy.addAudioEventStart(); + // Play the audio assert(_vm->_audioVideoId < 38); - _vm->_bVoy->getBoltGroup(0x7F00); - _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( - 0x7F00 + BLIND_TABLE[_vm->_audioVideoId])._picResource; - _vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + - BLIND_TABLE[_vm->_audioVideoId])._cMapResource; - - (*_vm->_graphicsManager._vPort)->setupViewPort(); - _vm->_graphicsManager._backColors->startFade(); - _vm->flipPageAndWaitForFade(); + _vm->playAudio(_vm->_audioVideoId); - _vm->_voy._field478 &= ~1; - _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset); - Common::String filename = _vm->_soundManager.getVOCFileName( - _vm->_audioVideoId + 159); - _vm->_soundManager.startVOCPlay(filename); - _vm->_voy._field478 |= 16; - _vm->_eventsManager.startCursorBlink(); - - while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && - _vm->_soundManager.getVOCStatus()) - _vm->_eventsManager.delayClick(1); - - _vm->_voy._field478 |= 1; - _vm->_soundManager.stopVOCPlay(); _vm->_voy.addAudioEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_eventsManager.incrementTime(1); - - _vm->_bVoy->freeBoltGroup(0x7F00); - _vm->_voy._field478 &= ~0x10; - _vm->_audioVideoId = -1; - _vm->_voy._field470 = 129; parseIndex = 999; } } -- cgit v1.2.3 From 256bf62ee4d9822458a721c059fe4abbef8ca1df Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 11:54:33 -0500 Subject: VOYEUR: Refactored audio scene playback, and fixed a crash at the end --- engines/voyeur/files_threads.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 3e2fa6f7bc..8359cf88fb 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -391,6 +391,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy.addAudioEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_eventsManager.incrementTime(1); + _vm->_audioVideoId = -1; parseIndex = 999; } } -- cgit v1.2.3 From 3b414f10ba9e79fca6a920240435c1531ec6db1b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 11:56:51 -0500 Subject: VOYEUR: Fix hang when viewing scene is finished with very little time remaining --- engines/voyeur/files_threads.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 8359cf88fb..0892de1494 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1351,6 +1351,7 @@ int ThreadResource::doInterface() { while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._RTVLimit) { _vm->flashTimeBar(); + _vm->_eventsManager.delayClick(1); } _vm->_voy._field478 = 1; -- cgit v1.2.3 From 517df376a2d96b68e3a7b9f5c078be48cb12a211 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 15:04:18 -0500 Subject: VOYEUR: Refactored hotspot time arrays into a cleaner template --- engines/voyeur/files_threads.cpp | 57 +++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 0892de1494..134a064b42 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -344,12 +344,10 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 &= ~8; _vm->_eventsManager._videoDead = -1; - Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 9999); - Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0); - Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999); - Common::fill(&_vm->_voy._arr4[0][0], &_vm->_voy._arr4[3][20], 0); - Common::fill(&_vm->_voy._arr5[0][0], &_vm->_voy._arr5[3][20], 9999); - Common::fill(&_vm->_voy._arr6[0][0], &_vm->_voy._arr6[3][20], 0); + // Reset hotspot times data + _vm->_voy._videoHotspotTimes.reset(); + _vm->_voy._audioHotspotTimes.reset(); + _vm->_voy._evidenceHotspotTimes.reset(); Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0); byte *dataP = _playCommandsPtr; @@ -542,52 +540,54 @@ void ThreadResource::parsePlayCommands() { break; case 7: + // Load the video event scene hotspot times data v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { int idx = 0; - while (_vm->_voy._arr1[idx][v3] != 9999) + while (_vm->_voy._videoHotspotTimes._min[idx][v3] != 9999) ++idx; v2 = READ_LE_UINT16(dataP + 4); - _vm->_voy._arr1[idx][v3] = v2; - _vm->_voy._arr2[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; + _vm->_voy._videoHotspotTimes._min[idx][v3] = v2; + _vm->_voy._videoHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; } dataP += 8; break; case 8: + // Load the audio event scene hotspot times data v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { int idx = 0; - while (_vm->_voy._arr3[idx][v3] != 9999) + while (_vm->_voy._audioHotspotTimes._min[idx][v3] != 9999) ++idx; v2 = READ_LE_UINT16(dataP + 4); - _vm->_voy._arr3[idx][v3] = v2; - _vm->_voy._arr4[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; + _vm->_voy._audioHotspotTimes._min[idx][v3] = v2; + _vm->_voy._audioHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; } dataP += 8; break; case 9: - // Load up initial timeframese for third set of hotspots + // Load up evidence event scene hotspot times data v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { int idx = 0; - while (_vm->_voy._arr5[idx][v3] != 9999) + while (_vm->_voy._evidenceHotspotTimes._min[idx][v3] != 9999) ++idx; v2 = READ_LE_UINT16(dataP + 4); - _vm->_voy._arr5[idx][v3] = v2; - _vm->_voy._arr6[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; + _vm->_voy._evidenceHotspotTimes._min[idx][v3] = v2; + _vm->_voy._evidenceHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; } dataP += 8; @@ -1417,31 +1417,28 @@ int ThreadResource::doInterface() { Common::Point(pt.x - MANSION_VIEW_X, pt.y - MANSION_VIEW_Y); regionIndex = -1; - for (int idx = 0; idx < (int)hotspots->size(); ++idx) { - if ((*hotspots)[idx].contains(pt)) { + for (int hotspotIdx = 0; hotspotIdx < (int)hotspots->size(); ++hotspotIdx) { + if ((*hotspots)[hotspotIdx].contains(pt)) { // Rect check done for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { - if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum && - _vm->_voy._arr4[arrIndex][idx] > _vm->_voy._RTVNum) { - // Found a hotspot - switch to the magnifying glass cursor + if (_vm->_voy._audioHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy._RTVNum)) { + // Set the ear cursor for an audio event _vm->_eventsManager.setCursor(listenCursor); - regionIndex = idx; + regionIndex = hotspotIdx; } - if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum && - _vm->_voy._arr6[arrIndex][idx] > _vm->_voy._RTVNum) { - // Set unk? cursor + if (_vm->_voy._evidenceHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy._RTVNum)) { + // Set the magnifier cursor for an evidence event _vm->_eventsManager.setCursor(mangifyCursor); - regionIndex = idx; + regionIndex = hotspotIdx; } } for (int arrIndex = 0; arrIndex < 8; ++arrIndex) { - if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum && - _vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) { - // Draw the picture + if (_vm->_voy._videoHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy._RTVNum)) { + // Set the eye cursor for a video event _vm->_eventsManager.setCursor(eyeCursor); - regionIndex = idx; + regionIndex = hotspotIdx; } } } -- cgit v1.2.3 From 971fd6304fca2b31c8f92f8a3bf2606b1f0a4e0f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 15:09:52 -0500 Subject: VOYEUR: Renamed SVoy._arr7 to _roomHotspotsEnabled --- engines/voyeur/files_threads.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 134a064b42..0b4cdd2f99 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -344,11 +344,11 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 &= ~8; _vm->_eventsManager._videoDead = -1; - // Reset hotspot times data + // Reset hotspot data _vm->_voy._videoHotspotTimes.reset(); _vm->_voy._audioHotspotTimes.reset(); _vm->_voy._evidenceHotspotTimes.reset(); - Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0); + Common::fill(&_vm->_voy._roomHotspotsEnabled[0], &_vm->_voy._roomHotspotsEnabled[20], false); byte *dataP = _playCommandsPtr; int v2, v3; @@ -619,7 +619,7 @@ void ThreadResource::parsePlayCommands() { if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { _vm->_voy._field47A = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)]; - _vm->_voy._arr7[READ_LE_UINT16(dataP + 4) - 1] = 1; + _vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true; } dataP += 6; @@ -1145,7 +1145,7 @@ void ThreadResource::doRoom() { voy._field437E = 1; Common::Array &hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries; - int i4e4 = -1; + int hotspotId = -1; PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource; PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource; @@ -1179,25 +1179,25 @@ void ThreadResource::doRoom() { vm._eventsManager.getMouseInfo(); Common::Point pt = vm._eventsManager.getMousePos(); - i4e4 = -1; + hotspotId = -1; if (voy._computerTextId != -1 && voy._rect4E4.contains(pt)) - i4e4 = 999; + hotspotId = 999; for (uint idx = 0; idx < hotspots.size(); ++idx) { if (hotspots[idx].contains(pt)) { int arrIndex = hotspots[idx]._arrIndex; - if (voy._arr7[arrIndex - 1] == 1) { - i4e4 = idx; + if (voy._roomHotspotsEnabled[arrIndex - 1]) { + hotspotId = idx; break; } } } - if (i4e4 == -1) { + if (hotspotId == -1) { vm._graphicsManager.sDrawPic(pic1, *vm._graphicsManager._vPort, Common::Point(pt.x - 9, pt.y - 9)); vm._eventsManager.setCursorColor(128, 0); - } else if (i4e4 != 999 || voy._RTVNum < voy._field4EC || + } else if (hotspotId != 999 || voy._RTVNum < voy._field4EC || (voy._field4EE - 2) < voy._RTVNum) { vm._graphicsManager.sDrawPic(pic2, *vm._graphicsManager._vPort, Common::Point(pt.x - 12, pt.y - 9)); @@ -1215,7 +1215,7 @@ void ThreadResource::doRoom() { vm._eventsManager.sWaitFlip(); } while (!vm.shouldQuit() && !vm._eventsManager._mouseClicked); - if (!vm._eventsManager._leftClick || i4e4 == -1) { + if (!vm._eventsManager._leftClick || hotspotId == -1) { if (vm._eventsManager._rightClick) breakFlag = true; @@ -1226,7 +1226,7 @@ void ThreadResource::doRoom() { voy._field478 |= 16; vm._eventsManager.startCursorBlink(); - if (i4e4 == 999) { + if (hotspotId == 999) { _vm->flipPageAndWait(); if (vm._currentVocId != -1) { @@ -1248,7 +1248,7 @@ void ThreadResource::doRoom() { vm._bVoy->freeBoltGroup(0x4900); } else { - vm.doEvidDisplay(i4e4, 999); + vm.doEvidDisplay(hotspotId, 999); } voy._field478 &= ~0x10; -- cgit v1.2.3 From 24e40281742877f88b235838a25e6a1e2ba70f33 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 18:08:07 -0500 Subject: VOYEUR: Improvements for savegame support --- engines/voyeur/files_threads.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 0b4cdd2f99..94ef0f63ef 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -349,7 +349,6 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._audioHotspotTimes.reset(); _vm->_voy._evidenceHotspotTimes.reset(); Common::fill(&_vm->_voy._roomHotspotsEnabled[0], &_vm->_voy._roomHotspotsEnabled[20], false); - byte *dataP = _playCommandsPtr; int v2, v3; PictureResource *pic; @@ -1749,6 +1748,14 @@ void ThreadResource::doAptAnim(int mode) { void ThreadResource::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_aptPos.x); s.syncAsSint16LE(_aptPos.y); + + int sceneId = _threadId; + int stackId = _controlIndex; + s.syncAsSint16LE(sceneId); + s.syncAsSint16LE(stackId); + + if (s.isLoading() && (sceneId != _threadId || stackId != _controlIndex)) + goToState(stackId, sceneId); } } // End of namespace Voyeur -- cgit v1.2.3 From d215fae7212bd4063437c02a7dfdc0fc16110798 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 18:35:08 -0500 Subject: VOYEUR: Renaming to standardize on stateId/stackId variable names --- engines/voyeur/files_threads.cpp | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 94ef0f63ef..deb2e5bd89 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -39,20 +39,20 @@ void ThreadResource::init() { ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): _vm(state._vm) { - _threadId = READ_LE_UINT16(&src[0]); - _controlIndex = READ_LE_UINT16(&src[0]); - _field4 = READ_LE_UINT16(&src[0]); - _field6 = READ_LE_UINT16(&src[0]); + _stateId = READ_LE_UINT16(&src[0]); + _stackId = READ_LE_UINT16(&src[0]); + _savedStateId = READ_LE_UINT16(&src[0]); + _savedStackId = READ_LE_UINT16(&src[0]); _flags = src[8]; _ctlPtr = nullptr; _aptPos = Common::Point(-1, -1); } void ThreadResource::initThreadStruct(int idx, int id) { - _controlIndex = -1; + _stackId = -1; if (loadAStack(idx)) { - _field4 = _field6 = -1; - _threadId = id; + _savedStateId = _savedStackId = -1; + _stateId = id; _newSceneId = -1; _newStackId = -1; @@ -60,29 +60,29 @@ void ThreadResource::initThreadStruct(int idx, int id) { } } -bool ThreadResource::loadAStack(int idx) { +bool ThreadResource::loadAStack(int stackId) { if (_vm->_stampFlags & 1) { - unloadAStack(_controlIndex); - if (!_useCount[idx]) { - BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[idx]); + unloadAStack(_stackId); + if (!_useCount[stackId]) { + BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[stackId]); if (!boltEntry._data) return false; - _vm->_controlPtr->_entries[idx] = boltEntry._data; + _vm->_controlPtr->_entries[stackId] = boltEntry._data; } - ++_useCount[idx]; + ++_useCount[stackId]; } - _ctlPtr = _vm->_controlPtr->_entries[idx]; - _controlIndex = idx; + _ctlPtr = _vm->_controlPtr->_entries[stackId]; + _stackId = stackId; return true; } -void ThreadResource::unloadAStack(int idx) { - if ((_vm->_stampFlags & 1) && _useCount[idx]) { - if (--_useCount[idx] == 0) { - _vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[idx]); +void ThreadResource::unloadAStack(int stackId) { + if ((_vm->_stampFlags & 1) && _useCount[stackId]) { + if (--_useCount[stackId] == 0) { + _vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[stackId]); } } } @@ -111,12 +111,12 @@ bool ThreadResource::getStateInfo() { _field9 = 0; int id = READ_LE_UINT16(_ctlPtr); - if (id <= _threadId) { + if (id <= _stateId) { _field9 |= 0x80; return false; } else { uint32 fld = READ_LE_UINT32(_ctlPtr + 2); - fld += _threadId << 3; + fld += _stateId << 3; _field46 = READ_LE_UINT32(_ctlPtr + fld + 4); fld = READ_LE_UINT32(_ctlPtr + fld); @@ -930,7 +930,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { case 45: _newSceneId = _field46; - _newStackId = _controlIndex; + _newStackId = _stackId; break; case 46: @@ -1543,34 +1543,34 @@ bool ThreadResource::checkMansionScroll() { return result; } -bool ThreadResource::goToStateID(int stackId, int sceneId) { - debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, sceneId); +bool ThreadResource::goToStateID(int stackId, int id) { + debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, id); // Save current stack savePrevious(); - if (_controlIndex == stackId || stackId == -1 || loadAStack(stackId)) { + if (_stackId == stackId || stackId == -1 || loadAStack(stackId)) { // Now in the correct state - _threadId = getStateFromID(sceneId); + _stateId = getStateFromID(id); - if (_threadId != -1) { + if (_stateId != -1) { return doState(); } else { - _threadId = _field4; - _controlIndex = _field6; + _stateId = _savedStateId; + _stackId = _savedStackId; } } return false; } -bool ThreadResource::goToState(int stackId, int sceneId) { - debugC(DEBUG_BASIC, kDebugScripts, "goToState - %d, %d", stackId, sceneId); +bool ThreadResource::goToState(int stackId, int stateId) { + debugC(DEBUG_BASIC, kDebugScripts, "goToState - %d, %d", stackId, stateId); savePrevious(); if (stackId == -1 || loadAStack(stackId)) { - if (sceneId != -1) - _threadId = sceneId; + if (stateId != -1) + _stateId = stateId; return doState(); } else { @@ -1579,12 +1579,12 @@ bool ThreadResource::goToState(int stackId, int sceneId) { } void ThreadResource::savePrevious() { - if (_field4 == _threadId && _controlIndex == _field6) { + if (_savedStateId == _stateId && _stackId == _savedStackId) { _flags &= ~1; } else { _flags |= 1; - _field4 = _threadId; - _field6 = _controlIndex; + _savedStateId = _stateId; + _savedStackId = _stackId; } } @@ -1749,12 +1749,12 @@ void ThreadResource::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_aptPos.x); s.syncAsSint16LE(_aptPos.y); - int sceneId = _threadId; - int stackId = _controlIndex; + int sceneId = _stateId; + int stackId = _stackId; s.syncAsSint16LE(sceneId); s.syncAsSint16LE(stackId); - if (s.isLoading() && (sceneId != _threadId || stackId != _controlIndex)) + if (s.isLoading() && (sceneId != _stateId || stackId != _stackId)) goToState(stackId, sceneId); } -- cgit v1.2.3 From 8af390ab9f6db6bf623b609fd424832f1acd6826 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 18:55:18 -0500 Subject: VOYEUR: Further renaming of state Id, and merging of flag bytes --- engines/voyeur/files_threads.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index deb2e5bd89..41fc17a54a 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -53,7 +53,7 @@ void ThreadResource::initThreadStruct(int idx, int id) { if (loadAStack(idx)) { _savedStateId = _savedStackId = -1; _stateId = id; - _newSceneId = -1; + _newStateId = -1; _newStackId = -1; doState(); @@ -108,11 +108,11 @@ bool ThreadResource::doState() { } bool ThreadResource::getStateInfo() { - _field9 = 0; + _flags &= 0xff; int id = READ_LE_UINT16(_ctlPtr); if (id <= _stateId) { - _field9 |= 0x80; + _flags |= 0x8000; return false; } else { uint32 fld = READ_LE_UINT32(_ctlPtr + 2); @@ -929,14 +929,14 @@ const byte *ThreadResource::cardPerform(const byte *card) { card += 2; case 45: - _newSceneId = _field46; + _newStateId = _field46; _newStackId = _stackId; break; case 46: - _vm->_glGoScene = _newSceneId; + _vm->_glGoScene = _newStateId; _vm->_glGoStack = _newStackId; - _newSceneId = -1; + _newStateId = -1; _newStackId = -1; break; -- cgit v1.2.3 From f450b7947623c933040eb6b541387bc652f6c5de Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 21:38:08 -0500 Subject: VOYEUR: Converted doRoom to use ScummVM cursors --- engines/voyeur/files_threads.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 41fc17a54a..f18d84ec88 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1146,8 +1146,9 @@ void ThreadResource::doRoom() { Common::Array &hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries; int hotspotId = -1; - PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource; - PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource; + PictureResource *crosshairsCursor = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource; + PictureResource *magnifierCursor = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource; + vm._eventsManager.showCursor(); RectResource viewBounds(48, 38, 336, 202); voy._viewBounds = &viewBounds; @@ -1178,6 +1179,8 @@ void ThreadResource::doRoom() { vm._eventsManager.getMouseInfo(); Common::Point pt = vm._eventsManager.getMousePos(); + pt += Common::Point(30, 15); + hotspotId = -1; if (voy._computerTextId != -1 && voy._rect4E4.contains(pt)) hotspotId = 999; @@ -1193,19 +1196,15 @@ void ThreadResource::doRoom() { } if (hotspotId == -1) { - vm._graphicsManager.sDrawPic(pic1, *vm._graphicsManager._vPort, - Common::Point(pt.x - 9, pt.y - 9)); vm._eventsManager.setCursorColor(128, 0); + vm._eventsManager.setCursor(crosshairsCursor); } else if (hotspotId != 999 || voy._RTVNum < voy._field4EC || (voy._field4EE - 2) < voy._RTVNum) { - vm._graphicsManager.sDrawPic(pic2, *vm._graphicsManager._vPort, - Common::Point(pt.x - 12, pt.y - 9)); vm._eventsManager.setCursorColor(128, 1); + vm._eventsManager.setCursor(magnifierCursor); } else { - vm._graphicsManager.sDrawPic(pic2, - *vm._graphicsManager._vPort, - Common::Point(pt.x - 12, pt.y - 9)); vm._eventsManager.setCursorColor(128, 2); + vm._eventsManager.setCursor(magnifierCursor); } vm._eventsManager._intPtr.field38 = true; @@ -1223,6 +1222,7 @@ void ThreadResource::doRoom() { vm._eventsManager.setMousePos(pt); } else { voy._field478 |= 16; + vm._eventsManager.hideCursor(); vm._eventsManager.startCursorBlink(); if (hotspotId == 999) { @@ -1254,14 +1254,9 @@ void ThreadResource::doRoom() { if (!vm._eventsManager._mouseClicked) vm._eventsManager.delayClick(18000); - // WORKAROUND: Done in original, but not now, since freeing and reloading - // the group would invalidate the _backgroundPage picture resource - //vm._bVoy->freeBoltGroup(vm._playStampGroupId); - //vm._bVoy->getBoltGroup(vm._playStampGroupId); + // WORKAROUND: Skipped code from the original, that freed the group, + // reloaded it, and reloaded the cursors - hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries; - pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource; - pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource; vm._graphicsManager._backColors = vm._bVoy->boltEntry( vm._playStampGroupId + 1)._cMapResource; vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry( @@ -1294,6 +1289,7 @@ void ThreadResource::doRoom() { vm._graphicsManager.fadeUpICF1(0); voy._field478 &= 0x10; + vm._eventsManager.showCursor(); } } @@ -1318,6 +1314,7 @@ void ThreadResource::doRoom() { vm._currentVocId = -1; } + vm._eventsManager.hideCursor(); chooseSTAMPButton(0); } @@ -1749,13 +1746,16 @@ void ThreadResource::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_aptPos.x); s.syncAsSint16LE(_aptPos.y); - int sceneId = _stateId; + int stateId = _stateId; int stackId = _stackId; - s.syncAsSint16LE(sceneId); + s.syncAsSint16LE(stateId); s.syncAsSint16LE(stackId); - if (s.isLoading() && (sceneId != _stateId || stackId != _stackId)) - goToState(stackId, sceneId); + if (s.isLoading() && (stateId != _stateId || stackId != _stackId)) + goToState(stackId, stateId); + + s.syncAsSint16LE(_savedStateId); + s.syncAsSint16LE(_savedStackId); } } // End of namespace Voyeur -- cgit v1.2.3 From 54c479c3d9e7cf47e00d2b2d2c6bd16989eeb510 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 22:22:34 -0500 Subject: VOYEUR: Bugfixes for computer event display --- engines/voyeur/files_threads.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index f18d84ec88..7955cfdbb6 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -629,8 +629,8 @@ void ThreadResource::parsePlayCommands() { if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { _vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2); - _vm->_voy._field4EC = READ_LE_UINT16(dataP + 4); - _vm->_voy._field4EE = READ_LE_UINT16(dataP + 6); + _vm->_voy._computerTimeMin = READ_LE_UINT16(dataP + 4); + _vm->_voy._computerTimeMax = READ_LE_UINT16(dataP + 6); _vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4]; _vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 1]; @@ -1198,8 +1198,8 @@ void ThreadResource::doRoom() { if (hotspotId == -1) { vm._eventsManager.setCursorColor(128, 0); vm._eventsManager.setCursor(crosshairsCursor); - } else if (hotspotId != 999 || voy._RTVNum < voy._field4EC || - (voy._field4EE - 2) < voy._RTVNum) { + } else if (hotspotId != 999 || voy._RTVNum < voy._computerTimeMin || + (voy._computerTimeMax - 2) < voy._RTVNum) { vm._eventsManager.setCursorColor(128, 1); vm._eventsManager.setCursor(magnifierCursor); } else { @@ -1241,9 +1241,9 @@ void ThreadResource::doRoom() { vm._eventsManager._mouseClicked = false; vm._eventsManager.startCursorBlink(); - int v = vm.doComputerText(9999); - if (v) - vm._voy.addComputerEventEnd(v); + int totalChars = vm.doComputerText(9999); + if (totalChars) + vm._voy.addComputerEventEnd(totalChars); vm._bVoy->freeBoltGroup(0x4900); } else { @@ -1262,6 +1262,7 @@ void ThreadResource::doRoom() { vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry( vm._playStampGroupId)._picResource; + (*vm._graphicsManager._vPort)->setupViewPort(); vm._graphicsManager._backColors->startFade(); _vm->flipPageAndWait(); -- cgit v1.2.3 From 647a2ded958a295f0ca3fc74e6e0cdc452efe83e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 23:33:30 -0500 Subject: VOYEUR: Set up enum for event flags, and improved blinking record indicator --- engines/voyeur/files_threads.cpp | 56 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 7955cfdbb6..5ea450e30f 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -341,7 +341,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field46A = 0; _vm->_voy._field47A = -1; _vm->_voy._computerTextId = -1; - _vm->_voy._field478 &= ~8; + _vm->_voy._eventFlags &= ~EVTFLAG_8; _vm->_eventsManager._videoDead = -1; // Reset hotspot data @@ -410,12 +410,12 @@ void ThreadResource::parsePlayCommands() { } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; _vm->_voy.addVideoEventStart(); - _vm->_voy._field478 &= ~1; - _vm->_voy._field478 |= 0x10; + _vm->_voy._eventFlags &= ~EVTFLAG_1; + _vm->_voy._eventFlags |= EVTFLAG_RECORDING; _vm->playAVideo(_vm->_audioVideoId); - _vm->_voy._field478 &= ~0x10; - _vm->_voy._field478 |= 1; + _vm->_voy._eventFlags &= ~EVTFLAG_RECORDING; + _vm->_voy._eventFlags |= EVTFLAG_1; _vm->_voy.addVideoEventEnd(); _vm->_eventsManager.incrementTime(1); @@ -454,9 +454,9 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._vocSecondsOffset = 0; _vm->_voy._field468 = _vm->_voy._RTVNum; - _vm->_voy._field478 &= ~0x11; + _vm->_voy._eventFlags &= ~(EVTFLAG_1 | EVTFLAG_RECORDING); _vm->playAVideo(_vm->_audioVideoId); - _vm->_voy._field478 |= 1; + _vm->_voy._eventFlags |= EVTFLAG_1; if (id != 22) { _vm->_audioVideoId = -1; @@ -515,7 +515,7 @@ void ThreadResource::parsePlayCommands() { if (_vm->_voy._transitionId != count) { if (_vm->_voy._transitionId > 1) - _vm->_voy._field478 &= ~0x100; + _vm->_voy._eventFlags &= ~EVTFLAG_100; _vm->_voy._transitionId = count; _vm->_gameMinute = LEVEL_M[count - 1]; @@ -610,7 +610,7 @@ void ThreadResource::parsePlayCommands() { break; case 11: - _vm->_voy._field478 |= 2; + _vm->_voy._eventFlags |= EVTFLAG_2; break; case 12: @@ -1034,7 +1034,7 @@ int ThreadResource::doApt() { _vm->_graphicsManager.setColor(131, 215, 215, 215); _vm->_graphicsManager.setColor(132, 235, 235, 235); - _vm->_eventsManager._intPtr.field38 = true; + _vm->_eventsManager._intPtr._palChanged = true; _vm->_eventsManager._intPtr._hasPalette = true; // Main loop to allow users to move the cursor and select hotspots @@ -1070,7 +1070,7 @@ int ThreadResource::doApt() { if (hotspotId != prevHotspotId) { // Check for whether to replace hotspot Id for "Watch TV" for // "Review the Tape" if player has already watched the TV - if ((_vm->_voy._field478 & 0x100) && (hotspotId == 2)) + if ((_vm->_voy._eventFlags & 0x100) && (hotspotId == 2)) hotspotId = 5; // Draw the text description for the highlighted hotspot @@ -1161,13 +1161,13 @@ void ThreadResource::doRoom() { voy._vocSecondsOffset = 0; vm._soundManager.startVOCPlay(vm._currentVocId); - voy._field478 &= ~1; + voy._eventFlags &= ~EVTFLAG_1; bool breakFlag = false; while (!vm.shouldQuit() && !breakFlag) { _vm->_voyeurArea = AREA_ROOM; vm._graphicsManager.setColor(128, 0, 255, 0); - vm._eventsManager._intPtr.field38 = true; + vm._eventsManager._intPtr._palChanged = true; vm._eventsManager._intPtr._hasPalette = true; do { @@ -1207,7 +1207,7 @@ void ThreadResource::doRoom() { vm._eventsManager.setCursor(magnifierCursor); } - vm._eventsManager._intPtr.field38 = true; + vm._eventsManager._intPtr._palChanged = true; vm._eventsManager._intPtr._hasPalette = true; vm._graphicsManager.flipPage(); vm._eventsManager.sWaitFlip(); @@ -1221,7 +1221,7 @@ void ThreadResource::doRoom() { vm._eventsManager.getMouseInfo(); vm._eventsManager.setMousePos(pt); } else { - voy._field478 |= 16; + voy._eventFlags |= EVTFLAG_RECORDING; vm._eventsManager.hideCursor(); vm._eventsManager.startCursorBlink(); @@ -1250,7 +1250,7 @@ void ThreadResource::doRoom() { vm.doEvidDisplay(hotspotId, 999); } - voy._field478 &= ~0x10; + voy._eventFlags &= ~EVTFLAG_RECORDING; if (!vm._eventsManager._mouseClicked) vm._eventsManager.delayClick(18000); @@ -1289,12 +1289,12 @@ void ThreadResource::doRoom() { _vm->flipPageAndWait(); vm._graphicsManager.fadeUpICF1(0); - voy._field478 &= 0x10; + voy._eventFlags &= EVTFLAG_RECORDING; vm._eventsManager.showCursor(); } } - voy._field478 = 1; + voy._eventFlags = EVTFLAG_1; vm._eventsManager.incrementTime(1); voy._viewBounds = nullptr; voy._field437E = 0; @@ -1323,13 +1323,13 @@ int ThreadResource::doInterface() { PictureResource *pic; Common::Point pt; - _vm->_voy._field478 |= 1; + _vm->_voy._eventFlags |= EVTFLAG_1; if (_vm->_voy._field46E) { _vm->_voy._field46E = false; return -2; } - _vm->_voy._field478 &= ~0x100; + _vm->_voy._eventFlags &= ~EVTFLAG_100; _vm->_playStampGroupId = -1; _vm->_eventsManager._intPtr.field1E = 1; _vm->_eventsManager._intPtr.field1A = 0; @@ -1344,14 +1344,14 @@ int ThreadResource::doInterface() { _vm->initIFace(); _vm->_voy._RTVNum = _vm->_voy._RTVLimit - 4; - _vm->_voy._field478 &= ~1; + _vm->_voy._eventFlags &= ~EVTFLAG_1; while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._RTVLimit) { _vm->flashTimeBar(); _vm->_eventsManager.delayClick(1); } - _vm->_voy._field478 = 1; + _vm->_voy._eventFlags |= EVTFLAG_1; chooseSTAMPButton(20); parsePlayCommands(); } @@ -1371,9 +1371,9 @@ int ThreadResource::doInterface() { _vm->_eventsManager.getMouseInfo(); _vm->_graphicsManager.setColor(240, 220, 220, 220); - _vm->_eventsManager._intPtr.field38 = true; + _vm->_eventsManager._intPtr._palChanged = true; _vm->_eventsManager._intPtr._hasPalette = true; - _vm->_voy._field478 &= ~1; + _vm->_voy._eventFlags &= ~EVTFLAG_1; // Set the cusor PictureResource *crosshairsCursor = _vm->_bVoy->boltEntry(0x112)._picResource; @@ -1470,7 +1470,7 @@ int ThreadResource::doInterface() { _vm->flipPageAndWait(); pt = _vm->_eventsManager.getMousePos(); - if ((_vm->_voy._RTVNum >= _vm->_voy._RTVLimit) || ((_vm->_voy._field478 & 0x80) && + if ((_vm->_voy._RTVNum >= _vm->_voy._RTVLimit) || ((_vm->_voy._eventFlags & 0x80) && _vm->_eventsManager._rightClick && (pt.x == 0))) { // Time to transition to the next time period _vm->_eventsManager.getMouseInfo(); @@ -1482,7 +1482,7 @@ int ThreadResource::doInterface() { _vm->checkTransition(); _vm->_eventsManager._leftClick = true; } else { - _vm->_voy._field478 = 1; + _vm->_voy._eventFlags |= EVTFLAG_1; chooseSTAMPButton(20); parsePlayCommands(); @@ -1494,7 +1494,7 @@ int ThreadResource::doInterface() { hotspots = &_vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); - _vm->_voy._field478 &= ~2; + _vm->_voy._eventFlags &= ~2; _vm->_eventsManager._intPtr.field1E = 1; _vm->_eventsManager._intPtr.field1A = 0; } @@ -1503,7 +1503,7 @@ int ThreadResource::doInterface() { (!_vm->_eventsManager._leftClick || regionIndex == -1)); _vm->_eventsManager.hideCursor(); - _vm->_voy._field478 |= 1; + _vm->_voy._eventFlags |= EVTFLAG_1; _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); if (_vm->_currentVocId != -1) _vm->_soundManager.stopVOCPlay(); -- cgit v1.2.3 From d545b5cb75b31fc72ea14e508c04a60499c4cc4d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Feb 2014 14:41:18 -0500 Subject: VOYEUR: Fix incorrect loop terminator in room data load loop --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 5ea450e30f..409031d6e0 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -181,7 +181,7 @@ void ThreadResource::getButtonsFlags() { void ThreadResource::getField1CE() { int idx = 0; - for (const byte *p = _threadInfoPtr; *p++ != 0x49; p = getNextRecord(p)) { + for (const byte *p = _threadInfoPtr; *p++ != 0x4A; p = getNextRecord(p)) { assert(idx < 47); _field1CE[idx++] = getRecordOffset(p); _field1CE[idx] = NULL; -- cgit v1.2.3 From 63a06bc3f74f4951d7a0c12601a54367f15af36f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Feb 2014 17:33:42 -0500 Subject: VOYEUR: Refactored code for showing ending news into separate method --- engines/voyeur/files_threads.cpp | 48 +--------------------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') 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: -- cgit v1.2.3 From 2b69c5d07cb72b97690517cdf1f9d3d40f172029 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Feb 2014 18:42:45 -0500 Subject: VOYEUR: Fix issue with time not progressing, and renamed associated enum member --- engines/voyeur/files_threads.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 36b3376c32..6c39a97689 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -410,12 +410,12 @@ void ThreadResource::parsePlayCommands() { } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; _vm->_voy.addVideoEventStart(); - _vm->_voy._eventFlags &= ~EVTFLAG_1; + _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; _vm->_voy._eventFlags |= EVTFLAG_RECORDING; _vm->playAVideo(_vm->_audioVideoId); _vm->_voy._eventFlags &= ~EVTFLAG_RECORDING; - _vm->_voy._eventFlags |= EVTFLAG_1; + _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; _vm->_voy.addVideoEventEnd(); _vm->_eventsManager.incrementTime(1); @@ -454,9 +454,9 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._vocSecondsOffset = 0; _vm->_voy._field468 = _vm->_voy._RTVNum; - _vm->_voy._eventFlags &= ~(EVTFLAG_1 | EVTFLAG_RECORDING); + _vm->_voy._eventFlags &= ~(EVTFLAG_TIME_DISABLED | EVTFLAG_RECORDING); _vm->playAVideo(_vm->_audioVideoId); - _vm->_voy._eventFlags |= EVTFLAG_1; + _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; if (id != 22) { _vm->_audioVideoId = -1; @@ -1115,7 +1115,7 @@ void ThreadResource::doRoom() { voy._vocSecondsOffset = 0; vm._soundManager.startVOCPlay(vm._currentVocId); - voy._eventFlags &= ~EVTFLAG_1; + voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; bool breakFlag = false; while (!vm.shouldQuit() && !breakFlag) { @@ -1248,7 +1248,7 @@ void ThreadResource::doRoom() { } } - voy._eventFlags = EVTFLAG_1; + voy._eventFlags = EVTFLAG_TIME_DISABLED; vm._eventsManager.incrementTime(1); voy._viewBounds = nullptr; voy._field437E = 0; @@ -1277,7 +1277,7 @@ int ThreadResource::doInterface() { PictureResource *pic; Common::Point pt; - _vm->_voy._eventFlags |= EVTFLAG_1; + _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; if (_vm->_voy._field46E) { _vm->_voy._field46E = false; return -2; @@ -1298,14 +1298,14 @@ int ThreadResource::doInterface() { _vm->initIFace(); _vm->_voy._RTVNum = _vm->_voy._RTVLimit - 4; - _vm->_voy._eventFlags &= ~EVTFLAG_1; + _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._RTVLimit) { _vm->flashTimeBar(); _vm->_eventsManager.delayClick(1); } - _vm->_voy._eventFlags |= EVTFLAG_1; + _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; chooseSTAMPButton(20); parsePlayCommands(); } @@ -1327,7 +1327,7 @@ int ThreadResource::doInterface() { _vm->_graphicsManager.setColor(240, 220, 220, 220); _vm->_eventsManager._intPtr._palChanged = true; _vm->_eventsManager._intPtr._hasPalette = true; - _vm->_voy._eventFlags &= ~EVTFLAG_1; + _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; // Set the cusor PictureResource *crosshairsCursor = _vm->_bVoy->boltEntry(0x112)._picResource; @@ -1436,7 +1436,7 @@ int ThreadResource::doInterface() { _vm->checkTransition(); _vm->_eventsManager._leftClick = true; } else { - _vm->_voy._eventFlags |= EVTFLAG_1; + _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; chooseSTAMPButton(20); parsePlayCommands(); @@ -1448,7 +1448,7 @@ int ThreadResource::doInterface() { hotspots = &_vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); - _vm->_voy._eventFlags &= ~2; + _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; _vm->_eventsManager._intPtr.field1E = 1; _vm->_eventsManager._intPtr.field1A = 0; } @@ -1457,7 +1457,7 @@ int ThreadResource::doInterface() { (!_vm->_eventsManager._leftClick || regionIndex == -1)); _vm->_eventsManager.hideCursor(); - _vm->_voy._eventFlags |= EVTFLAG_1; + _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); if (_vm->_currentVocId != -1) _vm->_soundManager.stopVOCPlay(); -- cgit v1.2.3 From 569fa63a3a00cdba1d2e3c87941f300e4bfb1a4d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Feb 2014 19:01:01 -0500 Subject: VOYEUR: Fix for not highlighting camera on Monday morning after loading savegame --- engines/voyeur/files_threads.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 6c39a97689..e99a19f94f 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1016,15 +1016,20 @@ int ThreadResource::doApt() { hotspotId = -1; pt = _vm->_eventsManager.getMousePos(); for (int idx = 0; idx < (int)hotspots.size(); ++idx) { - if (pt.x > hotspots[idx].left && pt.x < hotspots[idx].right && - pt.y > hotspots[idx].top && pt.y < hotspots[idx].bottom) { + if (hotspots[idx].contains(pt)) { // Cursor is within hotspot area + + // Don't allow the camera to be highlighted on Monday morning. + if (idx == 0 && _vm->_voy._transitionId == 17) + continue; + + // Set the highlighted hotspot Id hotspotId = idx; if (hotspotId != prevHotspotId) { // Check for whether to replace hotspot Id for "Watch TV" for // "Review the Tape" if player has already watched the TV - if ((_vm->_voy._eventFlags & 0x100) && (hotspotId == 2)) + if ((_vm->_voy._eventFlags & EVTFLAG_100) && (hotspotId == 2)) hotspotId = 5; // Draw the text description for the highlighted hotspot -- cgit v1.2.3 From 4ef57db61a7730d0ff1fc19658cb8726ee35b9ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Feb 2014 22:38:27 -0500 Subject: VOYEUR: General field renaming and comments --- engines/voyeur/files_threads.cpp | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index e99a19f94f..1d66483ffe 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -94,9 +94,9 @@ bool ThreadResource::doState() { return false; getButtonsFlags(); - getField1CE(); + getButtonsUnused(); - _vm->_glGoScene = -1; + _vm->_glGoState = -1; _vm->_glGoStack = -1; performOpenCard(); @@ -168,7 +168,7 @@ void ThreadResource::getButtonsFlags() { _stateFlags |= 2; _buttonFlags[idx] = *p++; - _field18E[idx] = *p++; + _buttonIds[idx] = *p++; if (_buttonFlags[idx] & 0x80) p += 4; @@ -178,13 +178,13 @@ void ThreadResource::getButtonsFlags() { } } -void ThreadResource::getField1CE() { +void ThreadResource::getButtonsUnused() { int idx = 0; for (const byte *p = _threadInfoPtr; *p++ != 0x4A; p = getNextRecord(p)) { assert(idx < 47); - _field1CE[idx++] = getRecordOffset(p); - _field1CE[idx] = NULL; + _buttonUnused[idx++] = getRecordOffset(p); + _buttonUnused[idx] = nullptr; p += 4; } } @@ -300,11 +300,11 @@ void ThreadResource::doSTAMPCardAction() { } void ThreadResource::cardAction(const byte *card) { - _vm->_glGoScene = -1; + _vm->_glGoState = -1; _vm->_glGoStack = -1; // Loop to perform card commands - while (!_vm->shouldQuit() && *card < 70 && _vm->_glGoScene == -1) { + while (!_vm->shouldQuit() && *card < 70 && _vm->_glGoState == -1) { card = cardPerform(card); } } @@ -313,19 +313,19 @@ bool ThreadResource::chooseSTAMPButton(int buttonId) { _flags &= ~1; for (int idx = 0; idx < _stateCount; ++idx) { - if (_field18E[idx] == buttonId) { + if (_buttonIds[idx] == buttonId) { const byte *card = getSTAMPCard(idx); cardAction(card); bool flag = true; while (!_vm->shouldQuit() && _vm->_glGoStack != -1 && flag) { doSTAMPCardAction(); - flag = goToStateID(_vm->_glGoStack, _vm->_glGoScene); + flag = goToStateID(_vm->_glGoStack, _vm->_glGoState); } - while (!_vm->shouldQuit() && _vm->_glGoScene != -1 && flag) { + while (!_vm->shouldQuit() && _vm->_glGoState != -1 && flag) { doSTAMPCardAction(); - flag = goToState(-1, _vm->_glGoScene); + flag = goToState(-1, _vm->_glGoState); } return flag; @@ -339,7 +339,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field470 = -1; _vm->_voy._field468 = 0; _vm->_voy._field46A = 0; - _vm->_voy._field47A = -1; + _vm->_voy._boltGroupId2 = -1; _vm->_voy._computerTextId = -1; _vm->_voy._eventFlags &= ~EVTFLAG_8; _vm->_eventsManager._videoDead = -1; @@ -507,6 +507,7 @@ void ThreadResource::parsePlayCommands() { break; case 5: + // Load the time information for the new time period v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { _vm->_voy._field470 = 5; @@ -617,7 +618,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { - _vm->_voy._field47A = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)]; + _vm->_voy._boltGroupId2 = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)]; _vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true; } @@ -798,18 +799,18 @@ const byte *ThreadResource::cardPerform(const byte *card) { break; case 17: - _vm->_glGoScene = READ_LE_UINT16(card); + _vm->_glGoState = READ_LE_UINT16(card); card += 2; _vm->_glGoStack = -1; break; case 18: v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)); - _vm->_glGoScene = getStateFromID(v2); + _vm->_glGoState = getStateFromID(v2); break; case 19: - _vm->_glGoScene = READ_LE_UINT32(card); + _vm->_glGoState = READ_LE_UINT32(card); card += 4; _vm->_glGoStack = READ_LE_UINT16(card); card += 2; @@ -888,7 +889,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { break; case 46: - _vm->_glGoScene = _newStateId; + _vm->_glGoState = _newStateId; _vm->_glGoStack = _newStackId; _newStateId = -1; _newStackId = -1; @@ -1259,9 +1260,9 @@ void ThreadResource::doRoom() { voy._field437E = 0; vm.makeViewFinderP(); - if (voy._field47A != -1) { - vm._bVoy->freeBoltGroup(voy._field47A, 1); - voy._field47A = -1; + if (voy._boltGroupId2 != -1) { + vm._bVoy->freeBoltGroup(voy._boltGroupId2, 1); + voy._boltGroupId2 = -1; } if (vm._playStampGroupId != -1) { @@ -1283,8 +1284,8 @@ int ThreadResource::doInterface() { Common::Point pt; _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; - if (_vm->_voy._field46E) { - _vm->_voy._field46E = false; + if (_vm->_voy._abortInterface) { + _vm->_voy._abortInterface = false; return -2; } -- cgit v1.2.3 From fcaf2af6169f0da8aaf8b8b6eabc5d94a401cfd6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 3 Feb 2014 00:25:58 -0500 Subject: VOYEUR: Add a hotspot to the aprtment for the ScummVM GMM The original game doesn't have any savegame support, so this will provide users with a more obvious hint than knowing to explicitly show the GMM when in the apartment. --- engines/voyeur/files_threads.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 1d66483ffe..40f4fe6f04 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -507,9 +507,10 @@ void ThreadResource::parsePlayCommands() { break; case 5: - // Load the time information for the new time period + // 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 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { _vm->_voy._field470 = 5; int count = READ_LE_UINT16(dataP + 2); _vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4); @@ -997,6 +998,8 @@ int ThreadResource::doApt() { int prevHotspotId = -1; Common::Point pt; PictureResource *pic; + Common::Rect gmmHotspot(75, 125, 130, 140); + do { _vm->_voyeurArea = AREA_APARTMENT; @@ -1044,6 +1047,10 @@ int ThreadResource::doApt() { } } + // Check for presence in ScummVM GMM + if (gmmHotspot.contains(pt)) + hotspotId = 42; + // Draw either standard or highlighted eye cursor pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStampGroupId + 2 : _vm->_playStampGroupId + 3)._picResource; @@ -1051,6 +1058,12 @@ int ThreadResource::doApt() { _vm->flipPageAndWait(); + if (hotspotId == 42 && _vm->_eventsManager._leftClick) { + // Show the ScummVM GMM + _vm->_eventsManager.getMouseInfo(); + _vm->openMainMenuDialog(); + } + } while (!_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || hotspotId == -1)); pt = _vm->_eventsManager.getMousePos(); -- cgit v1.2.3 From ae9bca6bdf747e8ec1daa75b043a5a546eec21f7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 3 Feb 2014 20:16:13 -0500 Subject: VOYEUR: Remove a lot of outdated TODO's and clean up of stubbed methods --- engines/voyeur/files_threads.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 40f4fe6f04..e03e272b6e 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -462,7 +462,6 @@ void ThreadResource::parsePlayCommands() { _vm->_audioVideoId = -1; parseIndex = 999; } else { - // TODO: Double-check this int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size(); _vm->_soundManager.stopVOCPlay(); _vm->_eventsManager.getMouseInfo(); -- cgit v1.2.3 From 683ef9d50f49c989c6bb4df15e16bcb7c33e1980 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 3 Feb 2014 21:27:26 -0500 Subject: VOYEUR: Fix for control data comparisons in parsePlayCommands --- engines/voyeur/files_threads.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index e03e272b6e..c77cdd4fe5 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -369,7 +369,7 @@ void ThreadResource::parsePlayCommands() { case 2: v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 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); @@ -399,7 +399,7 @@ void ThreadResource::parsePlayCommands() { case 3: v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 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); @@ -544,7 +544,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; - if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { int idx = 0; while (_vm->_voy._videoHotspotTimes._min[idx][v3] != 9999) ++idx; @@ -562,7 +562,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; - if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { int idx = 0; while (_vm->_voy._audioHotspotTimes._min[idx][v3] != 9999) ++idx; @@ -580,7 +580,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2) - 1; - if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { int idx = 0; while (_vm->_voy._evidenceHotspotTimes._min[idx][v3] != 9999) ++idx; @@ -617,7 +617,7 @@ void ThreadResource::parsePlayCommands() { case 12: v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { _vm->_voy._boltGroupId2 = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)]; _vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true; } @@ -628,7 +628,7 @@ void ThreadResource::parsePlayCommands() { case 13: v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 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); @@ -663,7 +663,7 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); v3 = READ_LE_UINT16(dataP + 2); - if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) + if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) _vm->_voy._field4F2 = v3; dataP += 4; -- cgit v1.2.3 From d3f4156e6a7c4aac33224bbfc8e0f859401b51ed Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 3 Feb 2014 22:02:28 -0500 Subject: VOYEUR: Clean up, commenting, and bugfixes for checking for murder --- engines/voyeur/files_threads.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') 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; -- cgit v1.2.3 From f075f0336ea4f3315334f77d63836455c6a28e51 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 4 Feb 2014 22:23:15 -0500 Subject: VOYEUR: Convert ControlResource::_ptr raw data to a deserialized state object --- engines/voyeur/files_threads.cpp | 126 ++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 62 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index b766733699..57d878f9cd 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 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_v1 == 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 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_v1 == 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 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_v1 == 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 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_v1 == 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 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_v1 == 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 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_v1 == 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; - WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, randomVal); + _vm->_controlPtr->_state->_v1 = randomVal; } else { // 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); + _vm->_controlPtr->_state->_v1 = _vm->_iForceDeath; } _vm->saveLastInplay(); @@ -625,7 +625,7 @@ void ThreadResource::parsePlayCommands() { case 12: v2 = READ_LE_UINT16(dataP); - if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_v1 == 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 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) { + if (v2 == 0 || _vm->_controlPtr->_state->_v1 == 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 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) + if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) _vm->_voy._murderThreshold = v3; dataP += 4; @@ -715,9 +715,6 @@ void ThreadResource::parsePlayCommands() { } const byte *ThreadResource::cardPerform(const byte *card) { - const byte *p2; - byte *pDest; - uint16 id = *card++; int varD = 5; uint32 v2; @@ -730,82 +727,87 @@ const byte *ThreadResource::cardPerform(const byte *card) { case 1: v2 = READ_LE_UINT32(card); card += 4; - WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card << 2), v2); - ++card; + _vm->_controlPtr->_state->_vals[*card++] = v2; break; case 2: - v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)), - WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2); + v2 = _vm->_controlPtr->_state->_vals[*card++]; + _vm->_controlPtr->_state->_vals[*card++] = v2; break; case 3: v2 = READ_LE_UINT32(card); card += 4; - WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2); + _vm->_controlPtr->_state->_vals[*card++] = v2; break; case 4: - v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)); - WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2); + v2 = _vm->_controlPtr->_state->_vals[*card++]; + _vm->_controlPtr->_state->_vals[*card++] = v2; break; - case 5: + case 5: { v2 = READ_LE_UINT32(card); card += 4; - pDest = _vm->_controlPtr->_ptr + (*card++ << 2); - WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2); + int &v = _vm->_controlPtr->_state->_vals[*card++]; + v -= v2; break; + } - case 6: + case 6: { idx1 = *card++; idx2 = *card++; - v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + idx2); - pDest = _vm->_controlPtr->_ptr + idx1; - WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2); + v2 = _vm->_controlPtr->_state->_vals[idx1]; + int &v = _vm->_controlPtr->_state->_vals[idx2]; + v -= v2; break; + } - case 7: + case 7: { v3 = *card++; v2 = READ_LE_UINT32(card); card += 4; - pDest = _vm->_controlPtr->_ptr + (v3 << 2); - WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * v2); + int &v = _vm->_controlPtr->_state->_vals[v3]; + v *= v2; break; + } - case 8: + case 8: { idx1 = *card++; idx2 = *card++; - pDest = _vm->_controlPtr->_ptr + (idx1 << 2); - p2 = _vm->_controlPtr->_ptr + (idx2 << 2); - WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * READ_LE_UINT32(p2)); + int &v1 = _vm->_controlPtr->_state->_vals[idx1]; + int &v2 = _vm->_controlPtr->_state->_vals[idx2]; + v1 *= v2; break; + } - case 9: + case 9: { idx1 = *card++; v2 = READ_LE_UINT32(card); card += 4; - pDest = _vm->_controlPtr->_ptr + (idx1 << 2); - WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / v2); + int &v = _vm->_controlPtr->_state->_vals[idx1]; + v /= v2; break; + } - case 10: + case 10: { idx1 = *card++; idx2 = *card++; - pDest = _vm->_controlPtr->_ptr + (idx1 << 2); - p2 = _vm->_controlPtr->_ptr + (idx2 << 2); - WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / READ_LE_UINT32(p2)); + int &v1 = _vm->_controlPtr->_state->_vals[idx1]; + int &v2 = _vm->_controlPtr->_state->_vals[idx2]; + v1 /= v2; break; - + } + case 11: v2 = READ_LE_UINT32(card); card += 4; v2 = _vm->getRandomNumber(v2 - 1) + 1; - WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2); + _vm->_controlPtr->_state->_vals[*card++] = v2; break; case 17: @@ -815,7 +817,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { break; case 18: - v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)); + v2 = _vm->_controlPtr->_state->_vals[*card++]; _vm->_glGoState = getStateFromID(v2); break; @@ -921,45 +923,45 @@ const byte *ThreadResource::cardPerform(const byte *card) { } bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) { - uint32 vLong, vLong2; + int vLong, vLong2; switch (cardCmdId) { case 21: - vLong = READ_LE_UINT32(pSrc + 1); - return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) == vLong; + vLong = (int32)READ_LE_UINT32(pSrc + 1); + return _vm->_controlPtr->_state->_vals[*pSrc] == vLong; case 22: - vLong = READ_LE_UINT32(pSrc + 1); - return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) != vLong; + vLong = (int32)READ_LE_UINT32(pSrc + 1); + return _vm->_controlPtr->_state->_vals[*pSrc] != vLong; case 23: - vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); - vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2)); + vLong = _vm->_controlPtr->_state->_vals[*pSrc]; + vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)]; return vLong == vLong2; case 24: - vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); - vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2)); + vLong = _vm->_controlPtr->_state->_vals[*pSrc]; + vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)]; return vLong != vLong2; case 25: - vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); - vLong2 = READ_LE_UINT32(pSrc + 1); + vLong = _vm->_controlPtr->_state->_vals[*pSrc]; + vLong2 = (int32)READ_LE_UINT32(pSrc + 1); return vLong < vLong2; case 26: - vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); - vLong2 = READ_LE_UINT32(pSrc + 1); + vLong = _vm->_controlPtr->_state->_vals[*pSrc]; + vLong2 = (int32)READ_LE_UINT32(pSrc + 1); return vLong > vLong2; case 27: - vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); - vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2)); + vLong = _vm->_controlPtr->_state->_vals[*pSrc]; + vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)]; return vLong < vLong2; case 28: - vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); - vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2)); + vLong = _vm->_controlPtr->_state->_vals[*pSrc]; + vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)]; return vLong > vLong2; default: -- cgit v1.2.3 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/files_threads.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') 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; -- cgit v1.2.3 From 9d86715e30a91b405b5df2e2a3646d1f930d4e34 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 7 Feb 2014 20:40:04 -0500 Subject: VOYEUR: Renaming SVoy fields --- engines/voyeur/files_threads.cpp | 50 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index ba85ec2e80..7635a9dea2 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -336,9 +336,9 @@ bool ThreadResource::chooseSTAMPButton(int buttonId) { } void ThreadResource::parsePlayCommands() { - _vm->_voy._field470 = -1; - _vm->_voy._field468 = 0; - _vm->_voy._field46A = 0; + _vm->_voy._playStampMode = -1; + _vm->_voy._audioVisualStartTime = 0; + _vm->_voy._audioVisualDuration = 0; _vm->_voy._boltGroupId2 = -1; _vm->_voy._computerTextId = -1; _vm->_voy._eventFlags &= ~EVTFLAG_8; @@ -372,14 +372,14 @@ void ThreadResource::parsePlayCommands() { 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); + _vm->_voy._audioVisualStartTime = READ_LE_UINT16(dataP + 4); + _vm->_voy._audioVisualDuration = READ_LE_UINT16(dataP + 6); - if (_vm->_voy._RTVNum < _vm->_voy._field468 || - (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { + if (_vm->_voy._RTVNum < _vm->_voy._audioVisualStartTime || + (_vm->_voy._audioVisualStartTime + _vm->_voy._audioVisualDuration) < _vm->_voy._RTVNum) { _vm->_audioVideoId = -1; } else { - _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; + _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._audioVisualStartTime; _vm->_voy.addAudioEventStart(); // Play the audio @@ -403,14 +403,14 @@ void ThreadResource::parsePlayCommands() { 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); + _vm->_voy._audioVisualStartTime = READ_LE_UINT16(dataP + 4); + _vm->_voy._audioVisualDuration = READ_LE_UINT16(dataP + 6); - if (_vm->_voy._RTVNum < _vm->_voy._field468 || - (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) { + if (_vm->_voy._RTVNum < _vm->_voy._audioVisualStartTime || + (_vm->_voy._audioVisualStartTime + _vm->_voy._audioVisualDuration) < _vm->_voy._RTVNum) { _vm->_audioVideoId = -1; } else { - _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; + _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._audioVisualStartTime; _vm->_voy.addVideoEventStart(); _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; _vm->_voy._eventFlags |= EVTFLAG_RECORDING; @@ -432,10 +432,10 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager._videoDead = -1; if (_stateCount == 2 && _vm->_eventsManager._mouseClicked == 0) { - _vm->_voy._field470 = 132; + _vm->_voy._playStampMode = 132; parseIndex = 999; } else { - _vm->_voy._field470 = 129; + _vm->_voy._playStampMode = 129; } } } @@ -456,7 +456,7 @@ void ThreadResource::parsePlayCommands() { } _vm->_voy._vocSecondsOffset = 0; - _vm->_voy._field468 = _vm->_voy._RTVNum; + _vm->_voy._audioVisualStartTime = _vm->_voy._RTVNum; _vm->_voy._eventFlags &= ~(EVTFLAG_TIME_DISABLED | EVTFLAG_RECORDING); _vm->playAVideo(_vm->_audioVideoId); _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; @@ -513,7 +513,7 @@ void ThreadResource::parsePlayCommands() { // if so, load the time information for the new time period v2 = READ_LE_UINT16(dataP); if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { - _vm->_voy._field470 = 5; + _vm->_voy._playStampMode = 5; int count = READ_LE_UINT16(dataP + 2); _vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4); @@ -536,7 +536,7 @@ void ThreadResource::parsePlayCommands() { break; case 6: - _vm->_voy._field470 = 6; + _vm->_voy._playStampMode = 6; v2 = READ_LE_UINT16(dataP); _vm->_playStampGroupId = _vm->_resolvePtr[v2]; dataP += 2; @@ -652,7 +652,7 @@ void ThreadResource::parsePlayCommands() { case 14: _vm->_playStampGroupId = 2048; - _vm->_voy._field470 = 130; + _vm->_voy._playStampMode = 130; break; case 15: @@ -660,11 +660,11 @@ void ThreadResource::parsePlayCommands() { break; case 16: - _vm->_voy._field470 = 16; + _vm->_voy._playStampMode = 16; break; case 17: - _vm->_voy._field470 = 17; + _vm->_voy._playStampMode = 17; break; case 18: @@ -985,7 +985,7 @@ int ThreadResource::doApt() { _vm->_currentVocId = 153; } - if (_vm->_voy._field470 == 16) { + if (_vm->_voy._playStampMode == 16) { hotspots[0].left = 999; hotspots[3].left = 999; _aptPos.x = hotspots[4].left + 28; @@ -1141,7 +1141,7 @@ void ThreadResource::doRoom() { vm._eventsManager.setMousePos(Common::Point(192, 120)); voy._field437E = 0; vm._currentVocId = 146; - voy._field4AC = voy._RTVNum; + voy._musicStartTime = voy._RTVNum; voy._vocSecondsOffset = 0; vm._soundManager.startVOCPlay(vm._currentVocId); @@ -1156,7 +1156,7 @@ void ThreadResource::doRoom() { do { if (vm._currentVocId != -1 && !vm._soundManager.getVOCStatus()) { - voy._field4AC = voy._RTVNum; + voy._musicStartTime = voy._RTVNum; voy._vocSecondsOffset = 0; vm._soundManager.startVOCPlay(vm._currentVocId); } @@ -1213,7 +1213,7 @@ void ThreadResource::doRoom() { _vm->flipPageAndWait(); if (vm._currentVocId != -1) { - voy._vocSecondsOffset = voy._RTVNum - voy._field4AC; + voy._vocSecondsOffset = voy._RTVNum - voy._musicStartTime; vm._soundManager.stopVOCPlay(); } -- cgit v1.2.3 From 9608a521625122e1499d5fae60d3c7ecd0456f90 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 10 Feb 2014 07:56:35 +0100 Subject: VOYEUR: Reduce the scope of a couple of variables --- engines/voyeur/files_threads.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 7635a9dea2..ab639021a4 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -718,7 +718,6 @@ const byte *ThreadResource::cardPerform(const byte *card) { uint16 id = *card++; int varD = 5; uint32 v2; - int v3; byte bVal; uint32 idx1, idx2; debugC(DEBUG_BASIC, kDebugScripts, "cardPerform - %d", id); @@ -765,7 +764,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { } case 7: { - v3 = *card++; + int v3 = *card++; v2 = READ_LE_UINT32(card); card += 4; int &v = _vm->_controlPtr->_state->_vals[v3]; -- cgit v1.2.3 From 72d21312639921691336640614f93bb7d3ba1b27 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 10 Feb 2014 07:57:57 +0100 Subject: VOYEUR: Remove a useless variable --- engines/voyeur/files_threads.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index ab639021a4..a5e27eb32d 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1371,16 +1371,13 @@ int ThreadResource::doInterface() { Common::Rect mansionViewBounds(MANSION_VIEW_X, MANSION_VIEW_Y, MANSION_VIEW_X + MANSION_VIEW_WIDTH, MANSION_VIEW_Y + MANSION_VIEW_HEIGHT); - int priorRegionIndex = -1; do { _vm->_voyeurArea = AREA_INTERFACE; _vm->doTimeBar(true); _vm->_eventsManager.getMouseInfo(); - if (checkMansionScroll()) { - priorRegionIndex = regionIndex; + if (checkMansionScroll()) _vm->doScroll(_vm->_mansionViewPos); - } _vm->checkPhoneCall(); if (!_vm->_soundManager.getVOCStatus()) { -- cgit v1.2.3 From 1ed4ed47afdfeae436391b36a6cb2a3e192f06ae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 11 Feb 2014 08:00:15 +0100 Subject: VOYEUR: Rename some fields related to fading --- engines/voyeur/files_threads.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index a5e27eb32d..2241431ac4 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1112,7 +1112,7 @@ void ThreadResource::doRoom() { SVoy &voy = vm._voy; vm.makeViewFinderP(); - voy._field437E = 0; + voy._fadingType = 0; if (!vm._bVoy->getBoltGroup(vm._playStampGroupId, true)) return; @@ -1122,9 +1122,9 @@ void ThreadResource::doRoom() { (*vm._graphicsManager._vPort)->setupViewPort(vm._graphicsManager._backgroundPage); vm._graphicsManager._backColors->startFade(); - voy._field437A = 2; - voy._field437C = 0; - voy._field437E = 1; + voy._fadingStep1 = 2; + voy._fadingStep2 = 0; + voy._fadingType = 1; Common::Array &hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries; int hotspotId = -1; @@ -1138,7 +1138,7 @@ void ThreadResource::doRoom() { vm._eventsManager.getMouseInfo(); vm._eventsManager.setMousePos(Common::Point(192, 120)); - voy._field437E = 0; + voy._fadingType = 0; vm._currentVocId = 146; voy._musicStartTime = voy._RTVNum; @@ -1253,17 +1253,17 @@ void ThreadResource::doRoom() { vm._eventsManager.delay(1); vm._eventsManager.hideCursor(); - while (!vm.shouldQuit() && voy._field4378 > 0) { - if (voy._field4376 < 63) { - voy._field4376 += 4; - if (voy._field4376 > 63) - voy._field4376 = 63; + while (!vm.shouldQuit() && voy._fadingAmount2 > 0) { + if (voy._fadingAmount1 < 63) { + voy._fadingAmount1 += 4; + if (voy._fadingAmount1 > 63) + voy._fadingAmount1 = 63; } - if (voy._field4378 > 0) { - voy._field4378 -= 8; - if (voy._field4378 < 0) - voy._field4378 = 0; + if (voy._fadingAmount2 > 0) { + voy._fadingAmount2 -= 8; + if (voy._fadingAmount2 < 0) + voy._fadingAmount2 = 0; } vm._eventsManager.delay(1); @@ -1280,7 +1280,7 @@ void ThreadResource::doRoom() { voy._eventFlags = EVTFLAG_TIME_DISABLED; vm._eventsManager.incrementTime(1); voy._viewBounds = nullptr; - voy._field437E = 0; + voy._fadingType = 0; vm.makeViewFinderP(); if (voy._boltGroupId2 != -1) { -- cgit v1.2.3 From 1949f4511fa1bfc99f6f336dbf10dc0668021fff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 13 Feb 2014 08:14:01 +0100 Subject: VOYEUR: Some renaming in Files --- engines/voyeur/files_threads.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 2241431ac4..897bfae1b6 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -117,7 +117,7 @@ bool ThreadResource::getStateInfo() { } else { uint32 fld = READ_LE_UINT32(_ctlPtr + 2); fld += _stateId << 3; - _field46 = READ_LE_UINT32(_ctlPtr + fld + 4); + _nextStateId = READ_LE_UINT32(_ctlPtr + fld + 4); fld = READ_LE_UINT32(_ctlPtr + fld); byte *baseP = _ctlPtr + fld; @@ -895,7 +895,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { card += 2; case 45: - _newStateId = _field46; + _newStateId = _nextStateId; _newStackId = _stackId; break; -- cgit v1.2.3 From 013522457ca3fd84d4c9575d9bc20b6a875b09a3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 13 Feb 2014 08:44:06 +0100 Subject: VOYEUR: Remove useless fields in Events, some renaming --- engines/voyeur/files_threads.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 897bfae1b6..5989c92439 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1000,7 +1000,6 @@ int ThreadResource::doApt() { _vm->_graphicsManager.setColor(131, 215, 215, 215); _vm->_graphicsManager.setColor(132, 235, 235, 235); - _vm->_eventsManager._intPtr._palChanged = true; _vm->_eventsManager._intPtr._hasPalette = true; // Main loop to allow users to move the cursor and select hotspots @@ -1150,7 +1149,6 @@ void ThreadResource::doRoom() { while (!vm.shouldQuit() && !breakFlag) { _vm->_voyeurArea = AREA_ROOM; vm._graphicsManager.setColor(128, 0, 255, 0); - vm._eventsManager._intPtr._palChanged = true; vm._eventsManager._intPtr._hasPalette = true; do { @@ -1190,7 +1188,6 @@ void ThreadResource::doRoom() { vm._eventsManager.setCursor(magnifierCursor); } - vm._eventsManager._intPtr._palChanged = true; vm._eventsManager._intPtr._hasPalette = true; vm._graphicsManager.flipPage(); vm._eventsManager.sWaitFlip(); @@ -1314,8 +1311,8 @@ int ThreadResource::doInterface() { _vm->_voy._eventFlags &= ~EVTFLAG_100; _vm->_playStampGroupId = -1; - _vm->_eventsManager._intPtr.field1E = 1; - _vm->_eventsManager._intPtr.field1A = 0; + _vm->_eventsManager._intPtr._flashStep = 1; + _vm->_eventsManager._intPtr._flashTimer = 0; if (_vm->_voy._RTVNum >= _vm->_voy._RTVLimit || _vm->_voy._RTVNum < 0) _vm->_voy._RTVNum = _vm->_voy._RTVLimit - 1; @@ -1354,7 +1351,6 @@ int ThreadResource::doInterface() { _vm->_eventsManager.getMouseInfo(); _vm->_graphicsManager.setColor(240, 220, 220, 220); - _vm->_eventsManager._intPtr._palChanged = true; _vm->_eventsManager._intPtr._hasPalette = true; _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; @@ -1475,8 +1471,8 @@ int ThreadResource::doInterface() { _vm->_eventsManager.getMouseInfo(); _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; - _vm->_eventsManager._intPtr.field1E = 1; - _vm->_eventsManager._intPtr.field1A = 0; + _vm->_eventsManager._intPtr._flashStep = 1; + _vm->_eventsManager._intPtr._flashTimer = 0; } } } while (!_vm->_eventsManager._rightClick && !_vm->shouldQuit() && -- cgit v1.2.3 From 36ac801a4da38a2454ebc7a305093f8ed66cd1b3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 18 Feb 2014 02:43:50 +0100 Subject: VOYEUR: Make GPL headers consistent in themselves. --- engines/voyeur/files_threads.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 5989c92439..189c127cac 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -- cgit v1.2.3 From 2a62c310c3aa42a094530b0b03e1a080b4b2e4c0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Feb 2014 07:27:52 +0100 Subject: VOYEUR: More cleanup --- engines/voyeur/files_threads.cpp | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 189c127cac..1ac2af97c8 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -28,13 +28,9 @@ namespace Voyeur { int ThreadResource::_useCount[8]; -byte *ThreadResource::_threadDataPtr; -CMapResource *ThreadResource::_cmd14Pal; void ThreadResource::init() { Common::fill(&_useCount[0], &_useCount[8], 0); - _threadDataPtr = nullptr; - _cmd14Pal = nullptr; } ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): @@ -43,7 +39,6 @@ ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): _stackId = READ_LE_UINT16(&src[0]); _savedStateId = READ_LE_UINT16(&src[0]); _savedStackId = READ_LE_UINT16(&src[0]); - _flags = src[8]; _ctlPtr = nullptr; _aptPos = Common::Point(-1, -1); } @@ -88,13 +83,10 @@ void ThreadResource::unloadAStack(int stackId) { } bool ThreadResource::doState() { - _flags |= 1; - if (!getStateInfo()) return false; getButtonsFlags(); - getButtonsUnused(); _vm->_glGoState = -1; _vm->_glGoStack = -1; @@ -108,11 +100,9 @@ bool ThreadResource::doState() { } bool ThreadResource::getStateInfo() { - _flags &= 0xff; int id = READ_LE_UINT16(_ctlPtr); if (id <= _stateId) { - _flags |= 0x8000; return false; } else { uint32 fld = READ_LE_UINT32(_ctlPtr + 2); @@ -137,8 +127,7 @@ bool ThreadResource::getStateInfo() { byte *ThreadResource::getDataOffset() { uint32 offset = READ_LE_UINT32(_ctlPtr + 10); - _threadDataPtr = _ctlPtr + offset; - return _threadDataPtr; + return _ctlPtr + offset; } void ThreadResource::getButtonsText() { @@ -149,12 +138,10 @@ void ThreadResource::getButtonsText() { ++p; if (*p++ & 0x80) { assert(idx < 63); - _field8E[idx] = getRecordOffset(p); p += 4; } ++idx; - _field8E[idx] = NULL; } } } @@ -178,17 +165,6 @@ void ThreadResource::getButtonsFlags() { } } -void ThreadResource::getButtonsUnused() { - int idx = 0; - - for (const byte *p = _threadInfoPtr; *p++ != 0x4A; p = getNextRecord(p)) { - assert(idx < 47); - _buttonUnused[idx++] = getRecordOffset(p); - _buttonUnused[idx] = nullptr; - p += 4; - } -} - void ThreadResource::unloadAllStacks(VoyeurEngine *vm) { if (vm->_stampFlags & 1) { for (int i = 0; i < 8; ++i) { @@ -310,8 +286,6 @@ void ThreadResource::cardAction(const byte *card) { } bool ThreadResource::chooseSTAMPButton(int buttonId) { - _flags &= ~1; - for (int idx = 0; idx < _stateCount; ++idx) { if (_buttonIds[idx] == buttonId) { const byte *card = getSTAMPCard(idx); @@ -888,11 +862,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { case 41: bVal = *card++; assert(bVal < 8); - _fieldA[bVal] = READ_LE_UINT32(card); - card += 4; - - _field2A[bVal] = READ_LE_UINT16(card); - card += 2; + card += 6; case 45: _newStateId = _nextStateId; @@ -1553,10 +1523,7 @@ bool ThreadResource::goToState(int stackId, int stateId) { } void ThreadResource::savePrevious() { - if (_savedStateId == _stateId && _stackId == _savedStackId) { - _flags &= ~1; - } else { - _flags |= 1; + if (_savedStateId != _stateId || _stackId != _savedStackId) { _savedStateId = _stateId; _savedStackId = _stackId; } -- cgit v1.2.3 From 27d624e79f4d488b9a97806bb5ddb81e4a40097b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 20 Feb 2014 00:37:11 +0100 Subject: VOYEUR: Remove unused variables and functions in GraphicsManager --- engines/voyeur/files_threads.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 1ac2af97c8..918f8338cf 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1238,7 +1238,7 @@ void ThreadResource::doRoom() { _vm->flipPageAndWait(); - vm._graphicsManager.fadeUpICF1(0); + vm._graphicsManager.fadeUpICF1(); voy._eventFlags &= EVTFLAG_RECORDING; vm._eventsManager.showCursor(); } @@ -1595,7 +1595,7 @@ void ThreadResource::freeTheApt() { _vm->_graphicsManager.fadeDownICF1(5); _vm->flipPageAndWaitForFade(); - _vm->_graphicsManager.fadeUpICF1(0); + _vm->_graphicsManager.fadeUpICF1(); if (_vm->_currentVocId != -1) { _vm->_soundManager.stopVOCPlay(); -- cgit v1.2.3 From 31d3171b65d9e56b3aa0add8ca05fdb542c13a26 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 20 Feb 2014 07:43:41 +0100 Subject: VOYEUR: Remove a useless parameter in doTimeBar() --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 918f8338cf..3ab3067762 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1339,7 +1339,7 @@ int ThreadResource::doInterface() { do { _vm->_voyeurArea = AREA_INTERFACE; - _vm->doTimeBar(true); + _vm->doTimeBar(); _vm->_eventsManager.getMouseInfo(); if (checkMansionScroll()) -- cgit v1.2.3 From d0bbb68eabbd64af46e01a9f06437cef8821d26e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 20 Feb 2014 08:10:48 +0100 Subject: VOYEUR: Some more renaming --- engines/voyeur/files_threads.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 3ab3067762..42446f72b7 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -690,7 +690,7 @@ void ThreadResource::parsePlayCommands() { const byte *ThreadResource::cardPerform(const byte *card) { uint16 id = *card++; - int varD = 5; + int subId = 5; uint32 v2; byte bVal; uint32 idx1, idx2; @@ -805,17 +805,17 @@ const byte *ThreadResource::cardPerform(const byte *card) { case 24: case 27: case 28: - varD -= 3; + subId -= 3; // Deliberate fall-through case 21: case 22: case 25: case 26: - bVal = card[varD]; + bVal = card[subId]; if (bVal == 61) { if (cardPerform2(card, id)) { - card += varD; + card += subId; while (*card != 30 && *card != 29) card = cardPerform(card); @@ -830,7 +830,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { } } } else { - card += varD; + card += subId; int count = 1; while (count > 0) { card = getNextRecord(card); @@ -848,11 +848,11 @@ const byte *ThreadResource::cardPerform(const byte *card) { ++card; } else { if (cardPerform2(card, id)) { - card += varD; + card += subId; card = cardPerform(card); while (*card++ != 61) ; } else { - card += varD; + card += subId; while (*card != 61 && *card != 29) ++card; } -- cgit v1.2.3 From 691ac84f3676e5ce92ef8bc2727ccbcacc29c5cd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 20 Feb 2014 23:35:20 +0100 Subject: VOYEUR: Fix some shadowed variables and functions in file handlers --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 42446f72b7..501e62b66b 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -751,7 +751,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { idx2 = *card++; int &v1 = _vm->_controlPtr->_state->_vals[idx1]; - int &v2 = _vm->_controlPtr->_state->_vals[idx2]; + v2 = _vm->_controlPtr->_state->_vals[idx2]; v1 *= v2; break; } -- cgit v1.2.3 From 3a6e4b381ede711762694015cb5acdf415e4b30a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 21 Feb 2014 19:35:37 +0100 Subject: VOYEUR: Fix some more shadowed variables and functions --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 501e62b66b..ee626fd4c9 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -771,7 +771,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { idx2 = *card++; int &v1 = _vm->_controlPtr->_state->_vals[idx1]; - int &v2 = _vm->_controlPtr->_state->_vals[idx2]; + v2 = _vm->_controlPtr->_state->_vals[idx2]; v1 /= v2; break; } -- cgit v1.2.3 From eda34075c12a612ffb17ea39d524467233b288bf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Feb 2014 08:09:28 +0100 Subject: VOYEUR: Fix some uninitialized variables in ThreadResource --- engines/voyeur/files_threads.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index ee626fd4c9..d0addc868f 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -33,14 +33,22 @@ void ThreadResource::init() { Common::fill(&_useCount[0], &_useCount[8], 0); } -ThreadResource::ThreadResource(BoltFilesState &state, const byte *src): - _vm(state._vm) { +ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):_vm(state._vm) { _stateId = READ_LE_UINT16(&src[0]); _stackId = READ_LE_UINT16(&src[0]); _savedStateId = READ_LE_UINT16(&src[0]); _savedStackId = READ_LE_UINT16(&src[0]); _ctlPtr = nullptr; _aptPos = Common::Point(-1, -1); + + _newStateId = -1; + _newStackId = -1; + _stateFlags = 0; + _stateCount = 0; + _parseCount = 0; + _nextStateId = -1; + _threadInfoPtr = nullptr; + _playCommandsPtr = nullptr; } void ThreadResource::initThreadStruct(int idx, int id) { -- cgit v1.2.3 From 54095bd323a755b23cc5de462ba810d4b5f7484b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Feb 2014 07:59:56 +0100 Subject: VOYEUR: Add a sanity check in loadAStack() --- engines/voyeur/files_threads.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index d0addc868f..7261aa2449 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -46,7 +46,7 @@ ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):_vm(state _stateFlags = 0; _stateCount = 0; _parseCount = 0; - _nextStateId = -1; + _nextStateId = 0; _threadInfoPtr = nullptr; _playCommandsPtr = nullptr; } @@ -65,6 +65,9 @@ void ThreadResource::initThreadStruct(int idx, int id) { bool ThreadResource::loadAStack(int stackId) { if (_vm->_stampFlags & 1) { + if (stackId < 0) + error('loadAStack() - Invalid stackId %d', stackId); + unloadAStack(_stackId); if (!_useCount[stackId]) { BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[stackId]); -- cgit v1.2.3 From 63bf41f4175b4fa3e0f87a1b0937ad89e3f490bf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Feb 2014 08:05:11 +0100 Subject: VOYEUR: Add missing break in cardPerform() switch --- engines/voyeur/files_threads.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 7261aa2449..0ce1fedcd4 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -66,7 +66,7 @@ void ThreadResource::initThreadStruct(int idx, int id) { bool ThreadResource::loadAStack(int stackId) { if (_vm->_stampFlags & 1) { if (stackId < 0) - error('loadAStack() - Invalid stackId %d', stackId); + error("loadAStack() - Invalid stackId %d", stackId); unloadAStack(_stackId); if (!_useCount[stackId]) { @@ -874,6 +874,7 @@ const byte *ThreadResource::cardPerform(const byte *card) { bVal = *card++; assert(bVal < 8); card += 6; + break; case 45: _newStateId = _nextStateId; -- cgit v1.2.3 From ccde2d5b7604756f5333ea16807c82ef1b387c10 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Feb 2014 22:44:30 +0100 Subject: VOYEUR: Remove setVm from SVoy --- engines/voyeur/files_threads.cpp | 262 +++++++++++++++++++-------------------- 1 file changed, 131 insertions(+), 131 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 0ce1fedcd4..2c3b5f2454 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -321,19 +321,19 @@ bool ThreadResource::chooseSTAMPButton(int buttonId) { } void ThreadResource::parsePlayCommands() { - _vm->_voy._playStampMode = -1; - _vm->_voy._audioVisualStartTime = 0; - _vm->_voy._audioVisualDuration = 0; - _vm->_voy._boltGroupId2 = -1; - _vm->_voy._computerTextId = -1; - _vm->_voy._eventFlags &= ~EVTFLAG_8; + _vm->_voy->_playStampMode = -1; + _vm->_voy->_audioVisualStartTime = 0; + _vm->_voy->_audioVisualDuration = 0; + _vm->_voy->_boltGroupId2 = -1; + _vm->_voy->_computerTextId = -1; + _vm->_voy->_eventFlags &= ~EVTFLAG_8; _vm->_eventsManager._videoDead = -1; // Reset hotspot data - _vm->_voy._videoHotspotTimes.reset(); - _vm->_voy._audioHotspotTimes.reset(); - _vm->_voy._evidenceHotspotTimes.reset(); - Common::fill(&_vm->_voy._roomHotspotsEnabled[0], &_vm->_voy._roomHotspotsEnabled[20], false); + _vm->_voy->_videoHotspotTimes.reset(); + _vm->_voy->_audioHotspotTimes.reset(); + _vm->_voy->_evidenceHotspotTimes.reset(); + Common::fill(&_vm->_voy->_roomHotspotsEnabled[0], &_vm->_voy->_roomHotspotsEnabled[20], false); byte *dataP = _playCommandsPtr; int v2, v3; PictureResource *pic; @@ -357,21 +357,21 @@ void ThreadResource::parsePlayCommands() { if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { _vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1; - _vm->_voy._audioVisualStartTime = READ_LE_UINT16(dataP + 4); - _vm->_voy._audioVisualDuration = READ_LE_UINT16(dataP + 6); + _vm->_voy->_audioVisualStartTime = READ_LE_UINT16(dataP + 4); + _vm->_voy->_audioVisualDuration = READ_LE_UINT16(dataP + 6); - if (_vm->_voy._RTVNum < _vm->_voy._audioVisualStartTime || - (_vm->_voy._audioVisualStartTime + _vm->_voy._audioVisualDuration) < _vm->_voy._RTVNum) { + if (_vm->_voy->_RTVNum < _vm->_voy->_audioVisualStartTime || + (_vm->_voy->_audioVisualStartTime + _vm->_voy->_audioVisualDuration) < _vm->_voy->_RTVNum) { _vm->_audioVideoId = -1; } else { - _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._audioVisualStartTime; - _vm->_voy.addAudioEventStart(); + _vm->_voy->_vocSecondsOffset = _vm->_voy->_RTVNum - _vm->_voy->_audioVisualStartTime; + _vm->_voy->addAudioEventStart(); // Play the audio assert(_vm->_audioVideoId < 38); _vm->playAudio(_vm->_audioVideoId); - _vm->_voy.addAudioEventEnd(); + _vm->_voy->addAudioEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_eventsManager.incrementTime(1); _vm->_audioVideoId = -1; @@ -388,22 +388,22 @@ void ThreadResource::parsePlayCommands() { if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { _vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1; - _vm->_voy._audioVisualStartTime = READ_LE_UINT16(dataP + 4); - _vm->_voy._audioVisualDuration = READ_LE_UINT16(dataP + 6); + _vm->_voy->_audioVisualStartTime = READ_LE_UINT16(dataP + 4); + _vm->_voy->_audioVisualDuration = READ_LE_UINT16(dataP + 6); - if (_vm->_voy._RTVNum < _vm->_voy._audioVisualStartTime || - (_vm->_voy._audioVisualStartTime + _vm->_voy._audioVisualDuration) < _vm->_voy._RTVNum) { + if (_vm->_voy->_RTVNum < _vm->_voy->_audioVisualStartTime || + (_vm->_voy->_audioVisualStartTime + _vm->_voy->_audioVisualDuration) < _vm->_voy->_RTVNum) { _vm->_audioVideoId = -1; } else { - _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._audioVisualStartTime; - _vm->_voy.addVideoEventStart(); - _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; - _vm->_voy._eventFlags |= EVTFLAG_RECORDING; + _vm->_voy->_vocSecondsOffset = _vm->_voy->_RTVNum - _vm->_voy->_audioVisualStartTime; + _vm->_voy->addVideoEventStart(); + _vm->_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED; + _vm->_voy->_eventFlags |= EVTFLAG_RECORDING; _vm->playAVideo(_vm->_audioVideoId); - _vm->_voy._eventFlags &= ~EVTFLAG_RECORDING; - _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; - _vm->_voy.addVideoEventEnd(); + _vm->_voy->_eventFlags &= ~EVTFLAG_RECORDING; + _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; + _vm->_voy->addVideoEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_audioVideoId = -1; @@ -417,10 +417,10 @@ void ThreadResource::parsePlayCommands() { _vm->_eventsManager._videoDead = -1; if (_stateCount == 2 && _vm->_eventsManager._mouseClicked == 0) { - _vm->_voy._playStampMode = 132; + _vm->_voy->_playStampMode = 132; parseIndex = 999; } else { - _vm->_voy._playStampMode = 129; + _vm->_voy->_playStampMode = 129; } } } @@ -440,11 +440,11 @@ void ThreadResource::parsePlayCommands() { _vm->_playStampGroupId = _vm->_resolvePtr[resolveIndex]; } - _vm->_voy._vocSecondsOffset = 0; - _vm->_voy._audioVisualStartTime = _vm->_voy._RTVNum; - _vm->_voy._eventFlags &= ~(EVTFLAG_TIME_DISABLED | EVTFLAG_RECORDING); + _vm->_voy->_vocSecondsOffset = 0; + _vm->_voy->_audioVisualStartTime = _vm->_voy->_RTVNum; + _vm->_voy->_eventFlags &= ~(EVTFLAG_TIME_DISABLED | EVTFLAG_RECORDING); _vm->playAVideo(_vm->_audioVideoId); - _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; + _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; if (id != 22) { _vm->_audioVideoId = -1; @@ -498,30 +498,30 @@ void ThreadResource::parsePlayCommands() { // if so, load the time information for the new time period v2 = READ_LE_UINT16(dataP); if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { - _vm->_voy._playStampMode = 5; + _vm->_voy->_playStampMode = 5; int count = READ_LE_UINT16(dataP + 2); - _vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4); + _vm->_voy->_RTVLimit = READ_LE_UINT16(dataP + 4); - if (_vm->_voy._transitionId != count) { - if (_vm->_voy._transitionId > 1) - _vm->_voy._eventFlags &= ~EVTFLAG_100; + if (_vm->_voy->_transitionId != count) { + if (_vm->_voy->_transitionId > 1) + _vm->_voy->_eventFlags &= ~EVTFLAG_100; - _vm->_voy._transitionId = count; + _vm->_voy->_transitionId = count; _vm->_gameMinute = LEVEL_M[count - 1]; _vm->_gameHour = LEVEL_H[count - 1]; //_vm->_v2A0A2 = 0; - _vm->_voy._RTVNum = 0; - _vm->_voy._RTANum = 255; + _vm->_voy->_RTVNum = 0; + _vm->_voy->_RTANum = 255; } - _vm->_voy._isAM = (_vm->_voy._transitionId == 6); + _vm->_voy->_isAM = (_vm->_voy->_transitionId == 6); } dataP += 6; break; case 6: - _vm->_voy._playStampMode = 6; + _vm->_voy->_playStampMode = 6; v2 = READ_LE_UINT16(dataP); _vm->_playStampGroupId = _vm->_resolvePtr[v2]; dataP += 2; @@ -534,12 +534,12 @@ void ThreadResource::parsePlayCommands() { if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { int idx = 0; - while (_vm->_voy._videoHotspotTimes._min[idx][v3] != 9999) + while (_vm->_voy->_videoHotspotTimes._min[idx][v3] != 9999) ++idx; v2 = READ_LE_UINT16(dataP + 4); - _vm->_voy._videoHotspotTimes._min[idx][v3] = v2; - _vm->_voy._videoHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; + _vm->_voy->_videoHotspotTimes._min[idx][v3] = v2; + _vm->_voy->_videoHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; } dataP += 8; @@ -552,12 +552,12 @@ void ThreadResource::parsePlayCommands() { if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { int idx = 0; - while (_vm->_voy._audioHotspotTimes._min[idx][v3] != 9999) + while (_vm->_voy->_audioHotspotTimes._min[idx][v3] != 9999) ++idx; v2 = READ_LE_UINT16(dataP + 4); - _vm->_voy._audioHotspotTimes._min[idx][v3] = v2; - _vm->_voy._audioHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; + _vm->_voy->_audioHotspotTimes._min[idx][v3] = v2; + _vm->_voy->_audioHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; } dataP += 8; @@ -570,12 +570,12 @@ void ThreadResource::parsePlayCommands() { if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) { int idx = 0; - while (_vm->_voy._evidenceHotspotTimes._min[idx][v3] != 9999) + while (_vm->_voy->_evidenceHotspotTimes._min[idx][v3] != 9999) ++idx; v2 = READ_LE_UINT16(dataP + 4); - _vm->_voy._evidenceHotspotTimes._min[idx][v3] = v2; - _vm->_voy._evidenceHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; + _vm->_voy->_evidenceHotspotTimes._min[idx][v3] = v2; + _vm->_voy->_evidenceHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2; } dataP += 8; @@ -590,13 +590,13 @@ void ThreadResource::parsePlayCommands() { int randomVal; do { randomVal = _vm->getRandomNumber(3) + 1; - } while (randomVal == _vm->_voy._victimNumber); + } while (randomVal == _vm->_voy->_victimNumber); - _vm->_voy._victimNumber = randomVal; + _vm->_voy->_victimNumber = randomVal; _vm->_controlPtr->_state->_victimIndex = randomVal; } else { // Player has seen something that locks in the character to die - _vm->_voy._victimNumber = _vm->_iForceDeath; + _vm->_voy->_victimNumber = _vm->_iForceDeath; _vm->_controlPtr->_state->_victimIndex = _vm->_iForceDeath; } @@ -604,15 +604,15 @@ void ThreadResource::parsePlayCommands() { break; case 11: - _vm->_voy._eventFlags |= EVTFLAG_2; + _vm->_voy->_eventFlags |= EVTFLAG_2; break; case 12: v2 = READ_LE_UINT16(dataP); 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; + _vm->_voy->_boltGroupId2 = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)]; + _vm->_voy->_roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true; } dataP += 6; @@ -622,14 +622,14 @@ void ThreadResource::parsePlayCommands() { v2 = READ_LE_UINT16(dataP); 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); - - _vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4]; - _vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 1]; - _vm->_voy._rect4E4.right = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 2]; - _vm->_voy._rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 3]; + _vm->_voy->_computerTextId = READ_LE_UINT16(dataP + 2); + _vm->_voy->_computerTimeMin = READ_LE_UINT16(dataP + 4); + _vm->_voy->_computerTimeMax = READ_LE_UINT16(dataP + 6); + + _vm->_voy->_rect4E4.left = COMP_BUT_TABLE[_vm->_voy->_computerTextId * 4]; + _vm->_voy->_rect4E4.top = COMP_BUT_TABLE[_vm->_voy->_computerTextId * 4 + 1]; + _vm->_voy->_rect4E4.right = COMP_BUT_TABLE[_vm->_voy->_computerTextId * 4 + 2]; + _vm->_voy->_rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy->_computerTextId * 4 + 3]; } dataP += 8; @@ -637,7 +637,7 @@ void ThreadResource::parsePlayCommands() { case 14: _vm->_playStampGroupId = 2048; - _vm->_voy._playStampMode = 130; + _vm->_voy->_playStampMode = 130; break; case 15: @@ -645,11 +645,11 @@ void ThreadResource::parsePlayCommands() { break; case 16: - _vm->_voy._playStampMode = 16; + _vm->_voy->_playStampMode = 16; break; case 17: - _vm->_voy._playStampMode = 17; + _vm->_voy->_playStampMode = 17; break; case 18: @@ -659,37 +659,37 @@ void ThreadResource::parsePlayCommands() { v3 = READ_LE_UINT16(dataP + 2); if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) - _vm->_voy._murderThreshold = v3; + _vm->_voy->_murderThreshold = v3; dataP += 4; break; case 19: - _vm->_voy._aptLoadMode = 140; + _vm->_voy->_aptLoadMode = 140; loadTheApt(); - _vm->_voy._aptLoadMode = 141; + _vm->_voy->_aptLoadMode = 141; freeTheApt(); break; case 20: - _vm->_voy._aptLoadMode = -1; + _vm->_voy->_aptLoadMode = -1; loadTheApt(); - _vm->_voy._aptLoadMode = 141; + _vm->_voy->_aptLoadMode = 141; freeTheApt(); break; case 21: - _vm->_voy._aptLoadMode = -1; + _vm->_voy->_aptLoadMode = -1; loadTheApt(); - _vm->_voy._aptLoadMode = 140; + _vm->_voy->_aptLoadMode = 140; freeTheApt(); break; case 23: - _vm->_voy._transitionId = 17; - _vm->_voy._aptLoadMode = -1; + _vm->_voy->_transitionId = 17; + _vm->_voy->_aptLoadMode = -1; loadTheApt(); - _vm->_voy._aptLoadMode = 144; + _vm->_voy->_aptLoadMode = 144; freeTheApt(); break; @@ -954,7 +954,7 @@ int ThreadResource::doApt() { loadTheApt(); _vm->_currentVocId = 151; - _vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._rectResource; + _vm->_voy->_viewBounds = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._rectResource; Common::Array &hotspots = _vm->_bVoy->boltEntry( _vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); @@ -966,7 +966,7 @@ int ThreadResource::doApt() { _vm->_currentVocId = 153; } - if (_vm->_voy._playStampMode == 16) { + if (_vm->_voy->_playStampMode == 16) { hotspots[0].left = 999; hotspots[3].left = 999; _aptPos.x = hotspots[4].left + 28; @@ -1015,7 +1015,7 @@ int ThreadResource::doApt() { // Cursor is within hotspot area // Don't allow the camera to be highlighted on Monday morning. - if (idx == 0 && _vm->_voy._transitionId == 17) + if (idx == 0 && _vm->_voy->_transitionId == 17) continue; // Set the highlighted hotspot Id @@ -1024,7 +1024,7 @@ int ThreadResource::doApt() { if (hotspotId != prevHotspotId) { // Check for whether to replace hotspot Id for "Watch TV" for // "Review the Tape" if player has already watched the TV - if ((_vm->_voy._eventFlags & EVTFLAG_100) && (hotspotId == 2)) + if ((_vm->_voy->_eventFlags & EVTFLAG_100) && (hotspotId == 2)) hotspotId = 5; // Draw the text description for the highlighted hotspot @@ -1063,23 +1063,23 @@ int ThreadResource::doApt() { switch (hotspotId) { case 0: - _vm->_voy._aptLoadMode = 140; + _vm->_voy->_aptLoadMode = 140; break; case 1: - _vm->_voy._aptLoadMode = 143; + _vm->_voy->_aptLoadMode = 143; break; case 2: - _vm->_voy._aptLoadMode = 142; + _vm->_voy->_aptLoadMode = 142; case 5: - _vm->_voy._aptLoadMode = 141; + _vm->_voy->_aptLoadMode = 141; break; default: - _vm->_voy._aptLoadMode = -1; + _vm->_voy->_aptLoadMode = -1; break; } freeTheApt(); - if (_vm->_voy._transitionId == 1 && hotspotId == 0) + if (_vm->_voy->_transitionId == 1 && hotspotId == 0) _vm->checkTransition(); if (!hotspotId) @@ -1090,7 +1090,7 @@ int ThreadResource::doApt() { void ThreadResource::doRoom() { VoyeurEngine &vm = *_vm; - SVoy &voy = vm._voy; + SVoy voy = *vm._voy; vm.makeViewFinderP(); voy._fadingType = 0; @@ -1198,14 +1198,14 @@ void ThreadResource::doRoom() { vm.getComputerBrush(); _vm->flipPageAndWait(); - vm._voy.addComputerEventStart(); + vm._voy->addComputerEventStart(); vm._eventsManager._mouseClicked = false; vm._eventsManager.startCursorBlink(); int totalChars = vm.doComputerText(9999); if (totalChars) - vm._voy.addComputerEventEnd(totalChars); + vm._voy->addComputerEventEnd(totalChars); vm._bVoy->freeBoltGroup(0x4900); } else { @@ -1285,35 +1285,35 @@ int ThreadResource::doInterface() { PictureResource *pic; Common::Point pt; - _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; - if (_vm->_voy._abortInterface) { - _vm->_voy._abortInterface = false; + _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; + if (_vm->_voy->_abortInterface) { + _vm->_voy->_abortInterface = false; return -2; } - _vm->_voy._eventFlags &= ~EVTFLAG_100; + _vm->_voy->_eventFlags &= ~EVTFLAG_100; _vm->_playStampGroupId = -1; _vm->_eventsManager._intPtr._flashStep = 1; _vm->_eventsManager._intPtr._flashTimer = 0; - if (_vm->_voy._RTVNum >= _vm->_voy._RTVLimit || _vm->_voy._RTVNum < 0) - _vm->_voy._RTVNum = _vm->_voy._RTVLimit - 1; + if (_vm->_voy->_RTVNum >= _vm->_voy->_RTVLimit || _vm->_voy->_RTVNum < 0) + _vm->_voy->_RTVNum = _vm->_voy->_RTVLimit - 1; - if (_vm->_voy._transitionId < 15 && _vm->_debugger._isTimeActive && - (_vm->_voy._RTVLimit - 3) < _vm->_voy._RTVNum) { - _vm->_voy._RTVNum = _vm->_voy._RTVLimit; + if (_vm->_voy->_transitionId < 15 && _vm->_debugger._isTimeActive && + (_vm->_voy->_RTVLimit - 3) < _vm->_voy->_RTVNum) { + _vm->_voy->_RTVNum = _vm->_voy->_RTVLimit; _vm->makeViewFinder(); _vm->initIFace(); - _vm->_voy._RTVNum = _vm->_voy._RTVLimit - 4; - _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; + _vm->_voy->_RTVNum = _vm->_voy->_RTVLimit - 4; + _vm->_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED; - while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._RTVLimit) { + while (!_vm->shouldQuit() && _vm->_voy->_RTVNum < _vm->_voy->_RTVLimit) { _vm->flashTimeBar(); _vm->_eventsManager.delayClick(1); } - _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; + _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; chooseSTAMPButton(20); parsePlayCommands(); } @@ -1326,7 +1326,7 @@ int ThreadResource::doInterface() { Common::Array *hotspots = &_vm->_bVoy->boltEntry( _vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_currentVocId = 151 - _vm->getRandomNumber(5); - _vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29); + _vm->_voy->_vocSecondsOffset = _vm->getRandomNumber(29); Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_currentVocId); _vm->_soundManager.startVOCPlay(fname); @@ -1334,7 +1334,7 @@ int ThreadResource::doInterface() { _vm->_graphicsManager.setColor(240, 220, 220, 220); _vm->_eventsManager._intPtr._hasPalette = true; - _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; + _vm->_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED; // Set the cusor PictureResource *crosshairsCursor = _vm->_bVoy->boltEntry(0x112)._picResource; @@ -1376,13 +1376,13 @@ int ThreadResource::doInterface() { if ((*hotspots)[hotspotIdx].contains(pt)) { // Rect check done for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { - if (_vm->_voy._audioHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy._RTVNum)) { + if (_vm->_voy->_audioHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy->_RTVNum)) { // Set the ear cursor for an audio event _vm->_eventsManager.setCursor(listenCursor); regionIndex = hotspotIdx; } - if (_vm->_voy._evidenceHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy._RTVNum)) { + if (_vm->_voy->_evidenceHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy->_RTVNum)) { // Set the magnifier cursor for an evidence event _vm->_eventsManager.setCursor(mangifyCursor); regionIndex = hotspotIdx; @@ -1390,7 +1390,7 @@ int ThreadResource::doInterface() { } for (int arrIndex = 0; arrIndex < 8; ++arrIndex) { - if (_vm->_voy._videoHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy._RTVNum)) { + if (_vm->_voy->_videoHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy->_RTVNum)) { // Set the eye cursor for a video event _vm->_eventsManager.setCursor(eyeCursor); regionIndex = hotspotIdx; @@ -1405,42 +1405,42 @@ int ThreadResource::doInterface() { } // Regularly update the time display - if (_vm->_voy._RTANum & 2) { + if (_vm->_voy->_RTANum & 2) { _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, _vm->_gameMinute / 10, Common::Point(190, 25)); _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, _vm->_gameMinute % 10, Common::Point(201, 25)); - if (_vm->_voy._RTANum & 4) { + if (_vm->_voy->_RTANum & 4) { int v = _vm->_gameHour / 10; _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, v == 0 ? 10 : v, Common::Point(161, 25)); _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, _vm->_gameHour % 10, Common::Point(172, 25)); - pic = _vm->_bVoy->boltEntry(_vm->_voy._isAM ? 272 : 273)._picResource; + pic = _vm->_bVoy->boltEntry(_vm->_voy->_isAM ? 272 : 273)._picResource; _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, Common::Point(215, 27)); } } - _vm->_voy._RTANum = 0; + _vm->_voy->_RTANum = 0; _vm->flipPageAndWait(); pt = _vm->_eventsManager.getMousePos(); - if ((_vm->_voy._RTVNum >= _vm->_voy._RTVLimit) || ((_vm->_voy._eventFlags & 0x80) && + if ((_vm->_voy->_RTVNum >= _vm->_voy->_RTVLimit) || ((_vm->_voy->_eventFlags & 0x80) && _vm->_eventsManager._rightClick && (pt.x == 0))) { // Time to transition to the next time period _vm->_eventsManager.getMouseInfo(); - if (_vm->_voy._transitionId == 15) { + if (_vm->_voy->_transitionId == 15) { regionIndex = 20; - _vm->_voy._transitionId = 17; + _vm->_voy->_transitionId = 17; _vm->_soundManager.stopVOCPlay(); _vm->checkTransition(); _vm->_eventsManager._leftClick = true; } else { - _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; + _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; chooseSTAMPButton(20); parsePlayCommands(); @@ -1452,7 +1452,7 @@ int ThreadResource::doInterface() { hotspots = &_vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._rectResource->_entries; _vm->_eventsManager.getMouseInfo(); - _vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; + _vm->_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED; _vm->_eventsManager._intPtr._flashStep = 1; _vm->_eventsManager._intPtr._flashTimer = 0; } @@ -1461,7 +1461,7 @@ int ThreadResource::doInterface() { (!_vm->_eventsManager._leftClick || regionIndex == -1)); _vm->_eventsManager.hideCursor(); - _vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED; + _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); if (_vm->_currentVocId != -1) _vm->_soundManager.stopVOCPlay(); @@ -1550,7 +1550,7 @@ void ThreadResource::clearButtonFlag(int idx, byte bits) { } void ThreadResource::loadTheApt() { - switch (_vm->_voy._transitionId) { + switch (_vm->_voy->_transitionId) { case 1: case 2: case 5: @@ -1578,13 +1578,13 @@ void ThreadResource::loadTheApt() { break; } - if (_vm->_voy._aptLoadMode == 143) - _vm->_voy._aptLoadMode = -1; + if (_vm->_voy->_aptLoadMode == 143) + _vm->_voy->_aptLoadMode = -1; - if (_vm->_voy._aptLoadMode != -1) { + if (_vm->_voy->_aptLoadMode != -1) { doAptAnim(1); _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId); - _vm->_voy._aptLoadMode = -1; + _vm->_voy->_aptLoadMode = -1; _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( _vm->_playStampGroupId + 5)._picResource; (*_vm->_graphicsManager._vPort)->setupViewPort( @@ -1614,13 +1614,13 @@ void ThreadResource::freeTheApt() { _vm->_currentVocId = -1; } - if (_vm->_voy._aptLoadMode == -1) { + if (_vm->_voy->_aptLoadMode == -1) { _vm->_graphicsManager.fadeDownICF(6); } else { doAptAnim(2); } - if (_vm->_voy._aptLoadMode == 140) { + if (_vm->_voy->_aptLoadMode == 140) { _vm->_graphicsManager.screenReset(); _vm->_graphicsManager.resetPalette(); } @@ -1628,7 +1628,7 @@ void ThreadResource::freeTheApt() { (*_vm->_graphicsManager._vPort)->setupViewPort(nullptr); _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); _vm->_playStampGroupId = -1; - _vm->_voy._viewBounds = nullptr; + _vm->_voy->_viewBounds = nullptr; } void ThreadResource::doAptAnim(int mode) { @@ -1636,7 +1636,7 @@ void ThreadResource::doAptAnim(int mode) { // Figure out the resource to use int id = 0; - switch (_vm->_voy._aptLoadMode) { + switch (_vm->_voy->_aptLoadMode) { case 140: id = 0x5A00; break; @@ -1657,7 +1657,7 @@ void ThreadResource::doAptAnim(int mode) { } int id2 = (id == 0x6C00 || id == 0x6F00) ? 1 : 2; - switch (_vm->_voy._transitionId) { + switch (_vm->_voy->_transitionId) { case 3: id += id2 << 8; break; -- cgit v1.2.3 From 8215f598612a61e472ec56db0f93fb43908a1348 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Feb 2014 22:54:13 +0100 Subject: VOYEUR: Remove setVm from Debugger --- engines/voyeur/files_threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 2c3b5f2454..7e776cef8f 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1299,7 +1299,7 @@ int ThreadResource::doInterface() { if (_vm->_voy->_RTVNum >= _vm->_voy->_RTVLimit || _vm->_voy->_RTVNum < 0) _vm->_voy->_RTVNum = _vm->_voy->_RTVLimit - 1; - if (_vm->_voy->_transitionId < 15 && _vm->_debugger._isTimeActive && + if (_vm->_voy->_transitionId < 15 && _vm->_debugger->_isTimeActive && (_vm->_voy->_RTVLimit - 3) < _vm->_voy->_RTVNum) { _vm->_voy->_RTVNum = _vm->_voy->_RTVLimit; _vm->makeViewFinder(); -- cgit v1.2.3 From 9278ec342caf1c47ca5882103bb587ec40ab93e6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Feb 2014 07:12:10 +0100 Subject: VOYEUR: Remove setVm from SoundManager --- engines/voyeur/files_threads.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 7e776cef8f..b03e9ac99c 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -451,7 +451,7 @@ void ThreadResource::parsePlayCommands() { parseIndex = 999; } else { int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size() / 2; - _vm->_soundManager.stopVOCPlay(); + _vm->_soundManager->stopVOCPlay(); _vm->_eventsManager.getMouseInfo(); for (int i = 0; i < count; ++i) { @@ -469,15 +469,15 @@ void ThreadResource::parsePlayCommands() { } Common::String file = Common::String::format("news%d.voc", i + 1); - _vm->_soundManager.startVOCPlay(file); + _vm->_soundManager->startVOCPlay(file); while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && - _vm->_soundManager.getVOCStatus()) { + _vm->_soundManager->getVOCStatus()) { _vm->_eventsManager.delayClick(1); _vm->_eventsManager.getMouseInfo(); } - _vm->_soundManager.stopVOCPlay(); + _vm->_soundManager->stopVOCPlay(); if (i == (count - 1)) _vm->_eventsManager.delayClick(480); @@ -974,7 +974,7 @@ int ThreadResource::doApt() { } _vm->_eventsManager.setMousePos(Common::Point(_aptPos.x, _aptPos.y)); - _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId)); + _vm->_soundManager->startVOCPlay(_vm->_soundManager->getVOCFileName(_vm->_currentVocId)); _vm->_currentVocId = 151; _vm->_graphicsManager.setColor(129, 82, 82, 82); @@ -1001,10 +1001,10 @@ int ThreadResource::doApt() { } _vm->_eventsManager.getMouseInfo(); - if (!_vm->_soundManager.getVOCStatus()) { + if (!_vm->_soundManager->getVOCStatus()) { // Previous sound ended, so start up a new one _vm->_currentVocId = 151 - _vm->getRandomNumber(4); - _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId)); + _vm->_soundManager->startVOCPlay(_vm->_soundManager->getVOCFileName(_vm->_currentVocId)); } // Loop through the hotspot list @@ -1124,7 +1124,7 @@ void ThreadResource::doRoom() { voy._musicStartTime = voy._RTVNum; voy._vocSecondsOffset = 0; - vm._soundManager.startVOCPlay(vm._currentVocId); + vm._soundManager->startVOCPlay(vm._currentVocId); voy._eventFlags &= ~EVTFLAG_TIME_DISABLED; bool breakFlag = false; @@ -1134,10 +1134,10 @@ void ThreadResource::doRoom() { vm._eventsManager._intPtr._hasPalette = true; do { - if (vm._currentVocId != -1 && !vm._soundManager.getVOCStatus()) { + if (vm._currentVocId != -1 && !vm._soundManager->getVOCStatus()) { voy._musicStartTime = voy._RTVNum; voy._vocSecondsOffset = 0; - vm._soundManager.startVOCPlay(vm._currentVocId); + vm._soundManager->startVOCPlay(vm._currentVocId); } vm._eventsManager.getMouseInfo(); @@ -1192,7 +1192,7 @@ void ThreadResource::doRoom() { if (vm._currentVocId != -1) { voy._vocSecondsOffset = voy._RTVNum - voy._musicStartTime; - vm._soundManager.stopVOCPlay(); + vm._soundManager->stopVOCPlay(); } vm.getComputerBrush(); @@ -1273,7 +1273,7 @@ void ThreadResource::doRoom() { } if (vm._currentVocId != -1) { - vm._soundManager.stopVOCPlay(); + vm._soundManager->stopVOCPlay(); vm._currentVocId = -1; } @@ -1328,8 +1328,8 @@ int ThreadResource::doInterface() { _vm->_currentVocId = 151 - _vm->getRandomNumber(5); _vm->_voy->_vocSecondsOffset = _vm->getRandomNumber(29); - Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_currentVocId); - _vm->_soundManager.startVOCPlay(fname); + Common::String fname = _vm->_soundManager->getVOCFileName(_vm->_currentVocId); + _vm->_soundManager->startVOCPlay(fname); _vm->_eventsManager.getMouseInfo(); _vm->_graphicsManager.setColor(240, 220, 220, 220); @@ -1358,9 +1358,9 @@ int ThreadResource::doInterface() { _vm->doScroll(_vm->_mansionViewPos); _vm->checkPhoneCall(); - if (!_vm->_soundManager.getVOCStatus()) { + if (!_vm->_soundManager->getVOCStatus()) { _vm->_currentVocId = 151 - _vm->getRandomNumber(5); - _vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId)); + _vm->_soundManager->startVOCPlay(_vm->_soundManager->getVOCFileName(_vm->_currentVocId)); } // Calculate the mouse position within the entire mansion @@ -1436,7 +1436,7 @@ int ThreadResource::doInterface() { if (_vm->_voy->_transitionId == 15) { regionIndex = 20; _vm->_voy->_transitionId = 17; - _vm->_soundManager.stopVOCPlay(); + _vm->_soundManager->stopVOCPlay(); _vm->checkTransition(); _vm->_eventsManager._leftClick = true; } else { @@ -1464,7 +1464,7 @@ int ThreadResource::doInterface() { _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); if (_vm->_currentVocId != -1) - _vm->_soundManager.stopVOCPlay(); + _vm->_soundManager->stopVOCPlay(); return !_vm->_eventsManager._rightClick ? regionIndex : -2; } @@ -1610,7 +1610,7 @@ void ThreadResource::freeTheApt() { _vm->_graphicsManager.fadeUpICF1(); if (_vm->_currentVocId != -1) { - _vm->_soundManager.stopVOCPlay(); + _vm->_soundManager->stopVOCPlay(); _vm->_currentVocId = -1; } -- cgit v1.2.3 From 9f74d13c57033f5cf60b711021f0b0b1e8697f9e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Feb 2014 07:29:49 +0100 Subject: VOYEUR: Remove setVm from EventManager --- engines/voyeur/files_threads.cpp | 164 +++++++++++++++++++-------------------- 1 file changed, 82 insertions(+), 82 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index b03e9ac99c..385e61ecee 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -327,7 +327,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy->_boltGroupId2 = -1; _vm->_voy->_computerTextId = -1; _vm->_voy->_eventFlags &= ~EVTFLAG_8; - _vm->_eventsManager._videoDead = -1; + _vm->_eventsManager->_videoDead = -1; // Reset hotspot data _vm->_voy->_videoHotspotTimes.reset(); @@ -372,8 +372,8 @@ void ThreadResource::parsePlayCommands() { _vm->playAudio(_vm->_audioVideoId); _vm->_voy->addAudioEventEnd(); - _vm->_eventsManager.incrementTime(1); - _vm->_eventsManager.incrementTime(1); + _vm->_eventsManager->incrementTime(1); + _vm->_eventsManager->incrementTime(1); _vm->_audioVideoId = -1; parseIndex = 999; } @@ -404,19 +404,19 @@ void ThreadResource::parsePlayCommands() { _vm->_voy->_eventFlags &= ~EVTFLAG_RECORDING; _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; _vm->_voy->addVideoEventEnd(); - _vm->_eventsManager.incrementTime(1); + _vm->_eventsManager->incrementTime(1); _vm->_audioVideoId = -1; _vm->_playStampGroupId = -1; - if (_vm->_eventsManager._videoDead != -1) { + if (_vm->_eventsManager->_videoDead != -1) { _vm->_bVoy->freeBoltGroup(0xE00); - _vm->_eventsManager._videoDead = -1; + _vm->_eventsManager->_videoDead = -1; _vm->flipPageAndWait(); } - _vm->_eventsManager._videoDead = -1; - if (_stateCount == 2 && _vm->_eventsManager._mouseClicked == 0) { + _vm->_eventsManager->_videoDead = -1; + if (_stateCount == 2 && _vm->_eventsManager->_mouseClicked == 0) { _vm->_voy->_playStampMode = 132; parseIndex = 999; } else { @@ -452,7 +452,7 @@ void ThreadResource::parsePlayCommands() { } else { int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size() / 2; _vm->_soundManager->stopVOCPlay(); - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->getMouseInfo(); for (int i = 0; i < count; ++i) { pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2)._picResource; @@ -471,18 +471,18 @@ void ThreadResource::parsePlayCommands() { Common::String file = Common::String::format("news%d.voc", i + 1); _vm->_soundManager->startVOCPlay(file); - while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && + while (!_vm->shouldQuit() && !_vm->_eventsManager->_mouseClicked && _vm->_soundManager->getVOCStatus()) { - _vm->_eventsManager.delayClick(1); - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->delayClick(1); + _vm->_eventsManager->getMouseInfo(); } _vm->_soundManager->stopVOCPlay(); if (i == (count - 1)) - _vm->_eventsManager.delayClick(480); + _vm->_eventsManager->delayClick(480); - if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked) + if (_vm->shouldQuit() || _vm->_eventsManager->_mouseClicked) break; } @@ -957,7 +957,7 @@ int ThreadResource::doApt() { _vm->_voy->_viewBounds = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._rectResource; Common::Array &hotspots = _vm->_bVoy->boltEntry( _vm->_playStampGroupId + 1)._rectResource->_entries; - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->getMouseInfo(); // Very first time apartment is shown, start the phone message if (_aptPos.x == -1) { @@ -973,7 +973,7 @@ int ThreadResource::doApt() { _aptPos.y = hotspots[4].top + 28; } - _vm->_eventsManager.setMousePos(Common::Point(_aptPos.x, _aptPos.y)); + _vm->_eventsManager->setMousePos(Common::Point(_aptPos.x, _aptPos.y)); _vm->_soundManager->startVOCPlay(_vm->_soundManager->getVOCFileName(_vm->_currentVocId)); _vm->_currentVocId = 151; @@ -982,7 +982,7 @@ int ThreadResource::doApt() { _vm->_graphicsManager.setColor(131, 215, 215, 215); _vm->_graphicsManager.setColor(132, 235, 235, 235); - _vm->_eventsManager._intPtr._hasPalette = true; + _vm->_eventsManager->_intPtr._hasPalette = true; // Main loop to allow users to move the cursor and select hotspots int hotspotId; @@ -1000,7 +1000,7 @@ int ThreadResource::doApt() { _vm->_loadGameSlot = -1; } - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->getMouseInfo(); if (!_vm->_soundManager->getVOCStatus()) { // Previous sound ended, so start up a new one _vm->_currentVocId = 151 - _vm->getRandomNumber(4); @@ -1009,7 +1009,7 @@ int ThreadResource::doApt() { // Loop through the hotspot list hotspotId = -1; - pt = _vm->_eventsManager.getMousePos(); + pt = _vm->_eventsManager->getMousePos(); for (int idx = 0; idx < (int)hotspots.size(); ++idx) { if (hotspots[idx].contains(pt)) { // Cursor is within hotspot area @@ -1049,15 +1049,15 @@ int ThreadResource::doApt() { _vm->flipPageAndWait(); - if (hotspotId == 42 && _vm->_eventsManager._leftClick) { + if (hotspotId == 42 && _vm->_eventsManager->_leftClick) { // Show the ScummVM GMM - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->getMouseInfo(); _vm->openMainMenuDialog(); } - } while (!_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || hotspotId == -1)); + } while (!_vm->shouldQuit() && (!_vm->_eventsManager->_leftClick || hotspotId == -1)); - pt = _vm->_eventsManager.getMousePos(); + pt = _vm->_eventsManager->getMousePos(); _aptPos.x = pt.x; _aptPos.y = pt.y; @@ -1112,13 +1112,13 @@ void ThreadResource::doRoom() { PictureResource *crosshairsCursor = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource; PictureResource *magnifierCursor = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource; - vm._eventsManager.showCursor(); + vm._eventsManager->showCursor(); RectResource viewBounds(48, 38, 336, 202); voy._viewBounds = &viewBounds; - vm._eventsManager.getMouseInfo(); - vm._eventsManager.setMousePos(Common::Point(192, 120)); + vm._eventsManager->getMouseInfo(); + vm._eventsManager->setMousePos(Common::Point(192, 120)); voy._fadingType = 0; vm._currentVocId = 146; voy._musicStartTime = voy._RTVNum; @@ -1131,7 +1131,7 @@ void ThreadResource::doRoom() { while (!vm.shouldQuit() && !breakFlag) { _vm->_voyeurArea = AREA_ROOM; vm._graphicsManager.setColor(128, 0, 255, 0); - vm._eventsManager._intPtr._hasPalette = true; + vm._eventsManager->_intPtr._hasPalette = true; do { if (vm._currentVocId != -1 && !vm._soundManager->getVOCStatus()) { @@ -1140,8 +1140,8 @@ void ThreadResource::doRoom() { vm._soundManager->startVOCPlay(vm._currentVocId); } - vm._eventsManager.getMouseInfo(); - Common::Point pt = vm._eventsManager.getMousePos(); + vm._eventsManager->getMouseInfo(); + Common::Point pt = vm._eventsManager->getMousePos(); pt += Common::Point(30, 15); hotspotId = -1; @@ -1159,33 +1159,33 @@ void ThreadResource::doRoom() { } if (hotspotId == -1) { - vm._eventsManager.setCursorColor(128, 0); - vm._eventsManager.setCursor(crosshairsCursor); + vm._eventsManager->setCursorColor(128, 0); + vm._eventsManager->setCursor(crosshairsCursor); } else if (hotspotId != 999 || voy._RTVNum < voy._computerTimeMin || (voy._computerTimeMax - 2) < voy._RTVNum) { - vm._eventsManager.setCursorColor(128, 1); - vm._eventsManager.setCursor(magnifierCursor); + vm._eventsManager->setCursorColor(128, 1); + vm._eventsManager->setCursor(magnifierCursor); } else { - vm._eventsManager.setCursorColor(128, 2); - vm._eventsManager.setCursor(magnifierCursor); + vm._eventsManager->setCursorColor(128, 2); + vm._eventsManager->setCursor(magnifierCursor); } - vm._eventsManager._intPtr._hasPalette = true; + vm._eventsManager->_intPtr._hasPalette = true; vm._graphicsManager.flipPage(); - vm._eventsManager.sWaitFlip(); - } while (!vm.shouldQuit() && !vm._eventsManager._mouseClicked); + vm._eventsManager->sWaitFlip(); + } while (!vm.shouldQuit() && !vm._eventsManager->_mouseClicked); - if (!vm._eventsManager._leftClick || hotspotId == -1) { - if (vm._eventsManager._rightClick) + if (!vm._eventsManager->_leftClick || hotspotId == -1) { + if (vm._eventsManager->_rightClick) breakFlag = true; - Common::Point pt = vm._eventsManager.getMousePos(); - vm._eventsManager.getMouseInfo(); - vm._eventsManager.setMousePos(pt); + Common::Point pt = vm._eventsManager->getMousePos(); + vm._eventsManager->getMouseInfo(); + vm._eventsManager->setMousePos(pt); } else { voy._eventFlags |= EVTFLAG_RECORDING; - vm._eventsManager.hideCursor(); - vm._eventsManager.startCursorBlink(); + vm._eventsManager->hideCursor(); + vm._eventsManager->startCursorBlink(); if (hotspotId == 999) { _vm->flipPageAndWait(); @@ -1200,8 +1200,8 @@ void ThreadResource::doRoom() { vm._voy->addComputerEventStart(); - vm._eventsManager._mouseClicked = false; - vm._eventsManager.startCursorBlink(); + vm._eventsManager->_mouseClicked = false; + vm._eventsManager->startCursorBlink(); int totalChars = vm.doComputerText(9999); if (totalChars) @@ -1213,8 +1213,8 @@ void ThreadResource::doRoom() { } voy._eventFlags &= ~EVTFLAG_RECORDING; - if (!vm._eventsManager._mouseClicked) - vm._eventsManager.delayClick(18000); + if (!vm._eventsManager->_mouseClicked) + vm._eventsManager->delayClick(18000); // WORKAROUND: Skipped code from the original, that freed the group, // reloaded it, and reloaded the cursors @@ -1228,9 +1228,9 @@ void ThreadResource::doRoom() { vm._graphicsManager._backColors->startFade(); _vm->flipPageAndWait(); - while (!vm.shouldQuit() && (vm._eventsManager._fadeStatus & 1)) - vm._eventsManager.delay(1); - vm._eventsManager.hideCursor(); + while (!vm.shouldQuit() && (vm._eventsManager->_fadeStatus & 1)) + vm._eventsManager->delay(1); + vm._eventsManager->hideCursor(); while (!vm.shouldQuit() && voy._fadingAmount2 > 0) { if (voy._fadingAmount1 < 63) { @@ -1245,19 +1245,19 @@ void ThreadResource::doRoom() { voy._fadingAmount2 = 0; } - vm._eventsManager.delay(1); + vm._eventsManager->delay(1); } _vm->flipPageAndWait(); vm._graphicsManager.fadeUpICF1(); voy._eventFlags &= EVTFLAG_RECORDING; - vm._eventsManager.showCursor(); + vm._eventsManager->showCursor(); } } voy._eventFlags = EVTFLAG_TIME_DISABLED; - vm._eventsManager.incrementTime(1); + vm._eventsManager->incrementTime(1); voy._viewBounds = nullptr; voy._fadingType = 0; vm.makeViewFinderP(); @@ -1277,7 +1277,7 @@ void ThreadResource::doRoom() { vm._currentVocId = -1; } - vm._eventsManager.hideCursor(); + vm._eventsManager->hideCursor(); chooseSTAMPButton(0); } @@ -1293,8 +1293,8 @@ int ThreadResource::doInterface() { _vm->_voy->_eventFlags &= ~EVTFLAG_100; _vm->_playStampGroupId = -1; - _vm->_eventsManager._intPtr._flashStep = 1; - _vm->_eventsManager._intPtr._flashTimer = 0; + _vm->_eventsManager->_intPtr._flashStep = 1; + _vm->_eventsManager->_intPtr._flashTimer = 0; if (_vm->_voy->_RTVNum >= _vm->_voy->_RTVLimit || _vm->_voy->_RTVNum < 0) _vm->_voy->_RTVNum = _vm->_voy->_RTVLimit - 1; @@ -1310,7 +1310,7 @@ int ThreadResource::doInterface() { while (!_vm->shouldQuit() && _vm->_voy->_RTVNum < _vm->_voy->_RTVLimit) { _vm->flashTimeBar(); - _vm->_eventsManager.delayClick(1); + _vm->_eventsManager->delayClick(1); } _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; @@ -1320,7 +1320,7 @@ int ThreadResource::doInterface() { _vm->checkTransition(); _vm->makeViewFinder(); - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->getMouseInfo(); _vm->initIFace(); Common::Array *hotspots = &_vm->_bVoy->boltEntry( @@ -1330,10 +1330,10 @@ int ThreadResource::doInterface() { Common::String fname = _vm->_soundManager->getVOCFileName(_vm->_currentVocId); _vm->_soundManager->startVOCPlay(fname); - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->getMouseInfo(); _vm->_graphicsManager.setColor(240, 220, 220, 220); - _vm->_eventsManager._intPtr._hasPalette = true; + _vm->_eventsManager->_intPtr._hasPalette = true; _vm->_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED; // Set the cusor @@ -1342,7 +1342,7 @@ int ThreadResource::doInterface() { PictureResource *listenCursor = _vm->_bVoy->boltEntry(0x114)._picResource; PictureResource *mangifyCursor = _vm->_bVoy->boltEntry(0x115)._picResource; - _vm->_eventsManager.setCursor(crosshairsCursor); + _vm->_eventsManager->setCursor(crosshairsCursor); // Main loop int regionIndex = 0; @@ -1352,7 +1352,7 @@ int ThreadResource::doInterface() { do { _vm->_voyeurArea = AREA_INTERFACE; _vm->doTimeBar(); - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->getMouseInfo(); if (checkMansionScroll()) _vm->doScroll(_vm->_mansionViewPos); @@ -1364,7 +1364,7 @@ int ThreadResource::doInterface() { } // Calculate the mouse position within the entire mansion - pt = _vm->_eventsManager.getMousePos(); + pt = _vm->_eventsManager->getMousePos(); if (!mansionViewBounds.contains(pt)) pt = Common::Point(-1, -1); else @@ -1378,13 +1378,13 @@ int ThreadResource::doInterface() { for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { if (_vm->_voy->_audioHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy->_RTVNum)) { // Set the ear cursor for an audio event - _vm->_eventsManager.setCursor(listenCursor); + _vm->_eventsManager->setCursor(listenCursor); regionIndex = hotspotIdx; } if (_vm->_voy->_evidenceHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy->_RTVNum)) { // Set the magnifier cursor for an evidence event - _vm->_eventsManager.setCursor(mangifyCursor); + _vm->_eventsManager->setCursor(mangifyCursor); regionIndex = hotspotIdx; } } @@ -1392,7 +1392,7 @@ int ThreadResource::doInterface() { for (int arrIndex = 0; arrIndex < 8; ++arrIndex) { if (_vm->_voy->_videoHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy->_RTVNum)) { // Set the eye cursor for a video event - _vm->_eventsManager.setCursor(eyeCursor); + _vm->_eventsManager->setCursor(eyeCursor); regionIndex = hotspotIdx; } } @@ -1401,7 +1401,7 @@ int ThreadResource::doInterface() { if (regionIndex == -1) { // Reset back to the crosshairs cursor - _vm->_eventsManager.setCursor(crosshairsCursor); + _vm->_eventsManager->setCursor(crosshairsCursor); } // Regularly update the time display @@ -1427,18 +1427,18 @@ int ThreadResource::doInterface() { _vm->_voy->_RTANum = 0; _vm->flipPageAndWait(); - pt = _vm->_eventsManager.getMousePos(); + pt = _vm->_eventsManager->getMousePos(); if ((_vm->_voy->_RTVNum >= _vm->_voy->_RTVLimit) || ((_vm->_voy->_eventFlags & 0x80) && - _vm->_eventsManager._rightClick && (pt.x == 0))) { + _vm->_eventsManager->_rightClick && (pt.x == 0))) { // Time to transition to the next time period - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->getMouseInfo(); if (_vm->_voy->_transitionId == 15) { regionIndex = 20; _vm->_voy->_transitionId = 17; _vm->_soundManager->stopVOCPlay(); _vm->checkTransition(); - _vm->_eventsManager._leftClick = true; + _vm->_eventsManager->_leftClick = true; } else { _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; @@ -1450,27 +1450,27 @@ int ThreadResource::doInterface() { _vm->initIFace(); hotspots = &_vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._rectResource->_entries; - _vm->_eventsManager.getMouseInfo(); + _vm->_eventsManager->getMouseInfo(); _vm->_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED; - _vm->_eventsManager._intPtr._flashStep = 1; - _vm->_eventsManager._intPtr._flashTimer = 0; + _vm->_eventsManager->_intPtr._flashStep = 1; + _vm->_eventsManager->_intPtr._flashTimer = 0; } } - } while (!_vm->_eventsManager._rightClick && !_vm->shouldQuit() && - (!_vm->_eventsManager._leftClick || regionIndex == -1)); + } while (!_vm->_eventsManager->_rightClick && !_vm->shouldQuit() && + (!_vm->_eventsManager->_leftClick || regionIndex == -1)); - _vm->_eventsManager.hideCursor(); + _vm->_eventsManager->hideCursor(); _vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED; _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); if (_vm->_currentVocId != -1) _vm->_soundManager->stopVOCPlay(); - return !_vm->_eventsManager._rightClick ? regionIndex : -2; + return !_vm->_eventsManager->_rightClick ? regionIndex : -2; } bool ThreadResource::checkMansionScroll() { - Common::Point pt = _vm->_eventsManager.getMousePos() - + Common::Point pt = _vm->_eventsManager->getMousePos() - Common::Point(MANSION_VIEW_X, MANSION_VIEW_Y); Common::Point &viewPos = _vm->_mansionViewPos; bool result = false; @@ -1689,7 +1689,7 @@ void ThreadResource::doAptAnim(int mode) { pal->startFade(); _vm->flipPageAndWait(); - _vm->_eventsManager.delayClick(5); + _vm->_eventsManager->delayClick(5); } _vm->_bVoy->freeBoltGroup(id); -- cgit v1.2.3 From e44690dae93605aaf466d335ef6dc4c64f2b132a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Feb 2014 08:15:29 +0100 Subject: VOYEUR: Remove setVm from GraphicsManager --- engines/voyeur/files_threads.cpp | 74 ++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'engines/voyeur/files_threads.cpp') diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 385e61ecee..603eb64a35 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -458,7 +458,7 @@ void ThreadResource::parsePlayCommands() { pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2)._picResource; pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2 + 1)._cMapResource; - (*_vm->_graphicsManager._vPort)->setupViewPort(pic); + (*_vm->_graphicsManager->_vPort)->setupViewPort(pic); pal->startFade(); _vm->flipPageAndWaitForFade(); @@ -977,10 +977,10 @@ int ThreadResource::doApt() { _vm->_soundManager->startVOCPlay(_vm->_soundManager->getVOCFileName(_vm->_currentVocId)); _vm->_currentVocId = 151; - _vm->_graphicsManager.setColor(129, 82, 82, 82); - _vm->_graphicsManager.setColor(130, 112, 112, 112); - _vm->_graphicsManager.setColor(131, 215, 215, 215); - _vm->_graphicsManager.setColor(132, 235, 235, 235); + _vm->_graphicsManager->setColor(129, 82, 82, 82); + _vm->_graphicsManager->setColor(130, 112, 112, 112); + _vm->_graphicsManager->setColor(131, 215, 215, 215); + _vm->_graphicsManager->setColor(132, 235, 235, 235); _vm->_eventsManager->_intPtr._hasPalette = true; @@ -1030,7 +1030,7 @@ int ThreadResource::doApt() { // Draw the text description for the highlighted hotspot pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + hotspotId + 6)._picResource; - _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, + _vm->_graphicsManager->sDrawPic(pic, *_vm->_graphicsManager->_vPort, Common::Point(106, 200)); } @@ -1045,7 +1045,7 @@ int ThreadResource::doApt() { // Draw either standard or highlighted eye cursor pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStampGroupId + 2 : _vm->_playStampGroupId + 3)._picResource; - _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, pt); + _vm->_graphicsManager->sDrawPic(pic, *_vm->_graphicsManager->_vPort, pt); _vm->flipPageAndWait(); @@ -1098,10 +1098,10 @@ void ThreadResource::doRoom() { if (!vm._bVoy->getBoltGroup(vm._playStampGroupId, true)) return; - vm._graphicsManager._backColors = vm._bVoy->boltEntry(vm._playStampGroupId + 1)._cMapResource; - vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(vm._playStampGroupId)._picResource; - (*vm._graphicsManager._vPort)->setupViewPort(vm._graphicsManager._backgroundPage); - vm._graphicsManager._backColors->startFade(); + vm._graphicsManager->_backColors = vm._bVoy->boltEntry(vm._playStampGroupId + 1)._cMapResource; + vm._graphicsManager->_backgroundPage = vm._bVoy->boltEntry(vm._playStampGroupId)._picResource; + (*vm._graphicsManager->_vPort)->setupViewPort(vm._graphicsManager->_backgroundPage); + vm._graphicsManager->_backColors->startFade(); voy._fadingStep1 = 2; voy._fadingStep2 = 0; @@ -1130,7 +1130,7 @@ void ThreadResource::doRoom() { bool breakFlag = false; while (!vm.shouldQuit() && !breakFlag) { _vm->_voyeurArea = AREA_ROOM; - vm._graphicsManager.setColor(128, 0, 255, 0); + vm._graphicsManager->setColor(128, 0, 255, 0); vm._eventsManager->_intPtr._hasPalette = true; do { @@ -1171,7 +1171,7 @@ void ThreadResource::doRoom() { } vm._eventsManager->_intPtr._hasPalette = true; - vm._graphicsManager.flipPage(); + vm._graphicsManager->flipPage(); vm._eventsManager->sWaitFlip(); } while (!vm.shouldQuit() && !vm._eventsManager->_mouseClicked); @@ -1219,13 +1219,13 @@ void ThreadResource::doRoom() { // WORKAROUND: Skipped code from the original, that freed the group, // reloaded it, and reloaded the cursors - vm._graphicsManager._backColors = vm._bVoy->boltEntry( + vm._graphicsManager->_backColors = vm._bVoy->boltEntry( vm._playStampGroupId + 1)._cMapResource; - vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry( + vm._graphicsManager->_backgroundPage = vm._bVoy->boltEntry( vm._playStampGroupId)._picResource; - (*vm._graphicsManager._vPort)->setupViewPort(); - vm._graphicsManager._backColors->startFade(); + (*vm._graphicsManager->_vPort)->setupViewPort(); + vm._graphicsManager->_backColors->startFade(); _vm->flipPageAndWait(); while (!vm.shouldQuit() && (vm._eventsManager->_fadeStatus & 1)) @@ -1250,7 +1250,7 @@ void ThreadResource::doRoom() { _vm->flipPageAndWait(); - vm._graphicsManager.fadeUpICF1(); + vm._graphicsManager->fadeUpICF1(); voy._eventFlags &= EVTFLAG_RECORDING; vm._eventsManager->showCursor(); } @@ -1332,7 +1332,7 @@ int ThreadResource::doInterface() { _vm->_soundManager->startVOCPlay(fname); _vm->_eventsManager->getMouseInfo(); - _vm->_graphicsManager.setColor(240, 220, 220, 220); + _vm->_graphicsManager->setColor(240, 220, 220, 220); _vm->_eventsManager->_intPtr._hasPalette = true; _vm->_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED; @@ -1406,20 +1406,20 @@ int ThreadResource::doInterface() { // Regularly update the time display if (_vm->_voy->_RTANum & 2) { - _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, + _vm->_graphicsManager->drawANumber(*_vm->_graphicsManager->_vPort, _vm->_gameMinute / 10, Common::Point(190, 25)); - _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, + _vm->_graphicsManager->drawANumber(*_vm->_graphicsManager->_vPort, _vm->_gameMinute % 10, Common::Point(201, 25)); if (_vm->_voy->_RTANum & 4) { int v = _vm->_gameHour / 10; - _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, + _vm->_graphicsManager->drawANumber(*_vm->_graphicsManager->_vPort, v == 0 ? 10 : v, Common::Point(161, 25)); - _vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, + _vm->_graphicsManager->drawANumber(*_vm->_graphicsManager->_vPort, _vm->_gameHour % 10, Common::Point(172, 25)); pic = _vm->_bVoy->boltEntry(_vm->_voy->_isAM ? 272 : 273)._picResource; - _vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, + _vm->_graphicsManager->sDrawPic(pic, *_vm->_graphicsManager->_vPort, Common::Point(215, 27)); } } @@ -1585,16 +1585,16 @@ void ThreadResource::loadTheApt() { doAptAnim(1); _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId); _vm->_voy->_aptLoadMode = -1; - _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( + _vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry( _vm->_playStampGroupId + 5)._picResource; - (*_vm->_graphicsManager._vPort)->setupViewPort( - _vm->_graphicsManager._backgroundPage); + (*_vm->_graphicsManager->_vPort)->setupViewPort( + _vm->_graphicsManager->_backgroundPage); } else { _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId); - _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( + _vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry( _vm->_playStampGroupId + 5)._picResource; - (*_vm->_graphicsManager._vPort)->setupViewPort( - _vm->_graphicsManager._backgroundPage); + (*_vm->_graphicsManager->_vPort)->setupViewPort( + _vm->_graphicsManager->_backgroundPage); } CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 4)._cMapResource; @@ -1604,10 +1604,10 @@ void ThreadResource::loadTheApt() { } void ThreadResource::freeTheApt() { - _vm->_graphicsManager.fadeDownICF1(5); + _vm->_graphicsManager->fadeDownICF1(5); _vm->flipPageAndWaitForFade(); - _vm->_graphicsManager.fadeUpICF1(); + _vm->_graphicsManager->fadeUpICF1(); if (_vm->_currentVocId != -1) { _vm->_soundManager->stopVOCPlay(); @@ -1615,17 +1615,17 @@ void ThreadResource::freeTheApt() { } if (_vm->_voy->_aptLoadMode == -1) { - _vm->_graphicsManager.fadeDownICF(6); + _vm->_graphicsManager->fadeDownICF(6); } else { doAptAnim(2); } if (_vm->_voy->_aptLoadMode == 140) { - _vm->_graphicsManager.screenReset(); - _vm->_graphicsManager.resetPalette(); + _vm->_graphicsManager->screenReset(); + _vm->_graphicsManager->resetPalette(); } - (*_vm->_graphicsManager._vPort)->setupViewPort(nullptr); + (*_vm->_graphicsManager->_vPort)->setupViewPort(nullptr); _vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId); _vm->_playStampGroupId = -1; _vm->_voy->_viewBounds = nullptr; @@ -1685,7 +1685,7 @@ void ThreadResource::doAptAnim(int mode) { for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) { PictureResource *pic = _vm->_bVoy->boltEntry(id + idx + 1)._picResource; - (*_vm->_graphicsManager._vPort)->setupViewPort(pic); + (*_vm->_graphicsManager->_vPort)->setupViewPort(pic); pal->startFade(); _vm->flipPageAndWait(); -- cgit v1.2.3