Use rotated calls in GhostTrain.cpp (#11691)

This commit is contained in:
Michael Steenbeek 2020-05-10 12:49:02 +02:00 committed by GitHub
parent d5f2168b22
commit 783494df68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 122 deletions

View File

@ -134,23 +134,9 @@ static void paint_ghost_train_track_flat(
{
uint32_t imageId = ghost_train_track_pieces_flat[direction] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98197C(session, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
}
else
{
sub_98197C(session, imageId, 0, 0, 20, 32, 3, height, 6, 0, height);
}
sub_98197C_rotated(session, direction, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
if (direction == 0 || direction == 2)
{
paint_util_push_tunnel_left(session, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_right(session, height, TUNNEL_0);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
if (track_paint_util_should_paint_supports(session->MapPosition))
{
@ -168,24 +154,10 @@ static void paint_ghost_train_track_25_deg_up(
const TileElement* tileElement)
{
uint32_t imageId = ghost_train_track_pieces_25_deg_up[direction][0] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98197C(session, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
}
else
{
sub_98197C(session, imageId, 0, 0, 20, 32, 3, height, 6, 0, height);
}
sub_98197C_rotated(session, direction, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
imageId = ghost_train_track_pieces_25_deg_up[direction][1] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98197C(session, imageId, 0, 0, 32, 1, 23, height, 0, 27, height);
}
else
{
sub_98197C(session, imageId, 0, 0, 1, 32, 23, height, 27, 0, height);
}
sub_98197C_rotated(session, direction, imageId, 0, 0, 32, 1, 23, height, 0, 27, height);
if (track_paint_util_should_paint_supports(session->MapPosition))
{
@ -219,24 +191,10 @@ static void paint_ghost_train_track_flat_to_25_deg_up(
const TileElement* tileElement)
{
uint32_t imageId = ghost_train_track_pieces_flat_to_25_deg_up[direction][0] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98197C(session, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
}
else
{
sub_98197C(session, imageId, 0, 0, 20, 32, 3, height, 6, 0, height);
}
sub_98197C_rotated(session, direction, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
imageId = ghost_train_track_pieces_flat_to_25_deg_up[direction][1] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98197C(session, imageId, 0, 0, 32, 1, 15, height, 0, 27, height);
}
else
{
sub_98197C(session, imageId, 0, 0, 1, 32, 15, height, 27, 0, height);
}
sub_98197C_rotated(session, direction, imageId, 0, 0, 32, 1, 15, height, 0, 27, height);
if (track_paint_util_should_paint_supports(session->MapPosition))
{
@ -269,24 +227,10 @@ static void paint_ghost_train_track_25_deg_up_to_flat_shared(
const TileElement* tileElement)
{
uint32_t imageId = ghost_train_track_pieces_25_deg_up_to_flat[direction][0] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98197C(session, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
}
else
{
sub_98197C(session, imageId, 0, 0, 20, 32, 3, height, 6, 0, height);
}
sub_98197C_rotated(session, direction, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
imageId = ghost_train_track_pieces_25_deg_up_to_flat[direction][1] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98197C(session, imageId, 0, 0, 32, 1, 15, height, 0, 27, height);
}
else
{
sub_98197C(session, imageId, 0, 0, 1, 32, 15, height, 27, 0, height);
}
sub_98197C_rotated(session, direction, imageId, 0, 0, 32, 1, 15, height, 0, 27, height);
if (track_paint_util_should_paint_supports(session->MapPosition))
{
@ -370,35 +314,20 @@ static void paint_ghost_train_station(
{
uint32_t imageId;
if (direction == 0 || direction == 2)
{
imageId = SPR_STATION_BASE_B_SW_NE | session->TrackColours[SCHEME_MISC];
sub_98197C(session, imageId, 0, 0, 32, 28, 3, height - 2, 0, 2, height);
}
else if (direction == 1 || direction == 3)
{
imageId = SPR_STATION_BASE_B_NW_SE | session->TrackColours[SCHEME_MISC];
sub_98197C(session, imageId, 0, 0, 28, 32, 3, height - 2, 2, 0, height);
}
static constexpr const std::array<uint32_t, 4> imageIds = {
SPR_STATION_BASE_B_SW_NE,
SPR_STATION_BASE_B_NW_SE,
SPR_STATION_BASE_B_SW_NE,
SPR_STATION_BASE_B_NW_SE,
};
imageId = imageIds[direction] | session->TrackColours[SCHEME_MISC];
sub_98197C_rotated(session, direction, imageId, 0, 0, 32, 28, 3, height - 2, 0, 2, height);
imageId = ghost_train_track_pieces_flat[direction] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98199C(session, imageId, 0, 0, 32, 20, 3, height, 0, 0, height);
}
else
{
sub_98199C(session, imageId, 0, 0, 20, 32, 3, height, 0, 0, height);
}
sub_98199C_rotated(session, direction, imageId, 0, 0, 32, 20, 3, height, 0, 0, height);
if (direction == 0 || direction == 2)
{
paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT);
}
else
{
paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_SQUARE_FLAT);
if (direction == 0 || direction == 2)
{
@ -494,25 +423,11 @@ static void paint_ghost_train_track_spinning_tunnel(
{
uint32_t imageId = ghost_train_track_pieces_spinning_tunnel_track[direction] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98197C(session, imageId, 0, 0, 28, 20, 3, height, 2, 6, height);
}
else
{
sub_98197C(session, imageId, 0, 0, 20, 28, 3, height, 6, 2, height);
}
sub_98197C_rotated(session, direction, imageId, 0, 0, 28, 20, 3, height, 2, 6, height);
track_paint_util_spinning_tunnel_paint(session, 3, height, direction);
if (direction == 0 || direction == 2)
{
paint_util_push_tunnel_left(session, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_right(session, height, TUNNEL_0);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
wooden_a_supports_paint_setup(session, (direction & 1), 0, height, session->TrackColours[SCHEME_MISC], nullptr);
@ -527,23 +442,9 @@ static void paint_ghost_train_track_brakes(
{
uint32_t imageId = ghost_train_track_pieces_brakes[direction] | session->TrackColours[SCHEME_TRACK];
if (direction == 0 || direction == 2)
{
sub_98197C(session, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
}
else
{
sub_98197C(session, imageId, 0, 0, 20, 32, 3, height, 6, 0, height);
}
sub_98197C_rotated(session, direction, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
if (direction == 0 || direction == 2)
{
paint_util_push_tunnel_left(session, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_right(session, height, TUNNEL_0);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
if (track_paint_util_should_paint_supports(session->MapPosition))
{