changeset 10932:8e60ddcfb9fa draft

(svn r15271) -Codechange: Use offsets for drawing elrail wires & pylons instead of absolute sprite IDs.
author peter1138 <peter1138@openttd.org>
date Sun, 25 Jan 2009 19:27:13 +0000 (2009-01-25)
parents 4b0aae0b22a8
children 8b730ca96125
files src/elrail.cpp src/table/elrail_data.h src/table/sprites.h
diffstat 3 files changed, 141 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -122,6 +122,22 @@
 	}
 }
 
+/**
+ * Get the base wire sprite to use.
+ */
+static inline SpriteID GetWireBase(TileIndex tile)
+{
+	return SPR_WIRE_BASE;
+}
+
+/**
+ * Get the base pylon sprite to use.
+ */
+static inline SpriteID GetPylonBase(TileIndex tile)
+{
+	return SPR_PYLON_BASE;
+}
+
 /** Corrects the tileh for certain tile types. Returns an effective tileh for the track on the tile.
  * @param tile The tile to analyse
  * @param *tileh the tileh
@@ -185,10 +201,12 @@
 
 	DiagDirection dir = GetTunnelBridgeDirection(ti->tile);
 
+	SpriteID wire_base = GetWireBase(ti->tile);
+
 	const SortableSpriteStruct *sss = &CatenarySpriteData_Tunnel[dir];
 	const int *BB_data = _tunnel_wire_BB[dir];
 	AddSortableSpriteToDraw(
-		sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
+		wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
 		BB_data[2] - sss->x_offset, BB_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1,
 		GetTileZ(ti->tile) + sss->z_offset,
 		IsTransparencySet(TO_CATENARY),
@@ -231,6 +249,8 @@
 
 	AdjustTileh(ti->tile, &tileh[TS_HOME]);
 
+	SpriteID pylon_base = GetPylonBase(ti->tile);
+
 	for (DiagDirection i = DIAGDIR_NE; i < DIAGDIR_END; i++) {
 		TileIndex neighbour = ti->tile + TileOffsByDiagDir(i);
 		Foundation foundation = FOUNDATION_NONE;
@@ -337,7 +357,7 @@
 						continue; /* No neighbour, go looking for a better position */
 					}
 
-					AddSortableSpriteToDraw(pylon_sprites[temp], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE,
+					AddSortableSpriteToDraw(pylon_base + pylon_sprites[temp], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE,
 						elevation, IsTransparencySet(TO_CATENARY), -1, -1);
 
 					break; /* We already have drawn a pylon, bail out */
@@ -356,6 +376,8 @@
 		if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
 	}
 
+	SpriteID wire_base = GetWireBase(ti->tile);
+
 	/* Drawing of pylons is finished, now draw the wires */
 	for (Track t = TRACK_BEGIN; t < TRACK_END; t++) {
 		if (HasBit(trackconfig[TS_HOME], t)) {
@@ -374,7 +396,7 @@
 			 * Therefore it is safe to use GetSlopeZ() for the elevation.
 			 * Also note, that the result of GetSlopeZ() is very special for bridge-ramps.
 			 */
-			AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
+			AddSortableSpriteToDraw(wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
 				sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset,
 				IsTransparencySet(TO_CATENARY));
 		}
@@ -407,11 +429,15 @@
 
 	height = GetBridgeHeight(end);
 
-	AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
+	SpriteID wire_base = GetWireBase(start);
+
+	AddSortableSpriteToDraw(wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
 		sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset,
 		IsTransparencySet(TO_CATENARY)
 	);
 
+	SpriteID pylon_base = GetPylonBase(start);
+
 	/* Finished with wires, draw pylons */
 	/* every other tile needs a pylon on the northern end */
 	if (num % 2) {
@@ -420,7 +446,7 @@
 		if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
 		uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
 		uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
-		AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
+		AddSortableSpriteToDraw(pylon_base + pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
 	}
 
 	/* need a pylon on the southern end of the bridge */
@@ -430,7 +456,7 @@
 		if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
 		uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
 		uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
-		AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
+		AddSortableSpriteToDraw(pylon_base + pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
 	}
 }
 
@@ -441,9 +467,11 @@
 			if (IsRailDepot(ti->tile)) {
 				const SortableSpriteStruct *sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
 
+				SpriteID wire_base = GetWireBase(ti->tile);
+
 				/* This wire is not visible with the default depot sprites */
 				AddSortableSpriteToDraw(
-					sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
+					wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
 					sss->x_size, sss->y_size, sss->z_size,
 					GetTileMaxZ(ti->tile) + sss->z_offset,
 					IsTransparencySet(TO_CATENARY)
--- a/src/table/elrail_data.h
+++ b/src/table/elrail_data.h
@@ -235,20 +235,72 @@
 /* Geometric placement of the PPP relative to the PCP*/
 static const int8 x_ppp_offsets[DIR_END] = {-2, -4, -2,  0,  2,  4,  2,  0};
 static const int8 y_ppp_offsets[DIR_END] = {-2,  0,  2,  4,  2,  0, -2, -4};
+
+/**
+ * Offset for pylon sprites from the base pylon sprite.
+ */
+enum PylonSpriteOffset {
+	PSO_Y_NE,
+	PSO_Y_SW,
+	PSO_X_NW,
+	PSO_X_SE,
+	PSO_EW_N,
+	PSO_EW_S,
+	PSO_NS_W,
+	PSO_NS_E,
+};
+
 /* The type of pylon to draw at each PPP */
-static const SpriteID pylon_sprites[] = {
-	SPR_PYLON_EW_N,
-	SPR_PYLON_Y_NE,
-	SPR_PYLON_NS_E,
-	SPR_PYLON_X_SE,
-	SPR_PYLON_EW_S,
-	SPR_PYLON_Y_SW,
-	SPR_PYLON_NS_W,
-	SPR_PYLON_X_NW
+static const uint8 pylon_sprites[] = {
+	PSO_EW_N,
+	PSO_Y_NE,
+	PSO_NS_E,
+	PSO_X_SE,
+	PSO_EW_S,
+	PSO_Y_SW,
+	PSO_NS_W,
+	PSO_X_NW,
+};
+
+/**
+ * Offset for wire sprites from the base wire sprite.
+ */
+enum WireSpriteOffset {
+	WSO_X_SHORT,
+	WSO_Y_SHORT,
+	WSO_EW_SHORT,
+	WSO_NS_SHORT,
+	WSO_X_SHORT_DOWN,
+	WSO_Y_SHORT_UP,
+	WSO_X_SHORT_UP,
+	WSO_Y_SHORT_DOWN,
+
+	WSO_X_SW,
+	WSO_Y_SE,
+	WSO_EW_E,
+	WSO_NS_S,
+	WSO_X_SW_DOWN,
+	WSO_Y_SE_UP,
+	WSO_X_SW_UP,
+	WSO_Y_SE_DOWN,
+
+	WSO_X_NE,
+	WSO_Y_NW,
+	WSO_EW_W,
+	WSO_NS_N,
+	WSO_X_NE_DOWN,
+	WSO_Y_NW_UP,
+	WSO_X_NE_UP,
+	WSO_Y_NW_DOWN,
+
+	WSO_ENTRANCE_NE,
+	WSO_ENTRANCE_SE,
+	WSO_ENTRANCE_SW,
+	WSO_ENTRANCE_NW,
 };
 
 struct SortableSpriteStruct {
-	SpriteID image;
+	uint8 image_offset;
 	int8 x_offset;
 	int8 y_offset;
 	int8 x_size;
@@ -268,75 +320,75 @@
 /* X direction */
 	/* Flat tiles: */
 		/* Wires */
-	{ SPR_WIRE_X_SW,          0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! 0: Wire in X direction, pylon on the SW end only
-	{ SPR_WIRE_X_NE,          0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! 1: Wire in X direction, pylon on the NE end
-	{ SPR_WIRE_X_SHORT,       0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! 2: Wire in X direction, pylon on both ends
+	{ WSO_X_SW,          0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! 0: Wire in X direction, pylon on the SW end only
+	{ WSO_X_NE,          0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! 1: Wire in X direction, pylon on the NE end
+	{ WSO_X_SHORT,       0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! 2: Wire in X direction, pylon on both ends
 
 	/* "up" tiles */
 		/* Wires */
-	{ SPR_WIRE_X_SW_UP,       0,  7, 15,  8,  1, ELRAIL_ELEVRAISE }, //! 3: Wire in X pitch up, pylon on the SW end only
-	{ SPR_WIRE_X_NE_UP,       0,  7, 15,  8,  1, ELRAIL_ELEVRAISE }, //! 4: Wire in X pitch up, pylon on the NE end
-	{ SPR_WIRE_X_SHORT_UP,    0,  7, 15,  8,  1, ELRAIL_ELEVRAISE }, //! 5: Wire in X pitch up, pylon on both ends
+	{ WSO_X_SW_UP,       0,  7, 15,  8,  1, ELRAIL_ELEVRAISE }, //! 3: Wire in X pitch up, pylon on the SW end only
+	{ WSO_X_NE_UP,       0,  7, 15,  8,  1, ELRAIL_ELEVRAISE }, //! 4: Wire in X pitch up, pylon on the NE end
+	{ WSO_X_SHORT_UP,    0,  7, 15,  8,  1, ELRAIL_ELEVRAISE }, //! 5: Wire in X pitch up, pylon on both ends
 
 	/* "down" tiles */
 		/* Wires */
-	{ SPR_WIRE_X_SW_DOWN,     0,  7, 15,  8,  1, ELRAIL_ELEVATION }, //! 6: Wire in X pitch down, pylon on the SW end
-	{ SPR_WIRE_X_NE_DOWN,     0,  7, 15,  8,  1, ELRAIL_ELEVATION }, //! 7: Wire in X pitch down, pylon on the NE end
-	{ SPR_WIRE_X_SHORT_DOWN,  0,  7, 15,  8,  1, ELRAIL_ELEVATION }, //! 8: Wire in X pitch down, pylon on both ends
+	{ WSO_X_SW_DOWN,     0,  7, 15,  8,  1, ELRAIL_ELEVATION }, //! 6: Wire in X pitch down, pylon on the SW end
+	{ WSO_X_NE_DOWN,     0,  7, 15,  8,  1, ELRAIL_ELEVATION }, //! 7: Wire in X pitch down, pylon on the NE end
+	{ WSO_X_SHORT_DOWN,  0,  7, 15,  8,  1, ELRAIL_ELEVATION }, //! 8: Wire in X pitch down, pylon on both ends
 
 
 /* Y direction */
 	/* Flat tiles: */
 		/* Wires */
-	{ SPR_WIRE_Y_SE,          7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //! 9: Wire in Y direction, pylon on the SE end only
-	{ SPR_WIRE_Y_NW,          7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //!10: Wire in Y direction, pylon on the NW end
-	{ SPR_WIRE_Y_SHORT,       7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //!11: Wire in Y direction, pylon on both ends
+	{ WSO_Y_SE,          7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //! 9: Wire in Y direction, pylon on the SE end only
+	{ WSO_Y_NW,          7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //!10: Wire in Y direction, pylon on the NW end
+	{ WSO_Y_SHORT,       7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //!11: Wire in Y direction, pylon on both ends
 
 	/* "up" tiles */
 		/* Wires */
-	{ SPR_WIRE_Y_SE_UP,       7,  0,  8, 15,  1, ELRAIL_ELEVRAISE }, //!12: Wire in Y pitch up, pylon on the SE end only
-	{ SPR_WIRE_Y_NW_UP,       7,  0,  8, 15,  1, ELRAIL_ELEVRAISE }, //!13: Wire in Y pitch up, pylon on the NW end
-	{ SPR_WIRE_Y_SHORT_UP,    7,  0,  8, 15,  1, ELRAIL_ELEVRAISE }, //!14: Wire in Y pitch up, pylon on both ends
+	{ WSO_Y_SE_UP,       7,  0,  8, 15,  1, ELRAIL_ELEVRAISE }, //!12: Wire in Y pitch up, pylon on the SE end only
+	{ WSO_Y_NW_UP,       7,  0,  8, 15,  1, ELRAIL_ELEVRAISE }, //!13: Wire in Y pitch up, pylon on the NW end
+	{ WSO_Y_SHORT_UP,    7,  0,  8, 15,  1, ELRAIL_ELEVRAISE }, //!14: Wire in Y pitch up, pylon on both ends
 
 	/* "down" tiles */
 		/* Wires */
-	{ SPR_WIRE_Y_SE_DOWN,     7,  0,  8, 15,  1, ELRAIL_ELEVATION }, //!15: Wire in Y pitch down, pylon on the SE end
-	{ SPR_WIRE_Y_NW_DOWN,     7,  0,  8, 15,  1, ELRAIL_ELEVATION }, //!16: Wire in Y pitch down, pylon on the NW end
-	{ SPR_WIRE_Y_SHORT_DOWN,  7,  0,  8, 15,  1, ELRAIL_ELEVATION }, //!17: Wire in Y pitch down, pylon on both ends
+	{ WSO_Y_SE_DOWN,     7,  0,  8, 15,  1, ELRAIL_ELEVATION }, //!15: Wire in Y pitch down, pylon on the SE end
+	{ WSO_Y_NW_DOWN,     7,  0,  8, 15,  1, ELRAIL_ELEVATION }, //!16: Wire in Y pitch down, pylon on the NW end
+	{ WSO_Y_SHORT_DOWN,  7,  0,  8, 15,  1, ELRAIL_ELEVATION }, //!17: Wire in Y pitch down, pylon on both ends
 
 /* NS Direction */
-	{ SPR_WIRE_NS_SHORT,      8,  0,  8,  8,  1, ELRAIL_ELEVATION }, //!18: LEFT  trackbit wire, pylon on both ends
-	{ SPR_WIRE_NS_SHORT,      0,  8,  8,  8,  1, ELRAIL_ELEVATION }, //!19: RIGHT trackbit wire, pylon on both ends
+	{ WSO_NS_SHORT,      8,  0,  8,  8,  1, ELRAIL_ELEVATION }, //!18: LEFT  trackbit wire, pylon on both ends
+	{ WSO_NS_SHORT,      0,  8,  8,  8,  1, ELRAIL_ELEVATION }, //!19: RIGHT trackbit wire, pylon on both ends
 
-	{ SPR_WIRE_NS_N,          8,  0,  8,  8,  1, ELRAIL_ELEVATION }, //!20: LEFT  trackbit wire, pylon on N end
-	{ SPR_WIRE_NS_N,          0,  8,  8,  8,  1, ELRAIL_ELEVATION }, //!21: RIGHT trackbit wire, pylon on N end
+	{ WSO_NS_N,          8,  0,  8,  8,  1, ELRAIL_ELEVATION }, //!20: LEFT  trackbit wire, pylon on N end
+	{ WSO_NS_N,          0,  8,  8,  8,  1, ELRAIL_ELEVATION }, //!21: RIGHT trackbit wire, pylon on N end
 
-	{ SPR_WIRE_NS_S,          8,  0,  8,  8,  1, ELRAIL_ELEVATION }, //!22: LEFT  trackbit wire, pylon on S end
-	{ SPR_WIRE_NS_S,          0,  8,  8,  8,  1, ELRAIL_ELEVATION }, //!23: RIGHT trackbit wire, pylon on S end
+	{ WSO_NS_S,          8,  0,  8,  8,  1, ELRAIL_ELEVATION }, //!22: LEFT  trackbit wire, pylon on S end
+	{ WSO_NS_S,          0,  8,  8,  8,  1, ELRAIL_ELEVATION }, //!23: RIGHT trackbit wire, pylon on S end
 
 /* EW Direction */
-	{ SPR_WIRE_EW_SHORT,      7,  0,  1,  1,  1, ELRAIL_ELEVATION }, //!24: UPPER trackbit wire, pylon on both ends
-	{ SPR_WIRE_EW_SHORT,     15,  8,  3,  3,  1, ELRAIL_ELEVATION }, //!25: LOWER trackbit wire, pylon on both ends
+	{ WSO_EW_SHORT,      7,  0,  1,  1,  1, ELRAIL_ELEVATION }, //!24: UPPER trackbit wire, pylon on both ends
+	{ WSO_EW_SHORT,     15,  8,  3,  3,  1, ELRAIL_ELEVATION }, //!25: LOWER trackbit wire, pylon on both ends
 
-	{ SPR_WIRE_EW_W,          7,  0,  1,  1,  1, ELRAIL_ELEVATION }, //!28: UPPER trackbit wire, pylon on both ends
-	{ SPR_WIRE_EW_W,         15,  8,  3,  3,  1, ELRAIL_ELEVATION }, //!29: LOWER trackbit wire, pylon on both ends
+	{ WSO_EW_W,          7,  0,  1,  1,  1, ELRAIL_ELEVATION }, //!28: UPPER trackbit wire, pylon on both ends
+	{ WSO_EW_W,         15,  8,  3,  3,  1, ELRAIL_ELEVATION }, //!29: LOWER trackbit wire, pylon on both ends
 
-	{ SPR_WIRE_EW_E,          7,  0,  1,  1,  1, ELRAIL_ELEVATION }, //!32: UPPER trackbit wire, pylon on both ends
-	{ SPR_WIRE_EW_E,         15,  8,  3,  3,  1, ELRAIL_ELEVATION }  //!33: LOWER trackbit wire, pylon on both ends
+	{ WSO_EW_E,          7,  0,  1,  1,  1, ELRAIL_ELEVATION }, //!32: UPPER trackbit wire, pylon on both ends
+	{ WSO_EW_E,         15,  8,  3,  3,  1, ELRAIL_ELEVATION }  //!33: LOWER trackbit wire, pylon on both ends
 };
 
 static const SortableSpriteStruct CatenarySpriteData_Depot[] = {
-	{ SPR_WIRE_DEPOT_NE,      0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for NE depot exit
-	{ SPR_WIRE_DEPOT_SE,      7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //! Wire for SE depot exit
-	{ SPR_WIRE_DEPOT_SW,      0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for SW depot exit
-	{ SPR_WIRE_DEPOT_NW,      7,  0,  1, 15,  1, ELRAIL_ELEVATION }  //! Wire for NW depot exit
+	{ WSO_ENTRANCE_NE,   0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for NE depot exit
+	{ WSO_ENTRANCE_SE,   7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //! Wire for SE depot exit
+	{ WSO_ENTRANCE_SW,   0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for SW depot exit
+	{ WSO_ENTRANCE_NW,   7,  0,  1, 15,  1, ELRAIL_ELEVATION }  //! Wire for NW depot exit
 };
 
 static const SortableSpriteStruct CatenarySpriteData_Tunnel[] = {
-	{ SPR_WIRE_TUNNEL_NE,      0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for NE tunnel exit
-	{ SPR_WIRE_TUNNEL_SE,      7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //! Wire for SE tunnel exit
-	{ SPR_WIRE_TUNNEL_SW,      0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for SW tunnel exit
-	{ SPR_WIRE_TUNNEL_NW,      7,  0,  1, 15,  1, ELRAIL_ELEVATION }  //! Wire for NW tunnel exit
+	{ WSO_ENTRANCE_NE,   0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for NE tunnel exit
+	{ WSO_ENTRANCE_SE,   7,  0,  1, 15,  1, ELRAIL_ELEVATION }, //! Wire for SE tunnel exit
+	{ WSO_ENTRANCE_SW,   0,  7, 15,  1,  1, ELRAIL_ELEVATION }, //! Wire for SW tunnel exit
+	{ WSO_ENTRANCE_NW,   7,  0,  1, 15,  1, ELRAIL_ELEVATION }  //! Wire for NW tunnel exit
 };
 
 
--- a/src/table/sprites.h
+++ b/src/table/sprites.h
@@ -379,59 +379,12 @@
 	SPR_TRACK_FENCE_SLOPE_NE  = 1307,
 	SPR_TRACK_FENCE_SLOPE_NW  = 1308,
 
-	/* Elrail stuff */
-	/* Wires. First identifier is the direction of the track, second is the required placement of the pylon.
-	 * "short" denotes a wire that requires a pylon on each end. Third identifier is the direction of the slope
-	 * (in positive coordinate direction) */
-	SPR_WIRE_X_SHORT      = SPR_ELRAIL_BASE + 0,
-	SPR_WIRE_Y_SHORT      = SPR_ELRAIL_BASE + 1,
-	SPR_WIRE_EW_SHORT     = SPR_ELRAIL_BASE + 2,
-	SPR_WIRE_NS_SHORT     = SPR_ELRAIL_BASE + 3,
-	SPR_WIRE_X_SHORT_DOWN = SPR_ELRAIL_BASE + 4,
-	SPR_WIRE_Y_SHORT_UP   = SPR_ELRAIL_BASE + 5,
-	SPR_WIRE_X_SHORT_UP   = SPR_ELRAIL_BASE + 6,
-	SPR_WIRE_Y_SHORT_DOWN = SPR_ELRAIL_BASE + 7,
-
-	SPR_WIRE_X_SW      = SPR_ELRAIL_BASE +  8,
-	SPR_WIRE_Y_SE      = SPR_ELRAIL_BASE +  9,
-	SPR_WIRE_EW_E      = SPR_ELRAIL_BASE + 10,
-	SPR_WIRE_NS_S      = SPR_ELRAIL_BASE + 11,
-	SPR_WIRE_X_SW_DOWN = SPR_ELRAIL_BASE + 12,
-	SPR_WIRE_Y_SE_UP   = SPR_ELRAIL_BASE + 13,
-	SPR_WIRE_X_SW_UP   = SPR_ELRAIL_BASE + 14,
-	SPR_WIRE_Y_SE_DOWN = SPR_ELRAIL_BASE + 15,
-
-	SPR_WIRE_X_NE      = SPR_ELRAIL_BASE + 16,
-	SPR_WIRE_Y_NW      = SPR_ELRAIL_BASE + 17,
-	SPR_WIRE_EW_W      = SPR_ELRAIL_BASE + 18,
-	SPR_WIRE_NS_N      = SPR_ELRAIL_BASE + 19,
-	SPR_WIRE_X_NE_DOWN = SPR_ELRAIL_BASE + 20,
-	SPR_WIRE_Y_NW_UP   = SPR_ELRAIL_BASE + 21,
-	SPR_WIRE_X_NE_UP   = SPR_ELRAIL_BASE + 22,
-	SPR_WIRE_Y_NW_DOWN = SPR_ELRAIL_BASE + 23,
-
-	/* Tunnel entries */
-	SPR_WIRE_TUNNEL_NE = SPR_ELRAIL_BASE + 24,
-	SPR_WIRE_TUNNEL_SE = SPR_ELRAIL_BASE + 25,
-	SPR_WIRE_TUNNEL_SW = SPR_ELRAIL_BASE + 26,
-	SPR_WIRE_TUNNEL_NW = SPR_ELRAIL_BASE + 27,
-
-	/* Depot entries */
-	SPR_WIRE_DEPOT_SW = SPR_ELRAIL_BASE + 24,
-	SPR_WIRE_DEPOT_NW = SPR_ELRAIL_BASE + 25,
-	SPR_WIRE_DEPOT_NE = SPR_ELRAIL_BASE + 26,
-	SPR_WIRE_DEPOT_SE = SPR_ELRAIL_BASE + 27,
-
-
-	/* Pylons, first identifier is the direction of the track, second the placement relative to the track */
-	SPR_PYLON_Y_NE = SPR_ELRAIL_BASE + 28,
-	SPR_PYLON_Y_SW = SPR_ELRAIL_BASE + 29,
-	SPR_PYLON_X_NW = SPR_ELRAIL_BASE + 30,
-	SPR_PYLON_X_SE = SPR_ELRAIL_BASE + 31,
-	SPR_PYLON_EW_N = SPR_ELRAIL_BASE + 32,
-	SPR_PYLON_EW_S = SPR_ELRAIL_BASE + 33,
-	SPR_PYLON_NS_W = SPR_ELRAIL_BASE + 34,
-	SPR_PYLON_NS_E = SPR_ELRAIL_BASE + 35,
+	/* Base sprites for elrail.
+	 * Offsets via an enum are used so a complete list of absolute
+	 * sprite numbers is unnecessary.
+	 */
+	SPR_WIRE_BASE         = SPR_ELRAIL_BASE +  0,
+	SPR_PYLON_BASE        = SPR_ELRAIL_BASE + 28,
 
 	/* sprites for roads */
 	SPR_ROAD_PAVED_STRAIGHT_Y       = 1313,