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

yazoo at users.sourceforge.net yazoo at users.sourceforge.net
Sun Apr 29 01:21:14 CEST 2007


Revision: 26669
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26669&view=rev
Author:   yazoo
Date:     2007-04-28 16:21:13 -0700 (Sat, 28 Apr 2007)

Log Message:
-----------
Implement missing opcode and fix staff intro

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/backgroundIncrust.cpp
    scummvm/trunk/engines/cruise/backgroundIncrust.h
    scummvm/trunk/engines/cruise/function.cpp

Modified: scummvm/trunk/engines/cruise/backgroundIncrust.cpp
===================================================================
--- scummvm/trunk/engines/cruise/backgroundIncrust.cpp	2007-04-28 22:37:42 UTC (rev 26668)
+++ scummvm/trunk/engines/cruise/backgroundIncrust.cpp	2007-04-28 23:21:13 UTC (rev 26669)
@@ -99,7 +99,7 @@
 	currentHead2->prev = newElement;
 
 	newElement->objectIdx = objectIdx;
-	newElement->field_6 = param4;
+	newElement->type = param4;
 	newElement->backgroundIdx = backgroundIdx;
 	newElement->overlayIdx = overlayIdx;
 	newElement->scriptNumber = scriptNumber;
@@ -137,9 +137,7 @@
 		 * ASSERT(0);
 		 * } */
 
-		addBackgroundIncrustSub1(params.fileIdx, newElement->X,
-		    newElement->Y, NULL, params.scale, (char *)backgroundPtr,
-		    (char *)filesDatabase[params.fileIdx].subData.ptr);
+		addBackgroundIncrustSub1(params.fileIdx, newElement->X, newElement->Y, NULL, params.scale, (char *)backgroundPtr, (char *)filesDatabase[params.fileIdx].subData.ptr);
 	}
 
 	return newElement;
@@ -164,7 +162,7 @@
 		fseek(fileHandle, 4, SEEK_CUR);
 
 		fread(&current->objectIdx, 2, 1, fileHandle);
-		fread(&current->field_6, 2, 1, fileHandle);
+		fread(&current->type, 2, 1, fileHandle);
 		fread(&current->overlayIdx, 2, 1, fileHandle);
 		fread(&current->X, 2, 1, fileHandle);
 		fread(&current->Y, 2, 1, fileHandle);
@@ -216,4 +214,62 @@
 	resetBackgroundIncrustList(pHead);
 }
 
+void removeBackgroundIncrust(int overlay, int idx, backgroundIncrustStruct * pHead) {
+	objectParamsQuery params;
+	int var_4;
+	int var_6;
+
+	backgroundIncrustStruct *pCurrent;
+	backgroundIncrustStruct *pCurrentHead;
+
+	getMultipleObjectParam(overlay, idx, &params);
+
+	var_4 = params.X;
+	var_6 = params.Y;
+
+	pCurrent = pHead->next;
+
+	while (pCurrent) {
+		if ((pCurrent->overlayIdx == overlay || overlay == -1) &&
+		    (pCurrent->objectIdx == idx || idx == -1) &&
+		    (pCurrent->X == var_4) && (pCurrent->Y == var_6)) {
+			pCurrent->type = - 1;
+		}
+
+		pCurrent = pCurrent->next;
+	}
+
+	pCurrentHead = pHead;
+	pCurrent = pHead->next;
+
+	while (pCurrent) {
+		if (pCurrent->type == - 1) {
+			backgroundIncrustStruct *pNext = pCurrent->next;
+			backgroundIncrustStruct *bx = pCurrentHead;
+			backgroundIncrustStruct *cx;
+
+			bx->next = pNext;
+			cx = pNext;
+
+			if (!pNext) {
+				cx = pHead;
+			}
+
+			bx = cx;
+			bx->prev = pCurrent->next;
+
+			if (pCurrent->ptr) {
+				free(pCurrent->ptr);
+			}
+
+			free(pCurrent);
+
+			pCurrent = pNext;
+		} else {
+			pCurrentHead = pCurrent;
+			pCurrent = pCurrent->next;
+		}
+	}
+}
+
 } // End of namespace Cruise

Modified: scummvm/trunk/engines/cruise/backgroundIncrust.h
===================================================================
--- scummvm/trunk/engines/cruise/backgroundIncrust.h	2007-04-28 22:37:42 UTC (rev 26668)
+++ scummvm/trunk/engines/cruise/backgroundIncrust.h	2007-04-28 23:21:13 UTC (rev 26669)
@@ -32,7 +32,7 @@
 	struct backgroundIncrustStruct *prev;
 
 	uint16 objectIdx;
-	uint16 field_6;
+	int16 type;
 	uint16 overlayIdx;
 	uint16 X;
 	uint16 Y;
@@ -61,6 +61,7 @@
 void loadBackgroundIncrustFromSave(FILE * fileHandle);
 void regenerateBackgroundIncrust(backgroundIncrustStruct * pHead);
 void freeBackgroundIncrustList(backgroundIncrustStruct * pHead);
+void removeBackgroundIncrust(int overlay, int idx, backgroundIncrustStruct * pHead);
 
 } // End of namespace Cruise
 

Modified: scummvm/trunk/engines/cruise/function.cpp
===================================================================
--- scummvm/trunk/engines/cruise/function.cpp	2007-04-28 22:37:42 UTC (rev 26668)
+++ scummvm/trunk/engines/cruise/function.cpp	2007-04-28 23:21:13 UTC (rev 26669)
@@ -839,65 +839,6 @@
 	return si;
 }
 
-void removeBackgroundIncrust(int overlay, int idx,
-    backgroundIncrustStruct * pHead) {
-	objectParamsQuery params;
-	int var_4;
-	int var_6;
-
-	backgroundIncrustStruct *pCurrent;
-	backgroundIncrustStruct *pCurrentHead;
-
-	getMultipleObjectParam(overlay, idx, &params);
-
-	var_4 = params.X;
-	var_6 = params.Y;
-
-	pCurrent = pHead->next;
-
-	while (pCurrent) {
-		if ((pCurrent->overlayIdx == overlay || overlay == -1) &&
-		    (pCurrent->objectIdx == idx || idx == -1) &&
-		    (pCurrent->X == var_4) && (pCurrent->Y == var_6)) {
-			pCurrent->field_6 = (uint16) - 1;
-		}
-
-		pCurrent = pCurrent->next;
-	}
-
-	pCurrentHead = pHead;
-	pCurrent = pHead->next;
-
-	while (pCurrent) {
-		if (pCurrent->field_6 == (uint16) - 1) {
-			backgroundIncrustStruct *pNext = pCurrent->next;
-			backgroundIncrustStruct *bx = pCurrentHead;
-			backgroundIncrustStruct *cx;
-
-			bx->next = pNext;
-			cx = pNext;
-
-			if (!pNext) {
-				cx = pHead;
-			}
-
-			bx = cx;
-			bx->prev = pCurrent->next;
-
-			if (pCurrent->ptr) {
-				free(pCurrent->ptr);
-			}
-
-			free(pCurrent);
-
-			pCurrent = pNext;
-		} else {
-			pCurrentHead = pCurrent;
-			pCurrent = pCurrent->next;
-		}
-	}
-}
-
 int16 Op_RemoveBackgroundIncrust(void) {
 	int idx = popVar();
 	int overlay = popVar();
@@ -1001,7 +942,7 @@
 	return si;
 }
 
-int16 Op_1A(void) {
+int16 Op_SetZoom(void) {
 	var46 = popVar();
 	var45 = popVar();
 	var42 = popVar();
@@ -1028,8 +969,7 @@
 	return (computeZoom(popVar()));
 }
 
-actorStruct *addAnimation(actorStruct * pHead, int overlay, int objIdx,
-	    int param, int param2) {
+actorStruct *addAnimation(actorStruct * pHead, int overlay, int objIdx, int param, int param2) {
 	actorStruct *pPrevious = pHead;
 	actorStruct *pCurrent = pHead->next;
 
@@ -1073,6 +1013,68 @@
 	return pNewElement;
 }
 
+int removeAnimation(actorStruct * pHead, int overlay, int objIdx, int objType)
+{
+	actorStruct* pl;
+	actorStruct* pl2;
+	actorStruct* pl3;
+	actorStruct* pl4;
+
+	int dir = 0;
+
+	pl = pHead;
+	pl2 = pl;
+	pl = pl2->next;
+
+	while(pl)
+	{
+		pl2 = pl;
+
+		if(((pl->overlayNumber == overlay) || (overlay == -1)) &&
+			((pl->idx == objIdx) || (objIdx == -1)) &&
+			((pl->type == objType) || (objType == -1)))
+		{
+			pl->type = -1;
+		}
+
+		pl = pl2->next;
+	}
+
+	pl = pHead;
+	pl2 = pl;
+	pl = pl2->next;
+
+	while(pl)
+	{
+		if(pl->type == -1)
+		{
+			pl4 = pl->next;
+			pl2->next = pl4;
+			pl3 = pl4;
+
+			if(pl3 == NULL)
+				pl3 = pHead;
+
+			pl3->prev = pl->prev;
+
+			dir = pl->startDirection;
+
+			if(pl->idx >= 0)
+				freePerso(pl->idx);
+
+			free(pl);
+			pl = pl4;
+		}
+		else
+		{
+			pl2 = pl;
+			pl = pl2->next;
+		}
+	}
+
+	return dir;
+}
+
 int flag_obstacle;		// computedVar14Bis
 
 void checkCollisionWithWalkBoxesBoundingBoxes(int x, int y) {
@@ -1157,8 +1159,7 @@
 				zoom = -zoom;
 			}
 
-			checkCollisionWithWalkBoxesBoundingBoxes(params.X,
-			    params.Y);
+			checkCollisionWithWalkBoxesBoundingBoxes(params.X, params.Y);
 
 			setObjectPosition(overlay, obj, 3, newFrame + start);
 			setObjectPosition(overlay, obj, 4, zoom);
@@ -1172,13 +1173,15 @@
 }
 
 int16 Op_RemoveAnimation(void) {
-	popVar();
-	popVar();
-	popVar();
+	int objType = popVar();
+	int objIdx = popVar();
+	int ovlIdx = popVar();
 
-	printf("Partial op 19 (remove actor)\n");
+	if (!ovlIdx) {
+		ovlIdx = currentScriptPtr->overlayNumber;
+	}
 
-	return 0;
+	return removeAnimation(&actorHead, ovlIdx, objIdx, objType);
 }
 
 int16 Op_regenerateBackgroundIncrust(void) {
@@ -1441,7 +1444,7 @@
 	opcodeTablePtr[0x17] = Op_LoadCt;
 	opcodeTablePtr[0x18] = Op_AddAnimation;
 	opcodeTablePtr[0x19] = Op_RemoveAnimation;
-	opcodeTablePtr[0x1A] = Op_1A;
+	opcodeTablePtr[0x1A] = Op_SetZoom;
 	opcodeTablePtr[0x1E] = Op_1E;
 	opcodeTablePtr[0x21] = Op_21;
 	opcodeTablePtr[0x22] = Op_22;


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