changeset 3575 | f5b56bd958c0 |
parent 3562 | 83a833bbe9ac |
child 3636 | a36cc46e754d |
3574:280e134ce515 | 3575:f5b56bd958c0 |
---|---|
1013 } |
1013 } |
1014 } |
1014 } |
1015 |
1015 |
1016 #include "table/track_land.h" |
1016 #include "table/track_land.h" |
1017 |
1017 |
1018 static void DrawSingleSignal(TileIndex tile, byte condition, uint32 image_and_pos) |
1018 static void DrawSingleSignal(TileIndex tile, byte condition, uint image, uint pos) |
1019 { |
1019 { |
1020 bool otherside = _opt.road_side & _patches.signal_side; |
1020 bool side = _opt.road_side & _patches.signal_side; |
1021 static const Point SignalPositions[2][12] = { |
1021 static const Point SignalPositions[2][12] = { |
1022 { /* Signals on the left side */ |
1022 { /* Signals on the left side */ |
1023 /* LEFT LEFT RIGHT RIGHT UPPER UPPER */ |
1023 /* LEFT LEFT RIGHT RIGHT UPPER UPPER */ |
1024 { 8, 5}, {14, 1}, { 1, 14}, { 9, 11}, { 1, 0}, { 3, 10}, |
1024 { 8, 5}, {14, 1}, { 1, 14}, { 9, 11}, { 1, 0}, { 3, 10}, |
1025 /* LOWER LOWER X X Y Y */ |
1025 /* LOWER LOWER X X Y Y */ |
1042 /* | | | | */ |
1042 /* | | | | */ |
1043 /* normal, entry, exit, combo */ |
1043 /* normal, entry, exit, combo */ |
1044 } |
1044 } |
1045 }; |
1045 }; |
1046 |
1046 |
1047 uint x = TileX(tile) * TILE_SIZE + SignalPositions[otherside][image_and_pos & 0xF].x; |
1047 uint x = TileX(tile) * TILE_SIZE + SignalPositions[side][pos].x; |
1048 uint y = TileY(tile) * TILE_SIZE + SignalPositions[otherside][image_and_pos & 0xF].y; |
1048 uint y = TileY(tile) * TILE_SIZE + SignalPositions[side][pos].y; |
1049 SpriteID sprite = SignalBase[otherside][GetSignalVariant(tile)][GetSignalType(tile)] + (image_and_pos>>4) + ((condition != 0) ? 1 : 0); |
1049 |
1050 SpriteID sprite = SignalBase[side][GetSignalVariant(tile)][GetSignalType(tile)] + image + condition; |
|
1051 |
|
1050 AddSortableSpriteToDraw(sprite, x, y, 1, 1, 10, GetSlopeZ(x,y)); |
1052 AddSortableSpriteToDraw(sprite, x, y, 1, 1, 10, GetSlopeZ(x,y)); |
1051 } |
1053 } |
1052 |
1054 |
1053 static uint32 _drawtile_track_palette; |
1055 static uint32 _drawtile_track_palette; |
1054 |
1056 |
1246 |
1248 |
1247 } |
1249 } |
1248 |
1250 |
1249 static void DrawSignals(TileIndex tile, TrackBits rails) |
1251 static void DrawSignals(TileIndex tile, TrackBits rails) |
1250 { |
1252 { |
1251 #define HAS_SIGNAL(x) (m23 & (byte)(0x1 << (x))) |
1253 #define MAYBE_DRAW_SIGNAL(x,y,z) if (IsSignalPresent(tile, x)) DrawSingleSignal(tile, GetSingleSignalState(tile, x), y - 0x4FB, z) |
1252 #define ISON_SIGNAL(x) (m23 & (byte)(0x10 << (x))) |
|
1253 #define MAYBE_DRAW_SIGNAL(x,y,z) if (HAS_SIGNAL(x)) DrawSingleSignal(tile, ISON_SIGNAL(x), ((y-0x4FB) << 4)|(z)) |
|
1254 |
|
1255 byte m23; |
|
1256 |
|
1257 m23 = (_m[tile].m3 >> 4) | (_m[tile].m2 & 0xF0); |
|
1258 |
1254 |
1259 if (!(rails & TRACK_BIT_Y)) { |
1255 if (!(rails & TRACK_BIT_Y)) { |
1260 if (!(rails & TRACK_BIT_X)) { |
1256 if (!(rails & TRACK_BIT_X)) { |
1261 if (rails & TRACK_BIT_LEFT) { |
1257 if (rails & TRACK_BIT_LEFT) { |
1262 MAYBE_DRAW_SIGNAL(2, 0x509, 0); |
1258 MAYBE_DRAW_SIGNAL(2, 0x509, 0); |