From 0337cf7baa07d1f804a08fac07a882043f4413ad Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 1 Oct 2016 23:08:15 +0100 Subject: [PATCH] Implement quarter_turn_3 --- src/ride/track_paint.c | 10 ++++ src/ride/track_paint.h | 1 + src/ride/water/dingy_slide.c | 102 ++++++++++++++++++++++++++++++++++- 3 files changed, 112 insertions(+), 1 deletion(-) diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 4341011a57..821e9ab904 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -1166,6 +1166,16 @@ void track_paint_util_right_quarter_turn_3_tiles_paint_2_with_height_offset(sint } } +void track_paint_util_right_quarter_turn_3_tiles_paint_3(sint16 height, int direction, uint8 rotation, uint8 trackSequence, uint32 colourFlags, const sprite_bb sprites[4][3]) +{ + sint8 sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence]; + if (sprite < 0) { + return; + } + const sprite_bb * spriteBB = &sprites[direction][sprite]; + sub_98197C(spriteBB->sprite_id | colourFlags, (sint8)spriteBB->offset.x, (sint8)spriteBB->offset.y, spriteBB->bb_size.x, spriteBB->bb_size.y, (sint8)spriteBB->bb_size.z, spriteBB->offset.z + height, spriteBB->bb_offset.x, spriteBB->bb_offset.y, height + spriteBB->bb_offset.z, rotation); +} + void track_paint_util_right_quarter_turn_3_tiles_tunnel(sint16 height, uint8 direction, uint8 trackSequence, uint8 tunnelType) { if (direction == 0 && trackSequence == 0) { diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 6f02a0571f..a521d7c93e 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -234,6 +234,7 @@ void track_paint_util_right_quarter_turn_5_tiles_paint_2(sint16 height, int dire void track_paint_util_right_quarter_turn_3_tiles_paint(sint8 thickness, sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3], const rct_xy16 offsets[4][3], const rct_xy16 boundsLengths[4][3], const rct_xyz16 boundsOffsets[4][3], uint8 rotation); void track_paint_util_right_quarter_turn_3_tiles_paint_2(sint8 thickness, sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3], uint8 rotation); void track_paint_util_right_quarter_turn_3_tiles_paint_2_with_height_offset(sint8 thickness, sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3], uint8 rotation, sint32 heightOffset); +void track_paint_util_right_quarter_turn_3_tiles_paint_3(sint16 height, int direction, uint8 rotation, uint8 trackSequence, uint32 colourFlags, const sprite_bb sprites[4][3]); void track_paint_util_right_quarter_turn_3_tiles_tunnel(sint16 height, uint8 direction, uint8 trackSequence, uint8 tunnelType); void track_paint_util_left_quarter_turn_3_tiles_paint(sint8 thickness, sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3], uint8 rotation); void track_paint_util_left_quarter_turn_3_tiles_paint_with_height_offset(sint8 thickness, sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3], uint8 rotation, sint32 heightOffset); diff --git a/src/ride/water/dingy_slide.c b/src/ride/water/dingy_slide.c index f012cf88d6..15c5d9a8ae 100644 --- a/src/ride/water/dingy_slide.c +++ b/src/ride/water/dingy_slide.c @@ -158,6 +158,30 @@ enum { SPR_DINGHY_SLIDE_60_DEG_COVERED_FRONT_NW_SE = 19857, SPR_DINGHY_SLIDE_60_DEG_COVERED_FRONT_NE_SW = 19858, SPR_DINGHY_SLIDE_60_DEG_COVERED_FRONT_SE_NW = 19859, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_SW_SE_PART_0 = 19860, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_SW_SE_PART_1 = 19861, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_SW_SE_PART_2 = 19862, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_NW_SW_PART_0 = 19863, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_NW_SW_PART_1 = 19864, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_NW_SW_PART_2 = 19865, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_NE_NW_PART_0 = 19866, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_NE_NW_PART_1 = 19867, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_NE_NW_PART_2 = 19868, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_SE_NE_PART_0 = 19869, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_SE_NE_PART_1 = 19870, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_SE_NE_PART_2 = 19871, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SW_SE_PART_0 = 19872, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SW_SE_PART_1 = 19873, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SW_SE_PART_2 = 19874, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NW_SW_PART_0 = 19875, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NW_SW_PART_1 = 19876, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NW_SW_PART_2 = 19877, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NE_NW_PART_0 = 19878, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NE_NW_PART_1 = 19879, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NE_NW_PART_2 = 19880, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SE_NE_PART_0 = 19881, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SE_NE_PART_1 = 19882, + SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SE_NE_PART_2 = 19883, SPR_DINGHY_SLIDE_QUARTER_TURN_5_SW_SE_PART_0 = 19908, SPR_DINGHY_SLIDE_QUARTER_TURN_5_SW_SE_PART_1 = 19909, @@ -802,6 +826,81 @@ static void dinghy_slide_track_s_bend_right(uint8 rideIndex, uint8 trackSequence paint_util_set_general_support_height(height + 32, 0x20); } +static void dinghy_slide_track_right_quarter_turn_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + static const sprite_bb imageIds[4][3] = { + { + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_SW_SE_PART_0, { 0, 0, 0 }, { 0, 6, 0 }, { 32, 20, 2 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_SW_SE_PART_1, { 0, 0, 0 }, { 16, 16, 0 }, { 16, 16, 2 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_SW_SE_PART_2, { 0, 0, 0 }, { 6, 0, 0 }, { 20, 32, 2 } }, + }, + { + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_NW_SW_PART_0, { 0, 0, 0 }, { 6, 0, 0 }, { 20, 32, 2 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_NW_SW_PART_1, { 0, 0, 0 }, { 16, 0, 0 }, { 16, 16, 2 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_NW_SW_PART_2, { 0, 0, 0 }, { 0, 6, 0 }, { 32, 20, 2 } }, + }, + { + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_NE_NW_PART_0, { 0, 0, 0 }, { 0, 6, 0 }, { 32, 20, 2 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_NE_NW_PART_1, { 0, 0, 0 }, { 0, 0, 0 }, { 16, 16, 2 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_NE_NW_PART_2, { 0, 0, 0 }, { 6, 0, 0 }, { 20, 32, 2 } }, + }, + { + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_SE_NE_PART_0, { 0, 0, 0 }, { 6, 0, 0 }, { 20, 32, 2 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_SE_NE_PART_1, { 0, 0, 0 }, { 0, 16, 0 }, { 16, 16, 2 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_SE_NE_PART_2, { 0, 0, 0 }, { 0, 6, 0 }, { 32, 20, 2 } }, + } + }; + static const sprite_bb frontImageIds[4][3] = { + { + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SW_SE_PART_0, { 0, 0, 0 }, { 0, 6, 27 }, { 32, 20, 0 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SW_SE_PART_1, { 0, 0, 0 }, { 16, 16, 27 }, { 16, 16, 0 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SW_SE_PART_2, { 0, 0, 0 }, { 6, 0, 27 }, { 20, 32, 0 } }, + }, + { + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NW_SW_PART_0, { 0, 0, 0 }, { 6, 0, 27 }, { 20, 32, 0 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NW_SW_PART_1, { 0, 0, 0 }, { 16, 0, 27 }, { 16, 16, 0 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NW_SW_PART_2, { 0, 0, 0 }, { 0, 6, 27 }, { 32, 20, 0 } }, + }, + { + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NE_NW_PART_0, { 0, 0, 0 }, { 0, 6, 27 }, { 32, 20, 0 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NE_NW_PART_1, { 0, 0, 0 }, { 0, 0, 27 }, { 16, 16, 0 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_NE_NW_PART_2, { 0, 0, 0 }, { 6, 0, 27 }, { 20, 32, 0 } }, + }, + { + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SE_NE_PART_0, { 0, 0, 0 }, { 6, 0, 27 }, { 20, 32, 0 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SE_NE_PART_1, { 0, 0, 0 }, { 0, 16, 27 }, { 16, 16, 0 } }, + { SPR_DINGHY_SLIDE_QUARTER_TURN_3_FRONT_SE_NE_PART_2, { 0, 0, 0 }, { 0, 6, 27 }, { 32, 20, 0 } }, + } + }; + + track_paint_util_right_quarter_turn_3_tiles_paint_3(height, direction, get_current_rotation(), trackSequence, gTrackColours[SCHEME_TRACK], imageIds); + track_paint_util_right_quarter_turn_3_tiles_paint_3(height, direction, get_current_rotation(), trackSequence, gTrackColours[SCHEME_TRACK], frontImageIds); + track_paint_util_right_quarter_turn_3_tiles_tunnel(height, direction, trackSequence, TUNNEL_0); + + switch (trackSequence) { + case 0: + case 3: + metal_a_supports_paint_setup(0, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]); + break; + } + + int blockedSegments = 0; + switch (trackSequence) { + case 0: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; break; + case 2: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0; break; + case 3: blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; break; + } + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + + paint_util_set_general_support_height(height + 32, 0x20); +} + +static void dinghy_slide_track_left_quarter_turn_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence]; + dinghy_slide_track_right_quarter_turn_3(rideIndex, trackSequence, (direction + 1) % 4, height, mapElement); +} + static void dinghy_slide_track_flat_covered(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { static const uint32 imageIds[4][2] = { @@ -1217,8 +1316,9 @@ TRACK_PAINT_FUNCTION get_track_paint_function_dinghy_slide(int trackType, int di case TRACK_ELEM_S_BEND_RIGHT: return dinghy_slide_track_s_bend_right; case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES: + return dinghy_slide_track_left_quarter_turn_3; case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES: - return NULL; + return dinghy_slide_track_right_quarter_turn_3; case TRACK_ELEM_FLAT_COVERED: return dinghy_slide_track_flat_covered; case TRACK_ELEM_25_DEG_UP_COVERED: