[Scummvm-cvs-logs] SF.net SVN: scummvm: [23150] scummvm/branches/branch-0-9-0/engines/saga/actor.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Fri Jun 16 21:35:43 CEST 2006


Revision: 23150
Author:   sev
Date:     2006-06-16 12:35:32 -0700 (Fri, 16 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23150&view=rev

Log Message:
-----------
Backport fix for #1507216: "ITE: 15 second freeze in Prince's bedroom"

Modified Paths:
--------------
    scummvm/branches/branch-0-9-0/engines/saga/actor.cpp
Modified: scummvm/branches/branch-0-9-0/engines/saga/actor.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/saga/actor.cpp	2006-06-16 19:34:16 UTC (rev 23149)
+++ scummvm/branches/branch-0-9-0/engines/saga/actor.cpp	2006-06-16 19:35:32 UTC (rev 23150)
@@ -1139,8 +1139,7 @@
 		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,19 @@
 	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();
+	stringLength = strlen(_activeSpeech.strings[0]);
+	outputString = (char*)calloc(stringLength + 1, 1);
 
-	if (_activeSpeech.speechFlags & kSpeakSlow) {
-		outputString = oneChar;
-		oneChar[0] = _activeSpeech.strings[0][_activeSpeech.slowModeCharIndex];
-	} else {
-		outputString = _activeSpeech.strings[0];
-	}
-	
+	if (_activeSpeech.speechFlags & kSpeakSlow)
+		strncpy(outputString, _activeSpeech.strings[0], _activeSpeech.slowModeCharIndex + 1);
+	else
+		strncpy(outputString, _activeSpeech.strings[0], stringLength);
+
 	if (_activeSpeech.actorsCount > 1) {
 		height = _vm->_font->getHeight(kKnownFontScript);
 		width = _vm->_font->getStringWidth(kKnownFontScript, _activeSpeech.strings[0], 0, kFontNormal);
@@ -1818,13 +1816,15 @@
 			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));
 	}
+
+	free(outputString);
 }
 
 bool Actor::followProtagonist(ActorData *actor) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list