summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rail.h5
-rw-r--r--rail_cmd.c2
-rw-r--r--railtypes.h14
-rw-r--r--station_cmd.c2
-rw-r--r--waypoint.c2
5 files changed, 21 insertions, 4 deletions
diff --git a/rail.h b/rail.h
index fa95fdd27..9ea050f04 100644
--- a/rail.h
+++ b/rail.h
@@ -129,6 +129,11 @@ typedef struct RailtypeInfo {
* Bridge offset
*/
SpriteID bridge_offset;
+
+ /**
+ * Offset to add to ground sprite when drawing custom waypoints / stations
+ */
+ byte custom_ground_offset;
} RailtypeInfo;
extern const RailtypeInfo _railtypes[RAILTYPE_END];
diff --git a/rail_cmd.c b/rail_cmd.c
index 9559d4015..c3e964c23 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1382,7 +1382,7 @@ static void DrawTile_Track(TileInfo *ti)
* up to the GRF file to decide that. */
image = cust->ground_sprite;
- image += (image < _custom_sprites_base) ? rti->total_offset : GetRailType(ti->tile);
+ image += (image < _custom_sprites_base) ? rti->total_offset : GetRailTypeInfo(GetRailType(ti->tile))->custom_ground_offset;
DrawGroundSprite(image);
diff --git a/railtypes.h b/railtypes.h
index 1b9b665c4..48f13286a 100644
--- a/railtypes.h
+++ b/railtypes.h
@@ -51,6 +51,9 @@ const RailtypeInfo _railtypes[] = {
/* bridge offset */
0,
+
+ /* custom ground offset */
+ 0,
},
/** Electrified railway */
@@ -100,7 +103,10 @@ const RailtypeInfo _railtypes[] = {
0,
/* bridge offset */
- 0
+ 0,
+
+ /* custom ground offset */
+ 0,
},
/** Monorail */
@@ -147,6 +153,9 @@ const RailtypeInfo _railtypes[] = {
/* bridge offset */
16,
+
+ /* custom ground offset */
+ 1,
},
/** Maglev */
@@ -193,5 +202,8 @@ const RailtypeInfo _railtypes[] = {
/* bridge offset */
24,
+
+ /* custom ground offset */
+ 2,
},
};
diff --git a/station_cmd.c b/station_cmd.c
index c9c2aefe8..b0a71769b 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1935,7 +1935,7 @@ static void DrawTile_Station(TileInfo *ti)
if (image & PALETTE_MODIFIER_COLOR) image |= image_or_modificator;
// For custom sprites, there's no railtype-based pitching.
- offset = (image & SPRITE_MASK) < _custom_sprites_base ? rti->total_offset : railtype;
+ offset = (image & SPRITE_MASK) < _custom_sprites_base ? rti->total_offset : GetRailTypeInfo(railtype)->custom_ground_offset;
image += offset;
// station_land array has been increased from 82 elements to 114
diff --git a/waypoint.c b/waypoint.c
index 715c530b3..00cc4f941 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -412,7 +412,7 @@ void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
cust = &stat->renderdata[2];
img = cust->ground_sprite;
- img += (img < _custom_sprites_base) ? rti->total_offset : railtype;
+ img += (img < _custom_sprites_base) ? rti->total_offset : GetRailTypeInfo(railtype)->custom_ground_offset;
if (img & PALETTE_MODIFIER_COLOR) img = (img & SPRITE_MASK);
DrawSprite(img, x, y);