(svn r8283) -Fix (r8128): Custom waypoint drawing used wrong bits since bitshuffling occurred. Also update with other station drawing changes (code duplication,
authorpeter1138
Fri, 19 Jan 2007 21:40:10 +0000
changeset 5989 88540735bad4
parent 5988 1807f4d572f0
child 5990 b3c4c4b66249
(svn r8283) -Fix (r8128): Custom waypoint drawing used wrong bits since bitshuffling occurred. Also update with other station drawing changes (code duplication,
eh?)
src/rail_cmd.cpp
--- a/src/rail_cmd.cpp	Fri Jan 19 18:33:30 2007 +0000
+++ b/src/rail_cmd.cpp	Fri Jan 19 21:40:10 2007 +0000
@@ -1324,8 +1324,7 @@
 					relocation = GetCustomStationRelocation(statspec, st, ti->tile);
 
 					image = dts->ground_sprite;
-					if (HASBIT(image, 31)) {
-						CLRBIT(image, 31);
+					if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
 						image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
 						image += rti->custom_ground_offset;
 					} else {
@@ -1349,9 +1348,18 @@
 		if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
 
 		foreach_draw_tile_seq(dtss, dts->seq) {
-			SpriteID image = dtss->image + relocation;
+			SpriteID image = dtss->image;
 			SpriteID pal;
 
+			/* Unlike stations, our default waypoint has no variation for
+			 * different railtype, so don't use the railtype offset if
+			 * no relocation is set */
+			if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
+				image += rti->total_offset;
+			} else {
+				image += relocation;
+			}
+
 			if (_display_opt & DO_TRANS_BUILDINGS) {
 				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 				pal = PALETTE_TO_TRANSPARENT;
@@ -1361,12 +1369,16 @@
 				pal = dtss->pal;
 			}
 
-			AddSortableSpriteToDraw(
-				image, pal,
-				ti->x + dtss->delta_x, ti->y + dtss->delta_y,
-				dtss->size_x, dtss->size_y,
-				dtss->size_z, ti->z + dtss->delta_z
-			);
+			if ((byte)dtss->delta_z != 0x80) {
+				AddSortableSpriteToDraw(
+					image, pal,
+					ti->x + dtss->delta_x, ti->y + dtss->delta_y,
+					dtss->size_x, dtss->size_y,
+					dtss->size_z, ti->z + dtss->delta_z
+				);
+			} else {
+				AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
+			}
 		}
 	}
 	DrawBridgeMiddle(ti);