[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.112,1.113 script.h,1.72,1.73 sfuncs.cpp,1.97,1.98 sprite.cpp,1.44,1.45

Andrew Kurushin h00ligan at users.sourceforge.net
Sat Apr 16 09:56:49 CEST 2005


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

Modified Files:
	actor.cpp script.h sfuncs.cpp sprite.cpp 
Log Message:
fixed: sprite hittest, speech draws in screen bounds


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- actor.cpp	2 Apr 2005 20:04:38 -0000	1.112
+++ actor.cpp	16 Apr 2005 16:55:24 -0000	1.113
@@ -739,6 +739,12 @@
 				actor->currentAction = kActionSpeak;
 				actor->actionCycle = _vm->_rnd.getRandomNumber(63);
 			}
+			for (i = 0; i < _activeSpeech.actorsCount; i++) {
+				actor = getActor(_activeSpeech.actorIds[i]);
+				_activeSpeech.speechCoords[i] = actor->screenPosition;
+				_activeSpeech.speechCoords[i].y -= ACTOR_DIALOGUE_HEIGHT;
+				_activeSpeech.speechCoords[i].y = MAX(_activeSpeech.speechCoords[i].y, (int16)10);
+			}
 		}
 		_activeSpeech.playing = true;			
 		return;
@@ -770,15 +776,6 @@
 			_activeSpeech.strings[i - 1] = _activeSpeech.strings[i];
 		}
 		_activeSpeech.stringsCount--;
-		if (_activeSpeech.stringsCount > 0 && _activeSpeech.actorIds[0] != 0) {
-			// Update actor speech position for the next string.
-			// Note that we only need to do this for the first
-			// actor since simultaneous speech is never more than
-			// one string at a time.
-			actor = getActor(_activeSpeech.actorIds[0]);
-			_activeSpeech.speechCoords[0] = actor->screenPosition;
-			_activeSpeech.speechCoords[0].y -= ACTOR_DIALOGUE_HEIGHT;
-		}
 	}
 
 	if (!isSpeaking())
@@ -1280,7 +1277,7 @@
 	}
 
 // draw speeches
-	if (isSpeaking() && !_vm->_script->_skipSpeeches) {
+	if (isSpeaking() && _activeSpeech.playing && !_vm->_script->_skipSpeeches) {
 		int i;
 		int textDrawFlags;
 		char oneChar[2];
@@ -1699,12 +1696,11 @@
 	for (i = 0; i < stringsCount; i++) {
 		_activeSpeech.strings[i] = strings[i];
 	}
+	 
 	_activeSpeech.stringsCount = stringsCount;
 	_activeSpeech.speechFlags = speechFlags;
 	_activeSpeech.actorsCount = 1;
 	_activeSpeech.actorIds[0] = actorId;
-	_activeSpeech.speechCoords[0] = actor->screenPosition;
-	_activeSpeech.speechCoords[0].y -= ACTOR_DIALOGUE_HEIGHT;
 	_activeSpeech.speechColor[0] = actor->speechColor;
 	_activeSpeech.outlineColor[0] = kITEColorBlack;
 	_activeSpeech.sampleResourceId = sampleResourceId;
@@ -1746,8 +1742,6 @@
 
 		actor = getActor(actorIds[i]);
 		_activeSpeech.actorIds[i] = actorIds[i];
-		_activeSpeech.speechCoords[i] = actor->screenPosition;
-		_activeSpeech.speechCoords[i].y -= ACTOR_DIALOGUE_HEIGHT;
 		_activeSpeech.speechColor[i] = actor->speechColor;
 		_activeSpeech.outlineColor[i] = 0; // disable outline
 	}

Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- script.h	16 Apr 2005 11:03:34 -0000	1.72
+++ script.h	16 Apr 2005 16:55:35 -0000	1.73
@@ -512,7 +512,7 @@
 	void sfResumeBgdAnim(SCRIPTFUNC_PARAMS);
 	void SF_throwActor(SCRIPTFUNC_PARAMS);
 	void sfWaitWalk(SCRIPTFUNC_PARAMS);
-	void SF_sceneID(SCRIPTFUNC_PARAMS);
+	void sfScriptSceneID(SCRIPTFUNC_PARAMS);
 	void SF_changeActorScene(SCRIPTFUNC_PARAMS);
 	void SF_climb(SCRIPTFUNC_PARAMS);
 	void sfSetDoorState(SCRIPTFUNC_PARAMS);

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- sfuncs.cpp	16 Apr 2005 11:03:34 -0000	1.97
+++ sfuncs.cpp	16 Apr 2005 16:55:35 -0000	1.98
@@ -104,7 +104,7 @@
 		OPCODE(sfResumeBgdAnim),
 		OPCODE(SF_throwActor),
 		OPCODE(sfWaitWalk),
-		OPCODE(SF_sceneID),
+		OPCODE(sfScriptSceneID),
 		OPCODE(SF_changeActorScene),
 		OPCODE(SF_climb),
 		OPCODE(sfSetDoorState),
@@ -1346,7 +1346,7 @@
 }
 
 // Script function #54 (0x36)
-void Script::SF_sceneID(SCRIPTFUNC_PARAMS) {
+void Script::sfScriptSceneID(SCRIPTFUNC_PARAMS) {
 	thread->_returnValue = _vm->_scene->currentSceneNumber();
 }
 

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- sprite.cpp	18 Feb 2005 00:00:00 -0000	1.44
+++ sprite.cpp	16 Apr 2005 16:55:35 -0000	1.45
@@ -241,8 +241,6 @@
 	const byte *spriteBuffer;
 	int i, j;
 	const byte *srcRowPointer;
-	int clipWidth;
-	int clipHeight;
 	int width;
 	int height;
 	int xAlign;
@@ -255,27 +253,10 @@
 	spritePointer.x = screenCoord.x + xAlign;
 	spritePointer.y = screenCoord.y + yAlign;
 
-	if (spritePointer.x < 0) {
-		return false;
-	}
-	if (spritePointer.y < 0) {
-		return false;
-	}
-
-	clipWidth = width;
-	if (width > (_vm->getDisplayWidth() - spritePointer.x)) {
-		clipWidth = (_vm->getDisplayWidth() - spritePointer.x);
-	}
-	
-	clipHeight = height;
-	if (height > (_vm->getDisplayHeight() - spritePointer.y)) {
-		clipHeight = (_vm->getDisplayHeight() - spritePointer.y);
-	}
-	
-	if ((testPoint.y < spritePointer.y) || (testPoint.y >= spritePointer.y + clipHeight)) {
+	if ((testPoint.y < spritePointer.y) || (testPoint.y >= spritePointer.y + height)) {
 		return false;
 	}
-	if ((testPoint.x < spritePointer.x) || (testPoint.x >= spritePointer.x + clipWidth)) {
+	if ((testPoint.x < spritePointer.x) || (testPoint.x >= spritePointer.x + width)) {
 		return false;
 	}
 	i = testPoint.y - spritePointer.y;





More information about the Scummvm-git-logs mailing list