aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/actor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/saga/actor.cpp')
-rw-r--r--engines/saga/actor.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp
index 2785acaee0..8128d70307 100644
--- a/engines/saga/actor.cpp
+++ b/engines/saga/actor.cpp
@@ -1797,14 +1797,13 @@ void Actor::drawSpeech(void) {
char *outputString;
backBuffer = _vm->_gfx->getBackBuffer();
+ stringLength = strlen(_activeSpeech.strings[0]);
+ outputString = (char*)calloc(stringLength + 1, 1);
- if (_activeSpeech.speechFlags & kSpeakSlow) {
- stringLength = strlen(_activeSpeech.strings[0]);
- outputString = (char*)calloc(stringLength + 1, 1);
+ if (_activeSpeech.speechFlags & kSpeakSlow)
strncpy(outputString, _activeSpeech.strings[0], _activeSpeech.slowModeCharIndex + 1);
- } else {
- outputString = (char*)_activeSpeech.strings[0];
- }
+ else
+ strncpy(outputString, _activeSpeech.strings[0], stringLength);
if (_activeSpeech.actorsCount > 1) {
height = _vm->_font->getHeight(kKnownFontScript);
@@ -1824,9 +1823,8 @@ void Actor::drawSpeech(void) {
_vm->_font->textDrawRect(kKnownFontScript, backBuffer, outputString, _activeSpeech.drawRect, _activeSpeech.speechColor[0],
_activeSpeech.outlineColor[0], _activeSpeech.getFontFlags(0));
}
- if (_activeSpeech.speechFlags & kSpeakSlow) {
- free(outputString);
- }
+
+ free(outputString);
}
bool Actor::followProtagonist(ActorData *actor) {