diff options
author | Strangerke | 2013-08-11 18:09:40 +0200 |
---|---|---|
committer | Strangerke | 2013-08-11 18:09:40 +0200 |
commit | 54f391a6899cc46c651ba0d077ae5ea47fc32dd5 (patch) | |
tree | e952dfe5ff79cc08f0082fd35b7f5555a55892c3 | |
parent | f621297dc76bb545ed5312fb941eea1da26a7052 (diff) | |
download | scummvm-rg350-54f391a6899cc46c651ba0d077ae5ea47fc32dd5.tar.gz scummvm-rg350-54f391a6899cc46c651ba0d077ae5ea47fc32dd5.tar.bz2 scummvm-rg350-54f391a6899cc46c651ba0d077ae5ea47fc32dd5.zip |
MORTEVIELLE: Merge SpeechManager and SoundManager
-rw-r--r-- | engines/mortevielle/actions.cpp | 15 | ||||
-rw-r--r-- | engines/mortevielle/dialogs.cpp | 3 | ||||
-rw-r--r-- | engines/mortevielle/module.mk | 1 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.cpp | 3 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.h | 2 | ||||
-rw-r--r-- | engines/mortevielle/sound.cpp | 559 | ||||
-rw-r--r-- | engines/mortevielle/sound.h | 62 | ||||
-rw-r--r-- | engines/mortevielle/speech.cpp | 575 | ||||
-rw-r--r-- | engines/mortevielle/speech.h | 87 | ||||
-rw-r--r-- | engines/mortevielle/utils.cpp | 32 |
10 files changed, 610 insertions, 729 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 361917d53b..3e3db5b224 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -30,7 +30,6 @@ #include "mortevielle/menu.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/speech.h" #include "common/scummsys.h" @@ -630,7 +629,7 @@ void MortevielleEngine::fctOpen() { || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) - _speechManager.startSpeech(7, 9, 1); + _soundManager.startSpeech(7, 9, 1); } _openObjects[i] = _num; displayAnimFrame(1, _num); @@ -699,7 +698,7 @@ void MortevielleEngine::fctPlace() { displayAnimFrame(1, 1); handleDescriptionText(2, 165); displayEmptyHand(); - _speechManager.startSpeech(6, -9, 1); + _soundManager.startSpeech(6, -9, 1); // Do you want to enter the hidden passage? int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); @@ -800,7 +799,7 @@ void MortevielleEngine::fctTurn() { _crep = 997; if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { handleDescriptionText(2, 167); - _speechManager.startSpeech(7, 9, 1); + _soundManager.startSpeech(7, 9, 1); int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) _endGame = true; @@ -810,7 +809,7 @@ void MortevielleEngine::fctTurn() { if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { handleDescriptionText(2, 175); clearVerbBar(); - _speechManager.startSpeech(6, -9, 1); + _soundManager.startSpeech(6, -9, 1); int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) { _coreVar._currPlace = CRYPT; @@ -932,7 +931,7 @@ void MortevielleEngine::fctKnock() { if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; - _speechManager.startSpeech(11, rand, 1); + _soundManager.startSpeech(11, rand, 1); int p = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); int l = _roomDoorId; if (l != OWN_ROOM) { @@ -1146,7 +1145,7 @@ void MortevielleEngine::fctEnter() { _crep = 179; else { int randVal = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, randVal, 1); + _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); int charIndex = convertBitIndexToCharacterIndex(z); @@ -1167,7 +1166,7 @@ void MortevielleEngine::fctEnter() { } } else { int randVal = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, randVal, 1); + _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); _coreVar._currPlace = _roomDoorId; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index ba5d984886..264839c158 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -30,7 +30,6 @@ #include "mortevielle/dialogs.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/speech.h" #include "common/str.h" @@ -428,7 +427,7 @@ void DialogManager::drawF3F8() { void DialogManager::checkForF8(int SpeechNum, bool drawFrame2Fl) { _vm->testKeyboard(); do { - _vm->_speechManager.startSpeech(SpeechNum, 0, 0); + _vm->_soundManager.startSpeech(SpeechNum, 0, 0); _vm->_key = waitForF3F8(); if (_vm->shouldQuit()) return; diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index e18657cb6a..a9f02c2a67 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -12,7 +12,6 @@ MODULE_OBJS := \ outtext.o \ saveload.o \ sound.o \ - speech.o \ utils.o # This module can be built as a plugin diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 1296e645e2..0b6b82c1a9 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -56,7 +56,6 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _mouse.setParent(this); _text.setParent(this); _soundManager.setParent(this); - _speechManager.setParent(this); _savegameManager.setParent(this); _lastGameFrame = 0; @@ -365,7 +364,7 @@ Common::Error MortevielleEngine::run() { // Cleanup (allocated in initialize()) _screenSurface.free(); - free(_speechManager._cfiphBuffer); + free(_soundManager._cfiphBuffer); free(_cfiecBuffer); return Common::kNoError; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index e849138dd1..699ee3f37a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -44,7 +44,6 @@ #include "mortevielle/mouse.h" #include "mortevielle/saveload.h" #include "mortevielle/sound.h" -#include "mortevielle/speech.h" #include "mortevielle/outtext.h" namespace Mortevielle { @@ -445,7 +444,6 @@ public: Common::RandomSource _randomSource; SoundManager _soundManager; SavegameManager _savegameManager; - SpeechManager _speechManager; Menu _menu; MouseHandler _mouse; TextHandler _text; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 3198de6ee8..3fd47de714 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -33,11 +33,45 @@ namespace Mortevielle { + const byte _tnocon[364] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + const byte _intcon[26] = {1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}; + const byte _typcon[26] = {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3}; + const byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; + const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; + SoundManager::SoundManager(Audio::Mixer *mixer) { _mixer = mixer; _audioStream = nullptr; _ambiantNoiseBuf = nullptr; _noiseBuf = nullptr; + + _soundType = 0; + _phonemeNumb = 0; + + for (int i = 0; i < 3; i++) { + _queue[i]._val = 0; + _queue[i]._code = 0; + _queue[i]._acc = 0; + _queue[i]._freq = 0; + _queue[i]._rep = 0; + } + _buildingSentence = false; } SoundManager::~SoundManager() { @@ -124,33 +158,33 @@ void SoundManager::loadNoise() { void SoundManager::regenbruit() { int i = 69876; for (int j = 0; j < 100; j++) { - _vm->_speechManager._cfiphBuffer[j] = READ_BE_UINT16(&_noiseBuf[i]); + _cfiphBuffer[j] = READ_BE_UINT16(&_noiseBuf[i]); i += 2; } } void SoundManager::litph(tablint &t, int typ, int tempo) { // Skip speech - if (_vm->_speechManager._soundType == 0) + if (_soundType == 0) return; - if (!_vm->_speechManager._buildingSentence) { + if (!_buildingSentence) { if (_mixer->isSoundHandleActive(_soundHandle)) _mixer->stopHandle(_soundHandle); - _vm->_speechManager._buildingSentence = true; + _buildingSentence = true; } int freq = tempo * 252; // 25.2 * 10 int i = 0; - while (i < _vm->_speechManager._ptr_oct) { - int idx = _vm->_speechManager._troctBuf[i]; + while (i < _ptr_oct) { + int idx = _troctBuf[i]; i++; switch(idx) { case 0: { - int val = _vm->_speechManager._troctBuf[i]; + int val = _troctBuf[i]; i++; - if (_vm->_speechManager._soundType == 0) + if (_soundType == 0) warning("TODO: vclas"); - else if (_vm->_speechManager._soundType == 1) { + else if (_soundType == 1) { debugC(5, kMortevielleSounds, "litph - duson"); const static int noiseAdr[] = {0, 17224, 17224, 33676, @@ -187,20 +221,20 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { break; } case 2: { - int val = _vm->_speechManager._troctBuf[i]; + int val = _troctBuf[i]; i++; int tmpidx = (val * 12) + 268; - val = _vm->_speechManager._troctBuf[i]; + val = _troctBuf[i]; i++; warning("TODO: reech %d %d", tmpidx, val); } break; case 4: - if (_vm->_speechManager._soundType) { + if (_soundType) { i += 2; } else { // Speech - warning("TODO: Interphoneme: consonne:%d voyelle:%d", _vm->_speechManager._troctBuf[i], _vm->_speechManager._troctBuf[i + 1]); + warning("TODO: Interphoneme: consonne:%d voyelle:%d", _troctBuf[i], _troctBuf[i + 1]); i += 2; } break; @@ -211,9 +245,9 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { if (idx == 62) warning("TODO: blab"); else if (idx == 35) { - if (i < _vm->_speechManager._ptr_oct) + if (i < _ptr_oct) warning("unexpected 35"); - i = _vm->_speechManager._ptr_oct; + i = _ptr_oct; } else warning("Other code: %d", idx); break; @@ -237,4 +271,499 @@ void SoundManager::playSong(const byte* buf, uint size, uint loops) { void SoundManager::setParent(MortevielleEngine *vm) { _vm = vm; } + +void SoundManager::spfrac(int wor) { + _queue[2]._rep = (uint)wor >> 12; + if ((_soundType == 0) && (_queue[2]._code != 9)) + if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) || + ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) { + ++_queue[2]._rep; + } + + _queue[2]._freq = ((uint)wor >> 6) & 7; + _queue[2]._acc = ((uint)wor >> 9) & 7; +} + +void SoundManager::charg_car(int &currWordNumb) { + assert(currWordNumb < 1712); + int wor = READ_BE_UINT16(&_wordBuf[currWordNumb]); + int int_ = wor & 0x3f; // 63 + + if ((int_ >= 0) && (int_ <= 13)) { + _queue[2]._val = int_; + _queue[2]._code = 5; + } else if ((int_ >= 14) && (int_ <= 21)) { + _queue[2]._val = int_; + _queue[2]._code = 6; + } else if ((int_ >= 22) && (int_ <= 47)) { + int_ -= 22; + _queue[2]._val = int_; + _queue[2]._code = _typcon[int_]; + } else if ((int_ >= 48) && (int_ <= 56)) { + _queue[2]._val = int_ - 22; + _queue[2]._code = 4; + } else { + switch (int_) { + case 60: + _queue[2]._val = 32; /* " " */ + _queue[2]._code = 9; + break; + case 61: + _queue[2]._val = 46; /* "." */ + _queue[2]._code = 9; + break; + case 62: + _queue[2]._val = 35; /* "#" */ + _queue[2]._code = 9; + default: + break; + } + } + + spfrac(wor); + currWordNumb += 2; +} + + +void SoundManager::entroct(byte o) { + assert(_ptr_oct < 10576); + _troctBuf[_ptr_oct] = o; + ++_ptr_oct; +} + +void SoundManager::veracf(byte b) { + ; +} + +void SoundManager::cctable(tablint &t) { + float tb[257]; + + tb[0] = 0; + for (int k = 0; k <= 255; ++k) { + tb[k + 1] = _vm->_addFix + tb[k]; + t[255 - k] = abs((int)tb[k] + 1); + } +} + +/** + * Load phoneme sound file + * @remarks Originally called 'charge_phbruit' + */ +void SoundManager::loadPhonemeSounds() { + Common::File f; + + if (!f.open("phbrui.mor")) + error("Missing file - phbrui.mor"); + + for (int i = 1; i <= f.size() / 2; ++i) + _cfiphBuffer[i] = f.readUint16BE(); + + f.close(); +} + +void SoundManager::trait_car() { + byte d3; + int d2, i; + + switch (_queue[1]._code) { + case 9: + if (_queue[1]._val != (int)'#') + for (i = 0; i <= _queue[1]._rep; ++i) + entroct(_queue[1]._val); + break; + case 5: + case 6: + if (_queue[1]._code == 6) + d3 = _tabdph[(_queue[1]._val - 14) << 1]; + else + d3 = kNullValue; + if (_queue[0]._code >= 5) { + veracf(_queue[1]._acc); + if (_queue[0]._code == 9) { + entroct(4); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(22); + } + } + + switch (_queue[1]._rep) { + case 0: + entroct(0); + entroct(_queue[1]._val); + if (d3 == kNullValue) + if (_queue[2]._code == 9) + entroct(2); + else + entroct(4); + else if (_queue[2]._code == 9) + entroct(0); + else + entroct(1); + break; + case 4: + case 5: + case 6: + if (_queue[1]._rep != 4) { + i = _queue[1]._rep - 5; + do { + --i; + entroct(0); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == kNullValue) { + entroct(4); + entroct(_queue[1]._val); + entroct(0); + } else { + entroct(0); + entroct(_queue[1]._val); + entroct(3); + } + + break; + case 7: + case 8: + case 9: + if (_queue[1]._rep != 7) { + i = _queue[1]._rep - 8; + do { + --i; + entroct(0); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == kNullValue) { + entroct(0); + entroct(_queue[1]._val); + entroct(2); + } else { + entroct(0); + entroct(_queue[1]._val); + entroct(0); + } + break; + case 1: + case 2: + case 3: + if (_queue[1]._rep != 1) { + i = _queue[1]._rep - 2; + do { + --i; + entroct(0); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + entroct(0); + entroct(_queue[1]._val); + if (_queue[2]._code == 9) + entroct(0); + else + entroct(1); + + break; + default: + break; + } // switch c2.rep + break; + + case 2: + case 3: + d3 = _queue[1]._code + 5; // 7 ou 8 => Corresponding vowel + if (_queue[0]._code > 4) { + veracf(_queue[1]._acc); + if (_queue[0]._code == 9) { + entroct(4); + entroct(d3); + entroct(22); + } + } + i = _queue[1]._rep; + assert(i >= 0); + if (i != 0) { + do { + --i; + entroct(0); + entroct(d3); + entroct(3); + } while (i > 0); + } + veracf(_queue[2]._acc); + if (_queue[2]._code == 6) { + entroct(4); + entroct(_tabdph[(_queue[2]._val - 14) << 1]); + entroct(_queue[1]._val); + } else { + entroct(4); + if (_queue[2]._val == 4) + entroct(3); + else + entroct(_queue[2]._val); + entroct(_queue[1]._val); + } + break; + case 0: + case 1: + veracf(_queue[1]._acc); + switch (_queue[2]._code) { + case 2: + d2 = 7; + break; + case 3: + d2 = 8; + break; + case 6: + d2 = _tabdph[(_queue[2]._val - 14) << 1]; + break; + case 5: + d2 = _queue[2]._val; + break; + default: + d2 = 10; + break; + } // switch c3._code + d2 = (d2 * 26) + _queue[1]._val; + if (_tnocon[d2] == 0) + d3 = 2; + else + d3 = 6; + if (_queue[1]._rep >= 5) { + _queue[1]._rep -= 5; + d3 = 8 - d3; // Swap 2 and 6 + } + if (_queue[1]._code == 0) { + i = _queue[1]._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(_queue[1]._val); + entroct(3); + } while (i > 0); + } + entroct(d3); + entroct(_queue[1]._val); + entroct(4); + } else { + entroct(d3); + entroct(_queue[1]._val); + entroct(3); + i = _queue[1]._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(_queue[1]._val); + entroct(4); + } while (i > 0); + } + } + if (_queue[2]._code == 9) { + entroct(d3); + entroct(_queue[1]._val); + entroct(5); + } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { + veracf(_queue[2]._acc); + switch (_queue[2]._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = _tabdph[(_queue[2]._val - 14) << 1]; + break; + case 5: + d2 = _queue[2]._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + if (d2 == 4) + d2 = 3; + + if (_intcon[_queue[1]._val] != 0) + ++_queue[1]._val; + + if ((_queue[1]._val == 17) || (_queue[1]._val == 18)) + _queue[1]._val = 16; + + entroct(4); + entroct(d2); + entroct(_queue[1]._val); + } + + break; + case 4: + veracf(_queue[1]._acc); + i = _queue[1]._rep; + if (i != 0) { + do { + --i; + entroct(2); + entroct(_queue[1]._val); + entroct(3); + } while (i > 0); + } + entroct(2); + entroct(_queue[1]._val); + entroct(4); + if (_queue[2]._code == 9) { + entroct(2); + entroct(_queue[1]._val); + entroct(5); + } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { + veracf(_queue[2]._acc); + switch (_queue[2]._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = _tabdph[(_queue[2]._val - 14) << 1]; + break; + case 5: + d2 = _queue[2]._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + + if (d2 == 4) + d2 = 3; + + if (_intcon[_queue[1]._val] != 0) + ++_queue[1]._val; + + entroct(4); + entroct(d2); + entroct(_tabdbc[((_queue[1]._val - 26) << 1) + 1]); + } + + break; + default: + break; + } // switch c2.code +} + +/** + * Make the queue evolve by 1 value + * @remarks Originally called 'rot_chariot' + */ +void SoundManager::moveQueue() { + _queue[0] = _queue[1]; + _queue[1] = _queue[2]; + _queue[2]._val = 32; + _queue[2]._code = 9; +} + +/** + * initialize the queue + * @remarks Originally called 'init_chariot' + */ +void SoundManager::initQueue() { + _queue[2]._rep = 0; + _queue[2]._freq = 0; + _queue[2]._acc = 0; + moveQueue(); + moveQueue(); +} + +/** + * Handle a phoneme + * @remarks Originally called 'trait_ph' + */ +void SoundManager::handlePhoneme() { + const uint16 deca[3] = {300, 30, 40}; + + uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_soundType]; + uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_soundType]; + int wordCount = endPos - startPos; + + startPos /= 2; + endPos /= 2; + assert((endPos - startPos) < 1711); + for (int i = startPos, currWord = 0; i < endPos; i++, currWord += 2) + WRITE_BE_UINT16(&_wordBuf[currWord], _cfiphBuffer[i]); + + _ptr_oct = 0; + int currWord = 0; + initQueue(); + + do { + moveQueue(); + charg_car(currWord); + trait_car(); + } while (currWord < wordCount); + + moveQueue(); + trait_car(); + entroct((int)'#'); +} + +/** + * Start speech + * @remarks Originally called 'parole' + */ +void SoundManager::startSpeech(int rep, int ht, int typ) { + uint16 savph[501]; + int tempo; + + if (_vm->_soundOff) + return; + + _phonemeNumb = rep; + int haut = ht; + _soundType = typ; + if (_soundType != 0) { + for (int i = 0; i <= 500; ++i) + savph[i] = _cfiphBuffer[i]; + tempo = kTempoNoise; + } else if (haut > 5) + tempo = kTempoF; + else + tempo = kTempoM; + _vm->_addFix = (float)((tempo - 8)) / 256; + cctable(_tbi); + switch (typ) { + case 1: + regenbruit(); + break; + case 2: + loadPhonemeSounds(); + break; + default: + break; + } + handlePhoneme(); + litph(_tbi, typ, tempo); + + _buildingSentence = false; + if (typ != 0) { + _audioStream->finish(); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _audioStream); + _audioStream = nullptr; + } + + if (_soundType != 0) { + for (int i = 0; i <= 500; ++i) + _cfiphBuffer[i] = savph[i]; + } + _vm->setPal(_vm->_numpal); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 322648140b..e52de32d04 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -36,45 +36,69 @@ namespace Mortevielle { class MortevielleEngine; -typedef int tablint[256]; - -/** - * Structure used to store pending notes to play - */ -struct SpeakerNote { - int freq; - uint32 length; - - SpeakerNote(int noteFreq, uint32 noteLength) { - freq = noteFreq; - length = noteLength; - } +const int kNullValue = 255; +const int kTempoMusic = 71; +const int kTempoNoise = 78; +const int kTempoF = 80; +const int kTempoM = 89; + +struct SpeechQueue { + int _val; + int _code; + int _acc; + int _freq; + int _rep; }; +typedef int tablint[256]; + class SoundManager { private: MortevielleEngine *_vm; + byte *_ambiantNoiseBuf; byte *_noiseBuf; + int _phonemeNumb; + int _soundType; + SpeechQueue _queue[3]; + byte _wordBuf[1712]; + byte _troctBuf[10576]; + bool _buildingSentence; + int _ptr_oct; + int _tbi[256]; -public: - Audio::Mixer *_mixer; Audio::QueuingAudioStream *_audioStream; - Audio::SoundHandle _soundHandle; + void loadPhonemeSounds(); + void moveQueue(); + void initQueue(); + void handlePhoneme(); + + void spfrac(int wor); + void charg_car(int &currWordNumb); + void entroct(byte o); + void veracf(byte b); + void cctable(tablint &t); + void trait_car(); + void regenbruit(); + void litph(tablint &t, int typ, int tempo); + +public: SoundManager(Audio::Mixer *mixer); ~SoundManager(); + Audio::Mixer *_mixer; + Audio::SoundHandle _soundHandle; + uint16 *_cfiphBuffer; + void setParent(MortevielleEngine *vm); int decodeMusic(const byte *PSrc, byte *PDest, int size); void playSong(const byte *buf, uint usize, uint loops); void loadAmbiantSounds(); void loadNoise(); - - void regenbruit(); - void litph(tablint &t, int typ, int tempo); + void startSpeech(int rep, int ht, int typ); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp deleted file mode 100644 index 6c90c8ea26..0000000000 --- a/engines/mortevielle/speech.cpp +++ /dev/null @@ -1,575 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1987-1989 Lankhor - */ - -#include "mortevielle/mortevielle.h" - -#include "mortevielle/speech.h" -#include "mortevielle/sound.h" - -#include "audio/decoders/raw.h" -#include "common/endian.h" -#include "common/file.h" - -namespace Mortevielle { - -const byte _tnocon[364] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -const byte _intcon[26] = {1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}; -const byte _typcon[26] = {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3}; -const byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; -const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; - -SpeechManager::SpeechManager() { - _soundType = 0; - _phonemeNumb = 0; - - for (int i = 0; i < 3; i++) { - _queue[i]._val = 0; - _queue[i]._code = 0; - _queue[i]._acc = 0; - _queue[i]._freq = 0; - _queue[i]._rep = 0; - } - _buildingSentence = false; -} - -SpeechManager::~SpeechManager() { -} - -void SpeechManager::spfrac(int wor) { - _queue[2]._rep = (uint)wor >> 12; - if ((_soundType == 0) && (_queue[2]._code != 9)) - if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) || - ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) { - ++_queue[2]._rep; - } - - _queue[2]._freq = ((uint)wor >> 6) & 7; - _queue[2]._acc = ((uint)wor >> 9) & 7; -} - -void SpeechManager::charg_car(int &currWordNumb) { - assert(currWordNumb < 1712); - int wor = READ_BE_UINT16(&_wordBuf[currWordNumb]); - int int_ = wor & 0x3f; // 63 - - if ((int_ >= 0) && (int_ <= 13)) { - _queue[2]._val = int_; - _queue[2]._code = 5; - } else if ((int_ >= 14) && (int_ <= 21)) { - _queue[2]._val = int_; - _queue[2]._code = 6; - } else if ((int_ >= 22) && (int_ <= 47)) { - int_ -= 22; - _queue[2]._val = int_; - _queue[2]._code = _typcon[int_]; - } else if ((int_ >= 48) && (int_ <= 56)) { - _queue[2]._val = int_ - 22; - _queue[2]._code = 4; - } else { - switch (int_) { - case 60: - _queue[2]._val = 32; /* " " */ - _queue[2]._code = 9; - break; - case 61: - _queue[2]._val = 46; /* "." */ - _queue[2]._code = 9; - break; - case 62: - _queue[2]._val = 35; /* "#" */ - _queue[2]._code = 9; - default: - break; - } - } - - spfrac(wor); - currWordNumb += 2; -} - - -void SpeechManager::entroct(byte o) { - assert(_ptr_oct < 10576); - _troctBuf[_ptr_oct] = o; - ++_ptr_oct; -} - -void SpeechManager::veracf(byte b) { - ; -} - -void SpeechManager::cctable(tablint &t) { - float tb[257]; - - tb[0] = 0; - for (int k = 0; k <= 255; ++k) { - tb[k + 1] = _vm->_addFix + tb[k]; - t[255 - k] = abs((int)tb[k] + 1); - } -} - -/** - * Load phoneme sound file - * @remarks Originally called 'charge_phbruit' - */ -void SpeechManager::loadPhonemeSounds() { - Common::File f; - - if (!f.open("phbrui.mor")) - error("Missing file - phbrui.mor"); - - for (int i = 1; i <= f.size() / 2; ++i) - _cfiphBuffer[i] = f.readUint16BE(); - - f.close(); -} - -void SpeechManager::trait_car() { - byte d3; - int d2, i; - - switch (_queue[1]._code) { - case 9: - if (_queue[1]._val != (int)'#') - for (i = 0; i <= _queue[1]._rep; ++i) - entroct(_queue[1]._val); - break; - case 5: - case 6: - if (_queue[1]._code == 6) - d3 = _tabdph[(_queue[1]._val - 14) << 1]; - else - d3 = kNullValue; - if (_queue[0]._code >= 5) { - veracf(_queue[1]._acc); - if (_queue[0]._code == 9) { - entroct(4); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(22); - } - } - - switch (_queue[1]._rep) { - case 0: - entroct(0); - entroct(_queue[1]._val); - if (d3 == kNullValue) - if (_queue[2]._code == 9) - entroct(2); - else - entroct(4); - else if (_queue[2]._code == 9) - entroct(0); - else - entroct(1); - break; - case 4: - case 5: - case 6: - if (_queue[1]._rep != 4) { - i = _queue[1]._rep - 5; - do { - --i; - entroct(0); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == kNullValue) { - entroct(4); - entroct(_queue[1]._val); - entroct(0); - } else { - entroct(0); - entroct(_queue[1]._val); - entroct(3); - } - - break; - case 7: - case 8: - case 9: - if (_queue[1]._rep != 7) { - i = _queue[1]._rep - 8; - do { - --i; - entroct(0); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == kNullValue) { - entroct(0); - entroct(_queue[1]._val); - entroct(2); - } else { - entroct(0); - entroct(_queue[1]._val); - entroct(0); - } - break; - case 1: - case 2: - case 3: - if (_queue[1]._rep != 1) { - i = _queue[1]._rep - 2; - do { - --i; - entroct(0); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - entroct(0); - entroct(_queue[1]._val); - if (_queue[2]._code == 9) - entroct(0); - else - entroct(1); - - break; - default: - break; - } // switch c2.rep - break; - - case 2: - case 3: - d3 = _queue[1]._code + 5; // 7 ou 8 => Corresponding vowel - if (_queue[0]._code > 4) { - veracf(_queue[1]._acc); - if (_queue[0]._code == 9) { - entroct(4); - entroct(d3); - entroct(22); - } - } - i = _queue[1]._rep; - assert(i >= 0); - if (i != 0) { - do { - --i; - entroct(0); - entroct(d3); - entroct(3); - } while (i > 0); - } - veracf(_queue[2]._acc); - if (_queue[2]._code == 6) { - entroct(4); - entroct(_tabdph[(_queue[2]._val - 14) << 1]); - entroct(_queue[1]._val); - } else { - entroct(4); - if (_queue[2]._val == 4) - entroct(3); - else - entroct(_queue[2]._val); - entroct(_queue[1]._val); - } - break; - case 0: - case 1: - veracf(_queue[1]._acc); - switch (_queue[2]._code) { - case 2: - d2 = 7; - break; - case 3: - d2 = 8; - break; - case 6: - d2 = _tabdph[(_queue[2]._val - 14) << 1]; - break; - case 5: - d2 = _queue[2]._val; - break; - default: - d2 = 10; - break; - } // switch c3._code - d2 = (d2 * 26) + _queue[1]._val; - if (_tnocon[d2] == 0) - d3 = 2; - else - d3 = 6; - if (_queue[1]._rep >= 5) { - _queue[1]._rep -= 5; - d3 = 8 - d3; // Swap 2 and 6 - } - if (_queue[1]._code == 0) { - i = _queue[1]._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(_queue[1]._val); - entroct(3); - } while (i > 0); - } - entroct(d3); - entroct(_queue[1]._val); - entroct(4); - } else { - entroct(d3); - entroct(_queue[1]._val); - entroct(3); - i = _queue[1]._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(_queue[1]._val); - entroct(4); - } while (i > 0); - } - } - if (_queue[2]._code == 9) { - entroct(d3); - entroct(_queue[1]._val); - entroct(5); - } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { - veracf(_queue[2]._acc); - switch (_queue[2]._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = _tabdph[(_queue[2]._val - 14) << 1]; - break; - case 5: - d2 = _queue[2]._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - if (d2 == 4) - d2 = 3; - - if (_intcon[_queue[1]._val] != 0) - ++_queue[1]._val; - - if ((_queue[1]._val == 17) || (_queue[1]._val == 18)) - _queue[1]._val = 16; - - entroct(4); - entroct(d2); - entroct(_queue[1]._val); - } - - break; - case 4: - veracf(_queue[1]._acc); - i = _queue[1]._rep; - if (i != 0) { - do { - --i; - entroct(2); - entroct(_queue[1]._val); - entroct(3); - } while (i > 0); - } - entroct(2); - entroct(_queue[1]._val); - entroct(4); - if (_queue[2]._code == 9) { - entroct(2); - entroct(_queue[1]._val); - entroct(5); - } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { - veracf(_queue[2]._acc); - switch (_queue[2]._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = _tabdph[(_queue[2]._val - 14) << 1]; - break; - case 5: - d2 = _queue[2]._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - - if (d2 == 4) - d2 = 3; - - if (_intcon[_queue[1]._val] != 0) - ++_queue[1]._val; - - entroct(4); - entroct(d2); - entroct(_tabdbc[((_queue[1]._val - 26) << 1) + 1]); - } - - break; - default: - break; - } // switch c2.code -} - -/** - * Make the queue evolve by 1 value - * @remarks Originally called 'rot_chariot' - */ -void SpeechManager::moveQueue() { - _queue[0] = _queue[1]; - _queue[1] = _queue[2]; - _queue[2]._val = 32; - _queue[2]._code = 9; -} - -/** - * initialize the queue - * @remarks Originally called 'init_chariot' - */ -void SpeechManager::initQueue() { - _queue[2]._rep = 0; - _queue[2]._freq = 0; - _queue[2]._acc = 0; - moveQueue(); - moveQueue(); -} - -/** - * Handle a phoneme - * @remarks Originally called 'trait_ph' - */ -void SpeechManager::handlePhoneme() { - const uint16 deca[3] = {300, 30, 40}; - - uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_soundType]; - uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_soundType]; - int wordCount = endPos - startPos; - - startPos /= 2; - endPos /= 2; - assert((endPos - startPos) < 1711); - for (int i = startPos, currWord = 0; i < endPos; i++, currWord += 2) - WRITE_BE_UINT16(&_wordBuf[currWord], _cfiphBuffer[i]); - - _ptr_oct = 0; - int currWord = 0; - initQueue(); - - do { - moveQueue(); - charg_car(currWord); - trait_car(); - } while (currWord < wordCount); - - moveQueue(); - trait_car(); - entroct((int)'#'); -} - -/** - * Start speech - * @remarks Originally called 'parole' - */ -void SpeechManager::startSpeech(int rep, int ht, int typ) { - uint16 savph[501]; - int tempo; - - if (_vm->_soundOff) - return; - - _phonemeNumb = rep; - int haut = ht; - _soundType = typ; - if (_soundType != 0) { - for (int i = 0; i <= 500; ++i) - savph[i] = _cfiphBuffer[i]; - tempo = kTempoNoise; - } else if (haut > 5) - tempo = kTempoF; - else - tempo = kTempoM; - _vm->_addFix = (float)((tempo - 8)) / 256; - cctable(_tbi); - switch (typ) { - case 1: - _vm->_soundManager.regenbruit(); - break; - case 2: - loadPhonemeSounds(); - break; - default: - break; - } - handlePhoneme(); - _vm->_soundManager.litph(_tbi, typ, tempo); - - _vm->_speechManager._buildingSentence = false; - if (typ != 0) { - _vm->_soundManager._audioStream->finish(); - _vm->_soundManager._mixer->playStream(Audio::Mixer::kSFXSoundType, &_vm->_soundManager._soundHandle, _vm->_soundManager._audioStream); - _vm->_soundManager._audioStream = nullptr; - } - - if (_soundType != 0) { - for (int i = 0; i <= 500; ++i) - _cfiphBuffer[i] = savph[i]; - } - _vm->setPal(_vm->_numpal); -} - -void SpeechManager::setParent(MortevielleEngine *vm) { - _vm = vm; -} -} // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h deleted file mode 100644 index c21d3a44c8..0000000000 --- a/engines/mortevielle/speech.h +++ /dev/null @@ -1,87 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1987-1989 Lankhor - */ - -#ifndef MORTEVIELLE_SPEECH_H -#define MORTEVIELLE_SPEECH_H - -#include "mortevielle/sound.h" - -#include "common/scummsys.h" - -namespace Mortevielle { - -const float kfreq0 = 1.19318e6; -const int kNullValue = 255; -const int kTempoMusic = 71; -const int kTempoNoise = 78; -const int kTempoF = 80; -const int kTempoM = 89; - -struct SpeechQueue { - int _val; - int _code; - int _acc; - int _freq; - int _rep; -}; - -class SpeechManager { -private: - MortevielleEngine *_vm; - - int _phonemeNumb; - SpeechQueue _queue[3]; - byte _wordBuf[1712]; -public: - byte _troctBuf[10576]; - int _soundType; - bool _buildingSentence; - - int _ptr_oct; - uint16 *_cfiphBuffer; - int _tbi[256]; - - SpeechManager(); - ~SpeechManager(); - void setParent(MortevielleEngine *vm); - void spfrac(int wor); - void charg_car(int &currWordNumb); - void entroct(byte o); - void veracf(byte b); - void cctable(tablint &t); - void loadPhonemeSounds(); - void trait_car(); - - void moveQueue(); - void initQueue(); - void handlePhoneme(); - void startSpeech(int rep, int ht, int typ); -}; - -} // End of namespace Mortevielle - -#endif diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index a5a64d604d..80f19277df 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -31,7 +31,6 @@ #include "mortevielle/menu.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/speech.h" #include "common/scummsys.h" #include "graphics/cursorman.h" @@ -1259,24 +1258,24 @@ void MortevielleEngine::startMusicOrSpeech(int so) { ; } else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) { // Type 1: Speech - _speechManager.startSpeech(10, 1, 1); + _soundManager.startSpeech(10, 1, 1); _introSpeechPlayed = true; } else { if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) // Type 1: Speech - _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); + _soundManager.startSpeech(9, getRandomNumber(2, 4), 1); else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) // Type 1: Speech - _speechManager.startSpeech(8, 1, 1); + _soundManager.startSpeech(8, 1, 1); else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) // Type 1: Speech - _speechManager.startSpeech(12, 1, 1); + _soundManager.startSpeech(12, 1, 1); else if (_coreVar._currPlace == INSIDE_WELL) // Type 1: Speech - _speechManager.startSpeech(13, 1, 1); + _soundManager.startSpeech(13, 1, 1); else // Type 2 : music - _speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); + _soundManager.startSpeech(getRandomNumber(1, 17), 1, 2); } } @@ -1344,7 +1343,7 @@ void MortevielleEngine::startDialog(int16 rep) { key = 0; do { - _speechManager.startSpeech(rep, haut[_caff - 69], 0); + _soundManager.startSpeech(rep, haut[_caff - 69], 0); key = _dialogManager.waitForF3F8(); if (shouldQuit()) return; @@ -2169,10 +2168,10 @@ void MortevielleEngine::loadCFIPH() { error("Missing file - *cfiph.mor"); } - _speechManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); + _soundManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); for (int i = 0; i < (f.size() / 2); ++i) - _speechManager._cfiphBuffer[i] = f.readUint16BE(); + _soundManager._cfiphBuffer[i] = f.readUint16BE(); f.close(); } @@ -2200,9 +2199,6 @@ void MortevielleEngine::music() { int musicSize = _soundManager.decodeMusic(compMusicBuf, musicBuf, size); free(compMusicBuf); - _addFix = (float)((kTempoMusic - 8)) / 256; - _speechManager.cctable(_speechManager._tbi); - _soundManager.playSong(musicBuf, musicSize, 5); while (keyPressed()) getChar(); @@ -2388,7 +2384,7 @@ void MortevielleEngine::prepareRoom() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(1, rand, 1); + _soundManager.startSpeech(1, rand, 1); clearVerbBar(); } } @@ -2514,7 +2510,7 @@ void MortevielleEngine::initCaveOrCellar() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(2, rand, 1); + _soundManager.startSpeech(2, rand, 1); // The original was doing here a useless loop. // It has been removed @@ -3214,9 +3210,9 @@ L1: _crep = 138; handleDescriptionText(2, _crep); if (_crep == 138) - _speechManager.startSpeech(5, 2, 1); + _soundManager.startSpeech(5, 2, 1); else - _speechManager.startSpeech(4, 4, 1); + _soundManager.startSpeech(4, 4, 1); if (_openObjCount == 0) _coreVar._faithScore += 2; @@ -3241,7 +3237,7 @@ L1: } else { handleDescriptionText(2, 136); int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(3, rand, 1); + _soundManager.startSpeech(3, rand, 1); clearDescriptionBar(); displayAloneText(); resetRoomVariables(MANOR_FRONT); |