[Scummvm-cvs-logs] CVS: scummvm/saga script.h,1.71,1.72 sfuncs.cpp,1.96,1.97

Andrew Kurushin h00ligan at users.sourceforge.net
Sat Apr 16 04:05:01 CEST 2005


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

Modified Files:
	script.h sfuncs.cpp 
Log Message:
fixed ram dialog crash
implemented: sfScriptSpecialWalk,sfScriptWalkRelative,sfScriptMoveRelative

Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- script.h	3 Apr 2005 17:23:02 -0000	1.71
+++ script.h	16 Apr 2005 11:03:34 -0000	1.72
@@ -500,11 +500,11 @@
 	void sfSetPortrait(SCRIPTFUNC_PARAMS);
 	void sfSetProtagPortrait(SCRIPTFUNC_PARAMS);
 	void sfChainBgdAnim(SCRIPTFUNC_PARAMS);
-	void SF_scriptSpecialWalk(SCRIPTFUNC_PARAMS);
+	void sfScriptSpecialWalk(SCRIPTFUNC_PARAMS);
 	void sfPlaceActor(SCRIPTFUNC_PARAMS);
 	void SF_checkUserInterrupt(SCRIPTFUNC_PARAMS);
-	void SF_walkRelative(SCRIPTFUNC_PARAMS);
-	void SF_moveRelative(SCRIPTFUNC_PARAMS);
+	void sfScriptWalkRelative(SCRIPTFUNC_PARAMS);
+	void sfScriptMoveRelative(SCRIPTFUNC_PARAMS);
 	void SF_simulSpeech2(SCRIPTFUNC_PARAMS);
 	void sfPlacard(SCRIPTFUNC_PARAMS);
 	void sfPlacardOff(SCRIPTFUNC_PARAMS);

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- sfuncs.cpp	3 Apr 2005 15:32:04 -0000	1.96
+++ sfuncs.cpp	16 Apr 2005 11:03:34 -0000	1.97
@@ -92,11 +92,11 @@
 		OPCODE(sfSetPortrait),
 		OPCODE(sfSetProtagPortrait),
 		OPCODE(sfChainBgdAnim),
-		OPCODE(SF_scriptSpecialWalk),
+		OPCODE(sfScriptSpecialWalk),
 		OPCODE(sfPlaceActor),
 		OPCODE(SF_checkUserInterrupt),
-		OPCODE(SF_walkRelative),
-		OPCODE(SF_moveRelative),
+		OPCODE(sfScriptWalkRelative),
+		OPCODE(sfScriptMoveRelative),
 		OPCODE(SF_simulSpeech2),
 		OPCODE(sfPlacard),
 		OPCODE(sfPlacardOff),
@@ -392,8 +392,8 @@
 	for (threadIterator = _threadList.begin(); threadIterator != _threadList.end(); ++threadIterator) {
 		anotherThread = threadIterator.operator->();
 		if ((anotherThread != thread) && (anotherThread->_threadVars[kThreadVarActor] == actorId)) {
-			thread->_flags &= ~kTFlagWaiting;
-			thread->_flags |= kTFlagAborted;
+			anotherThread->_flags &= ~kTFlagWaiting;
+			anotherThread->_flags |= kTFlagAborted;
 		}
 	}
 }
@@ -968,13 +968,27 @@
 }
 
 // Script function #42 (0x2A)
-void Script::SF_scriptSpecialWalk(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
+// Param1: actor id
+// Param2: actor x
+// Param3: actor y
+// Param4: frame seq
+void Script::sfScriptSpecialWalk(SCRIPTFUNC_PARAMS) {
+	int16 actorId;
+	int16 walkFrameSequence;
+	Location actorLocation;
+	ActorData *actor;
 
-	//debug(1, "stub: SF_scriptSpecialWalk(%d, %d, %d, %d)", param1, param2, param3, param4);
+	actorId = thread->pop();
+	actorLocation.x = thread->pop();
+	actorLocation.y = thread->pop();
+	walkFrameSequence =  thread->pop();
+
+	actor = _vm->_actor->getActor(actorId);
+	actorLocation.z = actor->location.z;
+
+	_vm->_actor->actorWalkTo(actorId, actorLocation);
+
+	actor->walkFrameSequence = walkFrameSequence;	
 }
 
 // Script function #43 (0x2B) nonblocking
@@ -1040,25 +1054,69 @@
 }
 
 // Script function #45 (0x2D)
-void Script::SF_walkRelative(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
+// Param1: actor id
+// Param2: object id
+// Param3: actor x
+// Param4: actor y
+// Param5: actor walk flag
+void Script::sfScriptWalkRelative(SCRIPTFUNC_PARAMS) {
+	int16 actorId;
+	int16 objectId;
+	uint16 walkFlags;
+	Location actorLocation;
+	ActorData *actor;
 
-	//debug(1, "stub: SF_walkRelative(%d, %d, %d, %d, %d)", param1, param2, param3, param4, param5);
+	actorId = thread->pop();
+	objectId = thread->pop();
+	actorLocation.x = thread->pop();
+	actorLocation.y = thread->pop();
+	walkFlags =  thread->pop();
+
+	actor = _vm->_actor->getActor(actorId);
+	actorLocation.z = actor->location.z;
+
+	_vm->_actor->realLocation(actorLocation, objectId, walkFlags);
+
+	actor->flags &= ~kFollower;
+
+	if (_vm->_actor->actorWalkTo(actorId, actorLocation) && !(walkFlags & kWalkAsync)) {
+		thread->waitWalk(actor);
+	}
+
+	if (walkFlags & kWalkBackPedal) {
+		actor->actorFlags |= kActorBackwards;
+	}
+
+	actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask);	
 }
 
 // Script function #46 (0x2E)
-void Script::SF_moveRelative(SCRIPTFUNC_PARAMS) {
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
-	thread->pop();
+// Param1: actor id
+// Param2: object id
+// Param3: actor x
+// Param4: actor y
+// Param5: actor walk flag
+void Script::sfScriptMoveRelative(SCRIPTFUNC_PARAMS) {
+	int16 actorId;
+	int16 objectId;
+	uint16 walkFlags;
+	Location actorLocation;
+	ActorData *actor;
 
-	//debug(1, "stub: SF_moveRelative(%d, %d, %d, %d, %d)", param1, param2, param3, param4, param5);
+	actorId = thread->pop();
+	objectId = thread->pop();
+	actorLocation.x = thread->pop();
+	actorLocation.y = thread->pop();
+	walkFlags =  thread->pop();
+
+	actor = _vm->_actor->getActor(actorId);
+	actorLocation.z = actor->location.z;
+
+	_vm->_actor->realLocation(actorLocation, objectId, walkFlags);
+
+
+	actor->location = actorLocation;
+	actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask);
 }
 
 // Script function #47 (0x2F)





More information about the Scummvm-git-logs mailing list