diff options
author | Strangerke | 2014-08-24 18:49:34 +0200 |
---|---|---|
committer | Strangerke | 2014-08-24 18:49:34 +0200 |
commit | 6774dd42467265e4083fd7f97447d7ce2f437529 (patch) | |
tree | 9b7a391b72eaa69b8cac2698fa8530de9382ab2c /engines | |
parent | 89a3c43da1318644b14531b69ed1b38708a6413a (diff) | |
download | scummvm-rg350-6774dd42467265e4083fd7f97447d7ce2f437529.tar.gz scummvm-rg350-6774dd42467265e4083fd7f97447d7ce2f437529.tar.bz2 scummvm-rg350-6774dd42467265e4083fd7f97447d7ce2f437529.zip |
ACCESS: Implement speakText()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/access/access.cpp | 91 | ||||
-rw-r--r-- | engines/access/access.h | 2 | ||||
-rw-r--r-- | engines/access/scripts.cpp | 2 | ||||
-rw-r--r-- | engines/access/scripts.h | 3 | ||||
-rw-r--r-- | engines/access/sound.h | 3 |
5 files changed, 92 insertions, 9 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 0db3376697..9cddd1ba46 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -264,6 +264,90 @@ void AccessEngine::loadEstablish(int sub) { _countTbl[i] = READ_LE_UINT16(_eseg + idx + 6 + (2 * i)); } +void AccessEngine::speakText(int idx) { + int curPage = 0; + int soundsLeft = 0; + + Common::String msg; + for (int i = idx; _eseg[i] != 0; ++i) + msg += _eseg[i]; + + while(true) { + soundsLeft = _countTbl[curPage]; + _events->zeroKeys(); + + Common::String line; + int width = 0; + bool lastLine = _fonts._font2.getLine(msg, _bubbleBox->_maxChars * 6, line, width); + // Set font colors + _fonts._font2._fontColors[0] = 0; + _fonts._font2._fontColors[1] = 28; + _fonts._font2._fontColors[2] = 29; + _fonts._font2._fontColors[3] = 30; + + _fonts._font2.drawString(_screen, line, _fonts._printOrg); + _fonts._printOrg = Common::Point(_fonts._printStart.x, _fonts._printOrg.y + 9); + + if ((_fonts._printOrg.y > _printEnd) && (!lastLine)) { + while (true) { + _sound->_soundTable[0]._data = _sound->loadSound(_narateFile + 99, _sndSubFile); + _sound->_soundPriority[0] = 1; + _sound->playSound(1); + _scripts->CMDFREESOUND(); + + _events->pollEvents(); + + if (_events->_leftButton) { + _events->debounceLeft(); + _sndSubFile += soundsLeft; + break; + } else if (_events->_keypresses.size() != 0) { + _sndSubFile += soundsLeft; + break; + } else { + ++_sndSubFile; + --soundsLeft; + if (soundsLeft == 0) + break; + } + } + _buffer2.copyBuffer(_screen); + _fonts._printOrg.y = _fonts._printStart.y; + ++curPage; + soundsLeft = _countTbl[curPage]; + } + + if (lastLine) + break; + } + + if (soundsLeft == 0) + return; + + while(true) { + _sound->_soundTable[0]._data = _sound->loadSound(_narateFile + 99, _sndSubFile); + _sound->_soundPriority[0] = 1; + _sound->playSound(1); + _scripts->CMDFREESOUND(); + + _events->pollEvents(); + + if (_events->_leftButton) { + _events->debounceLeft(); + _sndSubFile += soundsLeft; + break; + } else if (_events->_keypresses.size() != 0) { + _sndSubFile += soundsLeft; + break; + } else { + ++_sndSubFile; + --soundsLeft; + if (soundsLeft == 0) + break; + } + } +} + void AccessEngine::doEstablish(int esatabIndex, int sub) { _establishMode = 1; @@ -289,16 +373,13 @@ void AccessEngine::doEstablish(int esatabIndex, int sub) { loadEstablish(sub); _et = sub; warning("CHECKME: Use of di"); - Common::String msg; int idx = READ_LE_UINT16(_eseg + (sub * 2) + 2); - for (int i = idx; _eseg[i] != 0; ++i) - msg += _eseg[i]; _printEnd = 155; if (_txtPages == 0) - warning("TODO: printText(%s)", msg.c_str()); + warning("TODO: printText()"); else - warning("TODO: speakText(%s)", msg.c_str()); + speakText(idx); _screen->forceFadeOut(); _screen->clearScreen(); diff --git a/engines/access/access.h b/engines/access/access.h index db969357aa..bd1269f3f9 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -91,6 +91,8 @@ private: void dummyLoop(); + void speakText(int idx); + void doEstablish(int esatabIndex, int sub); protected: const AccessGameDescription *_gameDescription; diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index 37d1d50899..6ee8eb0da5 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -658,7 +658,7 @@ void Scripts::cmdLoadSound() { _vm->_sound->_soundPriority[0] = 1; } -void Scripts::CMDFREESOUND() { error("TODO CMDFREESOUND"); } +void Scripts::CMDFREESOUND() { warning("TODO CMDFREESOUND"); } void Scripts::cmdSetVideoSound() { uint32 startPos = _data->pos(); diff --git a/engines/access/scripts.h b/engines/access/scripts.h index 93cd495be6..aa5c4063f6 100644 --- a/engines/access/scripts.h +++ b/engines/access/scripts.h @@ -113,7 +113,6 @@ protected: void cmdReturnChoice(); void cmdClearBlock(); void cmdLoadSound(); - void CMDFREESOUND(); void cmdSetVideoSound(); void CMDPLAYVIDSND(); void CMDPUSHLOCATION(); @@ -144,6 +143,8 @@ public: int executeScript(); void findNull(); + + void CMDFREESOUND(); }; } // End of namespace Access diff --git a/engines/access/sound.h b/engines/access/sound.h index cb73bae52c..e0992db0e2 100644 --- a/engines/access/sound.h +++ b/engines/access/sound.h @@ -42,8 +42,6 @@ private: Audio::Mixer *_mixer; Audio::SoundHandle _soundHandle; - byte *loadSound(int fileNum, int subfile); - void playSound(byte *data, uint32 size); public: SoundEntry _soundTable[MAX_SOUNDS]; @@ -61,6 +59,7 @@ public: void playSound(int soundIndex); + byte *loadSound(int fileNum, int subfile); void loadSounds(Common::Array<RoomInfo::SoundIdent> &sounds); void midiPlay(); |