1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Implement station and brakes

This commit is contained in:
Ted John
2016-10-06 12:58:49 +01:00
parent 89d70545c5
commit 7e2074d16b

View File

@@ -34,12 +34,34 @@ enum {
SPR_WOODEN_RC_FLAT_CHAIN_RAILS_NE_SW = 24617,
SPR_WOODEN_RC_FLAT_CHAIN_RAILS_SE_NW = 24618,
SPR_WOODEN_RC_FLAT_SW_NE = 23753,
SPR_WOODEN_RC_FLAT_NW_SE = 23754,
SPR_WOODEN_RC_BRAKES_RAILS_SW_NE = 24621,
SPR_WOODEN_RC_BRAKES_RAILS_NW_SE = 24622,
SPR_WOODEN_RC_BLOCK_BRAKES_RAILS_SW_NE = 24623,
SPR_WOODEN_RC_BLOCK_BRAKES_RAILS_NW_SE = 24624,
SPR_WOODEN_RC_FLAT_CHAIN_SW_NE = 23749,
SPR_WOODEN_RC_FLAT_CHAIN_NW_SE = 23750,
SPR_WOODEN_RC_FLAT_CHAIN_NE_SW = 23751,
SPR_WOODEN_RC_FLAT_CHAIN_SE_NW = 23752,
SPR_WOODEN_RC_FLAT_SW_NE = 23753,
SPR_WOODEN_RC_FLAT_NW_SE = 23754,
SPR_WOODEN_RC_BRAKES_SW_NE = 23755,
SPR_WOODEN_RC_BRAKES_NW_SE = 23756,
SPR_WOODEN_RC_BLOCK_BRAKES_SW_NE = 23757,
SPR_WOODEN_RC_BLOCK_BRAKES_NW_SE = 23758,
SPR_WOODEN_RC_STATION_SW_NE = 23973,
SPR_WOODEN_RC_STATION_NW_SE = 23974,
SPR_WOODEN_RC_STATION_RAILS_SW_NE = 24839,
SPR_WOODEN_RC_STATION_RAILS_NW_SE = 24840,
};
static const uint32 _wooden_rc_block_brakes_image_ids[4][2] = {
{ SPR_WOODEN_RC_BLOCK_BRAKES_SW_NE, SPR_WOODEN_RC_BLOCK_BRAKES_RAILS_SW_NE },
{ SPR_WOODEN_RC_BLOCK_BRAKES_NW_SE, SPR_WOODEN_RC_BLOCK_BRAKES_RAILS_NW_SE },
{ SPR_WOODEN_RC_BLOCK_BRAKES_SW_NE, SPR_WOODEN_RC_BLOCK_BRAKES_RAILS_SW_NE },
{ SPR_WOODEN_RC_BLOCK_BRAKES_NW_SE, SPR_WOODEN_RC_BLOCK_BRAKES_RAILS_NW_SE },
};
static uint32 wooden_rc_get_track_colour()
@@ -78,11 +100,80 @@ static void wooden_rc_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 dir
paint_util_set_general_support_height(height + 32, 0x20);
}
static void wooden_rc_track_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
static const uint32 stationImageIds[4][2] = {
{ SPR_WOODEN_RC_STATION_SW_NE, SPR_WOODEN_RC_STATION_RAILS_SW_NE },
{ SPR_WOODEN_RC_STATION_NW_SE, SPR_WOODEN_RC_STATION_RAILS_NW_SE },
{ SPR_WOODEN_RC_STATION_SW_NE, SPR_WOODEN_RC_STATION_RAILS_SW_NE },
{ SPR_WOODEN_RC_STATION_NW_SE, SPR_WOODEN_RC_STATION_RAILS_NW_SE },
};
int trackType = mapElement->properties.track.type;
if (trackType == TRACK_ELEM_END_STATION) {
uint32 imageId = _wooden_rc_block_brakes_image_ids[direction][0] | wooden_rc_get_track_colour();
uint32 railsImageId = _wooden_rc_block_brakes_image_ids[direction][1] | wooden_rc_get_rails_colour();
sub_98197C_rotated(direction, imageId | gTrackColours[SCHEME_TRACK], 0, 2, 32, 27, 2, height, 0, 2, height);
sub_98199C_rotated(direction, railsImageId | gTrackColours[SCHEME_TRACK], 0, 2, 32, 27, 2, height, 0, 2, height);
} else {
uint32 imageId = stationImageIds[direction][0] | wooden_rc_get_track_colour();
uint32 railsImageId = stationImageIds[direction][1] | wooden_rc_get_rails_colour();
sub_98197C_rotated(direction, imageId | gTrackColours[SCHEME_TRACK], 0, 2, 32, 27, 2, height, 0, 2, height);
sub_98199C_rotated(direction, railsImageId | gTrackColours[SCHEME_TRACK], 0, 2, 32, 27, 2, height, 0, 2, height);
}
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
track_paint_util_draw_station(rideIndex, trackSequence, direction, height + 4, mapElement);
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);
}
static void wooden_rc_track_brakes(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
static const uint32 imageIds[4][2] = {
{ SPR_WOODEN_RC_BRAKES_SW_NE, SPR_WOODEN_RC_BRAKES_RAILS_SW_NE },
{ SPR_WOODEN_RC_BRAKES_NW_SE, SPR_WOODEN_RC_BRAKES_RAILS_NW_SE },
{ SPR_WOODEN_RC_BRAKES_SW_NE, SPR_WOODEN_RC_BRAKES_RAILS_SW_NE },
{ SPR_WOODEN_RC_BRAKES_NW_SE, SPR_WOODEN_RC_BRAKES_RAILS_NW_SE },
};
uint8 isChained = track_element_is_lift_hill(mapElement) ? 1 : 0;
uint32 imageId = imageIds[direction][0] | wooden_rc_get_track_colour();
uint32 railsImageId = imageIds[direction][1] | wooden_rc_get_rails_colour();
sub_98197C_rotated(direction, imageId, 0, 2, 32, 25, 2, height, 0, 3, height);
sub_98199C_rotated(direction, railsImageId, 0, 2, 32, 25, 2, height, 0, 3, height);
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
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);
}
static void wooden_rc_track_block_brakes(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
uint8 isChained = track_element_is_lift_hill(mapElement) ? 1 : 0;
uint32 imageId = _wooden_rc_block_brakes_image_ids[direction][0] | wooden_rc_get_track_colour();
uint32 railsImageId = _wooden_rc_block_brakes_image_ids[direction][1] | wooden_rc_get_rails_colour();
sub_98197C_rotated(direction, imageId, 0, 2, 32, 25, 2, height, 0, 3, height);
sub_98199C_rotated(direction, railsImageId, 0, 2, 32, 25, 2, height, 0, 3, height);
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
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);
}
TRACK_PAINT_FUNCTION get_track_paint_function_wooden_rc(int trackType, int direction)
{
switch (trackType) {
case TRACK_ELEM_FLAT:
return wooden_rc_track_flat;
case TRACK_ELEM_END_STATION:
case TRACK_ELEM_BEGIN_STATION:
case TRACK_ELEM_MIDDLE_STATION:
return wooden_rc_track_station;
case TRACK_ELEM_BRAKES:
return wooden_rc_track_brakes;
case TRACK_ELEM_BLOCK_BRAKES:
return wooden_rc_track_block_brakes;
}
return NULL;
}