Fix station covers

This commit is contained in:
Marijn van der Werf 2016-10-18 01:26:38 +02:00
parent 9c52e36332
commit 2666088ce4
12 changed files with 45 additions and 29 deletions

View File

@ -76,7 +76,7 @@ static void compact_inverted_rc_track_station(uint8 rideIndex, uint8 trackSequen
sub_98197C_rotated(direction, imageIds[direction][1] | gTrackColours[SCHEME_TRACK], 0, 0, 32, 20, 3, height + 29, 0, 6, height + 29);
sub_98199C_rotated(direction, imageIds[direction][2] | gTrackColours[SCHEME_SUPPORTS], 0, 6, 32, 20, 3, height + 29, 0, 6, height + 29);
track_paint_util_draw_station_metal_supports_2(direction, height, gTrackColours[SCHEME_SUPPORTS], 11);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement, STATION_VARIANT_TALL);
paint_util_push_tunnel_rotated(direction, height, TUNNEL_9);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);

View File

@ -80,7 +80,7 @@ static void inverted_hairpin_rc_track_station(uint8 rideIndex, uint8 trackSequen
sub_98197C_rotated(direction, imageIds[direction][1] | gTrackColours[SCHEME_TRACK], 0, 0, 32, 20, 3, height + 24, 0, 6, height + 24);
sub_98199C_rotated(direction, imageIds[direction][2] | gTrackColours[SCHEME_SUPPORTS], 0, 6, 32, 20, 1, height + 24, 0, 6, height + 24);
track_paint_util_draw_station_metal_supports_2(direction, height, gTrackColours[SCHEME_SUPPORTS], 11);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement, STATION_VARIANT_1);
paint_util_push_tunnel_rotated(direction, height, TUNNEL_6);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 32, 0x20);

View File

@ -63,7 +63,7 @@ static void inverted_impulse_rc_track_station(uint8 rideIndex, uint8 trackSequen
sub_98197C_rotated(direction, imageIds[direction][1] | gTrackColours[SCHEME_TRACK], 0, 0, 32, 20, 3, height + 29, 0, 6, height + 29);
sub_98199C_rotated(direction, imageIds[direction][2] | gTrackColours[SCHEME_SUPPORTS], 0, 6, 32, 20, 3, height + 29, 0, 6, height + 29);
track_paint_util_draw_station_metal_supports_2(direction, height, gTrackColours[SCHEME_SUPPORTS], 11);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement, STATION_VARIANT_TALL);
paint_util_push_tunnel_rotated(direction, height, TUNNEL_9);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);

View File

@ -76,7 +76,7 @@ static void inverted_rc_track_station(uint8 rideIndex, uint8 trackSequence, uint
sub_98197C_rotated(direction, imageIds[direction][1] | gTrackColours[SCHEME_TRACK], 0, 0, 32, 20, 3, height + 29, 0, 6, height + 29);
sub_98199C_rotated(direction, imageIds[direction][2] | gTrackColours[SCHEME_SUPPORTS], 0, 6, 32, 20, 3, height + 29, 0, 6, height + 29);
track_paint_util_draw_station_metal_supports_2(direction, height, gTrackColours[SCHEME_SUPPORTS], 3);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement, STATION_VARIANT_TALL);
paint_util_push_tunnel_rotated(direction, height, TUNNEL_9);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);

View File

@ -85,7 +85,7 @@ static void mini_suspended_rc_track_station(uint8 rideIndex, uint8 trackSequence
sub_98196C_rotated(direction, imageIds[direction][1] | gTrackColours[SCHEME_TRACK], 0, 6, 32, 20, 1, height + 24);
sub_98199C_rotated(direction, imageIds[direction][2] | gTrackColours[SCHEME_SUPPORTS], 0, 6, 32, 20, 1, height + 24, 0, 2, height);
track_paint_util_draw_station_metal_supports_2(direction, height, gTrackColours[SCHEME_SUPPORTS], 3);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement, STATION_VARIANT_1);
paint_util_push_tunnel_rotated(direction, height, TUNNEL_6);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 32, 0x20);

View File

@ -76,7 +76,7 @@ static void suspended_swinging_rc_track_station(uint8 rideIndex, uint8 trackSequ
sub_98197C_rotated(direction, imageIds[direction][1] | gTrackColours[SCHEME_TRACK], 0, 0, 32, 20, 3, height + 29, 0, 6, height + 29);
sub_98199C_rotated(direction, imageIds[direction][2] | gTrackColours[SCHEME_SUPPORTS], 0, 6, 32, 20, 3, height + 29, 0, 6, height + 29);
track_paint_util_draw_station_metal_supports_2(direction, height, gTrackColours[SCHEME_SUPPORTS], 0);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement, STATION_VARIANT_TALL);
paint_util_push_tunnel_rotated(direction, height, TUNNEL_9);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);

View File

@ -638,14 +638,15 @@ static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8
imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE | gTrackColours[SCHEME_MISC];
sub_98197C(imageId, -10, 0, 1, 32, 7, height, 0, 0, height + 2, get_current_rotation());
}
track_paint_util_draw_station_covers(EDGE_NE, hasFence, entranceStyle, direction, height);
hasFence = track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation());
bool hasSWFence = track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation());
if (hasFence) {
imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE | gTrackColours[SCHEME_MISC];
sub_98197C(imageId, 10, 0, 1, 32, 7, height, 31, 0, height + 2, get_current_rotation());
}
track_paint_util_draw_station_covers(EDGE_SW, hasFence, entranceStyle, direction, height);
track_paint_util_draw_station_covers(EDGE_NE, hasFence, entranceStyle, direction, height);
track_paint_util_draw_station_covers(EDGE_SW, hasSWFence, entranceStyle, direction, height);
// Was leftwards tunnel in game, seems odd
paint_util_push_tunnel_right(height, TUNNEL_6);
@ -655,14 +656,15 @@ static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8
imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | gTrackColours[SCHEME_MISC];
sub_98197C(imageId, 0, -10, 32, 1, 7, height, 0, 0, height + 2, get_current_rotation());
}
track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height);
hasFence = track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation());
bool hasSEFence = track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation());
if (hasFence) {
imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | gTrackColours[SCHEME_MISC];
sub_98197C(imageId, 0, 10, 32, 1, 7, height, 0, 31, height + 2, get_current_rotation());
}
track_paint_util_draw_station_covers(EDGE_SE, hasFence, entranceStyle, direction, height);
track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height);
track_paint_util_draw_station_covers(EDGE_SE, hasSEFence, entranceStyle, direction, height);
paint_util_push_tunnel_left(height, TUNNEL_6);
}

View File

@ -198,7 +198,7 @@ enum
SPR_STATION_COVER_OFFSET_SE_NW_BACK_0,
SPR_STATION_COVER_OFFSET_SE_NW_BACK_1,
SPR_STATION_COVER_OFFSET_SE_NW_FRONT,
SPR_STATION_COVER_OFFSET_HIGH
SPR_STATION_COVER_OFFSET_TALL
};
#ifdef NO_RCT2
@ -424,7 +424,7 @@ void track_paint_util_draw_station_2(uint8 rideIndex, uint8 trackSequence, uint8
}
}
void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement, uint8 stationVariant)
{
rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y};
rct_ride * ride = get_ride(rideIndex);
@ -451,7 +451,7 @@ void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence
}
sub_98196C(imageId, 0, 0, 32, 8, 1, height + 6, get_current_rotation());
//height -= 5 (height)
track_paint_util_draw_station_covers_2(EDGE_NW, hasFence, entranceStyle, direction, height, true);
track_paint_util_draw_station_covers_2(EDGE_NW, hasFence, entranceStyle, direction, height, stationVariant);
//height += 5 (height + 5)
if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) {
@ -484,7 +484,7 @@ void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence
sub_98196C(imageId, 31, 23, 1, 8, 7, height + 8, get_current_rotation());
}
//height -= 7 (height)
track_paint_util_draw_station_covers_2(EDGE_SE, hasFence, entranceStyle, direction, height, true);
track_paint_util_draw_station_covers_2(EDGE_SE, hasFence, entranceStyle, direction, height, stationVariant);
//height += 7 (height + 7)
if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) {
@ -511,7 +511,7 @@ void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence
}
sub_98196C(imageId, 0, 0, 8, 32, 1, height + 6, get_current_rotation());
//height -= 5 (height)
track_paint_util_draw_station_covers_2(EDGE_NE, hasFence, entranceStyle, direction, height, true);
track_paint_util_draw_station_covers_2(EDGE_NE, hasFence, entranceStyle, direction, height, stationVariant);
//height += 5 (height + 5)
if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 3) {
@ -545,7 +545,7 @@ void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence
}
//height -= 7 (height)
track_paint_util_draw_station_covers_2(EDGE_SW, hasFence, entranceStyle, direction, height, true);
track_paint_util_draw_station_covers_2(EDGE_SW, hasFence, entranceStyle, direction, height, stationVariant);
//height += 7 (height + 7)
if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 3) {
@ -560,15 +560,21 @@ void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence
bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height)
{
return track_paint_util_draw_station_covers_2(edge, hasFence, entranceStyle, direction, height, false);
return track_paint_util_draw_station_covers_2(edge, hasFence, entranceStyle, direction, height, STATION_VARIANT_BASIC);
}
bool track_paint_util_draw_station_covers_2(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, bool tall)
bool track_paint_util_draw_station_covers_2(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, uint8 stationVariant)
{
if (!(g141E9DB & (G141E9DB_FLAG_1 | G141E9DB_FLAG_2))) {
return false;
}
static const sint16 heights[][2] = {
{22,0},
{30,0},
{46,0},
};
uint32 imageId;
uint32 baseImageId = entranceStyle->base_image_id;
int imageOffset = 0;
@ -577,22 +583,22 @@ bool track_paint_util_draw_station_covers_2(enum edge edge, bool hasFence, const
offset = (rct_xyz16) {0, 0, height};
switch (edge) {
case EDGE_NE:
bounds = (rct_xyz16) {1, 30, (tall ? 46 : 0)};
bounds = (rct_xyz16) {1, 30, heights[stationVariant][0]};
boundsOffset = (rct_xyz16) {0, 1, height + 1};
imageOffset = hasFence ? SPR_STATION_COVER_OFFSET_SE_NW_BACK_1 : SPR_STATION_COVER_OFFSET_SE_NW_BACK_0;
break;
case EDGE_SE:
bounds = (rct_xyz16) {32, 32, 0};
boundsOffset = (rct_xyz16) {(tall ? 0 : 1), 0, height + (tall ? 47 : 23)};
boundsOffset = (rct_xyz16) {0, 0, height + 1 + heights[stationVariant][0]};
imageOffset = SPR_STATION_COVER_OFFSET_NE_SW_FRONT;
break;
case EDGE_SW:
bounds = (rct_xyz16) {32, 32, 0};
boundsOffset = (rct_xyz16) {0, 0, height + (tall ? 47 : 23)};
boundsOffset = (rct_xyz16) {0, 0, height + 1 + heights[stationVariant][0]};
imageOffset = SPR_STATION_COVER_OFFSET_SE_NW_FRONT;
break;
case EDGE_NW:
bounds = (rct_xyz16) {30, 1, (tall ? 46 : 0)};
bounds = (rct_xyz16) {30, 1, heights[stationVariant][0]};
boundsOffset = (rct_xyz16) {1, 0, height + 1};
imageOffset = hasFence ? SPR_STATION_COVER_OFFSET_NE_SW_BACK_1 : SPR_STATION_COVER_OFFSET_NE_SW_BACK_0;
break;
@ -606,8 +612,8 @@ bool track_paint_util_draw_station_covers_2(enum edge edge, bool hasFence, const
return false;
}
if (tall) {
imageOffset += 6;
if (stationVariant == STATION_VARIANT_TALL) {
imageOffset += SPR_STATION_COVER_OFFSET_TALL;
}
if (baseImageId & 0x40000000) {

View File

@ -218,6 +218,12 @@ enum {
SCHEME_3 = 3,
};
enum {
STATION_VARIANT_BASIC,
STATION_VARIANT_1,
STATION_VARIANT_TALL,
};
#ifdef NO_RCT2
extern uint32 gTrackColours[4];
#else
@ -265,11 +271,11 @@ bool track_paint_util_has_fence(enum edge edge, rct_xy16 position, rct_map_eleme
void track_paint_util_paint_floor(uint8 edges, uint32 colourFlags, uint16 height, const uint32 floorSprites[4], uint8 rotation);
void track_paint_util_paint_fences(uint8 edges, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint32 colourFlags, uint16 height, const uint32 fenceSprites[4], uint8 rotation);
bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height);
bool track_paint_util_draw_station_covers_2(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, bool tall);
bool track_paint_util_draw_station_covers_2(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, uint8 stationVariant);
void track_paint_util_draw_station_platform(rct_ride *ride, uint8 direction, int height, int zOffset, rct_map_element * mapElement);
void track_paint_util_draw_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement);
void track_paint_util_draw_station_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement, int fenceOffsetA, int fenceOffsetB);
void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement);
void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement, uint8 stationVariant);
bool track_paint_util_should_paint_supports(rct_xy16 position);
void track_paint_util_draw_pier(rct_ride * ride, const rct_ride_entrance_definition * entranceStyle, rct_xy16 position, uint8 direction, int height, rct_map_element * mapElement, uint8 rotation);
void track_paint_util_draw_station_metal_supports(uint8 direction, uint16 height, uint32 colour);

View File

@ -612,6 +612,7 @@ static void paint_miniature_railway_station(uint8 rideIndex, uint8 trackSequence
paint_util_push_tunnel_rotated(direction, height, TUNNEL_6);
track_paint_util_draw_station(rideIndex, trackSequence, direction, height + 2, mapElement);
// covers shouldn't be offset by +2
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 30, 0x20);

View File

@ -63,7 +63,7 @@ static void suspended_monorail_track_station(uint8 rideIndex, uint8 trackSequenc
sub_98197C_rotated(direction, imageIds[direction][1] | gTrackColours[SCHEME_TRACK], 0, 0, 32, 20, 3, height + 32, 0, 6, height + 32);
sub_98199C_rotated(direction, imageIds[direction][2] | gTrackColours[SCHEME_SUPPORTS], 0, 6, 32, 20, 3, height + 32, 0, 6, height + 32);
track_paint_util_draw_station_metal_supports_2(direction, height, gTrackColours[SCHEME_SUPPORTS], 3);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement);
track_paint_util_draw_station_inverted(rideIndex, trackSequence, direction, height, mapElement, STATION_VARIANT_TALL);
paint_util_push_tunnel_rotated(direction, height, TUNNEL_9);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);

View File

@ -206,6 +206,7 @@ static void paint_log_flume_track_station(uint8 rideIndex, uint8 trackSequence,
}
track_paint_util_draw_station(rideIndex, trackSequence, direction, height + 2, mapElement);
// covers shouldn't be offset by +2
paint_util_push_tunnel_rotated(direction, height, TUNNEL_6);