From f618a67dc4d9b18ab3ecedda9d4323deb59cfb35 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 24 May 2016 20:44:59 +0200 Subject: [PATCH] Draw flat track --- src/ride/gentle/ghost_train.c | 161 ++++++++++++++++++++++++++++++++++ src/ride/track_data.c | 2 +- src/ride/track_paint.h | 1 + 3 files changed, 163 insertions(+), 1 deletion(-) diff --git a/src/ride/gentle/ghost_train.c b/src/ride/gentle/ghost_train.c index 846fd9695d..c15f5a0b84 100644 --- a/src/ride/gentle/ghost_train.c +++ b/src/ride/gentle/ghost_train.c @@ -13,3 +13,164 @@ * A full copy of the GNU General Public License can be found in licence.txt *****************************************************************************/ #pragma endregion + +#include "../track_paint.h" +#include "../track.h" +#include "../vehicle_paint.h" +#include "../../interface/viewport.h" +#include "../../paint/paint.h" +#include "../../paint/supports.h" +#include "../ride_data.h" +#include "../../world/map.h" + +enum +{ + SPR_GHOST_TRAIN_TRACK_FLAT_SW_NE = 28821, + SPR_GHOST_TRAIN_TRACK_FLAT_NW_SE = 28822, +}; + +static const uint32 ghost_train_track_pieces_flat[4] = { + SPR_GHOST_TRAIN_TRACK_FLAT_SW_NE, + SPR_GHOST_TRAIN_TRACK_FLAT_NW_SE, + SPR_GHOST_TRAIN_TRACK_FLAT_SW_NE, + SPR_GHOST_TRAIN_TRACK_FLAT_NW_SE, +}; + +/** rct2: 0x00770BEC */ +static void paint_ghost_train_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)}; + + uint32 imageId = ghost_train_track_pieces_flat[direction] | RCT2_GLOBAL(0x00F44198, uint32); + + if (direction == 0 || direction == 2) { + sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); + } else { + sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); + } + + if (direction == 0 || direction == 2) { + paint_util_push_tunnel_left(height, TUNNEL_0); + } else { + paint_util_push_tunnel_right(height, TUNNEL_0); + } + + if (track_paint_util_should_paint_supports(position)) { + metal_a_supports_paint_setup(3, 4, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); + } + + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); +} + +/** rct2: 0x */ +static void paint_ghost_train_track_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_right_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_left_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_right_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_spinning_tunnel(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** rct2: 0x */ +static void paint_ghost_train_track_brakes(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ +} + +/** + * rct2: 0x00770924 + */ +TRACK_PAINT_FUNCTION get_track_paint_function_ghost_train(int trackType, int direction) { + switch(trackType) { + case TRACK_ELEM_FLAT: + return paint_ghost_train_track_flat; + + case TRACK_ELEM_END_STATION: + case TRACK_ELEM_BEGIN_STATION: + case TRACK_ELEM_MIDDLE_STATION: + return paint_ghost_train_station; + + case TRACK_ELEM_25_DEG_UP: + return paint_ghost_train_track_25_deg_up; + case TRACK_ELEM_FLAT_TO_25_DEG_UP: + return paint_ghost_train_track_flat_to_25_deg_up; + case TRACK_ELEM_25_DEG_UP_TO_FLAT: + return paint_ghost_train_track_25_deg_up_to_flat; + + case TRACK_ELEM_25_DEG_DOWN: + return paint_ghost_train_track_25_deg_down; + case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: + return paint_ghost_train_track_flat_to_25_deg_down; + case TRACK_ELEM_25_DEG_DOWN_TO_FLAT: + return paint_ghost_train_track_25_deg_down_to_flat; + + case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES: + return paint_ghost_train_track_left_quarter_turn_3_tiles; + case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES: + return paint_ghost_train_track_right_quarter_turn_3_tiles; + + case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE: + return paint_ghost_train_track_left_quarter_turn_1_tile; + case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE: + return paint_ghost_train_track_right_quarter_turn_1_tile; + + case TRACK_ELEM_BRAKES: + return paint_ghost_train_track_brakes; + + case TRACK_ELEM_SPINNING_TUNNEL: + return paint_ghost_train_track_spinning_tunnel; + } + + return NULL; +} diff --git a/src/ride/track_data.c b/src/ride/track_data.c index 6092025521..5333bf40da 100644 --- a/src/ride/track_data.c +++ b/src/ride/track_data.c @@ -5612,7 +5612,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = { get_track_paint_function_haunted_house, // RIDE_TYPE_HAUNTED_HOUSE get_track_paint_function_facility, // RIDE_TYPE_FIRST_AID get_track_paint_function_circus_show, // RIDE_TYPE_CIRCUS_SHOW - 0, // RIDE_TYPE_GHOST_TRAIN + get_track_paint_function_ghost_train, // RIDE_TYPE_GHOST_TRAIN 0, // RIDE_TYPE_TWISTER_ROLLER_COASTER 0, // RIDE_TYPE_WOODEN_ROLLER_COASTER 0, // RIDE_TYPE_SIDE_FRICTION_ROLLER_COASTER diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 705c118ca4..e0e7b3f6f9 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -230,6 +230,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direct TRACK_PAINT_FUNCTION get_track_paint_function_twist(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_haunted_house(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_circus_show(int trackType, int direction); +TRACK_PAINT_FUNCTION get_track_paint_function_ghost_train(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_virginia_reel(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_mini_helicopters(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direction);