summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-11-14 22:10:08 +0000
committerdominik <dominik@openttd.org>2004-11-14 22:10:08 +0000
commitfb64b4e499ceb631f6e9109d18422e2ae604c204 (patch)
treed6896398c02266f1cd7239e6ea3c40dfde2ef609 /rail_cmd.c
parent051e094921f208f48f3239622f96078c528ef734 (diff)
downloadopenttd-fb64b4e499ceb631f6e9109d18422e2ae604c204.tar.xz
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 3c46b8798..ac32369d8 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -9,6 +9,8 @@
#include "station.h"
#include "sprite.h"
+extern uint16 _custom_sprites_base;
+
void ShowTrainDepotWindow(uint tile);
enum { /* These values are bitmasks for the map5 byte */
@@ -1569,9 +1571,12 @@ static void DrawTile_Track(TileInfo *ti)
// emulate station tile - open with building
DrawTileSprites *cust = &stat->renderdata[2 + (m5 & 0x1)];
uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0);
+ int railtype=(_map3_lo[ti->tile] & 0xF);
+
+ image = cust->ground_sprite + railtype*((image<_custom_sprites_base)?TRACKTYPE_SPRITE_PITCH:1);
+ if (image & 0x8000) image = (image & 0x7FFF);
+
- image = cust->ground_sprite;
- if (image & 0x8000) image = (image & 0x7FFF) + tracktype_offs;
DrawGroundSprite(image);
foreach_draw_tile_seq(seq, cust->seq) {
@@ -1640,7 +1645,7 @@ void DrawTrainDepotSprite(int x, int y, int image, int railtype)
}
}
-void DrawWaypointSprite(int x, int y, int stat_id)
+void DrawWaypointSprite(int x, int y, int stat_id, int railtype)
{
struct StationSpec *stat;
uint32 relocation;
@@ -1659,14 +1664,14 @@ void DrawWaypointSprite(int x, int y, int stat_id)
const DrawTrackSeqStruct *dtss;
img = *(const uint16*)t;
- if (img & 0x8000) img = (img & 0x7FFF) + 0;
+ if (img & 0x8000) img = (img & 0x7FFF) + railtype*TRACKTYPE_SPRITE_PITCH;
DrawSprite(img, x, y);
for (dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
img = dtss->image;
if (img & 0x8000) img |= ormod;
- DrawSprite(img + 0, x + pt.x, y + pt.y);
+ DrawSprite(img, x + pt.x, y + pt.y);
}
return;
}
@@ -1678,7 +1683,7 @@ void DrawWaypointSprite(int x, int y, int stat_id)
// add 1 to get the other direction
cust = &stat->renderdata[2];
- img = cust->ground_sprite;
+ img = cust->ground_sprite + railtype*((img<_custom_sprites_base)?TRACKTYPE_SPRITE_PITCH:1);
if (img & 0x8000) img = (img & 0x7FFF);
DrawSprite(img, x, y);