mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
ACCESS: Implement speakText()
This commit is contained in:
parent
89a3c43da1
commit
6774dd4246
@ -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();
|
||||
|
@ -91,6 +91,8 @@ private:
|
||||
|
||||
void dummyLoop();
|
||||
|
||||
void speakText(int idx);
|
||||
|
||||
void doEstablish(int esatabIndex, int sub);
|
||||
protected:
|
||||
const AccessGameDescription *_gameDescription;
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user