[Scummvm-cvs-logs] SF.net SVN: scummvm:[34797] scummvm/branches/branch-0-12-0/engines/sword1

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon Oct 13 20:44:33 CEST 2008


Revision: 34797
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34797&view=rev
Author:   eriktorbjorn
Date:     2008-10-13 18:44:30 +0000 (Mon, 13 Oct 2008)

Log Message:
-----------
Backported fixes for cutscene subtitles.

Modified Paths:
--------------
    scummvm/branches/branch-0-12-0/engines/sword1/animation.cpp
    scummvm/branches/branch-0-12-0/engines/sword1/text.cpp
    scummvm/branches/branch-0-12-0/engines/sword1/text.h

Modified: scummvm/branches/branch-0-12-0/engines/sword1/animation.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/engines/sword1/animation.cpp	2008-10-13 18:41:12 UTC (rev 34796)
+++ scummvm/branches/branch-0-12-0/engines/sword1/animation.cpp	2008-10-13 18:44:30 UTC (rev 34797)
@@ -184,7 +184,7 @@
 	if (SwordEngine::_systemVars.showText) {
 		sprintf(fileName, "%s.txt", sequenceList[id]);
 		if (f.open(fileName)) {
-			char line[120];
+			char line[240];
 			int lineNo = 0;
 			int lastEnd = -1;
 
@@ -278,7 +278,7 @@
 				_textSpriteBuf = (byte *)calloc(_textHeight, _textWidth);
 			}
 			if (_currentFrame == _movieTexts[0]->_endFrame) {
-				_textMan->releaseText(2);
+				_textMan->releaseText(2, false);
 				free(_textSpriteBuf);
 				_textSpriteBuf = NULL;
 				delete _movieTexts.remove_at(0);
@@ -309,10 +309,15 @@
 		}
 	}
 
-	while (!_movieTexts.empty()) {
-		delete _movieTexts.remove_at(_movieTexts.size() - 1);
+	if (_textSpriteBuf) {
+		_textMan->releaseText(2, false);
+		free(_textSpriteBuf);
+		_textSpriteBuf = NULL;
 	}
 
+	while (!_movieTexts.empty())
+		delete _movieTexts.remove_at(_movieTexts.size() - 1);
+
 	while (_snd->isSoundHandleActive(_bgSoundHandle))
 		_system->delayMillis(100);
 

Modified: scummvm/branches/branch-0-12-0/engines/sword1/text.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/engines/sword1/text.cpp	2008-10-13 18:41:12 UTC (rev 34796)
+++ scummvm/branches/branch-0-12-0/engines/sword1/text.cpp	2008-10-13 18:44:30 UTC (rev 34797)
@@ -89,7 +89,7 @@
 	assert(!_textBlocks[slot]); // if this triggers, the speechDriver failed to call Text::releaseText.
 	_textBlocks[slot] = (FrameHeader*)malloc(sprSize + sizeof(FrameHeader));
 
-	memcpy( _textBlocks[slot]->runTimeComp, "Nu  ", 4);
+	memcpy(_textBlocks[slot]->runTimeComp, "Nu  ", 4);
 	_textBlocks[slot]->compSize	= 0;
 	_textBlocks[slot]->width	= _resMan->toUint16(sprWidth);
 	_textBlocks[slot]->height	= _resMan->toUint16(sprHeight);
@@ -179,13 +179,14 @@
 	return _textBlocks[textTarget];
 }
 
-void Text::releaseText(uint32 id) {
+void Text::releaseText(uint32 id, bool updateCount) {
 	id &= ITM_ID;
 	assert(id < MAX_TEXT_OBS);
 	if (_textBlocks[id]) {
 		free(_textBlocks[id]);
 		_textBlocks[id] = NULL;
-		_textCount--;
+		if (updateCount)
+			_textCount--;
 	}
 }
 

Modified: scummvm/branches/branch-0-12-0/engines/sword1/text.h
===================================================================
--- scummvm/branches/branch-0-12-0/engines/sword1/text.h	2008-10-13 18:41:12 UTC (rev 34796)
+++ scummvm/branches/branch-0-12-0/engines/sword1/text.h	2008-10-13 18:44:30 UTC (rev 34797)
@@ -52,7 +52,7 @@
 	FrameHeader *giveSpriteData(uint32 textTarget);
 	uint32 lowTextManager(uint8 *text, int32 width, uint8 pen);
 	void makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 pen);
-	void releaseText(uint32 id);
+	void releaseText(uint32 id, bool updateCount = true);
 
 private:
 	uint16 analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *info);


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