[Scummvm-cvs-logs] SF.net SVN: scummvm: [24324] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Oct 15 03:26:30 CEST 2006


Revision: 24324
          http://svn.sourceforge.net/scummvm/?rev=24324&view=rev
Author:   fingolfin
Date:     2006-10-14 18:26:23 -0700 (Sat, 14 Oct 2006)

Log Message:
-----------
Replaced function level static variable (YUCK) called 'sentence' by ScummEngine_v2:_sentenceBuf

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/intern.h
    scummvm/trunk/engines/scumm/script_c64.cpp
    scummvm/trunk/engines/scumm/script_v2.cpp

Modified: scummvm/trunk/engines/scumm/intern.h
===================================================================
--- scummvm/trunk/engines/scumm/intern.h	2006-10-15 01:24:17 UTC (rev 24323)
+++ scummvm/trunk/engines/scumm/intern.h	2006-10-15 01:26:23 UTC (rev 24324)
@@ -273,6 +273,8 @@
 
 	V2MouseoverBox _mouseOverBoxesV2[7];
 	int8 _mouseOverBoxV2;
+	
+	static char _sentenceBuf[256];
 
 public:
 	ScummEngine_v2(OSystem *syst, const DetectorResult &dr);

Modified: scummvm/trunk/engines/scumm/script_c64.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_c64.cpp	2006-10-15 01:24:17 UTC (rev 24323)
+++ scummvm/trunk/engines/scumm/script_c64.cpp	2006-10-15 01:26:23 UTC (rev 24324)
@@ -460,7 +460,6 @@
 
 void ScummEngine_c64::drawSentence() {
 	Common::Rect sentenceline;
-	static char sentence[256];
 	const byte *temp;
 	int sentencePrep = 0;
 
@@ -468,7 +467,7 @@
 		return;
 
 	if (getResourceAddress(rtVerb, _activeVerb)) {
-		strcpy(sentence, (char*)getResourceAddress(rtVerb, _activeVerb));
+		strcpy(_sentenceBuf, (char*)getResourceAddress(rtVerb, _activeVerb));
 	} else {
 		return;
 	}
@@ -476,8 +475,8 @@
 	if (_activeObject > 0) {
 		temp = getObjOrActorName(_activeObject);
 		if (temp) {
-			strcat(sentence, " ");
-			strcat(sentence, (const char*)temp);
+			strcat(_sentenceBuf, " ");
+			strcat(_sentenceBuf, (const char*)temp);
 		}
 
 		if (_verbs[_activeVerb].prep == 0xFF) {
@@ -518,14 +517,14 @@
 			lang = 0;	// Default to english
 		}
 
-		strcat(sentence, prepositions[lang][sentencePrep]);
+		strcat(_sentenceBuf, prepositions[lang][sentencePrep]);
 	}
 
 	if (_activeInventory > 0) {
 		temp = getObjOrActorName(_activeInventory);
 		if (temp) {
-			strcat(sentence, " ");
-			strcat(sentence, (const char*)temp);
+			strcat(_sentenceBuf, " ");
+			strcat(_sentenceBuf, (const char*)temp);
 		}
 	}
 
@@ -536,7 +535,7 @@
 	_string[2].color = 16;
 
 	byte string[80];
-	char *ptr = sentence;
+	char *ptr = _sentenceBuf;
 	int i = 0, len = 0;
 
 	// Maximum length of printable characters

Modified: scummvm/trunk/engines/scumm/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v2.cpp	2006-10-15 01:24:17 UTC (rev 24323)
+++ scummvm/trunk/engines/scumm/script_v2.cpp	2006-10-15 01:26:23 UTC (rev 24324)
@@ -976,7 +976,6 @@
 
 void ScummEngine_v2::o2_drawSentence() {
 	Common::Rect sentenceline;
-	static char sentence[256];
 	const byte *temp;
 	int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB), 0);
 
@@ -984,15 +983,15 @@
 		return;
 
 	if (getResourceAddress(rtVerb, slot))
-		strcpy(sentence, (char*)getResourceAddress(rtVerb, slot));
+		strcpy(_sentenceBuf, (char*)getResourceAddress(rtVerb, slot));
 	else
 		return;
 
 	if (VAR(VAR_SENTENCE_OBJECT1) > 0) {
 		temp = getObjOrActorName(VAR(VAR_SENTENCE_OBJECT1));
 		if (temp) {
-			strcat(sentence, " ");
-			strcat(sentence, (const char*)temp);
+			strcat(_sentenceBuf, " ");
+			strcat(_sentenceBuf, (const char*)temp);
 		}
 
 		// For V1 games, the engine must compute the preposition.
@@ -1037,16 +1036,16 @@
 		}
 
 		if (_game.platform == Common::kPlatformNES) {
-			strcat(sentence, (const char *)(getResourceAddress(rtCostume, 78) + VAR(VAR_SENTENCE_PREPOSITION) * 8 + 2));
+			strcat(_sentenceBuf, (const char *)(getResourceAddress(rtCostume, 78) + VAR(VAR_SENTENCE_PREPOSITION) * 8 + 2));
 		} else
-			strcat(sentence, prepositions[lang][VAR(VAR_SENTENCE_PREPOSITION)]);
+			strcat(_sentenceBuf, prepositions[lang][VAR(VAR_SENTENCE_PREPOSITION)]);
 	}
 
 	if (VAR(VAR_SENTENCE_OBJECT2) > 0) {
 		temp = getObjOrActorName(VAR(VAR_SENTENCE_OBJECT2));
 		if (temp) {
-			strcat(sentence, " ");
-			strcat(sentence, (const char*)temp);
+			strcat(_sentenceBuf, " ");
+			strcat(_sentenceBuf, (const char*)temp);
 		}
 	}
 
@@ -1063,7 +1062,7 @@
 		_string[2].color = 13;
 
 	byte string[80];
-	char *ptr = sentence;
+	char *ptr = _sentenceBuf;
 	int i = 0, len = 0;
 
 	// Maximum length of printable characters


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