summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-07-31 22:53:57 +0000
committercelestar <celestar@openttd.org>2005-07-31 22:53:57 +0000
commit5352ad45822f4b49a03e2586474776b54873048b (patch)
treec9a9a1e3f27f68a40f4993b7913fab6b2142b6f2 /station_cmd.c
parent21897860038c4f8487483472cd153727b6dc601c (diff)
downloadopenttd-5352ad45822f4b49a03e2586474776b54873048b.tar.xz
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 7e88c284b..d35626b1a 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -2137,7 +2137,8 @@ static void DrawTile_Station(TileInfo *ti)
const DrawTileSeqStruct *dtss;
const DrawTileSprites *t = NULL;
byte railtype = _m[ti->tile].m3 & 0xF;
- int type_offset;
+ const RailtypeInfo *rti = GetRailTypeInfo(railtype);
+ SpriteID offset;
uint32 relocation = 0;
{
@@ -2173,26 +2174,26 @@ static void DrawTile_Station(TileInfo *ti)
image |= image_or_modificator;
// For custom sprites, there's no railtype-based pitching.
- type_offset = railtype * ((image & SPRITE_MASK) < _custom_sprites_base ? TRACKTYPE_SPRITE_PITCH : 1);
+ offset = (image & SPRITE_MASK) < _custom_sprites_base ? rti->total_offset : railtype;
+ 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
- image += type_offset;
DrawGroundSprite(image);
if (_debug_pbs_level >= 1) {
byte pbs = PBSTileReserved(ti->tile);
- if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite((0x3ED + type_offset) | PALETTE_CRASH);
- if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite((0x3EE + type_offset) | PALETTE_CRASH);
- if (pbs & TRACK_BIT_UPPER) DrawGroundSprite((0x3EF + type_offset) | PALETTE_CRASH);
- if (pbs & TRACK_BIT_LOWER) DrawGroundSprite((0x3F0 + type_offset) | PALETTE_CRASH);
- if (pbs & TRACK_BIT_LEFT) DrawGroundSprite((0x3F2 + type_offset) | PALETTE_CRASH);
- if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite((0x3F1 + type_offset) | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite(rti->base_sprites.single_y | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite(rti->base_sprites.single_x | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_UPPER) DrawGroundSprite(rti->base_sprites.single_n | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_LOWER) DrawGroundSprite(rti->base_sprites.single_s | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_LEFT) DrawGroundSprite(rti->base_sprites.single_w | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite(rti->base_sprites.single_e | PALETTE_CRASH);
}
foreach_draw_tile_seq(dtss, t->seq) {
image = dtss->image + relocation;
- image += type_offset;
+ image += offset;
if (_display_opt & DO_TRANS_BUILDINGS) {
MAKE_TRANSPARENT(image);
} else {
@@ -2212,9 +2213,7 @@ void StationPickerDrawSprite(int x, int y, int railtype, int image)
uint32 ormod, img;
const DrawTileSeqStruct *dtss;
const DrawTileSprites *t;
-
- /* baseimage */
- railtype *= TRACKTYPE_SPRITE_PITCH;
+ const RailtypeInfo *rti = GetRailTypeInfo(railtype);
ormod = PLAYER_SPRITE_COLOR(_local_player);
@@ -2223,11 +2222,11 @@ void StationPickerDrawSprite(int x, int y, int railtype, int image)
img = t->ground_sprite;
if (img & PALETTE_MODIFIER_COLOR)
img |= ormod;
- DrawSprite(img + railtype, x, y);
+ DrawSprite(img + rti->total_offset, x, y);
foreach_draw_tile_seq(dtss, t->seq) {
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
- DrawSprite((dtss->image | ormod) + railtype, x + pt.x, y + pt.y);
+ DrawSprite((dtss->image | ormod) + rti->total_offset, x + pt.x, y + pt.y);
}
}