aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Kagerer2009-03-09 00:54:27 +0000
committerFlorian Kagerer2009-03-09 00:54:27 +0000
commit6d9a047276d55c1e7299bfa503a7637205acf27f (patch)
tree3018eb23d8bf24f5e2d94bd8280a35904fc02bd1
parent6cb3f665aff572fdbdb12c940ace9c4bfe912138 (diff)
downloadscummvm-rg350-6d9a047276d55c1e7299bfa503a7637205acf27f.tar.gz
scummvm-rg350-6d9a047276d55c1e7299bfa503a7637205acf27f.tar.bz2
scummvm-rg350-6d9a047276d55c1e7299bfa503a7637205acf27f.zip
LOL: minor fix for text displayer (text pages now advance automatically when the speech has reached the next part)
svn-id: r39250
-rw-r--r--engines/kyra/lol.cpp4
-rw-r--r--engines/kyra/sound.cpp9
-rw-r--r--engines/kyra/text_lol.cpp23
-rw-r--r--engines/kyra/text_lol.h3
4 files changed, 22 insertions, 17 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index b6b655bd9c..f3bc4aa960 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -415,8 +415,8 @@ Common::Error LoLEngine::init() {
_tmpData136 = new uint8[136];
memset(_tmpData136, 0, 136);
- memset(_gameFlags, 0, 16 * sizeof(uint16));
- memset(_globalScriptVars, 0, 16 * sizeof(uint16));
+ memset(_gameFlags, 0, sizeof(_gameFlags));
+ memset(_globalScriptVars, 0, sizeof(_globalScriptVars));
_levelFileData = 0;
_lvlShpFileHandle = 0;
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 4b4439c1e3..10c43b5637 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -123,7 +123,8 @@ uint32 Sound::voicePlayFromList(Common::List<const char*> fileList) {
return 0;
Audio::AppendableAudioStream *out = Audio::makeAppendableAudioStream(22050, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED);
-
+ uint32 totalPlayTime = 0;
+
for (Common::List<const char*>::iterator i = fileList.begin(); i != fileList.end(); i++) {
Common::SeekableReadStream *file = _vm->resource()->createReadStream(*i);
@@ -146,13 +147,15 @@ uint32 Sound::voicePlayFromList(Common::List<const char*> fileList) {
free(data);
out->queueBuffer(vocBuffer, size);
+ totalPlayTime += size;
}
-
+
+ totalPlayTime = (totalPlayTime * 1000) / 22050;
out->finish();
_soundChannels[h].file = *fileList.begin();
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, out);
- return out->getTotalPlayTime();
+ return totalPlayTime;
}
void Sound::voiceStop(const char *file) {
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index 5996712bd3..7fd47d6bc2 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -32,7 +32,7 @@ namespace Kyra {
TextDisplayer_LoL::TextDisplayer_LoL(LoLEngine *vm, Screen_LoL *screen) : _vm(vm), _screen(screen),
_scriptParameter(0), _animWidth(0), _animColour1(0), _animColour2(0), _animFlag(true),
- _printFlag(false), _lineWidth(0), _numChars(0), _numCharsPrinted(0), _posX(0), _posY(0), _colour1(0), _colour2(0) {
+ _printFlag(false), _lineWidth(0), _numCharsTotal(0), _numCharsLeft(0), _numCharsPrinted(0), _posX(0), _posY(0), _colour1(0), _colour2(0) {
memset(_stringParameters, 0, 15 * sizeof(char*));
_buffer = new char[600];
@@ -161,6 +161,7 @@ void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script,
Screen::FontId of = _screen->setFont(Screen::FID_9_FNT);
preprocessString(str, script, paramList, paramIndex);
+ _numCharsTotal = strlen(_dialogueBuffer);
displayText(_dialogueBuffer);
_screen->setScreenDim(oldDim);
@@ -316,7 +317,7 @@ void TextDisplayer_LoL::displayText(char *str, ...) {
_printFlag = false;
_lineWidth = 0;
- _numChars = 0;
+ _numCharsLeft = 0;
_numCharsPrinted = 0;
_tempString1 = str;
@@ -411,8 +412,8 @@ void TextDisplayer_LoL::displayText(char *str, ...) {
default:
_lineWidth += _screen->getCharWidth(c);
- _currentLine[_numChars++] = c;
- _currentLine[_numChars] = 0;
+ _currentLine[_numCharsLeft++] = c;
+ _currentLine[_numCharsLeft] = 0;
if ((_posX + _lineWidth) > (sd->w << 3))
printLine(_currentLine);
@@ -425,7 +426,7 @@ void TextDisplayer_LoL::displayText(char *str, ...) {
va_end(args);
- if (_numChars)
+ if (_numCharsLeft)
printLine(_currentLine);
}
@@ -468,7 +469,7 @@ void TextDisplayer_LoL::readNextPara() {
void TextDisplayer_LoL::printLine(char *str) {
const ScreenDim *sd = _screen->_curDim;
-
+
int fh = (_screen->getFontHeight() + _screen->_charOffset);
int lines = (sd->h - _screen->_charOffset) / fh;
@@ -494,7 +495,7 @@ void TextDisplayer_LoL::printLine(char *str) {
int y = sd->sy + fh * _posY;
int w = sd->w << 3;
int lw = _lineWidth;
- int s = _numChars;
+ int s = _numCharsLeft;
char c = 0;
if ((lw + _posX) > w) {
@@ -549,10 +550,10 @@ void TextDisplayer_LoL::printLine(char *str) {
s++;
strcpy(str, &str[s]);
- _numChars = strlen(str);
+ _numCharsLeft = strlen(str);
_lineWidth = _screen->getTextWidth(str);
- if (!_numChars && _posX < (sd->w << 3))
+ if (!_numCharsLeft && _posX < (sd->w << 3))
return;
_posX = 0;
@@ -581,8 +582,8 @@ void TextDisplayer_LoL::textPageBreak() {
}
uint32 speechPartTime = 0;
- if (_vm->_speechFlag && _vm->_activeVoiceFileTotalTime && _numChars)
- speechPartTime = _vm->_system->getMillis() + ((_numCharsPrinted * _vm->_activeVoiceFileTotalTime) / _numChars);
+ if (_vm->_speechFlag && _vm->_activeVoiceFileTotalTime && _numCharsTotal)
+ speechPartTime = _vm->_system->getMillis() + ((_numCharsPrinted * _vm->_activeVoiceFileTotalTime) / _numCharsTotal);
const ScreenDim *dim = _screen->getScreenDim(_screen->curDimIndex());
diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h
index 9876bfbb56..b25a3c6a40 100644
--- a/engines/kyra/text_lol.h
+++ b/engines/kyra/text_lol.h
@@ -70,7 +70,8 @@ private:
char _scriptParaString[11];
uint16 _lineWidth;
- uint32 _numChars;
+ uint32 _numCharsTotal;
+ uint32 _numCharsLeft;
uint32 _numCharsPrinted;
const char *_animString;