diff options
author | peter1138 <peter1138@openttd.org> | 2006-05-06 09:40:12 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-05-06 09:40:12 +0000 |
commit | b7e0ca44531de504797e2eb9c7e77c678ebbbd43 (patch) | |
tree | bb4224ce0181d8ccc7fc1a591b9c8158173e9b7f /rail_cmd.c | |
parent | 0197d7d683731100e9634112e65541a1af78e45e (diff) | |
download | openttd-b7e0ca44531de504797e2eb9c7e77c678ebbbd43.tar.xz |
(svn r4748) - Newstations: use custom sprite layout callback for waypoints as well as stations. Supports merging of adjacent waypoints if the GRF supports it (newstatsw.grf)
Diffstat (limited to 'rail_cmd.c')
-rw-r--r-- | rail_cmd.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/rail_cmd.c b/rail_cmd.c index fdadfddfe..107b5bc17 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -27,6 +27,8 @@ #include "rail.h" #include "railtypes.h" // include table for railtypes #include "newgrf.h" +#include "newgrf_callbacks.h" +#include "newgrf_station.h" extern uint16 _custom_sprites_base; @@ -1323,17 +1325,18 @@ static void DrawTile_Track(TileInfo *ti) if (statspec != NULL) { DrawTileSeqStruct const *seq; // emulate station tile - open with building - const DrawTileSprites *cust = &statspec->renderdata[2 + GetWaypointAxis(ti->tile)]; - uint32 relocation = GetCustomStationRelocation(statspec, ComposeWaypointStation(ti->tile), ti->tile); - - /* We don't touch the 0x8000 bit. In all this - * waypoint code, it is used to indicate that - * we should offset by railtype, but we always - * do that for custom ground sprites and never - * for station sprites. And in the drawing - * code, it is used to indicate that the sprite - * should be drawn in company colors, and it's - * up to the GRF file to decide that. */ + uint tile = 2; + const DrawTileSprites *cust; + Station *st = ComposeWaypointStation(ti->tile); + + uint32 relocation = GetCustomStationRelocation(statspec, st, ti->tile); + + if (HASBIT(statspec->callbackmask, CBM_CUSTOM_LAYOUT)) { + uint16 callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0, 0, statspec, st, ti->tile); + if (callback != CALLBACK_FAILED) tile = callback; + } + + cust = &statspec->renderdata[(tile < statspec->tiles ? tile : 0) + GetWaypointAxis(ti->tile)]; /* If there is no sprite layout, we fall back to the default waypoint graphics. */ if (cust != NULL && cust->seq != NULL) { |