diff options
author | Paul Gilbert | 2013-12-10 09:19:54 -0500 |
---|---|---|
committer | Paul Gilbert | 2013-12-10 09:19:54 -0500 |
commit | 573e2c143dd34658c23f9c5820bb8eac0262ad9b (patch) | |
tree | bde06b8862f5fb05bada74f008492c0f79baaf21 /engines/voyeur | |
parent | 9cb1122a989b255e8944c07afdeed2175b2ee5cc (diff) | |
download | scummvm-rg350-573e2c143dd34658c23f9c5820bb8eac0262ad9b.tar.gz scummvm-rg350-573e2c143dd34658c23f9c5820bb8eac0262ad9b.tar.bz2 scummvm-rg350-573e2c143dd34658c23f9c5820bb8eac0262ad9b.zip |
VOYEUR: Start of implementing parsePlayCommands
Diffstat (limited to 'engines/voyeur')
-rw-r--r-- | engines/voyeur/events.cpp | 19 | ||||
-rw-r--r-- | engines/voyeur/events.h | 40 | ||||
-rw-r--r-- | engines/voyeur/files.cpp | 93 | ||||
-rw-r--r-- | engines/voyeur/files.h | 3 | ||||
-rw-r--r-- | engines/voyeur/sound.cpp | 16 | ||||
-rw-r--r-- | engines/voyeur/sound.h | 4 | ||||
-rw-r--r-- | engines/voyeur/staticres.cpp | 6 | ||||
-rw-r--r-- | engines/voyeur/staticres.h | 2 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 23 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 1 | ||||
-rw-r--r-- | engines/voyeur/voyeur_game.cpp | 50 |
11 files changed, 201 insertions, 56 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index 5edcf22d05..67471ad1b8 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -44,6 +44,19 @@ IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) { /*------------------------------------------------------------------------*/ +VoyeurEvent::VoyeurEvent(int v1, int v2, int v3, int v4, int v5, int v6, int v7) { + _computerNum = v1; + _computerBut[0] = v2; + _computerBut[1] = v3; + _computerBut[2] = v4; + _computerBut[3] = v5; + _computerOn = v6; + _dead = v7; +} + + +/*------------------------------------------------------------------------*/ + IntData::IntData() { _field9 = false; _flipWait = false; @@ -406,7 +419,7 @@ void EventsManager::mouseOff() { } void EventsManager::getMouseInfo() { - if (_vm->_voy._eCursorOff[58] & 0x10) { + if (_vm->_voy._field478 & 0x10) { if ((_gameCounter - _joe) > 8) { _joe = _gameCounter; @@ -433,4 +446,8 @@ void EventsManager::checkForKey() { warning("TODO: checkForKey"); } +void EventsManager::startCursorBlink() { + error("TODO: startCursorBlink"); +} + } // End of namespace Voyeur diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index c7bd52d59a..62ae6fd079 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -57,6 +57,8 @@ public: int _computerOn; int _computerOff; int _dead; +public: + VoyeurEvent(int v1, int v2, int v3, int v4, int v5, int v6, int v7); }; class SVoy { @@ -65,21 +67,25 @@ public: int _RTANum; int _RTVNum; int _switchBGNum; - int _group; - const int *_resolvePtr; - int _seconds; - int _minutes; - int _hours; - int _morning; - int _timeChangeFlag; - int _totalSeconds; - int _gameSeconds; - int _vCursorOn[160]; - int _vCursorOff[160]; - int _aCursorOn[60]; - int _aCursorOff[60]; - int _eCursorOn[60]; - int _eCursorOff[60]; + int _arr1[8][20]; + int _arr2[8][20]; + int _arr3[3][20]; + int _arr4[3][20]; + int _arr5[3][20]; + int _arr6[3][20]; + int _arr7[20]; + + int _field468; + int _field46A; + int _vocSecondsOffset; + int _field46E; + int _field470; + int _field472; + int _field474; + int _field478; + int _field47A; + int _field4F2; + int _timeStart; int _duration; int _vidStart; @@ -96,7 +102,8 @@ public: int _phones[5]; int _numPhonesUsed; int _evidence[20]; - VoyeurEvent _events[1000]; + + Common::Array<VoyeurEvent> _events; int _field4376; int _field4378; int _field437A; @@ -207,6 +214,7 @@ public: Common::Point getMousePos() { return _mousePos; } void getMouseInfo(); void checkForKey(); + void startCursorBlink(); }; } // End of namespace Voyeur diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index 6b0fc772d1..c8db3395f4 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -23,6 +23,7 @@ #include "voyeur/files.h" #include "voyeur/graphics.h" #include "voyeur/voyeur.h" +#include "voyeur/staticres.h" namespace Voyeur { @@ -1390,7 +1391,7 @@ bool ThreadResource::getStateInfo() { byte *baseP = _ctlPtr + fld; _field42 = READ_LE_UINT16(baseP); _field40 = READ_LE_UINT16(baseP + 2); - _field44 = READ_LE_UINT16(baseP + 4); + _parseCount = READ_LE_UINT16(baseP + 4); _field28E = getDataOffset(); _field28E += READ_LE_UINT32(baseP + 6) / 2; @@ -1536,10 +1537,93 @@ 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); + 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 0: + _vm->_playStamp2 = READ_LE_UINT16(dataP); + dataP += 2; + break; + case 1: + 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; + default: + break; + } + } } +#undef GET_WORD + int ThreadResource::doApt() { warning("TODO: doApt"); return 0; @@ -1554,6 +1638,13 @@ int ThreadResource::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)); +} + /*------------------------------------------------------------------------*/ PtrResource::PtrResource(BoltFilesState &state, const byte *src) { diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index f79c723733..12791cb8c0 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -430,6 +430,7 @@ private: const byte *getRecordOffset(const byte *p); const byte *getNextRecord(const byte *p); void cardAction(const byte *p); + void addAudioEventStart(); public: VoyeurEngine *_vm; @@ -442,7 +443,7 @@ public: int _field3E; int _field40; int _field42; - int _field44; + int _parseCount; uint32 _field46; byte *_field4A; byte _field4E[64]; diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp index f30fc649b8..752a35dcc8 100644 --- a/engines/voyeur/sound.cpp +++ b/engines/voyeur/sound.cpp @@ -55,4 +55,20 @@ void SoundManager::stopVOCPlay() { warning("TODO: stopVOCPlay()"); } +void SoundManager::setVOCOffset(int offset) { + error("TODO: setVOCOffset"); +} + +Common::String SoundManager::getVOCFileName(int idx) { + error("TODO: getVOCFileName"); +} + +void SoundManager::startVOCPlay(const Common::String &filename) { + error("TODO: startVOCPlay"); +} + +int SoundManager::getVOCStatus() { + error("TODO: getVOCStatus"); +} + } // End of namespace Voyeur diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h index 6f233e66d2..6de9804b8a 100644 --- a/engines/voyeur/sound.h +++ b/engines/voyeur/sound.h @@ -45,6 +45,10 @@ public: void continueVocMap(); void stopVOCPlay(); void abortVOCMap(); + void setVOCOffset(int offset); + Common::String getVOCFileName(int idx); + void startVOCPlay(const Common::String &filename); + int getVOCStatus(); }; } // End of namespace Voyeur diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp index a3a76b679f..f64cbdcc45 100644 --- a/engines/voyeur/staticres.cpp +++ b/engines/voyeur/staticres.cpp @@ -43,4 +43,10 @@ const int RESOLVE_TABLE[] = { 0x7500 }; +const int BLIND_TABLE[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 9, 10, 11, 1, 11, 5, 12, + 13, 16, 15, 16, 17, 18, 5, 6, 18, 17, 13, 13, 14, 14, + 5, 12, 6, 6, 13, 14, 13 +}; + } // End of namespace Voyeur diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h index 704ea35012..4cd00e4b7a 100644 --- a/engines/voyeur/staticres.h +++ b/engines/voyeur/staticres.h @@ -31,6 +31,8 @@ extern const int COMPUTER_DEFAULTS[]; extern const int RESOLVE_TABLE[]; +extern const int BLIND_TABLE[]; + } // End of namespace Voyeur #endif diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 58e94866b1..184026a044 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -91,7 +91,7 @@ Common::Error VoyeurEngine::run() { _eventsManager.resetMouse(); if (doHeadTitle()) { if (_iForceDeath >= 1 && _iForceDeath <= 4) - _voy._eCursorOff[58] |= 0x80; + _voy._field478 |= 0x80; playStamp(); } @@ -131,12 +131,11 @@ void VoyeurEngine::globalInitBolt() { // Setup default flags Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0); - _voy._eCursorOff[0x74 / 2] = 1; - _voy._eCursorOff[0x68 / 2] = 0; + _voy._field478 = 1; _voy._field4376 = NULL; // Original set 63h:63h - _voy._evidence[19] = 0; - _voy._evidence[17] = 0; - _voy._evidence[18] = 9999; + _voy._field4F2 = 9999; + _voy._field472 = -1; + _voy._field478 = 256; _voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; _eventsManager.addFadeInt(); @@ -184,7 +183,7 @@ bool VoyeurEngine::doHeadTitle() { _voy._incriminate = false; } - if (_voy._eCursorOff[58] & 0x80) { + if (_voy._field478 & 0x80) { // TODO: Check when these are called, and the two different loops. // Also, comptuerNu isn't an array in IDB? /* @@ -197,7 +196,7 @@ bool VoyeurEngine::doHeadTitle() { */ } - _voy._eCursorOff[55] = 140; + _voy._field472 = 140; return true; } @@ -483,17 +482,17 @@ void VoyeurEngine::doOpening() { int frmaeIndex = 0; int creditShow = 1; - _voy._eCursorOff[52] = 0; + _voy._vocSecondsOffset = 0; _voy._RTVNum = 0; - _voy._eCursorOff[50] = _voy._RTVNum; - _voy._eCursorOff[58] = 16; + _voy._field468 = _voy._RTVNum; + _voy._field478 = 16; _eventsManager._videoComputerNum = 4; _eventsManager._videoComputerBut1 = 0; _eventsManager._videoComputerBut4 = 1; _eventsManager._videoDead = -1; addVideoEventStart(); - _voy._eCursorOff[58] &= ~1; + _voy._field478 &= ~1; for (int i = 0; i < 256; ++i) _graphicsManager.setColor(i, 8, 8, 8); diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index a2bde98e72..9edabbf687 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -115,6 +115,7 @@ public: bool _bob; int _playStamp1; int _playStamp2; + const int *_resolvePtr; public: VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc); virtual ~VoyeurEngine(); diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index 4545a73416..1d453e36f4 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -40,7 +40,7 @@ void VoyeurEngine::playStamp() { _filesManager.openBoltLib("stampblt.blt", _stampLibPtr); _stampLibPtr->getBoltGroup(0x10000); - _voy._resolvePtr = &RESOLVE_TABLE[0]; + _resolvePtr = &RESOLVE_TABLE[0]; initStamp(); PtrResource *threadsList = _stampLibPtr->boltEntry(3)._ptrResource; @@ -51,7 +51,7 @@ void VoyeurEngine::playStamp() { _eventsManager._videoComputerNum = 9; _eventsManager._videoComputerBut1 = 0; _eventsManager._v2A0A2 = 0; - _voy._eCursorOff[53] = 1; + _voy._field46E = 1; int buttonId; bool breakFlag = false; @@ -62,31 +62,31 @@ void VoyeurEngine::playStamp() { threadP->parsePlayCommands(); - bool flag = breakFlag = (_voy._eCursorOff[58] & 2) != 0; - - switch (_voy._eCursorOff[54]) { + bool flag = breakFlag = (_voy._field478 & 2) != 0; + + switch (_voy._field470) { case 5: buttonId = threadP->doInterface(); if (buttonId == -2) { switch (doApt()) { case 0: - _voy._eCursorOff[55] = 140; + _voy._field472 = 140; break; case 1: - _voy._eCursorOff[58] = -2; - _voy._eCursorOff[53] = 1; + _voy._field478 = -2; + _voy._field46E = 1; threadP->chooseSTAMPButton(22); - _voy._eCursorOff[55] = 143; + _voy._field472 = 143; break; case 2: - _voy._eCursorOff[58] = -2; + _voy._field478 = -2; reviewTape(); - _voy._eCursorOff[53] = 1; - _voy._eCursorOff[55] = 142; + _voy._field46E = 1; + _voy._field472 = 142; break; case 3: - _voy._eCursorOff[58] = -2; + _voy._field478 = -2; threadP->chooseSTAMPButton(21); break; case 4: @@ -94,9 +94,9 @@ void VoyeurEngine::playStamp() { break; case 5: doGossip(); - _voy._eCursorOff[53] = 1; - _voy._eCursorOff[55] = 141; - _voy._eCursorOff[58] = -1; + _voy._field46E = 1; + _voy._field472 = 141; + _voy._field478 = -1; break; default: break; @@ -111,7 +111,7 @@ void VoyeurEngine::playStamp() { break; case 16: - _voy._eCursorOff[56] = 17; + _voy._field474 = 17; buttonId = threadP->doApt(); switch (buttonId) { @@ -121,7 +121,7 @@ void VoyeurEngine::playStamp() { break; case 2: reviewTape(); - _voy._eCursorOff[53] = 1; + _voy._field46E = 1; break; case 4: flag = true; @@ -134,12 +134,12 @@ void VoyeurEngine::playStamp() { case 17: doTapePlaying(); - if (!checkForMurder() && _voy._eCursorOff[56] <= 15) + if (!checkForMurder() && _voy._field474 <= 15) checkForIncriminate(); if (_voy._videoEventId != -1) playAVideoEvent(_voy._videoEventId); - _voy._eCursorOff[58] &= 0x10; + _voy._field478 &= 0x10; threadP->chooseSTAMPButton(0); break; @@ -159,13 +159,13 @@ void VoyeurEngine::playStamp() { flag = true; if (buttonId == 4) { - _voy._eCursorOff[54] = 131; + _voy._field470 = 131; _eventsManager.checkForKey(); threadP->chooseSTAMPButton(buttonId); flag = true; } else { threadP->chooseSTAMPButton(buttonId); - _voy._eCursorOff[53] = 1; + _voy._field46E = 1; } } break; @@ -184,9 +184,9 @@ void VoyeurEngine::playStamp() { _eventsManager._videoComputerBut4 = -1; - if (_voy._eCursorOff[59] != -1) { - _bVoy->freeBoltGroup(_voy._eCursorOff[59]); - _voy._eCursorOff[59] = -1; + if (_voy._field47A != -1) { + _bVoy->freeBoltGroup(_voy._field47A); + _voy._field47A = -1; } if (_playStamp1 != -1) { |