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/events.cpp | 2 -- engines/voyeur/events.h | 6 ++--- engines/voyeur/files_threads.cpp | 41 ++++++++++++++++--------------- engines/voyeur/sound.cpp | 2 +- engines/voyeur/staticres.cpp | 6 +++++ engines/voyeur/staticres.h | 6 +++++ engines/voyeur/voyeur.cpp | 7 ++++-- engines/voyeur/voyeur.h | 3 +++ engines/voyeur/voyeur_game.cpp | 52 +++++++++++++++++++++++++++++++++------- 9 files changed, 86 insertions(+), 39 deletions(-) diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index 866706daa5..e5755399ef 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -88,8 +88,6 @@ EventsManager::EventsManager(): _intPtr(_gameData), Common::fill(&_keyState[0], &_keyState[256], false); _v2A0A2 = 0; - _videoComputerNum = 0; - _videoComputerBut1 = 0; _videoComputerBut4 = 0; _videoDead = 0; } diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index b341a238a9..9313ba3a56 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -63,7 +63,7 @@ public: class SVoy { public: - int _delaySecs; + int _isAM; int _RTANum; int _RTVNum; int _switchBGNum; @@ -81,7 +81,7 @@ public: int _field46E; int _field470; int _field472; - int _field474; + int _checkTransitionId; int _field476; int _field478; int _field47A; @@ -192,8 +192,6 @@ public: int _fadeStatus; int _v2A0A2; - int _videoComputerNum; - int _videoComputerBut1; int _videoComputerBut4; int _videoDead; public: 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 diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp index baad356c07..1cd0cf3c00 100644 --- a/engines/voyeur/sound.cpp +++ b/engines/voyeur/sound.cpp @@ -53,7 +53,7 @@ void SoundManager::abortVOCMap() { } void SoundManager::stopVOCPlay() { - warning("TODO: stopVOCPlay()"); + _mixer->stopHandle(_soundHandle); } void SoundManager::setVOCOffset(int offset) { diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp index 0056bbee22..b6f373078b 100644 --- a/engines/voyeur/staticres.cpp +++ b/engines/voyeur/staticres.cpp @@ -105,4 +105,10 @@ const char *const VOC_FILENAMES[] = { "Q1240100", "E1325100" }; +const char *const SATURDAY = "Saturday"; +const char *const SUNDAY = "Sunday"; +const char *const MONDAY = "Monday Morning"; +const char *const AM = "am"; +const char *const PM = "pm"; + } // End of namespace Voyeur diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h index 505b64411e..990e2cf72a 100644 --- a/engines/voyeur/staticres.h +++ b/engines/voyeur/staticres.h @@ -41,6 +41,12 @@ extern const int COMP_BUT_TABLE[]; extern const char *const VOC_FILENAMES[]; +extern const char *const SATURDAY; +extern const char *const SUNDAY; +extern const char *const MONDAY; +extern const char *const AM; +extern const char *const PM; + } // End of namespace Voyeur #endif diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index bb8b137b3e..1c8c185f78 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -44,6 +44,9 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) _controlPtr = NULL; _bob = false; _playStamp1 = _playStamp2 = 0; + _checkTransitionId = -1; + _gameHour = 0; + _gameMinute = 0; initialiseManagers(); } @@ -489,8 +492,8 @@ void VoyeurEngine::doOpening() { _voy._RTVNum = 0; _voy._field468 = _voy._RTVNum; _voy._field478 = 16; - _eventsManager._videoComputerNum = 4; - _eventsManager._videoComputerBut1 = 0; + _eventsManager._gameHour = 4; + _eventsManager._gameMinute = 0; _eventsManager._videoComputerBut4 = 1; _eventsManager._videoDead = -1; addVideoEventStart(); diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index 5d0c26787d..f35af7d17c 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -117,6 +117,9 @@ public: int _playStamp2; const int *_resolvePtr; int _iForceDeath; + int _checkTransitionId; + int _gameHour; + int _gameMinute; public: VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc); virtual ~VoyeurEngine(); diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index 172150360d..54ff56863f 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -27,9 +27,9 @@ namespace Voyeur { void VoyeurEngine::addVideoEventStart() { VoyeurEvent &e = _voy._events[_voy._evidence[19]]; - e._computerNum = _eventsManager._videoComputerNum; - e._computerBut[0] = _eventsManager._videoComputerBut1; - e._computerBut[1] = _voy._delaySecs; + e._computerNum = _gameHour; + e._computerBut[0] = _gameMinute; + e._computerBut[1] = _voy._isAM; e._computerBut[2] = 1; e._computerBut[3] = _eventsManager._videoComputerBut4; e._dead = _eventsManager._videoDead; @@ -47,9 +47,9 @@ void VoyeurEngine::playStamp() { ThreadResource *threadP = threadsList->_entries[0]->_threadResource; threadP->initThreadStruct(0, 0); - _voy._delaySecs = 0; - _eventsManager._videoComputerNum = 9; - _eventsManager._videoComputerBut1 = 0; + _voy._isAM = 0; + _gameHour = 9; + _gameMinute = 0; _eventsManager._v2A0A2 = 0; _voy._field46E = 1; @@ -111,7 +111,7 @@ void VoyeurEngine::playStamp() { break; case 16: - _voy._field474 = 17; + _voy._checkTransitionId = 17; buttonId = threadP->doApt(); switch (buttonId) { @@ -134,7 +134,7 @@ void VoyeurEngine::playStamp() { case 17: doTapePlaying(); - if (!checkForMurder() && _voy._field474 <= 15) + if (!checkForMurder() && _voy._checkTransitionId <= 15) checkForIncriminate(); if (_voy._videoEventId != -1) @@ -268,7 +268,41 @@ void VoyeurEngine::initIFace(){ } void VoyeurEngine::checkTransition(){ - error("TODO: checkTransition"); + Common::String time, day; + + if (_voy._checkTransitionId != _checkTransitionId) { + switch (_voy._checkTransitionId) { + case 0: + break; + case 1: + case 2: + case 3: + case 4: + day = SATURDAY; + break; + case 17: + day = MONDAY; + break; + default: + day = SUNDAY; + break; + } + + if (!day.empty()) { + _graphicsManager.fadeDownICF(6); + + if (_voy._checkTransitionId != 17) { + const char *amPm = _voy._isAM ? AM : PM; + time = Common::String::format("%d:%02d%s", + _gameHour, _gameMinute, amPm); + } + + doTransitionCard(day, time); + _eventsManager.delay(180); + } + + _checkTransitionId = _voy._checkTransitionId; + } } void VoyeurEngine::doTimeBar(int v) { -- cgit v1.2.3