summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-07 10:58:53 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-07 10:58:53 +0000
commit31a54a6835c6950d943bc0434653d555392a56af (patch)
tree28a6067bb4eb207cd3c7980dc477b8d7bffaed2c /station_cmd.c
parent24854be59e4150d08b3797c775b2cdcafcd73791 (diff)
downloadopenttd-31a54a6835c6950d943bc0434653d555392a56af.tar.xz
(svn r4767) - Newstations: fix loading / use of custom ground sprites
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 22c86c82a..788dc5d5c 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1986,8 +1986,6 @@ const DrawTileSprites *GetStationTileLayout(byte gfx)
return &_station_display_datas[gfx];
}
-extern uint16 _custom_sprites_base;
-
static void DrawTile_Station(TileInfo *ti)
{
uint32 image_or_modificator;
@@ -1996,8 +1994,9 @@ static void DrawTile_Station(TileInfo *ti)
const DrawTileSprites *t = NULL;
RailType railtype = GetRailType(ti->tile);
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
- SpriteID offset;
uint32 relocation = 0;
+ const Station *st = NULL;
+ const StationSpec *statspec = NULL;
{
PlayerID owner = GetTileOwner(ti->tile);
@@ -2011,8 +2010,8 @@ static void DrawTile_Station(TileInfo *ti)
if (IsCustomStationSpecIndex(ti->tile)) {
// look for customization
- const Station *st = GetStationByTile(ti->tile);
- const StationSpec *statspec = st->speclist[GetCustomStationSpecIndex(ti->tile)].spec;
+ st = GetStationByTile(ti->tile);
+ statspec = st->speclist[GetCustomStationSpecIndex(ti->tile)].spec;
//debug("Cust-o-mized %p", statspec);
@@ -2036,12 +2035,15 @@ static void DrawTile_Station(TileInfo *ti)
if (t == NULL || t->seq == NULL) t = &_station_display_datas[GetStationGfx(ti->tile)];
image = t->ground_sprite;
+ if (HASBIT(image, 31)) {
+ CLRBIT(image, 31);
+ image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
+ image += rti->custom_ground_offset;
+ } else {
+ image += rti->total_offset;
+ }
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 : rti->custom_ground_offset;
- image += offset;
-
// station_land array has been increased from 82 elements to 114
// but this is something else. If AI builds station with 114 it looks all weird
DrawGroundSprite(image);
@@ -2049,8 +2051,14 @@ static void DrawTile_Station(TileInfo *ti)
if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
foreach_draw_tile_seq(dtss, t->seq) {
- image = dtss->image + relocation;
- image += offset;
+ image = dtss->image;
+ if (HASBIT(image, 30)) {
+ CLRBIT(image, 30);
+ image += rti->total_offset;
+ } else {
+ image += relocation;
+ }
+
if (_display_opt & DO_TRANS_BUILDINGS) {
MAKE_TRANSPARENT(image);
} else {