[Scummvm-cvs-logs] CVS: scummvm/sky logic.cpp,1.6,1.7

Oliver Kiehl olki at users.sourceforge.net
Fri Apr 25 14:42:12 CEST 2003


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

Modified Files:
	logic.cpp 
Log Message:
some endian fixes


Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- logic.cpp	25 Apr 2003 18:26:41 -0000	1.6
+++ logic.cpp	25 Apr 2003 21:41:50 -0000	1.7
@@ -98,18 +98,20 @@
 	for (;;) {
 		uint16 mode = _compact->mode; // get pointer to current script
 		printf("compact mode: %d\n", mode);
-		// FIXME: not endian safe
-		uint32 *p = (uint32 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + mode);
-		uint32 scr = *p; // get script number and offset
+		uint16 *p1= (uint16 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + mode);
+		uint16 *p2= (uint16 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + mode + 2);
+		uint32 scr = (*p2 << 16) | *p1; // get script number and offset
 
 		// FIXME: HACK ALERT!!!!
 		if (scr == 0x27)
 			scr = 0x9fa0027;
 
 		printf("script: 0x%X\n", scr);
-		*p = script(_compact, scr);
+		scr = script(_compact, scr);
+		*p1 = (uint16)(scr & 0xffff);
+		*p2 = (uint16)(scr >> 16);
 
-		if (!(*p & 0xffff0000)) // script finished
+		if (!(scr & 0xffff0000)) // script finished
 			_compact->mode -= 4;
 		else if (_compact->mode == mode)
 			return;
@@ -157,9 +159,11 @@
 	// change the current script
 
 	_compact->logic = L_SCRIPT;
-	// FIXME: not endian safe
-	uint32 *p = (uint32 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + _compact->mode);
-	*p = _compact->extCompact->alt;
+	uint16 *p1= (uint16 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + _compact->mode);
+	uint16 *p2= (uint16 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + _compact->mode + 2);
+
+	*p1 = _compact->extCompact->alt;
+	*p2 = 0;
 
 	logicScript();
 }
@@ -686,9 +690,10 @@
 	while (*getToTable != targetPlaceId)
 		getToTable += 2;
 
-	// FIXME: not endian safe
-	uint32 *p = (uint32 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + _compact->mode);
-	*p = *(getToTable + 1); // get new script
+	uint16 *p1= (uint16 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + _compact->mode);
+	uint16 *p2= (uint16 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + _compact->mode + 2);
+	*p1 = *(getToTable + 1); // get new script
+	*p2 = 0;
 
 	return 0; // drop out of script
 }





More information about the Scummvm-git-logs mailing list