1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 23:34:37 +01:00

Implement brakes

This commit is contained in:
Ted John
2016-10-04 18:47:09 +01:00
parent 461680be46
commit 8f38a3b279

View File

@@ -29,10 +29,24 @@
enum {
SPR_WILD_MOUSE_FLAT_SW_NE = 16900,
SPR_WILD_MOUSE_FLAT_NW_SE = 16901,
SPR_WILD_MOUSE_STATION_SW_NE = 16902,
SPR_WILD_MOUSE_STATION_NW_SE = 16903,
SPR_WILD_MOUSE_STATION_END_SW_NE = 16904,
SPR_WILD_MOUSE_STATION_END_NW_SE = 16905,
SPR_WILD_MOUSE_BRAKES_SW_NE = 16902,
SPR_WILD_MOUSE_BRAKES_NW_SE = 16903,
SPR_WILD_MOUSE_BLOCK_BRAKES_SW_NE = 16904,
SPR_WILD_MOUSE_BLOCK_BRAKES_NW_SE = 16905,
};
static const uint32 _wild_mouse_brakes_image_ids[4] = {
SPR_WILD_MOUSE_BRAKES_SW_NE,
SPR_WILD_MOUSE_BRAKES_NW_SE,
SPR_WILD_MOUSE_BRAKES_SW_NE,
SPR_WILD_MOUSE_BRAKES_NW_SE,
};
static const uint32 _wild_mouse_block_brakes_image_ids[4] = {
SPR_WILD_MOUSE_BLOCK_BRAKES_SW_NE,
SPR_WILD_MOUSE_BLOCK_BRAKES_NW_SE,
SPR_WILD_MOUSE_BLOCK_BRAKES_SW_NE,
SPR_WILD_MOUSE_BLOCK_BRAKES_NW_SE,
};
static void wild_mouse_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
@@ -56,17 +70,20 @@ static void wild_mouse_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 di
static void wild_mouse_track_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
static const uint32 imageIds[4][3] = {
{ SPR_WILD_MOUSE_STATION_SW_NE, SPR_WILD_MOUSE_STATION_END_SW_NE, SPR_STATION_BASE_B_SW_NE },
{ SPR_WILD_MOUSE_STATION_NW_SE, SPR_WILD_MOUSE_STATION_END_NW_SE, SPR_STATION_BASE_B_NW_SE },
{ SPR_WILD_MOUSE_STATION_SW_NE, SPR_WILD_MOUSE_STATION_END_SW_NE, SPR_STATION_BASE_B_SW_NE },
{ SPR_WILD_MOUSE_STATION_NW_SE, SPR_WILD_MOUSE_STATION_END_NW_SE, SPR_STATION_BASE_B_NW_SE },
static const uint32 baseImageIds[4] = {
SPR_STATION_BASE_B_SW_NE,
SPR_STATION_BASE_B_NW_SE,
SPR_STATION_BASE_B_SW_NE,
SPR_STATION_BASE_B_NW_SE,
};
int trackType = mapElement->properties.track.type;
int t = (trackType == TRACK_ELEM_END_STATION ? 1 : 0);
sub_98197C_rotated(direction, imageIds[direction][2] | gTrackColours[SCHEME_MISC], 0, 0, 32, 28, 2, height - 2, 0, 2, height);
sub_98199C_rotated(direction, imageIds[direction][t] | gTrackColours[SCHEME_TRACK], 0, 0, 32, 20, 2, height, 0, 0, height);
sub_98197C_rotated(direction, baseImageIds[direction] | gTrackColours[SCHEME_MISC], 0, 0, 32, 28, 2, height - 2, 0, 2, height);
if (trackType == TRACK_ELEM_END_STATION) {
sub_98199C_rotated(direction, _wild_mouse_block_brakes_image_ids[direction] | gTrackColours[SCHEME_TRACK], 0, 0, 32, 20, 2, height, 0, 0, height);
} else {
sub_98199C_rotated(direction, _wild_mouse_brakes_image_ids[direction] | gTrackColours[SCHEME_TRACK], 0, 0, 32, 20, 2, height, 0, 0, height);
}
track_paint_util_draw_station_metal_supports(direction, height, gTrackColours[SCHEME_SUPPORTS]);
track_paint_util_draw_station(rideIndex, trackSequence, direction, height, mapElement);
paint_util_push_tunnel_rotated(direction, height, TUNNEL_6);
@@ -74,6 +91,30 @@ static void wild_mouse_track_station(uint8 rideIndex, uint8 trackSequence, uint8
paint_util_set_general_support_height(height + 32, 0x20);
}
static void wild_mouse_track_brakes(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
uint32 imageId = _wild_mouse_brakes_image_ids[direction] | gTrackColours[SCHEME_TRACK];
sub_98197C_rotated(direction, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
if (track_paint_util_should_paint_supports(gPaintMapPosition)) {
metal_a_supports_paint_setup(0, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(direction, height, TUNNEL_0);
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(height + 32, 0x20);
}
static void wild_mouse_track_block_brakes(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
uint32 imageId = _wild_mouse_block_brakes_image_ids[direction] | gTrackColours[SCHEME_TRACK];
sub_98197C_rotated(direction, imageId, 0, 0, 32, 20, 3, height, 0, 6, height);
if (track_paint_util_should_paint_supports(gPaintMapPosition)) {
metal_a_supports_paint_setup(0, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(direction, height, TUNNEL_0);
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(height + 32, 0x20);
}
TRACK_PAINT_FUNCTION get_track_paint_function_wild_mouse(int trackType, int direction)
{
switch (trackType) {
@@ -83,6 +124,13 @@ TRACK_PAINT_FUNCTION get_track_paint_function_wild_mouse(int trackType, int dire
case TRACK_ELEM_BEGIN_STATION:
case TRACK_ELEM_MIDDLE_STATION:
return wild_mouse_track_station;
case TRACK_ELEM_BRAKES:
return wild_mouse_track_brakes;
case TRACK_ELEM_ROTATION_CONTROL_TOGGLE:
return NULL;
case TRACK_ELEM_BLOCK_BRAKES:
return wild_mouse_track_block_brakes;
}
return NULL;
}