[Scummvm-cvs-logs] SF.net SVN: scummvm: [26856] scummvm/trunk/engines/cruise

yazoo at users.sourceforge.net yazoo at users.sourceforge.net
Thu May 17 00:44:23 CEST 2007


Revision: 26856
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26856&view=rev
Author:   yazoo
Date:     2007-05-16 15:44:22 -0700 (Wed, 16 May 2007)

Log Message:
-----------
Figured out the bug that was causing the animations to glitch

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/actor.cpp
    scummvm/trunk/engines/cruise/cell.cpp
    scummvm/trunk/engines/cruise/cruise_main.cpp
    scummvm/trunk/engines/cruise/function.cpp
    scummvm/trunk/engines/cruise/mainDraw.cpp
    scummvm/trunk/engines/cruise/script.cpp
    scummvm/trunk/engines/cruise/script.h
    scummvm/trunk/engines/cruise/vars.cpp

Modified: scummvm/trunk/engines/cruise/actor.cpp
===================================================================
--- scummvm/trunk/engines/cruise/actor.cpp	2007-05-16 19:23:14 UTC (rev 26855)
+++ scummvm/trunk/engines/cruise/actor.cpp	2007-05-16 22:44:22 UTC (rev 26856)
@@ -788,122 +788,73 @@
 				currentActor->pathId = computePathfinding(returnVar2, params.X, params.Y, var34, var35, currentActor->stepX, currentActor->stepY, currentActor->pathId);
 
 				if (currentActor->pathId == -1) {
-					if ((currentActor->endDirection != -1)
-					    && (currentActor->endDirection !=
-						currentActor->
-						startDirection)) {
-						currentActor->phase =
-						    ANIM_PHASE_STATIC_END;
-						currentActor->nextDirection =
-						    currentActor->endDirection;
-						currentActor->endDirection =
-						    -1;
+					if ((currentActor->endDirection != -1) && (currentActor->endDirection != currentActor->startDirection)) {
+						currentActor->phase = ANIM_PHASE_STATIC_END;
+						currentActor->nextDirection = currentActor->endDirection;
+						currentActor->endDirection = -1;
 						currentActor->counter = 0;
 					} else {
 						currentActor->pathId = -2;
 						currentActor->flag = 0;
-						currentActor->endDirection =
-						    -1;
-						currentActor->phase =
-						    ANIM_PHASE_WAIT;
+						currentActor->endDirection = -1;
+						currentActor->phase = ANIM_PHASE_WAIT;
 					}
 				} else {
-					currentActor->phase =
-					    ANIM_PHASE_STATIC;
+					currentActor->phase = ANIM_PHASE_STATIC;
 					currentActor->counter = -1;
 				}
 			} else
-			    if ((currentActor->type == 1)
-			    && (currentActor->x_dest != -1)
-			    && (currentActor->y_dest != -1)) {
+			    if ((currentActor->type == 1) && (currentActor->x_dest != -1) && (currentActor->y_dest != -1)) {
 				// track animation
-				currentActor->pathId =
-				    computePathfinding(returnVar2, params.X,
-				    params.Y, currentActor->x_dest,
-				    currentActor->y_dest, currentActor->stepX,
-				    currentActor->stepY, currentActor->pathId);
+				currentActor->pathId = computePathfinding(returnVar2, params.X, params.Y, currentActor->x_dest, currentActor->y_dest, currentActor->stepX, currentActor->stepY, currentActor->pathId);
 
 				currentActor->x_dest = -1;
 				currentActor->y_dest = -1;
 
 				if (currentActor->pathId == -1) {
-					if ((currentActor->endDirection != -1)
-					    && (currentActor->endDirection !=
-						currentActor->
-						startDirection)) {
-						currentActor->phase =
-						    ANIM_PHASE_STATIC_END;
-						currentActor->nextDirection =
-						    currentActor->endDirection;
-						currentActor->endDirection =
-						    -1;
+					if ((currentActor->endDirection != -1) && (currentActor->endDirection != currentActor->startDirection)) {
+						currentActor->phase = ANIM_PHASE_STATIC_END;
+						currentActor->nextDirection = currentActor->endDirection;
+						currentActor->endDirection = -1;
 						currentActor->counter = 0;
 					} else {
 						currentActor->pathId = -2;
 						currentActor->flag = 0;
-						currentActor->endDirection =
-						    -1;
-						currentActor->phase =
-						    ANIM_PHASE_WAIT;
+						currentActor->endDirection = -1;
+						currentActor->phase = ANIM_PHASE_WAIT;
 					}
 				} else {
-					currentActor->phase =
-					    ANIM_PHASE_STATIC;
+					currentActor->phase = ANIM_PHASE_STATIC;
 					currentActor->counter = -1;
 				}
 			}
 
 			animationStart = false;
 
-			if (currentActor->pathId >= 0
-			    || currentActor->phase == ANIM_PHASE_STATIC_END) {
+			if ((currentActor->pathId >= 0) || (currentActor->phase == ANIM_PHASE_STATIC_END)) {
 				switch (currentActor->phase) {
 				case ANIM_PHASE_STATIC_END:
 				case ANIM_PHASE_STATIC:
 					{
-						if (currentActor->counter == -1
-						    && currentActor->phase ==
-						    ANIM_PHASE_STATIC) {
-							affiche_chemin
-							    (currentActor->
-							    pathId,
-							    returnVar2);
+						if ((currentActor->counter == -1) && (currentActor->phase == ANIM_PHASE_STATIC)) {
+							affiche_chemin(currentActor->pathId, returnVar2);
 
-							if (returnVar2[0] ==
-							    -1) {
-								currentActor->
-								    pathId =
-								    -2;
-								currentActor->
-								    flag = 0;
-								currentActor->
-								    endDirection
-								    = -1;
-								currentActor->
-								    phase =
-								    ANIM_PHASE_WAIT;
+							if (returnVar2[0] == -1) {
+								currentActor->pathId = -2;
+								currentActor->flag = 0;
+								currentActor->endDirection = -1;
+								currentActor->phase = ANIM_PHASE_WAIT;
 								break;
 							}
 
-							currentActor->x =
-							    returnVar2[0];
-							currentActor->y =
-							    returnVar2[1];
-							currentActor->
-							    nextDirection =
-							    returnVar2[2];
-							currentActor->poly =
-							    returnVar2[4];
-							currentActor->counter =
-							    0;
+							currentActor->x = returnVar2[0];
+							currentActor->y = returnVar2[1];
+							currentActor->nextDirection = returnVar2[2];
+							currentActor->poly = returnVar2[4];
+							currentActor->counter = 0;
 
-							if (currentActor->
-							    startDirection ==
-							    currentActor->
-							    nextDirection)
-								currentActor->
-								    phase =
-								    ANIM_PHASE_MOVE;
+							if (currentActor->startDirection == currentActor->nextDirection)
+								currentActor->phase = ANIM_PHASE_MOVE;
 						}
 
 						if ((currentActor->counter >=

Modified: scummvm/trunk/engines/cruise/cell.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cell.cpp	2007-05-16 19:23:14 UTC (rev 26855)
+++ scummvm/trunk/engines/cruise/cell.cpp	2007-05-16 22:44:22 UTC (rev 26856)
@@ -27,6 +27,8 @@
 
 namespace Cruise {
 
+cellStruct cellHead;
+
 void resetPtr(cellStruct *ptr) {
 	ptr->next = NULL;
 	ptr->prev = NULL;

Modified: scummvm/trunk/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.cpp	2007-05-16 19:23:14 UTC (rev 26855)
+++ scummvm/trunk/engines/cruise/cruise_main.cpp	2007-05-16 22:44:22 UTC (rev 26856)
@@ -162,15 +162,13 @@
 	return 0;
 }
 
-void changeScriptParamInList(int param1, int param2,
-	    scriptInstanceStruct *pScriptInstance, int newValue, int param3) {
+void changeScriptParamInList(int param1, int param2, scriptInstanceStruct *pScriptInstance, int newValue, int param3) {
 	pScriptInstance = pScriptInstance->nextScriptPtr;
 	while (pScriptInstance) {
-		if ((pScriptInstance->overlayNumber == param1 || param1 == -1)
-		    && (pScriptInstance->scriptNumber == param2
-			|| param2 == -1)
-		    && (pScriptInstance->var12 == param3 || param3 == -1)) {
-			pScriptInstance->var12 = newValue;
+		if ((pScriptInstance->overlayNumber == param1) || (param1 == -1))
+		    if ((pScriptInstance->scriptNumber == param2) || (param2 == -1))
+				if ((pScriptInstance->freeze == param3) || (param3 == -1)) {
+					pScriptInstance->freeze = newValue;
 		}
 
 		pScriptInstance = pScriptInstance->nextScriptPtr;

Modified: scummvm/trunk/engines/cruise/function.cpp
===================================================================
--- scummvm/trunk/engines/cruise/function.cpp	2007-05-16 19:23:14 UTC (rev 26855)
+++ scummvm/trunk/engines/cruise/function.cpp	2007-05-16 22:44:22 UTC (rev 26856)
@@ -102,10 +102,7 @@
 		ovlIdx = currentScriptPtr->overlayNumber;
 	}
 
-	ptr =
-	    attacheNewScriptToTail(ovlIdx, &procHead, scriptIdx,
-	    currentScriptPtr->type, currentScriptPtr->scriptNumber,
-	    currentScriptPtr->overlayNumber, scriptType_MinusPROC);
+	ptr = attacheNewScriptToTail(ovlIdx, &procHead, scriptIdx, currentScriptPtr->type, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_MinusPROC);
 
 	if (!ptr)
 		return (0);
@@ -194,7 +191,7 @@
 	if (var < 2) {
 		return (0);
 	}
-//      return(8);
+
 	return (rand() % var);
 }
 
@@ -797,7 +794,7 @@
 
 	getMultipleObjectParam(overlay, index, &params);
 
-	return params.var7;
+	return params.var7 - 1;
 }
 
 int16 Op_SetActiveBackgroundPlane(void) {

Modified: scummvm/trunk/engines/cruise/mainDraw.cpp
===================================================================
--- scummvm/trunk/engines/cruise/mainDraw.cpp	2007-05-16 19:23:14 UTC (rev 26855)
+++ scummvm/trunk/engines/cruise/mainDraw.cpp	2007-05-16 22:44:22 UTC (rev 26856)
@@ -865,8 +865,7 @@
 	bgPtr = backgroundPtrtable[currentActiveBackgroundPlane];
 
 	if (bgPtr) {
-		gfxModuleData_gfxCopyScreen((char *)bgPtr,
-		    (char *)gfxModuleData.pPage10);
+		gfxModuleData_gfxCopyScreen((char *)bgPtr, (char *)gfxModuleData.pPage10);
 	}
 
 	autoCellHead.next = NULL;
@@ -881,24 +880,16 @@
 	//-------------------------------------------------- PROCESS SPRITES -----------------------------------------//
 
 	while (currentObjPtr) {
-		if ((currentActiveBackgroundPlane ==
-			currentObjPtr->backgroundPlane)
-		    && (currentObjPtr->freeze == 0)
-		    && (currentObjPtr->type == OBJ_SPRITE)) {
+		if ((currentActiveBackgroundPlane == currentObjPtr->backgroundPlane) && (currentObjPtr->freeze == 0) && (currentObjPtr->type == OBJ_SPRITE)) {
 			objectParamsQuery params;
 
 			currentObjIdx = currentObjPtr->idx;
 
-			if ((currentObjPtr->followObjectOverlayIdx !=
-				currentObjPtr->overlay)
-			    || (currentObjPtr->followObjectIdx !=
-				currentObjPtr->idx)) {
+			if ((currentObjPtr->followObjectOverlayIdx != currentObjPtr->overlay) || (currentObjPtr->followObjectIdx != currentObjPtr->idx)) {
 				// Declaring this twice ?
 				// objectParamsQuery params;
 
-				getMultipleObjectParam(currentObjPtr->
-				    followObjectOverlayIdx,
-				    currentObjPtr->followObjectIdx, &params);
+				getMultipleObjectParam(currentObjPtr->followObjectOverlayIdx, currentObjPtr->followObjectIdx, &params);
 
 				objX1 = params.X;
 				objY1 = params.Y;
@@ -940,18 +931,20 @@
 				}
 			}
 
-			if ((currentObjPtr->animStep != 0) && (param == 0)) {
+			// automatic animation process
+			if (currentObjPtr->animStep && !param) {
 				if (currentObjPtr->animCounter <= 0) {
-					int newVal;
+
 					bool change = true;
 
-					newVal = getValueFromObjectQuerry(&params, currentObjPtr->animChange) + currentObjPtr->animStep;
+					int newVal = getValueFromObjectQuerry(&params, currentObjPtr->animChange) + currentObjPtr->animStep;
 
 					if (currentObjPtr->animStep > 0) {
 						if (newVal > currentObjPtr->animEnd) {
 							if (currentObjPtr->animLoop) {
 								newVal = currentObjPtr->animStart;
-								currentObjPtr->animLoop--;
+								if(currentObjPtr->animLoop>0)
+									currentObjPtr->animLoop--;
 							} else {
 								int16 data2;
 								data2 = currentObjPtr->animStart;
@@ -968,7 +961,6 @@
 										changeScriptParamInList(currentObjPtr->parentOverlay, currentObjPtr->parent, &relHead,  0, -1);
 									}
 								}
-								newVal = data2;
 							}
 						}
 					} else {

Modified: scummvm/trunk/engines/cruise/script.cpp
===================================================================
--- scummvm/trunk/engines/cruise/script.cpp	2007-05-16 19:23:14 UTC (rev 26855)
+++ scummvm/trunk/engines/cruise/script.cpp	2007-05-16 22:44:22 UTC (rev 26856)
@@ -666,7 +666,7 @@
 		tempPtr->sysKey = 1;
 	}
 
-	tempPtr->var12 = 0;
+	tempPtr->freeze = 0;
 	tempPtr->type = scriptType;
 	tempPtr->var18 = arg2;
 	tempPtr->var16 = arg1;
@@ -753,8 +753,7 @@
 	if (ptr) {
 		do {
 			if (!overlayTable[ptr->overlayNumber].executeScripts) {
-				if (ptr->scriptNumber != -1 && ptr->var12 == 0
-				    && ptr->sysKey != 0) {
+				if ((ptr->scriptNumber != -1) && (ptr->freeze == 0) && (ptr->sysKey != 0)) {
 					executeScripts(ptr);
 				}
 

Modified: scummvm/trunk/engines/cruise/script.h
===================================================================
--- scummvm/trunk/engines/cruise/script.h	2007-05-16 19:23:14 UTC (rev 26855)
+++ scummvm/trunk/engines/cruise/script.h	2007-05-16 22:44:22 UTC (rev 26856)
@@ -42,7 +42,7 @@
 	int16 scriptNumber;
 	int16 overlayNumber;
 	int16 sysKey;
-	int16 var12;
+	int16 freeze;
 	scriptTypeEnum type;
 	int16 var16;
 	int16 var18;

Modified: scummvm/trunk/engines/cruise/vars.cpp
===================================================================
--- scummvm/trunk/engines/cruise/vars.cpp	2007-05-16 19:23:14 UTC (rev 26855)
+++ scummvm/trunk/engines/cruise/vars.cpp	2007-05-16 22:44:22 UTC (rev 26856)
@@ -89,8 +89,6 @@
 
 int16 initVar5[12];
 
-cellStruct cellHead;
-
 opcodeTypeFunction opcodeTypeTable[64];
 
 int16 positionInStack;


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