[Scummvm-cvs-logs] CVS: scummvm/sky logic.cpp,1.19,1.20 compact.cpp,1.5,1.6 skydefs.h,1.8,1.9

Oliver Kiehl olki at users.sourceforge.net
Fri May 2 05:05:28 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv17845

Modified Files:
	logic.cpp compact.cpp skydefs.h 
Log Message:
plenty of bugfixes


Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- logic.cpp	1 May 2003 14:05:09 -0000	1.19
+++ logic.cpp	2 May 2003 11:57:32 -0000	1.20
@@ -62,7 +62,7 @@
 }
 
 void SkyLogic::engine() {
-	Compact *compact2 = SkyState::fetchCompact(141); // logic list
+	Compact *compact2 = SkyState::fetchCompact(_scriptVariables[LOGIC_LIST_NO]);
 
 	while (compact2->logic) { // 0 means end of list
 		if (compact2->logic == 0xffff) {
@@ -172,7 +172,7 @@
 		// fine because the later collision will almost certainly
 		// take longer to clear than the earlier one.
 
-		if (!collide(SkyState::fetchCompact(_compact->extCompact->waitingFor)))
+		if (collide(SkyState::fetchCompact(_compact->extCompact->waitingFor)))
 			error("stop_and_wait not implemented\n");
 
 		// we are not in fact hitting this person so clr & continue
@@ -183,14 +183,11 @@
 
 	// ok, our turn to check for collisions
 
-#define logic_list_no 141
-	uint16 *logicList = (uint16 *)SkyState::fetchCompact(logic_list_no);
+	uint16 *logicList = (uint16 *)SkyState::fetchCompact(_scriptVariables[LOGIC_LIST_NO]);
 	Compact *cpt = 0;
 
-	for (;;) {
-		uint16 id = *logicList++; // get an id
-		if (!id) // 0 is list end
-			break;
+	uint16 id;
+	while ((id = *logicList++) != 0) { // get an id
 
 		if (id == 0xffff) { // address change?
 			logicList = (uint16 *)SkyState::fetchCompact(*logicList); // get new logic list
@@ -241,6 +238,7 @@
 	if (_compact->extCompact->request) {
 		_compact->mode = C_ACTION_MODE; // put into action mode
 		_compact->extCompact->actionSub = _compact->extCompact->request;
+		_compact->extCompact->actionSub_off = 0;
 		_compact->extCompact->request = 0; // trash request
 		_compact->logic = L_SCRIPT;
 		logicScript();
@@ -251,7 +249,7 @@
 	// if change then re-run the current script, which must be
 	// a position independent get-to		 ----
 
-	if (_compact->extCompact->atWatch) { // any flag set?
+	if (!_compact->extCompact->atWatch) { // any flag set?
 		mainAnim();
 		return;
 	}
@@ -281,7 +279,9 @@
 		if (!*sequence) { // end of route?
 			// ok, sequence has finished
 
-			_compact->extCompact->arAnimIndex = 0; // will start afresh if new sequence continues in last direction
+			// will start afresh if new sequence continues in last direction
+			_compact->extCompact->arAnimIndex = 0;
+
 			_compact->downFlag = 0; // pass back ok to script
 			_compact->logic = L_SCRIPT;
 			logicScript();
@@ -307,21 +307,21 @@
 		}
 	};
 
-	uint16 *animUp = (uint16 *)SkyCompact::getCompactElem(_compact,
-			C_ANIM_UP + _compact->extCompact->megaSet + (dir << 4));
+	uint16 **anim = (uint16 **)SkyCompact::getCompactElem(_compact,
+			C_ANIM_UP + _compact->extCompact->megaSet + dir * 4);
 
 	uint16 arAnimIndex = _compact->extCompact->arAnimIndex;
-	if (!animUp[arAnimIndex/2]) {
+	if (!(*anim)[arAnimIndex/2]) {
 		 arAnimIndex = 0;
 		_compact->extCompact->arAnimIndex = 0; // reset
 	}
 
 	_compact->extCompact->arAnimIndex += S_LENGTH;
 
-	*sequence       -= animUp[(S_COUNT + arAnimIndex)/2]; // reduce the distance to travel
-	_compact->frame  = animUp[(S_FRAME + arAnimIndex)/2]; // new graphic frame
-	_compact->xcood += animUp[(S_AR_X  + arAnimIndex)/2]; // update x coordinate
-	_compact->ycood += animUp[(S_AR_Y  + arAnimIndex)/2]; // update y coordinate
+	*sequence       -= (*anim)[(S_COUNT + arAnimIndex)/2]; // reduce the distance to travel
+	_compact->frame  = (*anim)[(S_FRAME + arAnimIndex)/2]; // new graphic frame
+	_compact->xcood += (*anim)[(S_AR_X  + arAnimIndex)/2]; // update x coordinate
+	_compact->ycood += (*anim)[(S_AR_Y  + arAnimIndex)/2]; // update y coordinate
 }
 
 void SkyLogic::arTurn() {
@@ -1320,18 +1320,15 @@
 uint32 SkyLogic::fnCheckRequest(uint32 a, uint32 b, uint32 c) {
 	// check for interaction request
 	
-	a = (a & 0xffffff00) | 1; // assume script continue
-
-	ExtCompact *ecpt = _compact->extCompact;
-
-	if (!ecpt->request)
-		return a;
+	if (!_compact->extCompact->request)
+		return 1;
 
 	_compact->mode = C_ACTION_MODE; // into action mode
 
-	ecpt->actionSub = ecpt->request;
+	_compact->extCompact->actionSub = _compact->extCompact->request;
+	_compact->extCompact->actionSub_off = 0;
 
-	ecpt->request = 0; // trash request
+	_compact->extCompact->request = 0; // trash request
 	return 0; // drop from script
 }
 

Index: compact.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/compact.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- compact.cpp	29 Apr 2003 22:33:12 -0000	1.5
+++ compact.cpp	2 May 2003 11:57:33 -0000	1.6
@@ -155,7 +155,7 @@
 
 	off -= MEGASET_SIZE;
 	if (off < TURNTABLE_SIZE)
-		return ((uint8 *)(cpt->extCompact->megaSet0->turnTable) + turnTableOffsets[off]);
+		return ((uint8 *)(cpt->extCompact->megaSet1->turnTable) + turnTableOffsets[off]);
 
 	off -= TURNTABLE_SIZE;
 	if (off < MEGASET_SIZE)
@@ -163,7 +163,7 @@
 
 	off -= MEGASET_SIZE;
 	if (off < TURNTABLE_SIZE)
-		return ((uint8 *)(cpt->extCompact->megaSet0->turnTable) + turnTableOffsets[off]);
+		return ((uint8 *)(cpt->extCompact->megaSet2->turnTable) + turnTableOffsets[off]);
 
 	off -= TURNTABLE_SIZE;
 	if (off < MEGASET_SIZE)
@@ -171,10 +171,10 @@
 
 	off -= MEGASET_SIZE;
 	if (off < TURNTABLE_SIZE)
-		return ((uint8 *)(cpt->extCompact->megaSet0->turnTable) + turnTableOffsets[off]);
+		return ((uint8 *)(cpt->extCompact->megaSet3->turnTable) + turnTableOffsets[off]);
 	off -= TURNTABLE_SIZE;
 
-	error("Offset %X out of bounds of compact", off + COMPACT_SIZE + EXTCOMPACT_SIZE + 4 * MEGASET_SIZE + 4 * 5*5*4);
+	error("Offset %X out of bounds of compact", off + COMPACT_SIZE + EXTCOMPACT_SIZE + 4 * MEGASET_SIZE + 4 * TURNTABLE_SIZE);
 }
 };
 

Index: skydefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/skydefs.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- skydefs.h	1 May 2003 14:05:10 -0000	1.8
+++ skydefs.h	2 May 2003 11:57:34 -0000	1.9
@@ -38,6 +38,7 @@
 
 // scriptVariable offsets
 #define RESULT 1
+#define LOGIC_LIST_NO 3
 #define CUR_ID 13
 #define HIT_ID 38
 #define THE_CHOSEN_ONE 52





More information about the Scummvm-git-logs mailing list