[Scummvm-cvs-logs] SF.net SVN: scummvm:[39250] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Mon Mar 9 01:54:27 CET 2009


Revision: 39250
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39250&view=rev
Author:   athrxx
Date:     2009-03-09 00:54:27 +0000 (Mon, 09 Mar 2009)

Log Message:
-----------
LOL: minor fix for text displayer (text pages now advance automatically when the speech has reached the next part)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/sound.cpp
    scummvm/trunk/engines/kyra/text_lol.cpp
    scummvm/trunk/engines/kyra/text_lol.h

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-03-08 23:28:19 UTC (rev 39249)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-03-09 00:54:27 UTC (rev 39250)
@@ -415,8 +415,8 @@
 	_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;

Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2009-03-08 23:28:19 UTC (rev 39249)
+++ scummvm/trunk/engines/kyra/sound.cpp	2009-03-09 00:54:27 UTC (rev 39250)
@@ -123,7 +123,8 @@
 		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 @@
 		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) {

Modified: scummvm/trunk/engines/kyra/text_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_lol.cpp	2009-03-08 23:28:19 UTC (rev 39249)
+++ scummvm/trunk/engines/kyra/text_lol.cpp	2009-03-09 00:54:27 UTC (rev 39250)
@@ -32,7 +32,7 @@
 
 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 @@
 	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 @@
 	_printFlag = false;
 	
 	_lineWidth = 0;
-	_numChars = 0;
+	_numCharsLeft = 0;
 	_numCharsPrinted = 0;
 
 	_tempString1 = str;
@@ -411,8 +412,8 @@
 
 			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 @@
 
 	va_end(args);
 
-	if (_numChars)
+	if (_numCharsLeft)
 		printLine(_currentLine);
 }
 
@@ -468,7 +469,7 @@
 
 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 @@
 	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 @@
 		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 @@
 	}
 
 	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());
 

Modified: scummvm/trunk/engines/kyra/text_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/text_lol.h	2009-03-08 23:28:19 UTC (rev 39249)
+++ scummvm/trunk/engines/kyra/text_lol.h	2009-03-09 00:54:27 UTC (rev 39250)
@@ -70,7 +70,8 @@
 	char _scriptParaString[11];
 
 	uint16 _lineWidth;
-	uint32 _numChars;
+	uint32 _numCharsTotal;
+	uint32 _numCharsLeft;
 	uint32 _numCharsPrinted;
 	
 	const char *_animString;


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