(svn r760) Replace some bit-juggling with bit fields
authortron
Mon, 22 Nov 2004 11:01:30 +0000
changeset 482 3ed6804ef31d
parent 481 8db362a96e73
child 483 e27622930ddc
(svn r760) Replace some bit-juggling with bit fields
table/town_land.h
town_cmd.c
--- a/table/town_land.h	Mon Nov 22 10:26:59 2004 +0000
+++ b/table/town_land.h	Mon Nov 22 11:01:30 2004 +0000
@@ -1,4 +1,4 @@
-#define M(s1,s2,sx,sy,w,h,dz,p) {s1,s2,(sx<<4)|sy,((w-1)<<4)|(h-1),dz,p}
+#define M(s1, s2, sx, sy, w, h, dz, p) {s1, s2, sx, sy, w - 1, h - 1, dz, p}
 
 static const DrawTownTileStruct _town_draw_tile_data[] = {
 	M(     0xf54,      0x58d,  0,  0, 14, 14,   8, 0),
--- a/town_cmd.c	Mon Nov 22 10:26:59 2004 +0000
+++ b/town_cmd.c	Mon Nov 22 11:01:30 2004 +0000
@@ -24,8 +24,10 @@
 	uint32 sprite_1;
 	uint32 sprite_2;
 
-	byte subtile_xy;
-	byte width_height;
+	byte subtile_x:4;
+	byte subtile_y:4;
+	byte width:4;
+	byte height:4;
 	byte dz;
 	byte proc;
 } DrawTownTileStruct;
@@ -82,10 +84,10 @@
 			image = (image & 0x3FFF) | 0x3224000;
 
 		AddSortableSpriteToDraw(image,
-			ti->x | (dcts->subtile_xy>>4),
-			ti->y | (dcts->subtile_xy&0xF),
-			(dcts->width_height>>4)+1,
-			(dcts->width_height&0xF)+1,
+			ti->x + dcts->subtile_x,
+			ti->y + dcts->subtile_y,
+			dcts->width + 1,
+			dcts->height + 1,
 			dcts->dz,
 			z);