diff options
Diffstat (limited to 'engines/voyeur')
-rw-r--r-- | engines/voyeur/files_threads.cpp | 38 | ||||
-rw-r--r-- | engines/voyeur/sound.cpp | 2 | ||||
-rw-r--r-- | engines/voyeur/sound.h | 3 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 34 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 2 | ||||
-rw-r--r-- | engines/voyeur/voyeur_game.cpp | 58 |
6 files changed, 69 insertions, 68 deletions
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; } diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp index 30780c34f4..ae10b2d4d9 100644 --- a/engines/voyeur/sound.cpp +++ b/engines/voyeur/sound.cpp @@ -28,7 +28,7 @@ namespace Voyeur { -SoundManager::SoundManager(Audio::Mixer *mixer) { + SoundManager::SoundManager(VoyeurEngine *vm, Audio::Mixer *mixer) : _vm(vm) { _mixer = mixer; _vocOffset = 0; } diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h index d2845bb69f..fc2d3047eb 100644 --- a/engines/voyeur/sound.h +++ b/engines/voyeur/sound.h @@ -38,8 +38,7 @@ private: Audio::SoundHandle _soundHandle; int _vocOffset; public: - SoundManager(Audio::Mixer *mixer); - void setVm(VoyeurEngine *vm) { _vm = vm; } + SoundManager(VoyeurEngine *vm, Audio::Mixer *mixer); void playVOCMap(byte *voc, int vocSize); void stopVOCPlay(); diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index b1ead5a8c4..f6a192e699 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -36,11 +36,12 @@ namespace Voyeur { VoyeurEngine *g_vm; VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst), - _gameDescription(gameDesc), _randomSource("Voyeur"), _soundManager(_mixer), + _gameDescription(gameDesc), _randomSource("Voyeur"), _defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1, Common::Point(1, 1), 1, 0, 0) { - _voy = nullptr; _debugger = nullptr; + _soundManager = nullptr; + _voy = nullptr; _bVoy = NULL; _iForceDeath = ConfMan.getInt("boot_param"); @@ -69,6 +70,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) VoyeurEngine::~VoyeurEngine() { delete _bVoy; delete _voy; + delete _soundManager; delete _debugger; } @@ -99,8 +101,8 @@ void VoyeurEngine::initializeManagers() { _eventsManager.setVm(this); _filesManager.setVm(this); _graphicsManager.setVm(this); - _soundManager.setVm(this); _debugger = new Debugger(this); + _soundManager = new SoundManager(this, _mixer); _voy = new SVoy(this); } @@ -323,10 +325,10 @@ bool VoyeurEngine::doLock() { _eventsManager._mouseClicked = false; } while (!shouldQuit() && key == -1); - _soundManager.abortVOCMap(); - _soundManager.playVOCMap(buttonVoc, buttonVocSize); + _soundManager->abortVOCMap(); + _soundManager->playVOCMap(buttonVoc, buttonVocSize); - while (_soundManager.getVOCStatus()) { + while (_soundManager->getVOCStatus()) { if (shouldQuit()) break; _eventsManager.delay(1); @@ -371,7 +373,7 @@ bool VoyeurEngine::doLock() { continue; } - _soundManager.playVOCMap(wrongVoc, wrongVocSize); + _soundManager->playVOCMap(wrongVoc, wrongVocSize); } _graphicsManager.fillPic(*_graphicsManager._vPort); @@ -609,19 +611,19 @@ void VoyeurEngine::playAudio(int audioId) { flipPageAndWaitForFade(); _voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED; - _soundManager.setVOCOffset(_voy->_vocSecondsOffset); - Common::String filename = _soundManager.getVOCFileName( + _soundManager->setVOCOffset(_voy->_vocSecondsOffset); + Common::String filename = _soundManager->getVOCFileName( audioId + 159); - _soundManager.startVOCPlay(filename); + _soundManager->startVOCPlay(filename); _voy->_eventFlags |= EVTFLAG_RECORDING; _eventsManager.startCursorBlink(); while (!shouldQuit() && !_eventsManager._mouseClicked && - _soundManager.getVOCStatus()) + _soundManager->getVOCStatus()) _eventsManager.delayClick(1); _voy->_eventFlags |= EVTFLAG_TIME_DISABLED; - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); _bVoy->freeBoltGroup(0x7F00); (*_graphicsManager._vPort)->setupViewPort(NULL); @@ -716,16 +718,16 @@ void VoyeurEngine::showEndingNews() { _bVoy->freeBoltMember(_playStampGroupId + (idx - 1) * 2 + 1); Common::String fname = Common::String::format("news%d.voc", idx); - _soundManager.startVOCPlay(fname); + _soundManager->startVOCPlay(fname); _eventsManager.getMouseInfo(); while (!shouldQuit() && !_eventsManager._mouseClicked && - _soundManager.getVOCStatus()) { + _soundManager->getVOCStatus()) { _eventsManager.delay(1); _eventsManager.getMouseInfo(); } - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); if (idx == 3) _eventsManager.delay(3); @@ -779,7 +781,7 @@ void VoyeurEngine::loadGame(int slot) { _checkTransitionId = _voy->_transitionId; // Stop any playing sound - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); // Read in the savegame header VoyeurSavegameHeader header; diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index b7fcad49f4..e9946634cc 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -161,7 +161,7 @@ public: EventsManager _eventsManager; FilesManager _filesManager; GraphicsManager _graphicsManager; - SoundManager _soundManager; + SoundManager *_soundManager; SVoy *_voy; BoltFile *_stampLibPtr; diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index 5a6f872c80..6b1c1dcb36 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -181,7 +181,7 @@ void VoyeurEngine::playStamp() { do { if (flag) { if (_currentVocId != -1) { - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); _currentVocId = -1; } @@ -263,7 +263,7 @@ void VoyeurEngine::doTailTitle() { flipPageAndWaitForFade(); _eventsManager.delayClick(120); - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); } } @@ -294,7 +294,7 @@ void VoyeurEngine::doClosingCredits() { _graphicsManager._fontPtr->_fontSaveBack = false; _graphicsManager._fontPtr->_fontFlags = 0; - _soundManager.startVOCPlay(152); + _soundManager->startVOCPlay(152); FontInfoResource &fi = *_graphicsManager._fontPtr; for (int idx = 0; idx < 78; ++idx) { @@ -380,7 +380,7 @@ void VoyeurEngine::doClosingCredits() { break; } - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); _graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource; _bVoy->freeBoltGroup(0x400); } @@ -473,9 +473,9 @@ void VoyeurEngine::reviewTape() { _voy->_vocSecondsOffset = 0; bool needRedraw = true; do { - if (_currentVocId != -1 && !_soundManager.getVOCStatus()) { + if (_currentVocId != -1 && !_soundManager->getVOCStatus()) { _voy->_musicStartTime = _voy->_RTVNum; - _soundManager.startVOCPlay(_currentVocId); + _soundManager->startVOCPlay(_currentVocId); } if (needRedraw) { @@ -655,7 +655,7 @@ void VoyeurEngine::reviewTape() { if (_currentVocId != -1) { _voy->_vocSecondsOffset = _voy->_RTVNum - _voy->_musicStartTime; - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); } // Break out if the exit button was pressed @@ -688,19 +688,19 @@ void VoyeurEngine::reviewTape() { _voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED; // Play suond for the given duration - _soundManager.setVOCOffset(_voy->_vocSecondsOffset); - _soundManager.startVOCPlay(_audioVideoId + 159); + _soundManager->setVOCOffset(_voy->_vocSecondsOffset); + _soundManager->startVOCPlay(_audioVideoId + 159); uint32 secondsDuration = e._computerOff; _eventsManager.getMouseInfo(); - while (!_eventsManager._mouseClicked && _soundManager.getVOCStatus() && - _soundManager.getVOCFrame() < secondsDuration) { + while (!_eventsManager._mouseClicked && _soundManager->getVOCStatus() && + _soundManager->getVOCFrame() < secondsDuration) { _eventsManager.getMouseInfo(); _eventsManager.delay(10); } _voy->_eventFlags |= EVTFLAG_TIME_DISABLED; - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); _bVoy->freeBoltGroup(0x7F00); break; } @@ -709,7 +709,7 @@ void VoyeurEngine::reviewTape() { _voy->reviewAnEvidEvent(eventIndex); _voy->_vocSecondsOffset = _voy->_RTVNum - _voy->_musicStartTime; - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); _bVoy->getBoltGroup(0x900); break; @@ -717,7 +717,7 @@ void VoyeurEngine::reviewTape() { _voy->reviewComputerEvent(eventIndex); _voy->_vocSecondsOffset = _voy->_RTVNum - _voy->_musicStartTime; - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); _bVoy->getBoltGroup(0x900); break; @@ -796,12 +796,12 @@ void VoyeurEngine::doTapePlaying() { cycle->vStartCycle(); - _soundManager.startVOCPlay("vcr.voc"); - while (!shouldQuit() && !_eventsManager._mouseClicked && _soundManager.getVOCStatus()) { + _soundManager->startVOCPlay("vcr.voc"); + while (!shouldQuit() && !_eventsManager._mouseClicked && _soundManager->getVOCStatus()) { _eventsManager.delayClick(2); } - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); cycle->vStopCycle(); _bVoy->freeBoltGroup(0xA00); } @@ -943,8 +943,8 @@ int VoyeurEngine::getChooseButton() { do { do { - if (_currentVocId != -1 && !_soundManager.getVOCStatus()) - _soundManager.startVOCPlay(_currentVocId); + if (_currentVocId != -1 && !_soundManager->getVOCStatus()) + _soundManager->startVOCPlay(_currentVocId); _eventsManager.getMouseInfo(); selectedIndex = -1; @@ -1177,7 +1177,7 @@ int VoyeurEngine::doComputerText(int maxLen) { if (_voy->_RTVNum > _voy->_computerTimeMax && maxLen == 9999) { if (_currentVocId != -1) - _soundManager.startVOCPlay(_currentVocId); + _soundManager->startVOCPlay(_currentVocId); font._justify = ALIGN_LEFT; font._justifyWidth = 384; font._justifyHeight = 100; @@ -1185,7 +1185,7 @@ int VoyeurEngine::doComputerText(int maxLen) { (*_graphicsManager._vPort)->drawText(END_OF_MESSAGE); } else if (_voy->_RTVNum < _voy->_computerTimeMin && maxLen == 9999) { if (_currentVocId != -1) - _soundManager.startVOCPlay(_currentVocId); + _soundManager->startVOCPlay(_currentVocId); font._justify = ALIGN_LEFT; font._justifyWidth = 384; font._justifyHeight = 100; @@ -1198,10 +1198,10 @@ int VoyeurEngine::doComputerText(int maxLen) { bool showEnd = true; int yp = 60; do { - if (_currentVocId != -1 && !_soundManager.getVOCStatus()) { + if (_currentVocId != -1 && !_soundManager->getVOCStatus()) { if (_voy->_vocSecondsOffset > 60) _voy->_vocSecondsOffset = 0; - _soundManager.startVOCPlay(_currentVocId); + _soundManager->startVOCPlay(_currentVocId); } char c = *msg++; @@ -1317,15 +1317,15 @@ void VoyeurEngine::checkPhoneCall() { if ((_voy->_RTVLimit - _voy->_RTVNum) >= 36 && _voy->_totalPhoneCalls < 5 && _currentVocId <= 151 && _currentVocId > 146) { if ((_voy->_switchBGNum < _checkPhoneVal || _checkPhoneVal > 180) && - !_soundManager.getVOCStatus()) { + !_soundManager->getVOCStatus()) { int soundIndex; do { soundIndex = getRandomNumber(4); } while (_voy->_phoneCallsReceived[soundIndex]); _currentVocId = 154 + soundIndex; - _soundManager.stopVOCPlay(); - _soundManager.startVOCPlay(_currentVocId); + _soundManager->stopVOCPlay(); + _soundManager->startVOCPlay(_currentVocId); _checkPhoneVal = _voy->_switchBGNum; _voy->_phoneCallsReceived[soundIndex] = true; ++_voy->_totalPhoneCalls; @@ -1339,7 +1339,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) { if (_currentVocId != -1) { _voy->_vocSecondsOffset = _voy->_RTVNum - _voy->_musicStartTime; - _soundManager.stopVOCPlay(); + _soundManager->stopVOCPlay(); } _bVoy->getBoltGroup(_voy->_boltGroupId2); @@ -1381,11 +1381,11 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) { while (!shouldQuit() && !_eventsManager._rightClick) { _voyeurArea = AREA_EVIDENCE; - if (_currentVocId != -1 && !_soundManager.getVOCStatus()) { + if (_currentVocId != -1 && !_soundManager->getVOCStatus()) { if (_voy->_vocSecondsOffset > 60) _voy->_vocSecondsOffset = 0; - _soundManager.startVOCPlay(_currentVocId); + _soundManager->startVOCPlay(_currentVocId); } _eventsManager.delayClick(600); |