[Scummvm-cvs-logs] CVS: scummvm/bs2 icons.cpp,1.5,1.6 interpreter.cpp,1.7,1.8 mouse.cpp,1.12,1.13 router.cpp,1.9,1.10

Max Horn fingolfin at users.sourceforge.net
Sat Sep 13 05:05:01 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv11755

Modified Files:
	icons.cpp interpreter.cpp mouse.cpp router.cpp 
Log Message:
let the interpreter use native endianess for variables -> this allows us to get rid of various endian conversions, and also fixs lots of other problems on BE systems. Beware, though, this may impair save game exchange between LE/BE: we'll have to adjust save_rest.cpp to convert to/from LE upon save/load

Index: icons.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/icons.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- icons.cpp	13 Sep 2003 01:50:11 -0000	1.5
+++ icons.cpp	13 Sep 2003 12:03:29 -0000	1.6
@@ -51,8 +51,6 @@
 
 //	copy the structure to our in-the-engine list
 	memcpy( &temp_list[total_temp], (uint8*) *params, sizeof(menu_object));	//
-	temp_list[total_temp].icon_resource = FROM_LE_32(temp_list[total_temp].icon_resource);
-	temp_list[total_temp].luggage_resource = FROM_LE_32(temp_list[total_temp].luggage_resource);
 	total_temp++;
 
 	return(IR_CONT);	// script continue

Index: interpreter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/interpreter.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- interpreter.cpp	7 Sep 2003 03:18:26 -0000	1.7
+++ interpreter.cpp	13 Sep 2003 12:03:29 -0000	1.8
@@ -396,8 +396,8 @@
 
 			case CP_PUSH_LOCAL_VAR32:		// 1	Push the contents of a local variable
 				Read16ip(parameter)
-				DEBUG2("Push local var %d (%d)",parameter,(int32)READ_LE_UINT32(variables+parameter));
-				PUSHONSTACK ( (int32)READ_LE_UINT32(variables+parameter) );
+				DEBUG2("Push local var %d (%d)",parameter,*(int32 *)(variables+parameter));
+				PUSHONSTACK ( *(int32 *)(variables+parameter) );
 				break;
 
 
@@ -417,7 +417,7 @@
 				Read16ip(parameter)
 				POPOFFSTACK ( value );
 				DEBUG2("Pop %d into var %d",value,parameter);
-				*((int *)(variables+parameter)) = TO_LE_32(value);
+				*((int *)(variables+parameter)) = value;
 				break;
 
 			case CP_CALL_MCODE:			// 4	Call an mcode routine
@@ -518,15 +518,15 @@
 			case CP_ADDNPOP_LOCAL_VAR32:						// 10
 				Read16ip(parameter)
 				POPOFFSTACK ( value );
-				*((int *)(variables+parameter)) = TO_LE_32((int32)READ_LE_UINT32(variables+parameter) + value);
-				DEBUG3("+= %d into var %d->%d",value,parameter,(int32)READ_LE_UINT32(variables+parameter));
+				*((int *)(variables+parameter)) = *(int32 *)(variables+parameter) + value;
+				DEBUG3("+= %d into var %d->%d",value,parameter,*(int32 *)(variables+parameter));
 				break;
 
 			case CP_SUBNPOP_LOCAL_VAR32:						// 11
 				Read16ip(parameter)
 				POPOFFSTACK ( value );
-				*((int *)(variables+parameter)) = TO_LE_32((int32)READ_LE_UINT32(variables+parameter) - value);
-				DEBUG3("-= %d into var %d->%d",value,parameter,(int32)READ_LE_UINT32(variables+parameter));
+				*((int *)(variables+parameter)) = *(int32 *)(variables+parameter) - value;
+				DEBUG3("-= %d into var %d->%d",value,parameter,*(int32 *)(variables+parameter));
 				break;
 
 			case CP_SKIPONTRUE:									//	12	Skip if the value on the stack is TRUE
@@ -574,7 +574,7 @@
 										VS_COL_GREY);
 #else
 				globalInterpreterVariables2[parameter] += value;
-				DEBUG3("+= %d into global var %d->%d",value,parameter,(int32)READ_LE_UINT32(variables+parameter));
+				DEBUG3("+= %d into global var %d->%d",value,parameter,*(int32 *)(variables+parameter));
 #endif
 				break;
 			}
@@ -593,7 +593,7 @@
 										VS_COL_GREY);
 #else
 				globalInterpreterVariables2[parameter] -= value;
-				DEBUG3("-= %d into global var %d->%d",value,parameter,(int32)READ_LE_UINT32(variables+parameter));
+				DEBUG3("-= %d into global var %d->%d",value,parameter,*(int32 *)(variables+parameter));
 #endif
 				break;
 			}

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/mouse.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mouse.cpp	13 Sep 2003 02:11:05 -0000	1.12
+++ mouse.cpp	13 Sep 2003 12:03:29 -0000	1.13
@@ -1252,13 +1252,13 @@
 			Con_fatal_error("ERROR: mouse_list full [%s line %u]",__FILE__,__LINE__);
 		#endif
 
-		mouse_list[cur_mouse].x1			= FROM_LE_32(ob_mouse->x1);
-		mouse_list[cur_mouse].y1			= FROM_LE_32(ob_mouse->y1);
-		mouse_list[cur_mouse].x2			= FROM_LE_32(ob_mouse->x2);
-		mouse_list[cur_mouse].y2			= FROM_LE_32(ob_mouse->y2);
+		mouse_list[cur_mouse].x1			= ob_mouse->x1;
+		mouse_list[cur_mouse].y1			= ob_mouse->y1;
+		mouse_list[cur_mouse].x2			= ob_mouse->x2;
+		mouse_list[cur_mouse].y2			= ob_mouse->y2;
 
-		mouse_list[cur_mouse].priority		= FROM_LE_32(ob_mouse->priority);
-		mouse_list[cur_mouse].pointer		= FROM_LE_32(ob_mouse->pointer);
+		mouse_list[cur_mouse].priority		= ob_mouse->priority;
+		mouse_list[cur_mouse].pointer		= ob_mouse->pointer;
 
 		//-----------------------------------------------
 		// (James17jun97)
@@ -1321,10 +1321,10 @@
 
 	ob_mouse->x1		= 0;
 	ob_mouse->y1		= 0;
-	ob_mouse->x2		= TO_LE_32(this_screen.screen_wide-1);
-	ob_mouse->y2		= TO_LE_32(this_screen.screen_deep-1);
-	ob_mouse->priority	= TO_LE_32(9);				// floor is always lowest priority
-	ob_mouse->pointer	= TO_LE_32(NORMAL_MOUSE_ID);	// normal pointer
+	ob_mouse->x2		= this_screen.screen_wide-1;
+	ob_mouse->y2		= this_screen.screen_deep-1;
+	ob_mouse->priority	= 9;				// floor is always lowest priority
+	ob_mouse->pointer	= NORMAL_MOUSE_ID;	// normal pointer
 
 
 	return(IR_CONT);	//	continue script
@@ -1342,12 +1342,12 @@
 
 	ob_mouse->x1		= 0;
 	ob_mouse->y1		= 0;
-	ob_mouse->x2		= TO_LE_32(this_screen.scroll_offset_x + SCROLL_MOUSE_WIDTH);
-	ob_mouse->y2		= TO_LE_32(this_screen.screen_deep-1);
+	ob_mouse->x2		= this_screen.scroll_offset_x + SCROLL_MOUSE_WIDTH;
+	ob_mouse->y2		= this_screen.screen_deep-1;
 	ob_mouse->priority	= 0;	// highest priority
 
 	if (this_screen.scroll_offset_x > 0)	// if not fully scrolled to the left
-		ob_mouse->pointer = TO_LE_32(SCROLL_LEFT_MOUSE_ID);
+		ob_mouse->pointer = SCROLL_LEFT_MOUSE_ID;
 	else
 		ob_mouse->pointer = 0;	// so the mouse area doesn't get registered
 
@@ -1362,14 +1362,14 @@
  	Object_mouse	*ob_mouse = (Object_mouse *) params[0];
 
 
-	ob_mouse->x1		= TO_LE_32(this_screen.scroll_offset_x + screenWide - SCROLL_MOUSE_WIDTH);
+	ob_mouse->x1		= this_screen.scroll_offset_x + screenWide - SCROLL_MOUSE_WIDTH;
 	ob_mouse->y1		= 0;
-	ob_mouse->x2		= TO_LE_32(this_screen.screen_wide-1);
-	ob_mouse->y2		= TO_LE_32(this_screen.screen_deep-1);
+	ob_mouse->x2		= this_screen.screen_wide-1;
+	ob_mouse->y2		= this_screen.screen_deep-1;
 	ob_mouse->priority	= 0;	// highest priority
 
 	if (this_screen.scroll_offset_x < this_screen.max_scroll_offset_x)	// if not fully scrolled to the right
-		ob_mouse->pointer = TO_LE_32(SCROLL_RIGHT_MOUSE_ID);
+		ob_mouse->pointer = SCROLL_RIGHT_MOUSE_ID;
 	else
 		ob_mouse->pointer = 0;	// so the mouse area doesn't get registered
 

Index: router.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/router.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- router.cpp	13 Sep 2003 00:19:39 -0000	1.9
+++ router.cpp	13 Sep 2003 12:03:29 -0000	1.10
@@ -2645,28 +2645,17 @@
 	uint32	frameCounter = 0;	// starts at frame 0 of mega set (16sep96 JEL)
       
 
-	nWalkFrames				= FROM_LE_32(ob_walkdata->nWalkFrames);
-	usingStandingTurnFrames	= FROM_LE_32(ob_walkdata->usingStandingTurnFrames);
-	usingWalkingTurnFrames	= FROM_LE_32(ob_walkdata->usingWalkingTurnFrames);
-	usingSlowInFrames		= FROM_LE_32(ob_walkdata->usingSlowInFrames);
-	usingSlowOutFrames		= FROM_LE_32(ob_walkdata->usingSlowOutFrames);
+	nWalkFrames				= ob_walkdata->nWalkFrames;
+	usingStandingTurnFrames	= ob_walkdata->usingStandingTurnFrames;
+	usingWalkingTurnFrames	= ob_walkdata->usingWalkingTurnFrames;
+	usingSlowInFrames		= ob_walkdata->usingSlowInFrames;
+	usingSlowOutFrames		= ob_walkdata->usingSlowOutFrames;
 	numberOfSlowOutFrames	= usingSlowOutFrames;	// 0 = not using slow out frames; non-zero = using that many frames for each leading leg for each direction
 
  	memcpy(&numberOfSlowInFrames[0],ob_walkdata->nSlowInFrames,NO_DIRECTIONS*sizeof(numberOfSlowInFrames[0]));
  	memcpy(&leadingLeg[0],ob_walkdata->leadingLeg,NO_DIRECTIONS*sizeof(leadingLeg[0]));
  	memcpy(&dx[0],ob_walkdata->dx,NO_DIRECTIONS*(nWalkFrames+1)*sizeof(dx[0]));
  	memcpy(&dy[0],ob_walkdata->dy,NO_DIRECTIONS*(nWalkFrames+1)*sizeof(dy[0]));
-
-#ifdef SCUMM_BIG_ENDIAN
-	for (direction=0; direction<NO_DIRECTIONS; direction++) {
-		numberOfSlowInFrames[direction] = SWAP_BYTES_32(numberOfSlowInFrames[direction]);
-		leadingLeg[direction] = SWAP_BYTES_32(leadingLeg[direction]);
-	}
-	for (walkFrameNo = 0; walkFrameNo < NO_DIRECTIONS*(nWalkFrames+1); walkFrameNo++) {
-		dx[walkFrameNo] = SWAP_BYTES_32(dx[walkFrameNo]);
-		dy[walkFrameNo] = SWAP_BYTES_32(dy[walkFrameNo]);
-	}
-#endif
 
 	//---------------------------------------------------------
 





More information about the Scummvm-git-logs mailing list