[Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.129,1.130 graphics.cpp,1.102,1.103 input.cpp,1.26,1.27 logic.cpp,1.200,1.201 talk.cpp,1.101,1.102

Gregory Montoir cyx at users.sourceforge.net
Sat Aug 14 15:34:01 CEST 2004


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31235/queen

Modified Files:
	cutaway.cpp graphics.cpp input.cpp logic.cpp talk.cpp 
Log Message:
minor cleanp

Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- cutaway.cpp	6 Aug 2004 11:28:33 -0000	1.129
+++ cutaway.cpp	14 Aug 2004 22:32:59 -0000	1.130
@@ -188,23 +188,23 @@
 {
 	byte *oldPtr = ptr;
 
-	object.objectNumber  = (int16)READ_BE_INT16(ptr); ptr += 2;
+	object.objectNumber = (int16)READ_BE_INT16(ptr); ptr += 2;
 	object.moveToX      = (int16)READ_BE_INT16(ptr); ptr += 2;
 	object.moveToY      = (int16)READ_BE_INT16(ptr); ptr += 2;
-	object.bank           = (int16)READ_BE_INT16(ptr); ptr += 2;      
-	object.animList      = (int16)READ_BE_INT16(ptr); ptr += 2;
-	object.execute        = (int16)READ_BE_INT16(ptr); ptr += 2;    
+	object.bank         = (int16)READ_BE_INT16(ptr); ptr += 2;      
+	object.animList     = (int16)READ_BE_INT16(ptr); ptr += 2;
+	object.execute      = (int16)READ_BE_INT16(ptr); ptr += 2;    
 	object.limitBobX1   = (int16)READ_BE_INT16(ptr); ptr += 2;
 	object.limitBobY1   = (int16)READ_BE_INT16(ptr); ptr += 2;
 	object.limitBobX2   = (int16)READ_BE_INT16(ptr); ptr += 2;
 	object.limitBobY2   = (int16)READ_BE_INT16(ptr); ptr += 2;
-	object.specialMove   = (int16)READ_BE_INT16(ptr); ptr += 2;
-	object.animType      = (int16)READ_BE_INT16(ptr); ptr += 2;   
-	object.fromObject    = (int16)READ_BE_INT16(ptr); ptr += 2;
+	object.specialMove  = (int16)READ_BE_INT16(ptr); ptr += 2;
+	object.animType     = (int16)READ_BE_INT16(ptr); ptr += 2;   
+	object.fromObject   = (int16)READ_BE_INT16(ptr); ptr += 2;
 	object.bobStartX    = (int16)READ_BE_INT16(ptr); ptr += 2;
 	object.bobStartY    = (int16)READ_BE_INT16(ptr); ptr += 2;
-	object.room           = (int16)READ_BE_INT16(ptr); ptr += 2;
-	object.scale          = (int16)READ_BE_INT16(ptr); ptr += 2;
+	object.room         = (int16)READ_BE_INT16(ptr); ptr += 2;
+	object.scale        = (int16)READ_BE_INT16(ptr); ptr += 2;
 
 	if ((ptr - oldPtr) != 17*sizeof(int16))
 		error("Wrong number of values read");
@@ -858,7 +858,6 @@
 
 		char sentence[MAX_STRING_SIZE];
 		_nextSentence = Talk::getString(_nextSentence, sentence, MAX_STRING_LENGTH);
-		//debug(6, "Sentence = '%s'", sentence);
 
 		if (OBJECT_ROOMFADE == object.objectNumber) {
 			_roomFade = true;

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- graphics.cpp	6 Aug 2004 11:28:33 -0000	1.102
+++ graphics.cpp	14 Aug 2004 22:33:13 -0000	1.103
@@ -914,7 +914,7 @@
 
 	// unpack the paste downs
 	for  (i = 1; i <= furnitureCount; ++i) {
-		if (furniture[i] > 5000) {;
+		if (furniture[i] > 5000) {
 			pasteBob(furniture[i] - 5000, curImage + 1);
 		}
 	}
@@ -948,11 +948,11 @@
 			// create a blank frame for the OFF object
 			++_numFrames;
 			++curImage;
-		} else if(pod->image == -2) {
+		} else if (pod->image == -2) {
 			// animated OFF Bob
 			curBob = 5 + _numFurnitureAnimated + numObjectAnimated;
 			++numObjectAnimated;
-		} else if(pod->image > 0 && pod->image < 5000) {
+		} else if (pod->image > 0 && pod->image < 5000) {
 			GraphicData *pgd = _vm->logic()->graphicData(pod->image);
 			int16 lastFrame = pgd->lastFrame;
 			bool rebound = false;
@@ -1196,7 +1196,7 @@
 		case 99: // end of BAM data
 			_lastSoundIndex = _index = 0;
 			const BamDataBlock *data[] = {
-				_fight1Data, 
+				_fight1Data,
 				_fight2Data,
 				_fight3Data
 			};

Index: input.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/input.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- input.cpp	17 Mar 2004 14:10:51 -0000	1.26
+++ input.cpp	14 Aug 2004 22:33:13 -0000	1.27
@@ -128,12 +128,10 @@
 		if (amount == 0)
 			break;
 
-		{
-			uint this_delay = 20; // 1?
-			if (this_delay > amount)
-				this_delay = amount;
-			_system->delay_msecs(this_delay);
-		}
+		uint this_delay = 20; // 1?
+		if (this_delay > amount)
+			this_delay = amount;
+		_system->delay_msecs(this_delay);
 		cur = _system->get_msecs();
 	} while (cur < start + amount);
 }

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -d -r1.200 -r1.201
--- logic.cpp	6 Aug 2004 17:01:58 -0000	1.200
+++ logic.cpp	14 Aug 2004 22:33:13 -0000	1.201
@@ -106,7 +106,6 @@
 		}	
 	}
 
-
 	_numItems = READ_BE_UINT16(ptr); ptr += 2;
 	_itemData = new ItemData[_numItems + 1];
 	memset(&_itemData[0], 0, sizeof(ItemData));
@@ -1186,7 +1185,6 @@
 	_vm->display()->horizontalScroll(_vm->input()->mousePosX());
 
 	joe->x = piton->x = 3 * _vm->input()->mousePosX() / 4 + 200;
-
 	joe->frameNum = _vm->input()->mousePosX() / 36 + 43 + FRAMES_JOE_XTRA;
 
 	// bobs have been unpacked from animating objects, we don't need them
@@ -1725,7 +1723,6 @@
 	lightningBob->x = 160;
 	lightningBob->y = 0;
 
-	// 23/2/95 - Play lightning SFX
 	_vm->sound()->playSfx(currentRoomSfx(), false);
 
 	_vm->bankMan()->unpack(18, lightningBob->frameNum, 15);
@@ -1850,27 +1847,25 @@
 	_vm->graphics()->putCameraOnBob(-1);
 	_vm->input()->fastMode(true);
 	_vm->update();
-				
-	int k = 160;
 
 	// Adjust thug1 gun so it matches rest of body
-	bob_thugA1->x += (k / 2) * 2 - 45; 
-	bob_thugA2->x += (k / 2) * 2; 
-	bob_thugA3->x += (k / 2) * 2;
+	bob_thugA1->x += 160 - 45; 
+	bob_thugA2->x += 160; 
+	bob_thugA3->x += 160;
 
-	bob_hugh1->x += (k / 2) * 3 + (k / 2);
-	bob_hugh2->x += (k / 2) * 3 + (k / 2);
-	bob_hugh3->x += (k / 2) * 3 + (k / 2);
+	bob_hugh1->x += 160 * 2;
+	bob_hugh2->x += 160 * 2;
+	bob_hugh3->x += 160 * 2;
 
-	bob_thugB1->x += (k / 2) * 4 + k; 
-	bob_thugB2->x += (k / 2) * 4 + k; 
+	bob_thugB1->x += 160 * 3;
+	bob_thugB2->x += 160 * 3; 
 
 	int horizontalScroll = 0;
-	while (horizontalScroll < k && !_vm->input()->cutawayQuit()) {
+	while (horizontalScroll < 160 && !_vm->input()->cutawayQuit()) {
 
 		horizontalScroll += 8;
-		if (horizontalScroll > k)
-			horizontalScroll = k;
+		if (horizontalScroll > 160)
+			horizontalScroll = 160;
 
 		_vm->display()->horizontalScroll(horizontalScroll);
 
@@ -2011,7 +2006,6 @@
 }
 
 void Logic::startCredits(const char *filename) {
-
 	stopCredits();
 	_credits = new Credits(_vm, filename);
 }

Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- talk.cpp	14 Aug 2004 09:10:13 -0000	1.101
+++ talk.cpp	14 Aug 2004 22:33:13 -0000	1.102
@@ -118,9 +118,7 @@
 		if (selectedValue(i) > 0) {
 			// This option has been redefined so display new dialogue option
 			_dialogueTree[1][i].head = selectedValue(i);
-		}
-		else if (selectedValue(i) == -1) {
-
+		} else if (selectedValue(i) == -1) {
 			// Already selected so don't redisplay
 			if (_dialogueTree[1][i].gameStateIndex >= 0) {
 				_dialogueTree[1][i].head = -1;
@@ -140,10 +138,8 @@
 	int16 head = _dialogueTree[level][0].head;
 
 	// TODO: split this loop in several functions
-	while(retval != -1) {
-		// debug(6, "retval = %i", retval);
-		
-		char otherVoiceFilePrefix    [MAX_STRING_SIZE];
+	while(retval != -1) {		
+		char otherVoiceFilePrefix[MAX_STRING_SIZE];
 
 		_talkString[0][0] = '\0';
 
@@ -269,7 +265,6 @@
 		if (index > 0)
 			_vm->logic()->gameState(index, _dialogueTree[oldLevel][selectedSentence].gameStateValue);
 
-
 		// check to see if person has something final to say
 		if (-1 == retval) {
 			findDialogueString(_person1Ptr, head, _pMax, _talkString[0]);
@@ -281,8 +276,6 @@
 		}
 	}
 
-// TALK_PROC_EXIT:
-
 	cutawayFilename[0] = '\0';
 
 	for (i = 0; i < 2; i++) {
@@ -400,19 +393,13 @@
 
 void Talk::load(const char *filename) {
 	int i;
-	
 	byte *ptr = _fileData = loadDialogFile(filename);
-
 	bool canQuit;
 
-	//
 	// Load talk header
-	//
 
 	_levelMax = (int16)READ_BE_INT16(ptr); ptr += 2;
 
-	//debug(6, "levelMax = %i", _levelMax);
-
 	if (_levelMax < 0) {
 		_levelMax = -_levelMax;
 		canQuit = false;
@@ -431,9 +418,6 @@
 		_itemNumber[i] = (int16)READ_BE_INT16(ptr); ptr += 2;
 	}
 
-	//debug(6, "uniqueKey = %i", _uniqueKey);
-	//debug(6, "talkKey   = %i", _talkKey);
-
 	_person1Ptr = _fileData + READ_BE_UINT16(ptr); ptr += 2;
 	_cutawayPtr = _fileData + READ_BE_UINT16(ptr); ptr += 2;
 	_person2Ptr = _fileData + READ_BE_UINT16(ptr); ptr += 2;
@@ -444,10 +428,7 @@
 	byte *dataPtr    = _fileData + 32;
 	_joePtr          = dataPtr + _levelMax * 96;
 	
-	//
 	// Load dialogue tree
-	//
-
 	ptr = dataPtr;
 
 	memset(&_dialogueTree[0], 0, sizeof(_dialogueTree[0]));
@@ -474,40 +455,31 @@
 	char joeString[MAX_STRING_SIZE];
 	if (!hasNotString) {
 		ptr = getString(ptr, joeString, MAX_STRING_LENGTH);
-		//debug(6, "joeString = '%s'", joeString);
-	}
-	else
+	} else {
 		joeString[0] = '\0';
+	}
 
 	ptr = _person2Ptr;
 	ptr = getString(ptr, _person2String, MAX_STRING_LENGTH);
-	//debug(6, "person2String = '%s'", _person2String);
 
 	char joe2String[MAX_STRING_SIZE];
 	ptr = getString(ptr, joe2String, MAX_STRING_LENGTH);
-	//debug(6, "joe2String = '%s'", joe2String);
 
-	if (!hasTalkedTo()) {
-		
-		// Not yet talked to this person
-		
+	if (!hasTalkedTo()) {		
+		// Not yet talked to this person		
 		if (joeString[0] != '0') {
 			char voiceFilePrefix[MAX_STRING_SIZE];
 			sprintf(voiceFilePrefix, "%2dSSSSJ", _talkKey);
 			speak(joeString, NULL, voiceFilePrefix);
 		}
-	}
-	else {
-		// Already spoken to them, choose second response
-		
+	} else {
+		// Already spoken to them, choose second response		
 		if (joe2String[0] != '0') {
 			char voiceFilePrefix[MAX_STRING_SIZE];
 			sprintf(voiceFilePrefix, "%2dXXXXJ", _talkKey);
 			speak(joe2String, NULL, voiceFilePrefix);
 		}
-
 	}
-
 }
 
 int Talk::getSpeakCommand(const Person *person, const char *sentence, unsigned &index) {
@@ -602,7 +574,7 @@
 			sentence, person->name, voiceFilePrefix);
 
 	if (sentence[0] == '\0') {
-		goto exit;
+		return personWalking;
 	}
 
 	if (0 == strcmp(person->name, "FAYE-H" ) ||
@@ -641,7 +613,7 @@
 			i++;
 
 		if (_vm->input()->cutawayQuit() || _vm->input()->talkQuit())
-			goto exit;
+			return personWalking;
 	}
 
 	if (segmentStart != i) {
@@ -654,7 +626,6 @@
 				segmentIndex);
 	}
 
-exit:
 	return personWalking;
 }
 
@@ -678,7 +649,6 @@
 		int offset = 1;
 	
 		BobSlot *bob  = _vm->graphics()->bob(bobNum);
-
 		int16 x = bob->x;
 		int16 y = bob->y;
 
@@ -1147,17 +1117,22 @@
 }
 
 int Talk::splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]) {
-	debug(6, "Talk::splitOption(%s)", str);
+	char option[MAX_STRING_SIZE];
+	strcpy(option, str);
+	// option text ends at '*' char
+	char *p = strchr(option, '*');
+	if (p) {
+		*p = '\0';
+	}
 	int lines;
 	memset(optionText, 0, 5 * MAX_STRING_SIZE);
-	if (_vm->resource()->getLanguage() == ENGLISH || 
-		_vm->display()->textWidth(str) <= MAX_TEXT_WIDTH) {
-		strcpy(optionText[0], str);
+	if (_vm->resource()->getLanguage() == ENGLISH || _vm->display()->textWidth(option) <= MAX_TEXT_WIDTH) {
+		strcpy(optionText[0], option);
 		lines = 1;
 	} else if (_vm->resource()->getLanguage() == HEBREW) {
-		lines = splitOptionHebrew(str, optionText);
+		lines = splitOptionHebrew(option, optionText);
 	} else {
-		lines = splitOptionDefault(str, optionText);
+		lines = splitOptionDefault(option, optionText);
 	}
 	return lines;
 }
@@ -1169,7 +1144,7 @@
 	uint16 width = 0;
 	uint16 optionLines = 0;
 	uint16 maxTextLen = MAX_TEXT_WIDTH;
-	char *p = (char *)strchr(str, '\0');
+	const char *p = strchr(str, '\0');
 	while (p != str - 1) {
 		while (*p != ' ' && p != str - 1) {
 			--p;
@@ -1245,19 +1220,6 @@
 	return optionLines;
 }
 
-static char *removeStar(char *str) {
-	
-	// The remove_star function in talk.c uses a static variable, but this
-	// modifies the string instead, so the caller should use a copy of the
-	// string.
-
-	char *p = strchr(str, '*');
-	if (p)
-		*p = '\0';
-
-	return str;
-}
-
 int16 Talk::selectSentence() {
 	int selectedSentence = 0;
 
@@ -1289,7 +1251,7 @@
 			_vm->grid()->setZone(GS_PANEL, ARROW_ZONE_DOWN, MAX_TEXT_WIDTH + 1, 25, 319, 49);
 		}
 
-		_vm->display()->clearTexts(151,199);
+		_vm->display()->clearTexts(151, 199);
 
 		int sentenceCount = 0;
 		int yOffset = 1;
@@ -1299,10 +1261,7 @@
 
 			if (_talkString[i][0] != '\0') {
 				sentenceCount++;
-
-				char temp[MAX_STRING_SIZE];
-				strcpy(temp, _talkString[i]);
-				optionLines = splitOption(removeStar(temp), optionText);
+				optionLines = splitOption(_talkString[i], optionText);
 
 				if (yOffset < 5) {
 					_vm->grid()->setZone(
@@ -1317,7 +1276,6 @@
 				int j;
 				for (j = 0; j < optionLines; j++) {
 					if (yOffset < 5) {
-						//debug(6, "Draw text '%s'", optionText[j]);
 						_vm->display()->setText(
 								(j == 0) ? 0 : OPTION_TEXT_MARGIN, 
 								150 - PUSHUP + yOffset * LINE_HEIGHT, 





More information about the Scummvm-git-logs mailing list