aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAndrew Kurushin2006-06-16 18:41:24 +0000
committerAndrew Kurushin2006-06-16 18:41:24 +0000
commit9e21960e934fc434b4cb83dd27af285508982cf8 (patch)
tree69ce9fee7bce4c2b80441253e38dd31b2d01c109 /engines
parent40bfc71de8102c0391f08ddb5de6009d924f07f7 (diff)
downloadscummvm-rg350-9e21960e934fc434b4cb83dd27af285508982cf8.tar.gz
scummvm-rg350-9e21960e934fc434b4cb83dd27af285508982cf8.tar.bz2
scummvm-rg350-9e21960e934fc434b4cb83dd27af285508982cf8.zip
fix bug id 1507216 "ITE: 15 second freeze in Prince's bedroom"
svn-id: r23148
Diffstat (limited to 'engines')
-rw-r--r--engines/saga/actor.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp
index 0f7e40f480..2785acaee0 100644
--- a/engines/saga/actor.cpp
+++ b/engines/saga/actor.cpp
@@ -1139,8 +1139,7 @@ void Actor::handleSpeech(int msec) {
if (_activeSpeech.slowModeCharIndex >= stringLength)
error("Wrong string index");
- warning("Slow string encountered");
- _activeSpeech.playingTime = stringLength * 1000 / 4;
+ _activeSpeech.playingTime = 1000 / 8;
} else {
sampleLength = _vm->_sndRes->getVoiceLength(_activeSpeech.sampleResourceId);
@@ -1793,20 +1792,20 @@ void Actor::drawSpeech(void) {
Point textPoint;
ActorData *actor;
int width, height;
- char oneChar[2];
- oneChar[1] = 0;
- const char *outputString;
+ int stringLength;
Surface *backBuffer;
+ char *outputString;
backBuffer = _vm->_gfx->getBackBuffer();
if (_activeSpeech.speechFlags & kSpeakSlow) {
- outputString = oneChar;
- oneChar[0] = _activeSpeech.strings[0][_activeSpeech.slowModeCharIndex];
+ stringLength = strlen(_activeSpeech.strings[0]);
+ outputString = (char*)calloc(stringLength + 1, 1);
+ strncpy(outputString, _activeSpeech.strings[0], _activeSpeech.slowModeCharIndex + 1);
} else {
- outputString = _activeSpeech.strings[0];
+ outputString = (char*)_activeSpeech.strings[0];
}
-
+
if (_activeSpeech.actorsCount > 1) {
height = _vm->_font->getHeight(kKnownFontScript);
width = _vm->_font->getStringWidth(kKnownFontScript, _activeSpeech.strings[0], 0, kFontNormal);
@@ -1818,13 +1817,16 @@ void Actor::drawSpeech(void) {
textPoint.x = clamp(10, actor->_screenPosition.x - width / 2, _vm->getDisplayWidth() - 10 - width);
textPoint.y = clamp(10, actor->_screenPosition.y - 58, _vm->_scene->getHeight() - 10 - height);
- _vm->_font->textDraw(kKnownFontScript, backBuffer, _activeSpeech.strings[0], textPoint,
+ _vm->_font->textDraw(kKnownFontScript, backBuffer, outputString, textPoint,
_activeSpeech.speechColor[i], _activeSpeech.outlineColor[i], _activeSpeech.getFontFlags(i));
}
} else {
- _vm->_font->textDrawRect(kKnownFontScript, backBuffer, _activeSpeech.strings[0], _activeSpeech.drawRect, _activeSpeech.speechColor[0],
+ _vm->_font->textDrawRect(kKnownFontScript, backBuffer, outputString, _activeSpeech.drawRect, _activeSpeech.speechColor[0],
_activeSpeech.outlineColor[0], _activeSpeech.getFontFlags(0));
}
+ if (_activeSpeech.speechFlags & kSpeakSlow) {
+ free(outputString);
+ }
}
bool Actor::followProtagonist(ActorData *actor) {