diff options
author | Paul Gilbert | 2013-12-20 22:51:31 -0500 |
---|---|---|
committer | Paul Gilbert | 2013-12-20 22:51:31 -0500 |
commit | 171d1594899e7064f2ebbbafd0f7b7858aaa2444 (patch) | |
tree | 9f22a3d3d1adc34649874137eb66a131ce542811 | |
parent | a73ea5c3dc0bfd8c5ad6909fcf74cb51fffe3702 (diff) | |
download | scummvm-rg350-171d1594899e7064f2ebbbafd0f7b7858aaa2444.tar.gz scummvm-rg350-171d1594899e7064f2ebbbafd0f7b7858aaa2444.tar.bz2 scummvm-rg350-171d1594899e7064f2ebbbafd0f7b7858aaa2444.zip |
VOYEUR: Implemented doRoom method
-rw-r--r-- | engines/voyeur/events.cpp | 4 | ||||
-rw-r--r-- | engines/voyeur/events.h | 5 | ||||
-rw-r--r-- | engines/voyeur/files_threads.cpp | 205 | ||||
-rw-r--r-- | engines/voyeur/sound.cpp | 4 | ||||
-rw-r--r-- | engines/voyeur/sound.h | 1 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 1 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 10 | ||||
-rw-r--r-- | engines/voyeur/voyeur_game.cpp | 42 |
8 files changed, 269 insertions, 3 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index e5755399ef..b28acfba0f 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -418,6 +418,10 @@ void EventsManager::mouseOff() { CursorMan.showMouse(false); } +void EventsManager::hideCursor() { + error("TODO: hideCursor"); +} + void EventsManager::getMouseInfo() { if (_vm->_voy._field478 & 0x10) { if ((_gameCounter - _joe) > 8) { diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index 0db1281706..494b90d6de 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -85,6 +85,10 @@ public: int _field476; int _field478; int _field47A; + int _field4AC; + int _field4AE[5]; + int _field4B8; + int _field4E2; Common::Rect _rect4E4; int _field4EC; @@ -216,6 +220,7 @@ public: void setCursorColor(int idx, int mode); void mouseOn(); void mouseOff(); + void hideCursor(); Common::Point getMousePos() { return _mousePos; } void getMouseInfo(); void checkForKey(); 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() { diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp index 1cd0cf3c00..e53716a70c 100644 --- a/engines/voyeur/sound.cpp +++ b/engines/voyeur/sound.cpp @@ -75,6 +75,10 @@ void SoundManager::startVOCPlay(const Common::String &filename) { _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream); } +void SoundManager::startVOCPlay(int soundId) { + startVOCPlay(getVOCFileName(soundId)); +} + int SoundManager::getVOCStatus() { return _mixer->isSoundHandleActive(_soundHandle); } diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h index 6de9804b8a..a73bd4a753 100644 --- a/engines/voyeur/sound.h +++ b/engines/voyeur/sound.h @@ -48,6 +48,7 @@ public: void setVOCOffset(int offset); Common::String getVOCFileName(int idx); void startVOCPlay(const Common::String &filename); + void startVOCPlay(int soundId); int getVOCStatus(); }; diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index fe2730700f..53698b2702 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -50,6 +50,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) _flashTimeVal = 0; _flashTimeFlag = false; _timeBarVal = -1; + _checkPhoneVal = 0; initialiseManagers(); } diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index b18a7c0b97..31f05fb2c2 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -74,7 +74,6 @@ private: void initBolt(); void vInitInterrupts(); void initInput(); - void addVideoEventStart(); bool doHeadTitle(); void showConversionScreen(); @@ -123,6 +122,7 @@ public: int _flashTimeVal; bool _flashTimeFlag; int _timeBarVal; + int _checkPhoneVal; public: VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc); virtual ~VoyeurEngine(); @@ -150,11 +150,19 @@ public: */ void saveLastInplay(); void makeViewFinder(); + void makeViewFinderP(); void initIFace(); void checkTransition(); + bool doComputerText(int v); + void getComputerBrush(); void doTimeBar(bool force); void flashTimeBar(); void checkPhoneCall(); + void doEvidDisplay(int v1, int v2); + + void addVideoEventStart(); + void addComputerEventEnd(); + void addPlainEvent(); }; } // End of namespace Voyeur diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index bdf4ee01a0..8ebb2c2563 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -35,6 +35,14 @@ void VoyeurEngine::addVideoEventStart() { e._dead = _eventsManager._videoDead; } +void VoyeurEngine::addComputerEventEnd() { + error("TODO: addComputerEventEnd"); +} + +void VoyeurEngine::addPlainEvent() { + error("TODO: addPlainEvent"); +} + void VoyeurEngine::playStamp() { _stampLibPtr = NULL; _filesManager.openBoltLib("stampblt.blt", _stampLibPtr); @@ -314,6 +322,10 @@ void VoyeurEngine::makeViewFinder() { _eventsManager._intPtr._hasPalette = true; } +void VoyeurEngine::makeViewFinderP() { + _graphicsManager.screenReset(); +} + void VoyeurEngine::initIFace(){ int playStamp1 = _playStamp1; switch (_voy._transitionId) { @@ -389,6 +401,14 @@ void VoyeurEngine::checkTransition(){ } } +bool VoyeurEngine::doComputerText(int v) { + error("TODO: doComputerText"); +} + +void VoyeurEngine::getComputerBrush() { + error("TODO: getComputerBrush"); +} + void VoyeurEngine::doTimeBar(bool force) { flashTimeBar(); @@ -435,7 +455,27 @@ void VoyeurEngine::flashTimeBar(){ } void VoyeurEngine::checkPhoneCall() { - error("TODO: checkPhoneCall"); + if ((_voy._field476 - _voy._RTVNum) >= 36 && _voy._field4B8 < 5 && + _playStamp2 <= 151 && _playStamp2 > 146) { + if ((_voy._switchBGNum < _checkPhoneVal || _checkPhoneVal > 180) && + !_soundManager.getVOCStatus()) { + int soundIndex; + do { + soundIndex = getRandomNumber(4); + } while (_voy._field4AE[soundIndex]); + _playStamp2 = 154 + soundIndex; + + _soundManager.stopVOCPlay(); + _soundManager.startVOCPlay(_playStamp2); + _checkPhoneVal = _voy._switchBGNum; + ++_voy._field4AE[soundIndex]; + ++_voy._field4B8; + } + } +} + +void VoyeurEngine::doEvidDisplay(int v1, int v2) { + error("TODO: doEvidDisplay"); } } // End of namespace Voyeur |