From 48ebfeeb83e0c51bb9a6c10c5635471e406a604b Mon Sep 17 00:00:00 2001 From: Ted John Date: Sun, 25 Sep 2016 14:51:19 +0100 Subject: [PATCH] Implement on ride photo --- src/ride/track_paint.c | 37 +++++++++++++++++++++++++ src/ride/track_paint.h | 1 + src/ride/water/log_flume.c | 30 +++++++++++++++++++++ src/ride/water/river_rapids.c | 51 +---------------------------------- 4 files changed, 69 insertions(+), 50 deletions(-) diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 77303611bb..6e0d099d58 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -1260,6 +1260,43 @@ void track_paint_util_spinning_tunnel_paint(sint8 thickness, sint16 height, uint } } +void track_paint_util_onride_photo_paint(uint8 direction, sint32 height, rct_map_element *mapElement) +{ + static const uint32 imageIds[4][3] = + { + { SPR_ON_RIDE_PHOTO_SIGN_SW_NE, SPR_ON_RIDE_PHOTO_CAMERA_S, SPR_ON_RIDE_PHOTO_CAMERA_FLASH_S }, + { SPR_ON_RIDE_PHOTO_SIGN_NW_SE, SPR_ON_RIDE_PHOTO_CAMERA_W, SPR_ON_RIDE_PHOTO_CAMERA_FLASH_W }, + { SPR_ON_RIDE_PHOTO_SIGN_NE_SW, SPR_ON_RIDE_PHOTO_CAMERA_N, SPR_ON_RIDE_PHOTO_CAMERA_FLASH_N }, + { SPR_ON_RIDE_PHOTO_SIGN_SE_NW, SPR_ON_RIDE_PHOTO_CAMERA_E, SPR_ON_RIDE_PHOTO_CAMERA_FLASH_E }, + }; + + bool takingPhoto = (mapElement->properties.track.sequence & 0xF0) != 0; + uint32 imageId = imageIds[direction][0] | gTrackColours[SCHEME_MISC]; + uint32 flashImageId = imageIds[direction][takingPhoto ? 2 : 1] | gTrackColours[SCHEME_MISC]; + switch (direction) { + case 0: + sub_98196C(imageId, 26, 0, 1, 1, 19, height, get_current_rotation()); + sub_98196C(imageId, 26, 31, 1, 1, 19, height, get_current_rotation()); + sub_98196C(flashImageId, 6, 0, 1, 1, 19, height, get_current_rotation()); + break; + case 1: + sub_98196C(imageId, 0, 6, 1, 1, 19, height, get_current_rotation()); + sub_98196C(imageId, 31, 6, 1, 1, 19, height, get_current_rotation()); + sub_98196C(flashImageId, 0, 26, 1, 1, 19, height, get_current_rotation()); + break; + case 2: + sub_98196C(imageId, 6, 0, 1, 1, 19, height, get_current_rotation()); + sub_98196C(imageId, 6, 31, 1, 1, 19, height, get_current_rotation()); + sub_98196C(flashImageId, 26, 31, 1, 1, 19, height, get_current_rotation()); + break; + case 3: + sub_98196C(imageId, 0, 26, 1, 1, 19, height, get_current_rotation()); + sub_98196C(imageId, 31, 26, 1, 1, 19, height, get_current_rotation()); + sub_98196C(flashImageId, 31, 6, 1, 1, 19, height, get_current_rotation()); + break; + } +} + static int pick_ride_type_for_drawing(int rideType, int trackType) { if (rideType == RIDE_TYPE_VERTICAL_DROP_ROLLER_COASTER) { diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 4c8eb48ec0..384fffd8b3 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -238,6 +238,7 @@ void track_paint_util_left_quarter_turn_3_tiles_tunnel(sint16 height, uint8 tunn void track_paint_util_left_quarter_turn_1_tile_paint(sint8 thickness, sint16 height, sint16 boundBoxZOffset, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation); void track_paint_util_left_quarter_turn_1_tile_tunnel(sint16 height, uint8 direction, uint8 trackSequence); void track_paint_util_spinning_tunnel_paint(sint8 thickness, sint16 height, uint8 direction, uint8 rotation); +void track_paint_util_onride_photo_paint(uint8 direction, sint32 height, rct_map_element *mapElement); void track_paint_util_right_helix_up_small_quarter_tiles_paint(const sint8 thickness[2], sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3][2], const rct_xy16 offsets[4][3][2], const rct_xy16 boundsLengths[4][3][2], const rct_xyz16 boundsOffsets[4][3][2], uint8 rotation); void track_paint_util_right_helix_up_large_quarter_tiles_paint(const sint8 thickness[2], sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][5][2], const rct_xy16 offsets[4][5][2], const rct_xy16 boundsLengths[4][5][2], const rct_xyz16 boundsOffsets[4][5][2], uint8 rotation); void track_paint_util_eighth_to_diag_tiles_paint(const sint8 thickness[4][4], sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][4], const rct_xy16 offsets[4][4], const rct_xy16 boundsLengths[4][4], const rct_xyz16 boundsOffsets[4][4], uint8 rotation); diff --git a/src/ride/water/log_flume.c b/src/ride/water/log_flume.c index d58a3555e1..71dd22a0f5 100644 --- a/src/ride/water/log_flume.c +++ b/src/ride/water/log_flume.c @@ -85,6 +85,32 @@ static void paint_log_flume_track_station(uint8 rideIndex, uint8 trackSequence, paint_util_set_general_support_height(height + 32, 0x20); } +static void paint_log_flume_track_on_ride_photo(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId = SPR_STATION_BASE_D | 0x20000000; + sub_98196C(imageId, 0, 0, 32, 32, 1, height, get_current_rotation()); + + if (direction & 1) { + metal_a_supports_paint_setup(2, 6, 6, height, gTrackColours[SCHEME_SUPPORTS]); + metal_a_supports_paint_setup(2, 7, 6, height, gTrackColours[SCHEME_SUPPORTS]); + } else { + metal_a_supports_paint_setup(1, 5, 6, height, gTrackColours[SCHEME_SUPPORTS]); + metal_a_supports_paint_setup(1, 8, 6, height, gTrackColours[SCHEME_SUPPORTS]); + } + + imageId = LogFlumeTrackFlatImageIds[direction][0] | gTrackColours[SCHEME_TRACK]; + sub_98197C_rotated(direction, imageId, 0, 0, 32, 20, 0, height, 0, 6, height + 3); + + imageId = LogFlumeTrackFlatImageIds[direction][1] | gTrackColours[SCHEME_TRACK]; + sub_98197C_rotated(direction, imageId, 0, 0, 32, 1, 21, height, 0, 27, height + 5); + + track_paint_util_onride_photo_paint(direction, height + 3, 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 + 48, 0x20); +} + TRACK_PAINT_FUNCTION get_track_paint_function_log_flume(int trackType, int direction) { switch (trackType) { @@ -95,6 +121,10 @@ TRACK_PAINT_FUNCTION get_track_paint_function_log_flume(int trackType, int direc case TRACK_ELEM_BEGIN_STATION: case TRACK_ELEM_MIDDLE_STATION: return paint_log_flume_track_station; + + case TRACK_ELEM_ON_RIDE_PHOTO: + return paint_log_flume_track_on_ride_photo; + } return NULL; diff --git a/src/ride/water/river_rapids.c b/src/ride/water/river_rapids.c index c95eefe0f6..cd72fc4a69 100644 --- a/src/ride/water/river_rapids.c +++ b/src/ride/water/river_rapids.c @@ -693,56 +693,7 @@ static void paint_river_rapids_track_rapids(uint8 rideIndex, uint8 trackSequence static void paint_river_rapids_track_on_ride_photo(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { paint_river_rapids_track_flat(rideIndex, trackSequence, direction, height, mapElement); - - uint32 imageId; - - const bool takingPhoto = (bool) (mapElement->properties.track.sequence & 0xF0); - switch (direction) { - case 0: - imageId = SPR_ON_RIDE_PHOTO_SIGN_SW_NE | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 26, 0, 1, 1, 19, height + 13, get_current_rotation()); - - imageId = SPR_ON_RIDE_PHOTO_SIGN_SW_NE | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 26, 31, 1, 1, 19, height + 13, get_current_rotation()); - - imageId = (takingPhoto ? SPR_ON_RIDE_PHOTO_CAMERA_FLASH_S : SPR_ON_RIDE_PHOTO_CAMERA_S) | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 6, 0, 1, 1, 19, height + 13, get_current_rotation()); - break; - - case 1: - imageId = SPR_ON_RIDE_PHOTO_SIGN_NW_SE | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 0, 6, 1, 1, 19, height + 13, get_current_rotation()); - - imageId = SPR_ON_RIDE_PHOTO_SIGN_NW_SE | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 31, 6, 1, 1, 19, height + 13, get_current_rotation()); - - imageId = (takingPhoto ? SPR_ON_RIDE_PHOTO_CAMERA_FLASH_W : SPR_ON_RIDE_PHOTO_CAMERA_W) | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 0, 26, 1, 1, 19, height + 13, get_current_rotation()); - break; - - case 2: - imageId = SPR_ON_RIDE_PHOTO_SIGN_NE_SW | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 6, 0, 1, 1, 19, height + 13, get_current_rotation()); - - imageId = SPR_ON_RIDE_PHOTO_SIGN_NE_SW | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 6, 31, 1, 1, 19, height + 13, get_current_rotation()); - - imageId = (takingPhoto ? SPR_ON_RIDE_PHOTO_CAMERA_FLASH_N : SPR_ON_RIDE_PHOTO_CAMERA_N) | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 26, 31, 1, 1, 19, height + 13, get_current_rotation()); - break; - - case 3: - imageId = SPR_ON_RIDE_PHOTO_SIGN_SE_NW | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 0, 26, 1, 1, 19, height + 13, get_current_rotation()); - - imageId = SPR_ON_RIDE_PHOTO_SIGN_SE_NW | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 31, 26, 1, 1, 19, height + 13, get_current_rotation()); - - imageId = (takingPhoto ? SPR_ON_RIDE_PHOTO_CAMERA_FLASH_E : SPR_ON_RIDE_PHOTO_CAMERA_E) | gTrackColours[SCHEME_MISC]; - sub_98196C(imageId, 31, 6, 1, 1, 19, height + 13, get_current_rotation()); - break; - } - + track_paint_util_onride_photo_paint(direction, height + 13, mapElement); paint_util_set_general_support_height(height + 48, 0x20); }