From 77bab8cd730e2afb7661275d4a4771d93e8d33d8 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 20 May 2016 21:46:31 +0200 Subject: [PATCH 01/12] Rebase branch --- src/ride/gentle/mini_golf.c | 446 ++++++++++++++++++++++++++++++++++++ src/ride/track_data.c | 4 +- src/ride/track_paint.h | 1 + src/ride/vehicle_paint.c | 4 +- src/ride/vehicle_paint.h | 2 + 5 files changed, 453 insertions(+), 4 deletions(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 846fd9695d..3a0c21cf2b 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -13,3 +13,449 @@ * A full copy of the GNU General Public License can be found in licence.txt *****************************************************************************/ #pragma endregion + +#include "../../config.h" +#include "../../interface/viewport.h" +#include "../../paint/paint.h" +#include "../../paint/supports.h" +#include "../ride_data.h" +#include "../track_data.h" +#include "../track_paint.h" + +/* rct2: 0x007667AE */ +static rct_xy16 loc_7667AE[] = { + { .x = 0, .y = -1 }, + { .x = 1, .y = 0 }, + { .x = 0, .y = 1}, + { .x = -1, .y = 0 }, +}; + +/* rct2: 0x007667AC */ +static rct_xy16 loc_7667AC[] = { + { .x = -1, .y = 0 }, + { .x = 0, .y = -1 }, + { .x = 1, .y = 0 }, + { .x = 0, .y = 1 }, +}; + +enum { + SPR_MINI_GOLF_FLAT_NE_SW = 14404, + SPR_MINI_GOLF_FLAT_NW_SE, + SPR_MINI_GOLF_FLAT_FENCE_BACK_NE_SW = 14406, + SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE, + SPR_MINI_GOLF_FLAT_FENCE_FRONT_NE_SW = 14408, + SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE, + SPR_MINI_GOLF_STATION_FLOOR = 14410, + SPR_MINI_GOLF_TURN_NW_SW = 14411, +}; + +/** + * rct2: 0x0087FA27 + */ +static void mini_golf_flat_paint_setup_rot_0_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + uint32 image_id = SPR_MINI_GOLF_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(image_id, 0, 0, 32, 20, 1, height, 0, 0, height, get_current_rotation()); + + metal_a_supports_paint_setup(3, 4, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); + + + RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF; + + uint32 eax = 0xFFFFFFFF | ((height / 16) & 0xFF); + RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax; + RCT2_GLOBAL(0x141F56A, uint8)++; + + bool drawFences = false; + + if (RCT2_GLOBAL(0x9DE57C, uint16) & 1) { + rct_map_element *highlight = RCT2_ADDRESS(0x009E3250, rct_map_element); + + if (mapElement->base_height != highlight->base_height) { + drawFences = true; + } else { + // test byte ptr [edi+4], 1Fh + // jz loc_87FB74 + } + } + + if (drawFences) { + image_id = SPR_MINI_GOLF_FLAT_FENCE_BACK_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 10, height + 2, get_current_rotation()); + + image_id = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 22, height + 2, get_current_rotation()); + } + + height += 32; + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; + RCT2_GLOBAL(0x141E9DA, uint8) = 32; + } +} + +/** + * rct2: 0x0087FB91 + */ +static void mini_golf_flat_paint_setup_rot_1_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { +} + +/** + * rct2: 0x0087F22C + */ +static void mini_golf_station_paint_setup_rot_0_1(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + rct_ride *ride = get_ride(rideIndex); + + int ebx = ride->entrance_style; + uint32 flags = RideEntranceDefinitions[ride->entrance_style].flags; + + + if (RCT2_GLOBAL(0x00F441A0, uint32) & 0x20000000) { + flags &= 0x7FFFF; + } + + RCT2_GLOBAL(0xF441E8, uint32) = flags; + RCT2_GLOBAL(0xF441E4, uint32) = flags; + + uint32 image_id = SPR_MINI_GOLF_STATION_FLOOR | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(image_id, 0, 0, 32, 28, 1, height, 0, 0, height, get_current_rotation()); + + sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); + uint16 entranceLoc = + ((x / 32) + loc_7667AE[get_current_rotation()].x) | + (((y / 32) + loc_7667AE[get_current_rotation()].y) << 8); + + uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; + + if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { + image_id = SPR_MINI_GOLF_FLAT_FENCE_BACK_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98199C(image_id, 0, -10, 32, 1, 7, height, 0, 0, height + 1, get_current_rotation()); + + RCT2_GLOBAL(0xF441E8, uint32)++; + } + + image_id = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98199C(image_id, 0, 10, 32, 1, 7, height, 0, 31, height + 2, get_current_rotation()); + + + if (RCT2_GLOBAL(0xF441E8, uint32) > 32) { + + } + + + // Something with covered stations based on entrance style + uint32 ebx_2 = RCT2_GLOBAL(0xF441E4, uint32); + if (RCT2_GLOBAL(0x0141E9DB, uint8) & 3 && ebx_2 >= 32) { + if (ebx_2 & 0x40000000) { + image_id = (ebx_2 & 0xBFFFFFFF) + 2; + sub_98197C(image_id, 0, 0, 32, 32, 0, height, 0, 0, height + 23, get_current_rotation()); + + uint32 edi = RCT2_GLOBAL(0x00F44198, uint32); + // and edi, (offset map_elements.field_0+19C48h) + // cmp edi, (offset map_elements.field_0+99C48h) + // ja short loc_87F582 + + image_id = (ebx | edi) + 0x380000C + 2; + sub_98199C(image_id, 0, 0, 32, 32, 0, height, 0, 0, height + 23, get_current_rotation()); + } else { + image_id = (ebx_2 + 2) | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(image_id, 0, 0, 32, 32, 0, height, 0, 0, height + 23, get_current_rotation()); + } + } + + wooden_a_supports_paint_setup(0, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + + RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF; + + uint32 eax = 0xFFFF0000 | (height & 0xFF) | (6 << 8); + RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax; + RCT2_GLOBAL(0x141F56A, uint16)++; + + + height += 32; + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; + RCT2_GLOBAL(0x141E9DA, uint8) = 32; + } +} + +/** + * rct2: 0x0087F625 + */ +static void mini_golf_station_paint_setup_rot_1_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { +} + +/** + * rct2: 0x00880C23 + */ +static void mini_golf_quarter_turn_paint_setup_nw_sw(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + uint32 image_id = SPR_MINI_GOLF_TURN_NW_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(image_id, 0, 0, 26, 24, 1, height, 6, 2, height, get_current_rotation()); + + metal_a_supports_paint_setup(3, 4, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); + + RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; + + uint32 eax = 0xFFFF0A00 | ((height / 16) & 0xFF); + RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax; + RCT2_GLOBAL(0x141F56A, uint8)++; + + if (RCT2_GLOBAL(0x9DE57C, uint16) & 1) { + // 0x00880CD0 + } + + height += 32; + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; + RCT2_GLOBAL(0x00141E9DA, uint8) = 32; + } +} + + +static void get_color_name(int color, char *buffer) { + char *COLOUR_NAMES[] = { + "COLOUR_BLACK", + "COLOUR_GREY", + "COLOUR_WHITE", + "COLOUR_DARK_PURPLE", + "COLOUR_LIGHT_PURPLE", + "COLOUR_BRIGHT_PURPLE", + "COLOUR_DARK_BLUE", + "COLOUR_LIGHT_BLUE", + "COLOUR_ICY_BLUE", + "COLOUR_TEAL", + "COLOUR_AQUAMARINE", + "COLOUR_SATURATED_GREEN", + "COLOUR_DARK_GREEN", + "COLOUR_MOSS_GREEN", + "COLOUR_BRIGHT_GREEN", + "COLOUR_OLIVE_GREEN", + "COLOUR_DARK_OLIVE_GREEN", + "COLOUR_BRIGHT_YELLOW", + "COLOUR_YELLOW", + "COLOUR_DARK_YELLOW", + "COLOUR_LIGHT_ORANGE", + "COLOUR_DARK_ORANGE", + "COLOUR_LIGHT_BROWN", + "COLOUR_SATURATED_BROWN", + "COLOUR_DARK_BROWN", + "COLOUR_SALMON_PINK", + "COLOUR_BORDEAUX_RED", + "COLOUR_SATURATED_RED", + "COLOUR_BRIGHT_RED", + "COLOUR_DARK_PINK", + "COLOUR_BRIGHT_PINK", + "COLOUR_LIGHT_PINK", + }; + + sprintf(buffer, "%s", COLOUR_NAMES[color]); +} + +static void log_color(uint32 color) { + return; + int image_id = color & 0x7ffff; + int color_1 = (color >> 19) & 31; + int color_2 = (color >> 24) & 31; + int flags = color >> 29; + + char color_1_name[128] = {0}; + get_color_name(color_1, color_1_name); + char color_2_name[128] = {0}; + get_color_name(color_2, color_2_name); + + printf("image:%d, color A: %s, colorB: %s, flags:%X\n", image_id, color_1_name, color_2_name, flags); +} + +/** + * rct2: 0x0088129C + */ +static void mini_golf_hole_a_paint_setup_0_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + + //printf("----\n"); + log_color(RCT2_GLOBAL(0x00F44198, uint32)); + log_color(RCT2_GLOBAL(0x00F441A0, uint32)); + log_color(RCT2_GLOBAL(0x00F441A4, uint32)); + log_color(RCT2_GLOBAL(0x00F4419C, uint32)); + + log_color(RCT2_ADDRESS(0x00993CC4, uint32)[gConfigGeneral.construction_marker_colour]); + + + bool drewSupports = wooden_a_supports_paint_setup(0, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + + RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF; + + uint32 eax = 0xFFFF0A00 | ((height >> 4) & 0xFF); + RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax; + RCT2_GLOBAL(0x141F56A, uint8)++; + + height += 32; + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; + RCT2_GLOBAL(0x00141E9DA, uint8) = 32; + } + height -= 32; + + uint32 image_id = 14469 | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(image_id, 0, 0, 32, 26, 0, height, 0, 3, height + 24, get_current_rotation()); + + if (drewSupports) { + image_id = 3395 + RCT2_GLOBAL(0x00F4419C, uint32); + sub_98197C(image_id, 0, 0, 32, 26, 1, height, 0, 3, height, get_current_rotation()); + } + + image_id = 14461 | RCT2_GLOBAL(0x00F44198, uint32); + if (drewSupports) { + sub_98199C(image_id, 0, 0, 32, 26, 1, height, 0, 3, height, get_current_rotation()); + } else { + sub_98197C(image_id, 0, 0, 32, 26, 1, height, 0, 3, height, get_current_rotation()); + } +} + +/** + * rct2: 0x0088125D + */ +static void mini_golf_hole_a_paint_setup_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + if (trackSequence == 0) mini_golf_hole_a_paint_setup_0_0(rideIndex, trackSequence, direction, height, mapElement); +} + +/** + * rct2: 0x0087EDC4 + */ +TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direction) { + switch (trackType) { + case TRACK_ELEM_FLAT: + if (direction == 0 || direction == 2) { + return mini_golf_flat_paint_setup_rot_0_2; + } + return mini_golf_flat_paint_setup_rot_1_3; + + case TRACK_ELEM_25_DEG_UP: + // 0x0087F11C + break; + case TRACK_ELEM_FLAT_TO_25_DEG_UP: + // 0x0087F12C + break; + case TRACK_ELEM_25_DEG_UP_TO_FLAT: + // 0x0087F13C + break; + case TRACK_ELEM_25_DEG_DOWN: + // 0x0087F14C + break; + case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: + // 0x0087F15C + break; + case TRACK_ELEM_25_DEG_DOWN_TO_FLAT: + // 0x0087F16C + break; + case TRACK_ELEM_BEGIN_STATION: + case TRACK_ELEM_MIDDLE_STATION: + case TRACK_ELEM_END_STATION: + if (direction == 0 || direction == 2) { + return mini_golf_station_paint_setup_rot_0_1; + } + + return mini_golf_station_paint_setup_rot_1_3; + + case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE: + if (direction == 0) return mini_golf_quarter_turn_paint_setup_nw_sw; + // 0x0087F1AC + break; + case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE: + if (direction == 1) return mini_golf_quarter_turn_paint_setup_nw_sw; + // 0x0087F1BC + break; + case TRACK_ELEM_MINI_GOLF_HOLE_A: + if (direction == 0) return mini_golf_hole_a_paint_setup_0; + // 0x0087F1CC + break; + case TRACK_ELEM_MINI_GOLF_HOLE_B: + // 0x0087F1DC + break; + case TRACK_ELEM_MINI_GOLF_HOLE_C: + // 0x0087F1EC + break; + case TRACK_ELEM_MINI_GOLF_HOLE_D: + // 0x0087F1FC + break; + case TRACK_ELEM_MINI_GOLF_HOLE_E: + // 0x0087F20C + break; + } + + return NULL; +} + +/** + * rct2: 0x006D42F0 + */ +void vehicle_visual_mini_golf_player(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, int rct2VehiclePtrFormat) +{ + if (vehicle->num_peeps == 0) { + return; + } + + rct_drawpixelinfo *edi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + if (edi->zoom_level >= 2) { + return; + } + + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_PEEPS) { + return; + } + + rct_ride_entry *rideType = get_ride_entry(get_ride(vehicle->ride)->subtype); + rct_sprite *sprite = &g_sprite_list[vehicle->peep[0]]; + + uint32 eax = RCT2_ADDRESS(0x008B8F74, uint32)[vehicle->var_D4]; + uint32 ebx = (RCT2_GLOBAL(eax + vehicle->var_C5, uint8) << 2) + (imageDirection >> 3); + + uint32 image_id = rideType->vehicles[0].base_image_id + 1 + ebx; + uint32 peep_palette = sprite->peep.tshirt_colour << 19 | sprite->peep.trousers_colour << 24 | 0x0A0000000; + sub_98197C(image_id | peep_palette, 0, 0, 1, 1, 11, z, 0, 0, z + 5, get_current_rotation()); +} + +/** + * rct2: 0x006D43C6 + */ +void vehicle_visual_mini_golf_ball(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, int rct2VehiclePtrFormat) +{ + if (vehicle->var_D4 != 1) { + return; + } + + rct_drawpixelinfo *edi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + if (edi->zoom_level >= 1) { + return; + } + + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_PEEPS) { + return; + } + + rct_ride *ride = get_ride(vehicle->ride); + rct_ride_entry *rideType = get_ride_entry(ride->subtype); + //log_info("base_image_id: %d, image_id: %d", rideType->vehicles[0].base_image_id, rideType->vehicles[0].base_image_id & 0x7FFFF); + + uint32 image_id = rideType->vehicles[0].base_image_id; + sub_98197C(image_id, 0, 0, 1, 1, 0, z, 0, 0, z + 3, get_current_rotation()); +} diff --git a/src/ride/track_data.c b/src/ride/track_data.c index 9efc63e1cf..2f9e43966f 100644 --- a/src/ride/track_data.c +++ b/src/ride/track_data.c @@ -5534,7 +5534,7 @@ const uint32 RideTypeTrackPaintFunctionsOld[91] = { 0x008245A8, // RIDE_TYPE_40 0x0086E2F8, // RIDE_TYPE_REVERSER_ROLLER_COASTER 0x00876618, // RIDE_TYPE_HEARTLINE_TWISTER_COASTER - 0x0087EDC4, // RIDE_TYPE_MINI_GOLF + 0, // RIDE_TYPE_MINI_GOLF 0x008AD280, // RIDE_TYPE_GIGA_COASTER 0, // RIDE_TYPE_ROTO_DROP 0, // RIDE_TYPE_FLYING_SAUCERS @@ -5629,7 +5629,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = { 0, // RIDE_TYPE_40 0, // RIDE_TYPE_REVERSER_ROLLER_COASTER 0, // RIDE_TYPE_HEARTLINE_TWISTER_COASTER - 0, // RIDE_TYPE_MINI_GOLF + get_track_paint_function_mini_golf, // RIDE_TYPE_MINI_GOLF 0, // RIDE_TYPE_GIGA_COASTER get_track_paint_function_roto_drop, // RIDE_TYPE_ROTO_DROP get_track_paint_function_flying_saucers,// RIDE_TYPE_FLYING_SAUCERS diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index fcae029f6b..84cfa4ee41 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -188,6 +188,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direct 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_mini_helicopters(int trackType, int direction); +TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_roto_drop(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_flying_saucers(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_crooked_house(int trackType, int direction); diff --git a/src/ride/vehicle_paint.c b/src/ride/vehicle_paint.c index 0cac934161..b1f2c34f8f 100644 --- a/src/ride/vehicle_paint.c +++ b/src/ride/vehicle_paint.c @@ -2366,8 +2366,8 @@ void vehicle_paint(rct_vehicle *vehicle, int imageDirection) case VEHICLE_VISUAL_LAUNCHED_FREEFALL: vehicle_visual_launched_freefall(x, imageDirection, y, z, vehicle, vehicleEntry); break; case VEHICLE_VISUAL_OBSERVATION_TOWER: vehicle_visual_observation_tower(x, imageDirection, y, z, vehicle, vehicleEntry); break; case VEHICLE_VISUAL_RIVER_RAPIDS: vehicle_visual_river_rapids(x, imageDirection, y, z, vehicle, vehicleEntry); break; - case VEHICLE_VISUAL_MINI_GOLF_PLAYER: RCT2_CALLPROC_X(0x006D42F0, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break; - case VEHICLE_VISUAL_MINI_GOLF_BALL: RCT2_CALLPROC_X(0x006D43C6, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break; + case VEHICLE_VISUAL_MINI_GOLF_PLAYER: vehicle_visual_mini_golf_player(x, imageDirection, y, z, vehicle, rct2VehiclePtrFormat); break; + case VEHICLE_VISUAL_MINI_GOLF_BALL: vehicle_visual_mini_golf_ball(x, imageDirection, y, z, vehicle, rct2VehiclePtrFormat); break; case VEHICLE_VISUAL_REVERSER: vehicle_visual_reverser(x, imageDirection, y, z, vehicle, vehicleEntry); break; case VEHICLE_VISUAL_SPLASH_BOATS_OR_WATER_COASTER: vehicle_visual_splash_boats_or_water_coaster(x, imageDirection, y, z, vehicle, vehicleEntry); break; case VEHICLE_VISUAL_ROTO_DROP: vehicle_visual_roto_drop(x, imageDirection, y, z, vehicle, vehicleEntry); break; diff --git a/src/ride/vehicle_paint.h b/src/ride/vehicle_paint.h index 2e46a93223..99fe93de06 100644 --- a/src/ride/vehicle_paint.h +++ b/src/ride/vehicle_paint.h @@ -42,5 +42,7 @@ void vehicle_visual_launched_freefall(int x, int imageDirection, int y, int z, r void vehicle_visual_splash_effect(int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry); void vehicle_visual_virginia_reel(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry); void vehicle_visual_submarine(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry); +void vehicle_visual_mini_golf_player(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, int rct2VehiclePtrFormat); +void vehicle_visual_mini_golf_ball(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, int rct2VehiclePtrFormat); #endif From ed137f6fb89e8331de584cc2d9e1af7d4598db1f Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 20 May 2016 22:10:05 +0200 Subject: [PATCH 02/12] Paint flat track --- src/paint/map_element/map_element.h | 1 + src/ride/gentle/mini_golf.c | 248 +++++++--------------------- 2 files changed, 61 insertions(+), 188 deletions(-) diff --git a/src/paint/map_element/map_element.h b/src/paint/map_element/map_element.h index 58503db004..f13864f689 100644 --- a/src/paint/map_element/map_element.h +++ b/src/paint/map_element/map_element.h @@ -56,6 +56,7 @@ enum TUNNEL_6 = 6, TUNNEL_7 = 7, TUNNEL_8 = 8, + TUNNEL_10 = 0x0A, TUNNEL_12 = 0x0C, TUNNEL_14 = 0x0E }; diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 3a0c21cf2b..1ce55aa136 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -21,94 +21,69 @@ #include "../ride_data.h" #include "../track_data.h" #include "../track_paint.h" - -/* rct2: 0x007667AE */ -static rct_xy16 loc_7667AE[] = { - { .x = 0, .y = -1 }, - { .x = 1, .y = 0 }, - { .x = 0, .y = 1}, - { .x = -1, .y = 0 }, -}; - -/* rct2: 0x007667AC */ -static rct_xy16 loc_7667AC[] = { - { .x = -1, .y = 0 }, - { .x = 0, .y = -1 }, - { .x = 1, .y = 0 }, - { .x = 0, .y = 1 }, -}; +#include "../../world/map.h" enum { - SPR_MINI_GOLF_FLAT_NE_SW = 14404, - SPR_MINI_GOLF_FLAT_NW_SE, - SPR_MINI_GOLF_FLAT_FENCE_BACK_NE_SW = 14406, - SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE, - SPR_MINI_GOLF_FLAT_FENCE_FRONT_NE_SW = 14408, - SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE, + SPR_MINI_GOLF_FLAT_SW_NE = 14404, + SPR_MINI_GOLF_FLAT_NW_SE = 14405, + SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE = 14406, + SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE = 14407, + SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE = 14408, + SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE = 14409, SPR_MINI_GOLF_STATION_FLOOR = 14410, - SPR_MINI_GOLF_TURN_NW_SW = 14411, + SPR_MINI_GOLF_TURN_SW_NW = 14411, + SPR_MINI_GOLF_TURN_NW_NE = 14412, + SPR_MINI_GOLF_TURN_NE_SE = 14413, + SPR_MINI_GOLF_TURN_SE_SW = 14413, }; -/** - * rct2: 0x0087FA27 - */ -static void mini_golf_flat_paint_setup_rot_0_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { - uint32 image_id = SPR_MINI_GOLF_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 20, 1, height, 0, 0, height, get_current_rotation()); +/** rct2: 0x0087F10C */ +static void paint_mini_golf_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId; + + if (direction & 1) { + imageId = SPR_MINI_GOLF_FLAT_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation()); + paint_util_push_tunnel_right(height, TUNNEL_10); + } else { + imageId = SPR_MINI_GOLF_FLAT_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); + paint_util_push_tunnel_left(height, TUNNEL_10); + } 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); + if (RCT2_GLOBAL(0x9DE57C, bool)) { + rct_map_element * surfaceElement = RCT2_GLOBAL(0x9E3250, rct_map_element *); + if (surfaceElement->base_height != mapElement->base_height || surfaceElement->properties.surface.slope & 0x1F) { + if (direction & 1) { + imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 1, 32, 7, height, 10, 0, height + 2, get_current_rotation()); - RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF; + imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 0, 1, 32, 7, height, 22, 0, height + 2, get_current_rotation()); + } else { + imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 1, 7, height, 0, 10, height + 2, get_current_rotation()); - uint32 eax = 0xFFFFFFFF | ((height / 16) & 0xFF); - RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax; - RCT2_GLOBAL(0x141F56A, uint8)++; - - bool drawFences = false; - - if (RCT2_GLOBAL(0x9DE57C, uint16) & 1) { - rct_map_element *highlight = RCT2_ADDRESS(0x009E3250, rct_map_element); - - if (mapElement->base_height != highlight->base_height) { - drawFences = true; - } else { - // test byte ptr [edi+4], 1Fh - // jz loc_87FB74 + imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 0, 32, 1, 7, height, 0, 22, height + 2, get_current_rotation()); + } } } - if (drawFences) { - image_id = SPR_MINI_GOLF_FLAT_FENCE_BACK_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 10, height + 2, get_current_rotation()); - - image_id = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 22, height + 2, get_current_rotation()); - } - - height += 32; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; - RCT2_GLOBAL(0x141E9DA, uint8) = 32; - } + paint_util_set_general_support_height(height + 32, 0x20); } -/** - * rct2: 0x0087FB91 - */ -static void mini_golf_flat_paint_setup_rot_1_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { -} - -/** - * rct2: 0x0087F22C - */ -static void mini_golf_station_paint_setup_rot_0_1(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { +/** rct2: 0x */ +static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ rct_ride *ride = get_ride(rideIndex); int ebx = ride->entrance_style; - uint32 flags = RideEntranceDefinitions[ride->entrance_style].flags; + uint32 flags = 0; if (RCT2_GLOBAL(0x00F441A0, uint32) & 0x20000000) { @@ -122,20 +97,18 @@ static void mini_golf_station_paint_setup_rot_0_1(uint8 rideIndex, uint8 trackSe sub_98197C(image_id, 0, 0, 32, 28, 1, height, 0, 0, height, get_current_rotation()); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); - uint16 entranceLoc = - ((x / 32) + loc_7667AE[get_current_rotation()].x) | - (((y / 32) + loc_7667AE[get_current_rotation()].y) << 8); + uint16 entranceLoc = 0; uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { - image_id = SPR_MINI_GOLF_FLAT_FENCE_BACK_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32); + image_id = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); sub_98199C(image_id, 0, -10, 32, 1, 7, height, 0, 0, height + 1, get_current_rotation()); RCT2_GLOBAL(0xF441E8, uint32)++; } - image_id = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32); + image_id = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); sub_98199C(image_id, 0, 10, 32, 1, 7, height, 0, 31, height + 2, get_current_rotation()); @@ -188,17 +161,11 @@ static void mini_golf_station_paint_setup_rot_0_1(uint8 rideIndex, uint8 trackSe } } -/** - * rct2: 0x0087F625 - */ -static void mini_golf_station_paint_setup_rot_1_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { -} - /** * rct2: 0x00880C23 */ static void mini_golf_quarter_turn_paint_setup_nw_sw(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { - uint32 image_id = SPR_MINI_GOLF_TURN_NW_SW | RCT2_GLOBAL(0x00F44198, uint32); + uint32 image_id = SPR_MINI_GOLF_TURN_SW_NW | RCT2_GLOBAL(0x00F44198, uint32); sub_98197C(image_id, 0, 0, 26, 24, 1, height, 6, 2, height, get_current_rotation()); metal_a_supports_paint_setup(3, 4, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); @@ -224,74 +191,11 @@ static void mini_golf_quarter_turn_paint_setup_nw_sw(uint8 rideIndex, uint8 trac } -static void get_color_name(int color, char *buffer) { - char *COLOUR_NAMES[] = { - "COLOUR_BLACK", - "COLOUR_GREY", - "COLOUR_WHITE", - "COLOUR_DARK_PURPLE", - "COLOUR_LIGHT_PURPLE", - "COLOUR_BRIGHT_PURPLE", - "COLOUR_DARK_BLUE", - "COLOUR_LIGHT_BLUE", - "COLOUR_ICY_BLUE", - "COLOUR_TEAL", - "COLOUR_AQUAMARINE", - "COLOUR_SATURATED_GREEN", - "COLOUR_DARK_GREEN", - "COLOUR_MOSS_GREEN", - "COLOUR_BRIGHT_GREEN", - "COLOUR_OLIVE_GREEN", - "COLOUR_DARK_OLIVE_GREEN", - "COLOUR_BRIGHT_YELLOW", - "COLOUR_YELLOW", - "COLOUR_DARK_YELLOW", - "COLOUR_LIGHT_ORANGE", - "COLOUR_DARK_ORANGE", - "COLOUR_LIGHT_BROWN", - "COLOUR_SATURATED_BROWN", - "COLOUR_DARK_BROWN", - "COLOUR_SALMON_PINK", - "COLOUR_BORDEAUX_RED", - "COLOUR_SATURATED_RED", - "COLOUR_BRIGHT_RED", - "COLOUR_DARK_PINK", - "COLOUR_BRIGHT_PINK", - "COLOUR_LIGHT_PINK", - }; - - sprintf(buffer, "%s", COLOUR_NAMES[color]); -} - -static void log_color(uint32 color) { - return; - int image_id = color & 0x7ffff; - int color_1 = (color >> 19) & 31; - int color_2 = (color >> 24) & 31; - int flags = color >> 29; - - char color_1_name[128] = {0}; - get_color_name(color_1, color_1_name); - char color_2_name[128] = {0}; - get_color_name(color_2, color_2_name); - - printf("image:%d, color A: %s, colorB: %s, flags:%X\n", image_id, color_1_name, color_2_name, flags); -} - /** * rct2: 0x0088129C */ static void mini_golf_hole_a_paint_setup_0_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { - //printf("----\n"); - log_color(RCT2_GLOBAL(0x00F44198, uint32)); - log_color(RCT2_GLOBAL(0x00F441A0, uint32)); - log_color(RCT2_GLOBAL(0x00F441A4, uint32)); - log_color(RCT2_GLOBAL(0x00F4419C, uint32)); - - log_color(RCT2_ADDRESS(0x00993CC4, uint32)[gConfigGeneral.construction_marker_colour]); - - bool drewSupports = wooden_a_supports_paint_setup(0, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; @@ -344,62 +248,30 @@ static void mini_golf_hole_a_paint_setup_0(uint8 rideIndex, uint8 trackSequence, TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direction) { switch (trackType) { case TRACK_ELEM_FLAT: - if (direction == 0 || direction == 2) { - return mini_golf_flat_paint_setup_rot_0_2; - } - return mini_golf_flat_paint_setup_rot_1_3; + return paint_mini_golf_track_flat; - case TRACK_ELEM_25_DEG_UP: - // 0x0087F11C - break; - case TRACK_ELEM_FLAT_TO_25_DEG_UP: - // 0x0087F12C - break; - case TRACK_ELEM_25_DEG_UP_TO_FLAT: - // 0x0087F13C - break; - case TRACK_ELEM_25_DEG_DOWN: - // 0x0087F14C - break; - case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: - // 0x0087F15C - break; - case TRACK_ELEM_25_DEG_DOWN_TO_FLAT: - // 0x0087F16C - break; case TRACK_ELEM_BEGIN_STATION: case TRACK_ELEM_MIDDLE_STATION: case TRACK_ELEM_END_STATION: - if (direction == 0 || direction == 2) { - return mini_golf_station_paint_setup_rot_0_1; - } + return paint_mini_golf_station; - return mini_golf_station_paint_setup_rot_1_3; + case TRACK_ELEM_25_DEG_UP: + case TRACK_ELEM_FLAT_TO_25_DEG_UP: + case TRACK_ELEM_25_DEG_UP_TO_FLAT: + + case TRACK_ELEM_25_DEG_DOWN: + case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: + case TRACK_ELEM_25_DEG_DOWN_TO_FLAT: case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE: - if (direction == 0) return mini_golf_quarter_turn_paint_setup_nw_sw; - // 0x0087F1AC - break; case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE: - if (direction == 1) return mini_golf_quarter_turn_paint_setup_nw_sw; - // 0x0087F1BC - break; + case TRACK_ELEM_MINI_GOLF_HOLE_A: - if (direction == 0) return mini_golf_hole_a_paint_setup_0; - // 0x0087F1CC - break; case TRACK_ELEM_MINI_GOLF_HOLE_B: - // 0x0087F1DC - break; case TRACK_ELEM_MINI_GOLF_HOLE_C: - // 0x0087F1EC - break; case TRACK_ELEM_MINI_GOLF_HOLE_D: - // 0x0087F1FC - break; case TRACK_ELEM_MINI_GOLF_HOLE_E: - // 0x0087F20C - break; + return NULL; } return NULL; From 73a07a33e55bac6720082797cc4186c8a6e18c14 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 20 May 2016 22:32:52 +0200 Subject: [PATCH 03/12] Draw upwards slope --- src/ride/gentle/mini_golf.c | 84 +++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 1ce55aa136..7f173b12f9 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -35,6 +35,20 @@ enum { SPR_MINI_GOLF_TURN_NW_NE = 14412, SPR_MINI_GOLF_TURN_NE_SE = 14413, SPR_MINI_GOLF_TURN_SE_SW = 14413, + + SPR_MINI_GOLF_25_DEG_UP_SW_NE = 14433, + SPR_MINI_GOLF_25_DEG_UP_NW_SE = 14434, + SPR_MINI_GOLF_25_DEG_UP_NE_SW = 14435, + SPR_MINI_GOLF_25_DEG_UP_SE_NW = 14436, + + SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SW_NE = 14453, + SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NW_SE = 14454, + SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NE_SW = 14455, + SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SE_NW = 14456, + SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SW_NE = 14457, + SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NW_SE = 14458, + SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NE_SW = 14459, + SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SE_NW = 14460, }; /** rct2: 0x0087F10C */ @@ -77,6 +91,75 @@ static void paint_mini_golf_track_flat(uint8 rideIndex, uint8 trackSequence, uin paint_util_set_general_support_height(height + 32, 0x20); } +/** rct2: 0x0087F11C */ +static void paint_mini_golf_track_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId; + + switch (direction) { + case 0: + imageId = SPR_MINI_GOLF_25_DEG_UP_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); + break; + case 1: + imageId = SPR_MINI_GOLF_25_DEG_UP_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation()); + break; + case 2: + imageId = SPR_MINI_GOLF_25_DEG_UP_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); + break; + case 3: + imageId = SPR_MINI_GOLF_25_DEG_UP_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation()); + break; + } + + metal_a_supports_paint_setup(3, 4, 8, height, RCT2_GLOBAL(0x00F4419C, uint32)); + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + + switch (direction) { + case 0: + paint_util_push_tunnel_left(height - 8, TUNNEL_1); + + imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 1, 15, height, 0, 10, height + 2, get_current_rotation()); + + imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 1, 15, height, 0, 22, height + 2, get_current_rotation()); + break; + case 1: + paint_util_push_tunnel_right(height + 8, TUNNEL_2); + + imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 1, 32, 15, height, 10, 0, height + 2, get_current_rotation()); + + imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 1, 32, 15, height, 22, 0, height + 2, get_current_rotation()); + break; + case 2: + paint_util_push_tunnel_left(height + 8, TUNNEL_2); + + imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 1, 15, height, 0, 10, height + 2, get_current_rotation()); + + imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 1, 15, height, 0, 22, height + 2, get_current_rotation()); + break; + case 3: + paint_util_push_tunnel_right(height - 8, TUNNEL_1); + + imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 1, 32, 15, height, 10, 0, height + 2, get_current_rotation()); + + imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 1, 32, 15, height, 22, 0, height + 2, get_current_rotation()); + break; + } + + paint_util_set_general_support_height(height + 56, 0x20); +} + /** rct2: 0x */ static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { @@ -256,6 +339,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direc return paint_mini_golf_station; case TRACK_ELEM_25_DEG_UP: + return paint_mini_golf_track_25_deg_up; case TRACK_ELEM_FLAT_TO_25_DEG_UP: case TRACK_ELEM_25_DEG_UP_TO_FLAT: From e4e250606950dbf38c38ae99afbaca4f83016b4d Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 20 May 2016 22:52:05 +0200 Subject: [PATCH 04/12] Draw flat to upwards track --- src/ride/gentle/mini_golf.c | 163 ++++++++++++++++++++++++++---------- 1 file changed, 121 insertions(+), 42 deletions(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 7f173b12f9..890d234db5 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -36,10 +36,24 @@ enum { SPR_MINI_GOLF_TURN_NE_SE = 14413, SPR_MINI_GOLF_TURN_SE_SW = 14413, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_SW_NE = 14425, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_NW_SE = 14426, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_NE_SW = 14427, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_SE_NW = 14428, + SPR_MINI_GOLF_25_DEG_UP_SW_NE = 14433, SPR_MINI_GOLF_25_DEG_UP_NW_SE = 14434, SPR_MINI_GOLF_25_DEG_UP_NE_SW = 14435, SPR_MINI_GOLF_25_DEG_UP_SE_NW = 14436, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_SW_NE = 14437, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_NW_SE = 14438, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_NE_SW = 14439, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_SE_NW = 14440, + + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_SW_NE = 14445, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_NW_SE = 14446, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_NE_SW = 14447, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_SE_NW = 14448, SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SW_NE = 14453, SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NW_SE = 14454, @@ -51,6 +65,69 @@ enum { SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SE_NW = 14460, }; +static const uint32 mini_golf_track_sprites_25_deg_up[][3] = { + { + SPR_MINI_GOLF_25_DEG_UP_SW_NE, + SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SW_NE, + SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SW_NE, + }, + { + SPR_MINI_GOLF_25_DEG_UP_NW_SE, + SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NW_SE, + SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NW_SE, + }, + { + SPR_MINI_GOLF_25_DEG_UP_NE_SW, + SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NE_SW, + SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NE_SW, + }, + { + SPR_MINI_GOLF_25_DEG_UP_SE_NW, + SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SE_NW, + SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SE_NW, + } +}; + +static const uint32 mini_golf_track_sprites_flat_to_25_deg_up[][3] = { + { + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_SW_NE, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_SW_NE, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_SW_NE, + }, + { + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_NW_SE, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_NW_SE, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_NW_SE, + }, + { + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_NE_SW, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_NE_SW, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_NE_SW, + }, + { + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_SE_NW, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_SE_NW, + SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_SE_NW, + } +}; + +paint_struct * mini_golf_paint_util_7c( + uint8 direction, + uint32 image_id, + sint8 x_offset, sint8 y_offset, + sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, + sint16 z_offset, + sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z, + uint32 rotation +) +{ + if (direction & 1) { + return sub_98197C(image_id, y_offset, x_offset, bound_box_length_y, bound_box_length_x, bound_box_length_z, z_offset, bound_box_offset_y, bound_box_offset_x, bound_box_offset_z, rotation); + } + + return sub_98197C(image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset, bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, rotation); +} + /** rct2: 0x0087F10C */ static void paint_mini_golf_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { @@ -96,70 +173,71 @@ static void paint_mini_golf_track_25_deg_up(uint8 rideIndex, uint8 trackSequence { uint32 imageId; - switch (direction) { - case 0: - imageId = SPR_MINI_GOLF_25_DEG_UP_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); - break; - case 1: - imageId = SPR_MINI_GOLF_25_DEG_UP_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation()); - break; - case 2: - imageId = SPR_MINI_GOLF_25_DEG_UP_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); - break; - case 3: - imageId = SPR_MINI_GOLF_25_DEG_UP_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation()); - break; - } + imageId = mini_golf_track_sprites_25_deg_up[direction][0] | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); metal_a_supports_paint_setup(3, 4, 8, height, RCT2_GLOBAL(0x00F4419C, uint32)); paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + imageId = mini_golf_track_sprites_25_deg_up[direction][1] | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 1, 15, height, 0, 10, height + 2, get_current_rotation()); + + imageId = mini_golf_track_sprites_25_deg_up[direction][2] | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 1, 15, height, 0, 22, height + 2, get_current_rotation()); + switch (direction) { case 0: paint_util_push_tunnel_left(height - 8, TUNNEL_1); - - imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 1, 15, height, 0, 10, height + 2, get_current_rotation()); - - imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 1, 15, height, 0, 22, height + 2, get_current_rotation()); break; case 1: paint_util_push_tunnel_right(height + 8, TUNNEL_2); - - imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 1, 32, 15, height, 10, 0, height + 2, get_current_rotation()); - - imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 1, 32, 15, height, 22, 0, height + 2, get_current_rotation()); break; case 2: paint_util_push_tunnel_left(height + 8, TUNNEL_2); - - imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 1, 15, height, 0, 10, height + 2, get_current_rotation()); - - imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 1, 15, height, 0, 22, height + 2, get_current_rotation()); break; case 3: paint_util_push_tunnel_right(height - 8, TUNNEL_1); - - imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 1, 32, 15, height, 10, 0, height + 2, get_current_rotation()); - - imageId = SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 1, 32, 15, height, 22, 0, height + 2, get_current_rotation()); break; } paint_util_set_general_support_height(height + 56, 0x20); } +/** rct2: 0x0087F12C */ +static void paint_mini_golf_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId; + + imageId = mini_golf_track_sprites_flat_to_25_deg_up[direction][0] | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); + + 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); + + imageId = mini_golf_track_sprites_flat_to_25_deg_up[direction][1] | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 1, 11, height, 0, 10, height + 2, get_current_rotation()); + + imageId = mini_golf_track_sprites_flat_to_25_deg_up[direction][2] | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 1, 11, height, 0, 22, height + 2, get_current_rotation()); + + switch (direction) { + case 0: + paint_util_push_tunnel_left(height, TUNNEL_10); + break; + case 1: + paint_util_push_tunnel_right(height, TUNNEL_2); + break; + case 2: + paint_util_push_tunnel_left(height, TUNNEL_2); + break; + case 3: + paint_util_push_tunnel_right(height, TUNNEL_10); + break; + } + + paint_util_set_general_support_height(height + 48, 0x20); +} + /** rct2: 0x */ static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { @@ -341,6 +419,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direc case TRACK_ELEM_25_DEG_UP: return paint_mini_golf_track_25_deg_up; case TRACK_ELEM_FLAT_TO_25_DEG_UP: + return paint_mini_golf_track_flat_to_25_deg_up; case TRACK_ELEM_25_DEG_UP_TO_FLAT: case TRACK_ELEM_25_DEG_DOWN: From 5c4f9c0e6567175f6825ce376b8e80f57204e2dd Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 20 May 2016 22:59:04 +0200 Subject: [PATCH 05/12] Draw upwards to flat track --- src/ride/gentle/mini_golf.c | 97 +++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 3 deletions(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 890d234db5..5acb57882f 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -40,7 +40,10 @@ enum { SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_NW_SE = 14426, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_NE_SW = 14427, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_SE_NW = 14428, - + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_SW_NE = 14429, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_NW_SE = 14430, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_NE_SW = 14431, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_SE_NW = 14432, SPR_MINI_GOLF_25_DEG_UP_SW_NE = 14433, SPR_MINI_GOLF_25_DEG_UP_NW_SE = 14434, SPR_MINI_GOLF_25_DEG_UP_NE_SW = 14435, @@ -49,12 +52,18 @@ enum { SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_NW_SE = 14438, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_NE_SW = 14439, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_BACK_SE_NW = 14440, - + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_BACK_SW_NE = 14441, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_BACK_NW_SE = 14442, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_BACK_NE_SW = 14443, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_BACK_SE_NW = 14444, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_SW_NE = 14445, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_NW_SE = 14446, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_NE_SW = 14447, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_FENCE_FRONT_SE_NW = 14448, - + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_FRONT_SW_NE = 14449, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_FRONT_NW_SE = 14450, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_FRONT_NE_SW = 14451, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_FRONT_SE_NW = 14452, SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_SW_NE = 14453, SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NW_SE = 14454, SPR_MINI_GOLF_25_DEG_UP_FENCE_BACK_NE_SW = 14455, @@ -111,6 +120,31 @@ static const uint32 mini_golf_track_sprites_flat_to_25_deg_up[][3] = { } }; + +static const uint32 mini_golf_track_sprites_25_deg_up_to_flat[][3] = { + { + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_SW_NE, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_BACK_SW_NE, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_FRONT_SW_NE, + }, + { + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_NW_SE, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_BACK_NW_SE, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_FRONT_NW_SE, + }, + { + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_NE_SW, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_BACK_NE_SW, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_FRONT_NE_SW, + }, + { + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_SE_NW, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_BACK_SE_NW, + SPR_MINI_GOLF_25_DEG_UP_TO_FLAT_FENCE_FRONT_SE_NW, + } +}; + + paint_struct * mini_golf_paint_util_7c( uint8 direction, uint32 image_id, @@ -238,6 +272,59 @@ static void paint_mini_golf_track_flat_to_25_deg_up(uint8 rideIndex, uint8 track paint_util_set_general_support_height(height + 48, 0x20); } +/** rct2: 0x0087F13C */ +static void paint_mini_golf_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId; + + imageId = mini_golf_track_sprites_25_deg_up_to_flat[direction][0] | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); + + metal_a_supports_paint_setup(3, 4, 8, height, RCT2_GLOBAL(0x00F4419C, uint32)); + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + + imageId = mini_golf_track_sprites_25_deg_up_to_flat[direction][1] | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 1, 11, height, 0, 10, height + 2, get_current_rotation()); + + imageId = mini_golf_track_sprites_25_deg_up_to_flat[direction][2] | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 1, 11, height, 0, 22, height + 2, get_current_rotation()); + + switch (direction) { + case 0: + paint_util_push_tunnel_left(height - 8, TUNNEL_0); + break; + case 1: + paint_util_push_tunnel_right(height + 8, TUNNEL_10); + break; + case 2: + paint_util_push_tunnel_left(height + 8, TUNNEL_10); + break; + case 3: + paint_util_push_tunnel_right(height - 8, TUNNEL_0); + break; + } + + paint_util_set_general_support_height(height + 40, 0x20); +} + +/** rct2: 0x0087F14C */ +static void paint_mini_golf_track_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_golf_track_25_deg_up(rideIndex, trackSequence, direction, (height + 2) % 4, mapElement); +} + +/** rct2: 0x0087F15C */ +static void paint_mini_golf_track_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_golf_track_25_deg_up_to_flat(rideIndex, trackSequence, direction, (height + 2) % 4, mapElement); +} + +/** rct2: 0x0087F16C */ +static void paint_mini_golf_track_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_golf_track_flat_to_25_deg_up(rideIndex, trackSequence, direction, (height + 2) % 4, mapElement); +} + /** rct2: 0x */ static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { @@ -421,10 +508,14 @@ TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direc case TRACK_ELEM_FLAT_TO_25_DEG_UP: return paint_mini_golf_track_flat_to_25_deg_up; case TRACK_ELEM_25_DEG_UP_TO_FLAT: + return paint_mini_golf_track_25_deg_up_to_flat; case TRACK_ELEM_25_DEG_DOWN: + return paint_mini_golf_track_25_deg_down; case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: + return paint_mini_golf_track_flat_to_25_deg_down; case TRACK_ELEM_25_DEG_DOWN_TO_FLAT: + return paint_mini_golf_track_25_deg_down_to_flat; case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE: case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE: From ae1a25a5ae2c3155faea02917bd9112525ef39b0 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 20 May 2016 23:16:12 +0200 Subject: [PATCH 06/12] Draw station --- src/ride/gentle/mini_golf.c | 117 +++++++++++++----------------------- 1 file changed, 43 insertions(+), 74 deletions(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 5acb57882f..980350ae9e 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -325,88 +325,57 @@ static void paint_mini_golf_track_25_deg_down_to_flat(uint8 rideIndex, uint8 tra paint_mini_golf_track_flat_to_25_deg_up(rideIndex, trackSequence, direction, (height + 2) % 4, mapElement); } -/** rct2: 0x */ +/** rct2: 0x0087F17C, 0x0087F18C, 0x0087F19C */ static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - rct_ride *ride = get_ride(rideIndex); + rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)}; + rct_ride * ride = get_ride(rideIndex); + const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style]; + uint32 imageId; + bool hasFence; - int ebx = ride->entrance_style; - uint32 flags = 0; + imageId = SPR_MINI_GOLF_STATION_FLOOR | RCT2_GLOBAL(0x00F44198, uint32); + mini_golf_paint_util_7c(direction, imageId, 0, 0, 32, 28, 1, height, 0, 0, height, get_current_rotation()); - - if (RCT2_GLOBAL(0x00F441A0, uint32) & 0x20000000) { - flags &= 0x7FFFF; - } - - RCT2_GLOBAL(0xF441E8, uint32) = flags; - RCT2_GLOBAL(0xF441E4, uint32) = flags; - - uint32 image_id = SPR_MINI_GOLF_STATION_FLOOR | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 28, 1, height, 0, 0, height, get_current_rotation()); - - sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); - uint16 entranceLoc = 0; - - uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; - - if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { - image_id = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, -10, 32, 1, 7, height, 0, 0, height + 1, get_current_rotation()); - - RCT2_GLOBAL(0xF441E8, uint32)++; - } - - image_id = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 10, 32, 1, 7, height, 0, 31, height + 2, get_current_rotation()); - - - if (RCT2_GLOBAL(0xF441E8, uint32) > 32) { - - } - - - // Something with covered stations based on entrance style - uint32 ebx_2 = RCT2_GLOBAL(0xF441E4, uint32); - if (RCT2_GLOBAL(0x0141E9DB, uint8) & 3 && ebx_2 >= 32) { - if (ebx_2 & 0x40000000) { - image_id = (ebx_2 & 0xBFFFFFFF) + 2; - sub_98197C(image_id, 0, 0, 32, 32, 0, height, 0, 0, height + 23, get_current_rotation()); - - uint32 edi = RCT2_GLOBAL(0x00F44198, uint32); - // and edi, (offset map_elements.field_0+19C48h) - // cmp edi, (offset map_elements.field_0+99C48h) - // ja short loc_87F582 - - image_id = (ebx | edi) + 0x380000C + 2; - sub_98199C(image_id, 0, 0, 32, 32, 0, height, 0, 0, height + 23, get_current_rotation()); - } else { - image_id = (ebx_2 + 2) | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 0, height, 0, 0, height + 23, get_current_rotation()); + if (direction & 1) { + hasFence = track_paint_util_has_fence(EDGE_NE, position, mapElement, ride, get_current_rotation()); + if (hasFence) { + imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, -10, 0, 1, 32, 7, height, 0, 0, height + 2, get_current_rotation()); } + track_paint_util_draw_station_covers(EDGE_NE, hasFence, entranceStyle, direction, height); + + hasFence = track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation()); + if (hasFence) { + imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 10, 0, 1, 32, 7, height, 31, 0, height + 2, get_current_rotation()); + } + track_paint_util_draw_station_covers(EDGE_SW, hasFence, entranceStyle, direction, height); + + // Was leftwards tunnel in game, seems odd + paint_util_push_tunnel_right(height, TUNNEL_6); + } else { + hasFence = track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation()); + if (hasFence) { + imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, -10, 32, 1, 7, height, 0, 0, height + 2, get_current_rotation()); + } + track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height); + + hasFence = track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation()); + if (hasFence) { + imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 10, 32, 1, 7, height, 0, 31, height + 2, get_current_rotation()); + } + track_paint_util_draw_station_covers(EDGE_SE, hasFence, entranceStyle, direction, height); + + paint_util_push_tunnel_left(height, TUNNEL_6); } - wooden_a_supports_paint_setup(0, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); - RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF; - - uint32 eax = 0xFFFF0000 | (height & 0xFF) | (6 << 8); - RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax; - RCT2_GLOBAL(0x141F56A, uint16)++; - - - height += 32; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; - RCT2_GLOBAL(0x141E9DA, uint8) = 32; - } + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); } /** From a38050da2849659c341f4cc5711882e77a9a2ca4 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 20 May 2016 23:19:05 +0200 Subject: [PATCH 07/12] [fixup] right slopes --- src/ride/gentle/mini_golf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 980350ae9e..bfe6cc0549 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -310,19 +310,19 @@ static void paint_mini_golf_track_25_deg_up_to_flat(uint8 rideIndex, uint8 track /** rct2: 0x0087F14C */ static void paint_mini_golf_track_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - paint_mini_golf_track_25_deg_up(rideIndex, trackSequence, direction, (height + 2) % 4, mapElement); + paint_mini_golf_track_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } /** rct2: 0x0087F15C */ static void paint_mini_golf_track_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - paint_mini_golf_track_25_deg_up_to_flat(rideIndex, trackSequence, direction, (height + 2) % 4, mapElement); + paint_mini_golf_track_25_deg_up_to_flat(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } /** rct2: 0x0087F16C */ static void paint_mini_golf_track_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - paint_mini_golf_track_flat_to_25_deg_up(rideIndex, trackSequence, direction, (height + 2) % 4, mapElement); + paint_mini_golf_track_flat_to_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } /** rct2: 0x0087F17C, 0x0087F18C, 0x0087F19C */ From 4bd804996924bb8ec6a425e496dffaadb1e6c06f Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 20 May 2016 23:49:34 +0200 Subject: [PATCH 08/12] Draw corners --- src/ride/gentle/mini_golf.c | 162 ++++++++++++++++++++++------- src/ride/gentle/mini_helicopters.c | 2 +- src/ride/track_paint.c | 10 +- src/ride/track_paint.h | 2 +- src/ride/water/submarine_ride.c | 2 +- 5 files changed, 131 insertions(+), 47 deletions(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index bfe6cc0549..f8358b2787 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -31,11 +31,20 @@ enum { SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE = 14408, SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE = 14409, SPR_MINI_GOLF_STATION_FLOOR = 14410, - SPR_MINI_GOLF_TURN_SW_NW = 14411, - SPR_MINI_GOLF_TURN_NW_NE = 14412, - SPR_MINI_GOLF_TURN_NE_SE = 14413, - SPR_MINI_GOLF_TURN_SE_SW = 14413, - + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_SW_NW = 14411, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_NW_NE = 14412, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_NE_SE = 14413, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_SE_SW = 14414, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_BACK_SW_NW = 14415, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_BACK_NW_NE = 14416, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_BACK_NE_SE = 14417, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_BACK_SE_SW = 14418, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_FRONT_SW_NW = 14419, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_FRONT_NW_NE = 14420, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_FRONT_NE_SE = 14421, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_FRONT_SE_SW = 14422, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_INSIDE_SW_NW = 14423, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_INSIDE_NE_SE = 14424, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_SW_NE = 14425, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_NW_SE = 14426, SPR_MINI_GOLF_FLAT_TO_25_DEG_UP_NE_SW = 14427, @@ -144,8 +153,22 @@ static const uint32 mini_golf_track_sprites_25_deg_up_to_flat[][3] = { } }; +static const uint32 mini_golf_track_sprites_quarter_turn_1_tile[] = { + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_SW_NW, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_NW_NE, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_NE_SE, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_SE_SW, +}; -paint_struct * mini_golf_paint_util_7c( +static const uint32 mini_golf_track_sprites_quarter_turn_1_tile_fence_front[] = { + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_FRONT_SW_NW, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_FRONT_NW_NE, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_FRONT_NE_SE, + SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_FRONT_SE_SW, +}; + + +static paint_struct * mini_golf_paint_util_7c( uint8 direction, uint32 image_id, sint8 x_offset, sint8 y_offset, @@ -162,6 +185,25 @@ paint_struct * mini_golf_paint_util_7c( return sub_98197C(image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset, bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, rotation); } +static bool mini_golf_paint_util_should_draw_fence(rct_map_element * mapElement) +{ + if (!RCT2_GLOBAL(0x9DE57C, bool)) { + // Should be above ground (have passed surface rendering) + return false; + } + + rct_map_element * surfaceElement = RCT2_GLOBAL(0x9E3250, rct_map_element *); + if (surfaceElement->base_height != mapElement->base_height) { + return true; + } + + if (surfaceElement->properties.surface.slope & 0x1F) { + return true; + } + + return false; +} + /** rct2: 0x0087F10C */ static void paint_mini_golf_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { @@ -180,22 +222,19 @@ static void paint_mini_golf_track_flat(uint8 rideIndex, uint8 trackSequence, uin 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); - if (RCT2_GLOBAL(0x9DE57C, bool)) { - rct_map_element * surfaceElement = RCT2_GLOBAL(0x9E3250, rct_map_element *); - if (surfaceElement->base_height != mapElement->base_height || surfaceElement->properties.surface.slope & 0x1F) { - if (direction & 1) { - imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 1, 32, 7, height, 10, 0, height + 2, get_current_rotation()); + if (mini_golf_paint_util_should_draw_fence(mapElement)) { + if (direction & 1) { + imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 1, 32, 7, height, 10, 0, height + 2, get_current_rotation()); - imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(imageId, 0, 0, 1, 32, 7, height, 22, 0, height + 2, get_current_rotation()); - } else { - imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 1, 7, height, 0, 10, height + 2, get_current_rotation()); + imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 0, 1, 32, 7, height, 22, 0, height + 2, get_current_rotation()); + } else { + imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 1, 7, height, 0, 10, height + 2, get_current_rotation()); - imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(imageId, 0, 0, 32, 1, 7, height, 0, 22, height + 2, get_current_rotation()); - } + imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 0, 32, 1, 7, height, 0, 22, height + 2, get_current_rotation()); } } @@ -378,35 +417,78 @@ static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8 paint_util_set_general_support_height(height + 32, 0x20); } -/** - * rct2: 0x00880C23 - */ -static void mini_golf_quarter_turn_paint_setup_nw_sw(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { - uint32 image_id = SPR_MINI_GOLF_TURN_SW_NW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 26, 24, 1, height, 6, 2, height, get_current_rotation()); +/** rct2: 0x0087F1AC */ +static void paint_mini_golf_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId; + + track_paint_util_left_quarter_turn_1_tile_paint(1, height, 0, direction, RCT2_GLOBAL(0x00F44198, uint32), mini_golf_track_sprites_quarter_turn_1_tile, get_current_rotation()); metal_a_supports_paint_setup(3, 4, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); - RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); - uint32 eax = 0xFFFF0A00 | ((height / 16) & 0xFF); - RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax; - RCT2_GLOBAL(0x141F56A, uint8)++; + const bool shouldDrawFence = mini_golf_paint_util_should_draw_fence(mapElement); - if (RCT2_GLOBAL(0x9DE57C, uint16) & 1) { - // 0x00880CD0 + switch (direction) { + case 0: + paint_util_push_tunnel_left(height, TUNNEL_10); + if (!shouldDrawFence) break; + + imageId = SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_BACK_SW_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, 26, 24, 1, height, 6, 2, height, get_current_rotation()); + + break; + + case 1: + if (!shouldDrawFence) break; + + imageId = SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_BACK_NW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, 26, 26, 1, height, 0, 0, height, get_current_rotation()); + break; + + case 2: + paint_util_push_tunnel_right(height, TUNNEL_10); + if (!shouldDrawFence) break; + + imageId = SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_BACK_NE_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, 24, 26, 1, height, 2, 6, height, get_current_rotation()); + break; + + case 3: + paint_util_push_tunnel_left(height, TUNNEL_10); + paint_util_push_tunnel_right(height, TUNNEL_10); + if (!shouldDrawFence) break; + + imageId = SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_BACK_SE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, 24, 24, 1, height, 6, 6, height, get_current_rotation()); + break; } - height += 32; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; - RCT2_GLOBAL(0x00141E9DA, uint8) = 32; + if (shouldDrawFence) { + // TODO: The back fence uses the same x/y offsets, but uses another paint function. See if this occurs more often. + track_paint_util_left_quarter_turn_1_tile_paint(0, height, 24, direction, RCT2_GLOBAL(0x00F44198, uint32), mini_golf_track_sprites_quarter_turn_1_tile_fence_front, get_current_rotation()); + + switch (direction) { + case 0: + imageId = SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_INSIDE_SW_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 5, 5, 5, height, 24, 0, height + 2, get_current_rotation()); + break; + case 2: + imageId = SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_INSIDE_NE_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 5, 5, 5, height, 0, 24, height + 2, get_current_rotation()); + break; + } } + + paint_util_set_general_support_height(height + 32, 0x20); } +/** rct2: 0x0087F1BC */ +static void paint_mini_golf_track_right_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_golf_track_left_quarter_turn_1_tile(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement); +} /** * rct2: 0x0088129C @@ -487,7 +569,9 @@ TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direc return paint_mini_golf_track_25_deg_down_to_flat; case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE: + return paint_mini_golf_track_left_quarter_turn_1_tile; case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE: + return paint_mini_golf_track_right_quarter_turn_1_tile; case TRACK_ELEM_MINI_GOLF_HOLE_A: case TRACK_ELEM_MINI_GOLF_HOLE_B: diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 5135a4a6b7..38debabfad 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -374,7 +374,7 @@ static void paint_mini_helicopters_track_right_quarter_turn_3_tiles(uint8 rideIn /** rct2: 0x0081F408 */ static void paint_mini_helicopters_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - track_paint_util_left_quarter_turn_1_tile_paint(height, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); + track_paint_util_left_quarter_turn_1_tile_paint(1, height, 0, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); track_paint_util_left_quarter_turn_1_tile_tunnel(height, direction, trackSequence); paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 15672a0fbd..63e33409f3 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -407,15 +407,15 @@ void track_paint_util_left_quarter_turn_3_tiles_tunnel(sint16 height, uint8 dire } -void track_paint_util_left_quarter_turn_1_tile_paint(sint16 height, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation) +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) { uint32 imageId = sprites[direction] | colourFlags; switch (direction) { - case 0: sub_98197C(imageId, 0, 0, 26, 24, 1, height, 6, 2, height, rotation); break; - case 1: sub_98197C(imageId, 0, 0, 26, 26, 1, height, 0, 0, height, rotation); break; - case 2: sub_98197C(imageId, 0, 0, 24, 26, 1, height, 2, 6, height, rotation); break; - case 3: sub_98197C(imageId, 0, 0, 24, 24, 1, height, 6, 6, height, rotation); break; + case 0: sub_98197C(imageId, 0, 0, 26, 24, thickness, height, 6, 2, height + boundBoxZOffset, rotation); break; + case 1: sub_98197C(imageId, 0, 0, 26, 26, thickness, height, 0, 0, height + boundBoxZOffset, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 24, 26, thickness, height, 2, 6, height + boundBoxZOffset, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 24, 24, thickness, height, 6, 6, height + boundBoxZOffset, rotation); break; } } diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 84cfa4ee41..5d3edc91da 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -163,7 +163,7 @@ void track_paint_util_draw_pier(rct_ride * ride, const rct_ride_entrance_definit void track_paint_util_left_quarter_turn_3_tiles_paint(sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3], uint8 rotation); void track_paint_util_left_quarter_turn_3_tiles_tunnel(sint16 height, uint8 direction, uint8 trackSequence); -void track_paint_util_left_quarter_turn_1_tile_paint(sint16 height, int direction, uint32 colourFlags, const uint32 sprites[4], uint8 rotation); +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); typedef void (*TRACK_PAINT_FUNCTION)(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement); diff --git a/src/ride/water/submarine_ride.c b/src/ride/water/submarine_ride.c index 83bfabef36..d3a87eb4a9 100644 --- a/src/ride/water/submarine_ride.c +++ b/src/ride/water/submarine_ride.c @@ -147,7 +147,7 @@ static void submarine_ride_paint_track_right_quarter_turn_3_tiles(uint8 rideInde static void submarine_ride_paint_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - track_paint_util_left_quarter_turn_1_tile_paint(height - 16, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); + track_paint_util_left_quarter_turn_1_tile_paint(1, height - 16, 0, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); track_paint_util_left_quarter_turn_1_tile_tunnel(height - 16, direction, trackSequence); paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); From 97083cacad8d687a61e84ebd9c660ccf62e0b5f9 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 21 May 2016 00:45:43 +0200 Subject: [PATCH 09/12] Draw holes A, B, C --- src/ride/gentle/mini_golf.c | 280 +++++++++++++++++++++++++++++++----- 1 file changed, 241 insertions(+), 39 deletions(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index f8358b2787..c8a9986e8d 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -24,6 +24,9 @@ #include "../../world/map.h" enum { + SPR_FLOOR_A = 3395, + SPR_FLOOR_B = 3396, + SPR_MINI_GOLF_FLAT_SW_NE = 14404, SPR_MINI_GOLF_FLAT_NW_SE = 14405, SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE = 14406, @@ -81,6 +84,82 @@ enum { SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NW_SE = 14458, SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_NE_SW = 14459, SPR_MINI_GOLF_25_DEG_UP_FENCE_FRONT_SE_NW = 14460, + + SPR_MINI_GOLF_HOLE_A_BASE_PART_1_SW_NE = 14461, + SPR_MINI_GOLF_HOLE_A_BASE_PART_2_SW_NE = 14462, + SPR_MINI_GOLF_HOLE_A_BASE_PART_1_NW_SE = 14463, + SPR_MINI_GOLF_HOLE_A_BASE_PART_2_NW_SE = 14464, + SPR_MINI_GOLF_HOLE_A_BASE_PART_1_NE_SW = 14465, + SPR_MINI_GOLF_HOLE_A_BASE_PART_2_NE_SW = 14466, + SPR_MINI_GOLF_HOLE_A_BASE_PART_1_SE_NW = 14467, + SPR_MINI_GOLF_HOLE_A_BASE_PART_2_SE_NW = 14468, + SPR_MINI_GOLF_HOLE_A_TRIM_PART_1_SW_NE = 14469, + SPR_MINI_GOLF_HOLE_A_TRIM_PART_2_SW_NE = 14470, + SPR_MINI_GOLF_HOLE_A_TRIM_PART_1_NW_SE = 14471, + SPR_MINI_GOLF_HOLE_A_TRIM_PART_2_NW_SE = 14472, + SPR_MINI_GOLF_HOLE_A_TRIM_PART_1_NE_SW = 14473, + SPR_MINI_GOLF_HOLE_A_TRIM_PART_2_NE_SW = 14474, + SPR_MINI_GOLF_HOLE_A_TRIM_PART_1_SE_NW = 14475, + SPR_MINI_GOLF_HOLE_A_TRIM_PART_2_SE_NW = 14476, + + SPR_MINI_GOLF_HOLE_B_BASE_PART_1_SW_NE = 14477, + SPR_MINI_GOLF_HOLE_B_BASE_PART_2_SW_NE = 14478, + SPR_MINI_GOLF_HOLE_B_BASE_PART_1_NW_SE = 14479, + SPR_MINI_GOLF_HOLE_B_BASE_PART_2_NW_SE = 14480, + SPR_MINI_GOLF_HOLE_B_BASE_PART_1_NE_SW = 14481, + SPR_MINI_GOLF_HOLE_B_BASE_PART_2_NE_SW = 14482, + SPR_MINI_GOLF_HOLE_B_BASE_PART_1_SE_NW = 14483, + SPR_MINI_GOLF_HOLE_B_BASE_PART_2_SE_NW = 14484, + SPR_MINI_GOLF_HOLE_B_TRIM_PART_1_SW_NE = 14485, + SPR_MINI_GOLF_HOLE_B_TRIM_PART_2_SW_NE = 14486, + SPR_MINI_GOLF_HOLE_B_TRIM_PART_1_NW_SE = 14487, + SPR_MINI_GOLF_HOLE_B_TRIM_PART_2_NW_SE = 14488, + SPR_MINI_GOLF_HOLE_B_TRIM_PART_1_NE_SW = 14489, + SPR_MINI_GOLF_HOLE_B_TRIM_PART_2_NE_SW = 14490, + SPR_MINI_GOLF_HOLE_B_TRIM_PART_1_SE_NW = 14491, + SPR_MINI_GOLF_HOLE_B_TRIM_PART_2_SE_NW = 14492, + + SPR_MINI_GOLF_HOLE_C_BASE_PART_1_SW_NE = 14493, + SPR_MINI_GOLF_HOLE_C_BASE_PART_2_SW_NE = 14494, + SPR_MINI_GOLF_HOLE_C_BASE_PART_1_NW_SE = 14495, + SPR_MINI_GOLF_HOLE_C_BASE_PART_2_NW_SE = 14496, + SPR_MINI_GOLF_HOLE_C_BASE_PART_1_NE_SW = 14497, + SPR_MINI_GOLF_HOLE_C_BASE_PART_2_NE_SW = 14498, + SPR_MINI_GOLF_HOLE_C_BASE_PART_1_SE_NW = 14499, + SPR_MINI_GOLF_HOLE_C_BASE_PART_2_SE_NW = 14500, + SPR_MINI_GOLF_HOLE_C_TRIM_PART_1_SW_NE = 14501, + SPR_MINI_GOLF_HOLE_C_TRIM_PART_2_SW_NE = 14502, + SPR_MINI_GOLF_HOLE_C_TRIM_PART_1_NW_SE = 14503, + SPR_MINI_GOLF_HOLE_C_TRIM_PART_2_NW_SE = 14504, + SPR_MINI_GOLF_HOLE_C_TRIM_PART_1_NE_SW = 14505, + SPR_MINI_GOLF_HOLE_C_TRIM_PART_2_NE_SW = 14506, + SPR_MINI_GOLF_HOLE_C_TRIM_PART_1_SE_NW = 14507, + SPR_MINI_GOLF_HOLE_C_TRIM_PART_2_SE_NW = 14508, + + SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SW_NE = 14509, + SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SW_NE = 14510, + SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SW_NE = 14511, + SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NW_SE = 14512, + SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NW_SE = 14513, + SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NW_SE = 14514, + SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NE_SW = 14515, + SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NE_SW = 14516, + SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NE_SW = 14517, + SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SE_NW = 14518, + SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SE_NW = 14519, + SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SE_NW = 14520, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SW_NE = 14521, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SW_NE = 14522, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SW_NE = 14523, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NW_SE = 14524, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NW_SE = 14525, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NW_SE = 14526, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NE_SW = 14527, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NE_SW = 14528, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NE_SW = 14529, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SE_NW = 14530, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SE_NW = 14531, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SE_NW = 14532, }; static const uint32 mini_golf_track_sprites_25_deg_up[][3] = { @@ -167,6 +246,85 @@ static const uint32 mini_golf_track_sprites_quarter_turn_1_tile_fence_front[] = SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_FRONT_SE_SW, }; +static const uint32 mini_golf_track_sprites_hole_a[4][2][2] = { + { + {SPR_MINI_GOLF_HOLE_A_BASE_PART_1_SW_NE, SPR_MINI_GOLF_HOLE_A_TRIM_PART_1_SW_NE}, + {SPR_MINI_GOLF_HOLE_A_BASE_PART_2_SW_NE, SPR_MINI_GOLF_HOLE_A_TRIM_PART_2_SW_NE} + }, + { + {SPR_MINI_GOLF_HOLE_A_BASE_PART_1_NW_SE, SPR_MINI_GOLF_HOLE_A_TRIM_PART_1_NW_SE}, + {SPR_MINI_GOLF_HOLE_A_BASE_PART_2_NW_SE, SPR_MINI_GOLF_HOLE_A_TRIM_PART_2_NW_SE} + }, + { + {SPR_MINI_GOLF_HOLE_A_BASE_PART_1_NE_SW, SPR_MINI_GOLF_HOLE_A_TRIM_PART_1_NE_SW}, + {SPR_MINI_GOLF_HOLE_A_BASE_PART_2_NE_SW, SPR_MINI_GOLF_HOLE_A_TRIM_PART_2_NE_SW} + }, + { + {SPR_MINI_GOLF_HOLE_A_BASE_PART_1_SE_NW, SPR_MINI_GOLF_HOLE_A_TRIM_PART_1_SE_NW}, + {SPR_MINI_GOLF_HOLE_A_BASE_PART_2_SE_NW, SPR_MINI_GOLF_HOLE_A_TRIM_PART_2_SE_NW} + }, +}; + +static const uint32 mini_golf_track_sprites_hole_b[4][2][2] = { + { + {SPR_MINI_GOLF_HOLE_B_BASE_PART_1_SW_NE, SPR_MINI_GOLF_HOLE_B_TRIM_PART_1_SW_NE}, + {SPR_MINI_GOLF_HOLE_B_BASE_PART_2_SW_NE, SPR_MINI_GOLF_HOLE_B_TRIM_PART_2_SW_NE} + }, + { + {SPR_MINI_GOLF_HOLE_B_BASE_PART_1_NW_SE, SPR_MINI_GOLF_HOLE_B_TRIM_PART_1_NW_SE}, + {SPR_MINI_GOLF_HOLE_B_BASE_PART_2_NW_SE, SPR_MINI_GOLF_HOLE_B_TRIM_PART_2_NW_SE} + }, + { + {SPR_MINI_GOLF_HOLE_B_BASE_PART_1_NE_SW, SPR_MINI_GOLF_HOLE_B_TRIM_PART_1_NE_SW}, + {SPR_MINI_GOLF_HOLE_B_BASE_PART_2_NE_SW, SPR_MINI_GOLF_HOLE_B_TRIM_PART_2_NE_SW} + }, + { + {SPR_MINI_GOLF_HOLE_B_BASE_PART_1_SE_NW, SPR_MINI_GOLF_HOLE_B_TRIM_PART_1_SE_NW}, + {SPR_MINI_GOLF_HOLE_B_BASE_PART_2_SE_NW, SPR_MINI_GOLF_HOLE_B_TRIM_PART_2_SE_NW} + }, +}; + +static const uint32 mini_golf_track_sprites_hole_c[][2][2] = { + { + {SPR_MINI_GOLF_HOLE_C_BASE_PART_1_SW_NE, SPR_MINI_GOLF_HOLE_C_TRIM_PART_1_SW_NE}, + {SPR_MINI_GOLF_HOLE_C_BASE_PART_2_SW_NE, SPR_MINI_GOLF_HOLE_C_TRIM_PART_2_SW_NE} + }, + { + {SPR_MINI_GOLF_HOLE_C_BASE_PART_1_NW_SE, SPR_MINI_GOLF_HOLE_C_TRIM_PART_1_NW_SE}, + {SPR_MINI_GOLF_HOLE_C_BASE_PART_2_NW_SE, SPR_MINI_GOLF_HOLE_C_TRIM_PART_2_NW_SE} + }, + { + {SPR_MINI_GOLF_HOLE_C_BASE_PART_1_NE_SW, SPR_MINI_GOLF_HOLE_C_TRIM_PART_1_NE_SW}, + {SPR_MINI_GOLF_HOLE_C_BASE_PART_2_NE_SW, SPR_MINI_GOLF_HOLE_C_TRIM_PART_2_NE_SW} + }, + { + {SPR_MINI_GOLF_HOLE_C_BASE_PART_1_SE_NW, SPR_MINI_GOLF_HOLE_C_TRIM_PART_1_SE_NW}, + {SPR_MINI_GOLF_HOLE_C_BASE_PART_2_SE_NW, SPR_MINI_GOLF_HOLE_C_TRIM_PART_2_SE_NW} + }, +}; + +static const uint32 mini_golf_track_sprites_hole_d[][3][2] = { + { + {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SW_NE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SW_NE}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SW_NE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SW_NE}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SW_NE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SW_NE} + }, + { + {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NW_SE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NW_SE}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NW_SE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NW_SE}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NW_SE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NW_SE} + }, + { + {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NE_SW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NE_SW}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NE_SW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NE_SW}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NE_SW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NE_SW} + }, + { + {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SE_NW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SE_NW}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SE_NW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SE_NW}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SE_NW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SE_NW} + }, +}; static paint_struct * mini_golf_paint_util_7c( uint8 direction, @@ -490,55 +648,96 @@ static void paint_mini_golf_track_right_quarter_turn_1_tile(uint8 rideIndex, uin paint_mini_golf_track_left_quarter_turn_1_tile(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement); } -/** - * rct2: 0x0088129C - */ -static void mini_golf_hole_a_paint_setup_0_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { +static void paint_mini_golf_hole_ab(uint8 trackSequence, uint8 direction, int height, const uint32 sprites[4][2][2]) +{ + uint32 imageId; - bool drewSupports = wooden_a_supports_paint_setup(0, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + bool drewSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); - RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; - RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF; + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); - uint32 eax = 0xFFFF0A00 | ((height >> 4) & 0xFF); - RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax; - RCT2_GLOBAL(0x141F56A, uint8)++; - - height += 32; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; - RCT2_GLOBAL(0x00141E9DA, uint8) = 32; - } - height -= 32; - - uint32 image_id = 14469 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 26, 0, height, 0, 3, height + 24, get_current_rotation()); - - if (drewSupports) { - image_id = 3395 + RCT2_GLOBAL(0x00F4419C, uint32); - sub_98197C(image_id, 0, 0, 32, 26, 1, height, 0, 3, height, get_current_rotation()); + if ((direction == 0 && trackSequence == 0) || (direction == 2 && trackSequence == 1)) { + paint_util_push_tunnel_left(height, TUNNEL_10); + } else if ((direction == 3 && trackSequence == 0) || (direction == 1 && trackSequence == 1)) { + paint_util_push_tunnel_right(height, TUNNEL_10); } - image_id = 14461 | RCT2_GLOBAL(0x00F44198, uint32); + rct_xy16 boundBox = (direction & 1) ? (rct_xy16) {26, 32} : (rct_xy16) {32, 26}; + rct_xy16 boundBoxOffset = (direction & 1) ? (rct_xy16) {3, 0} : (rct_xy16) {0, 3}; + + imageId = sprites[direction][trackSequence][1] | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 24, get_current_rotation()); + if (drewSupports) { - sub_98199C(image_id, 0, 0, 32, 26, 1, height, 0, 3, height, get_current_rotation()); + imageId = (direction & 1 ? SPR_FLOOR_B : SPR_FLOOR_A) | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + + imageId = sprites[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); } else { - sub_98197C(image_id, 0, 0, 32, 26, 1, height, 0, 3, height, get_current_rotation()); + imageId = sprites[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); } } -/** - * rct2: 0x0088125D - */ -static void mini_golf_hole_a_paint_setup_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { - if (trackSequence == 0) mini_golf_hole_a_paint_setup_0_0(rideIndex, trackSequence, direction, height, mapElement); +/** rct2: 0x0087F1CC */ +static void paint_mini_golf_hole_a(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_golf_hole_ab(trackSequence, direction, height, mini_golf_track_sprites_hole_a); +} + +/** rct2: 0x0087F1DC */ +static void paint_mini_golf_hole_b(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_golf_hole_ab(trackSequence, direction, height, mini_golf_track_sprites_hole_b); +} + +/** rct2: 0x0087F1EC */ +static void paint_mini_golf_hole_c(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId; + + bool drewSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); + + if ((direction == 0 && trackSequence == 0) || (direction == 2 && trackSequence == 1)) { + paint_util_push_tunnel_left(height, TUNNEL_10); + } else if ((direction == 3 && trackSequence == 0) || (direction == 1 && trackSequence == 1)) { + paint_util_push_tunnel_right(height, TUNNEL_10); + } + + rct_xy16 boundBox = (direction & 1) ? (rct_xy16) {26, 32} : (rct_xy16) {32, 26}; + rct_xy16 boundBoxOffset = (direction & 1) ? (rct_xy16) {3, 0} : (rct_xy16) {0, 3}; + + imageId = mini_golf_track_sprites_hole_c[direction][trackSequence][1] | RCT2_GLOBAL(0x00F44198, uint32); + + switch ((direction << 4) | trackSequence) { + case 0x01: + case 0x20: + sub_98197C(imageId, 0, 0, 2, 26, 3, height, 30, 3, height + 4, get_current_rotation()); + break; + case 0x10: + case 0x31: + sub_98197C(imageId, 0, 0, 26, 2, 3, height, 3, 30, height + 4, get_current_rotation()); + break; + default: + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 24, get_current_rotation()); + break; + } + + if (drewSupports) { + imageId = (direction & 1 ? SPR_FLOOR_B : SPR_FLOOR_A) | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + + imageId = mini_golf_track_sprites_hole_c[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + } else { + imageId = mini_golf_track_sprites_hole_c[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + } } /** @@ -574,8 +773,11 @@ TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direc return paint_mini_golf_track_right_quarter_turn_1_tile; case TRACK_ELEM_MINI_GOLF_HOLE_A: + return paint_mini_golf_hole_a; case TRACK_ELEM_MINI_GOLF_HOLE_B: + return paint_mini_golf_hole_b; case TRACK_ELEM_MINI_GOLF_HOLE_C: + return paint_mini_golf_hole_c; case TRACK_ELEM_MINI_GOLF_HOLE_D: case TRACK_ELEM_MINI_GOLF_HOLE_E: return NULL; From 90b22f01780e92879368f8208449521b06d8af01 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 21 May 2016 11:03:52 +0200 Subject: [PATCH 10/12] Draw hole D --- src/ride/gentle/mini_golf.c | 139 ++++++++++++++++++++++++++---------- 1 file changed, 103 insertions(+), 36 deletions(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index c8a9986e8d..569ad6e73e 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -136,30 +136,30 @@ enum { SPR_MINI_GOLF_HOLE_C_TRIM_PART_1_SE_NW = 14507, SPR_MINI_GOLF_HOLE_C_TRIM_PART_2_SE_NW = 14508, - SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SW_NE = 14509, - SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SW_NE = 14510, - SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SW_NE = 14511, - SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NW_SE = 14512, - SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NW_SE = 14513, - SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NW_SE = 14514, - SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NE_SW = 14515, - SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NE_SW = 14516, - SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NE_SW = 14517, - SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SE_NW = 14518, - SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SE_NW = 14519, - SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SE_NW = 14520, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SW_NE = 14521, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SW_NE = 14522, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SW_NE = 14523, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NW_SE = 14524, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NW_SE = 14525, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NW_SE = 14526, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NE_SW = 14527, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NE_SW = 14528, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NE_SW = 14529, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SE_NW = 14530, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SE_NW = 14531, - SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SE_NW = 14532, + SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SW_SE = 14509, + SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SW_SE = 14510, + SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SW_SE = 14511, + SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NW_SW = 14512, + SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NW_SW = 14513, + SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NW_SW = 14514, + SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NE_NW = 14515, + SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NE_NW = 14516, + SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NE_NW = 14517, + SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SE_NE = 14518, + SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SE_NE = 14519, + SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SE_NE = 14520, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SW_SE = 14521, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SW_SE = 14522, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SW_SE = 14523, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NW_SW = 14524, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NW_SW = 14525, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NW_SW = 14526, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NE_NW = 14527, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NE_NW = 14528, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NE_NW = 14529, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SE_NE = 14530, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SE_NE = 14531, + SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SE_NE = 14532, }; static const uint32 mini_golf_track_sprites_25_deg_up[][3] = { @@ -305,24 +305,24 @@ static const uint32 mini_golf_track_sprites_hole_c[][2][2] = { static const uint32 mini_golf_track_sprites_hole_d[][3][2] = { { - {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SW_NE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SW_NE}, - {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SW_NE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SW_NE}, - {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SW_NE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SW_NE} + {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SW_SE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SW_SE}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SW_SE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SW_SE}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SW_SE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SW_SE} }, { - {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NW_SE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NW_SE}, - {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NW_SE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NW_SE}, - {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NW_SE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NW_SE} + {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NW_SW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NW_SW}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NW_SW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NW_SW}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NW_SW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NW_SW} }, { - {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NE_SW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NE_SW}, - {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NE_SW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NE_SW}, - {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NE_SW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NE_SW} + {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_NE_NW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_NE_NW}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_NE_NW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_NE_NW}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_NE_NW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_NE_NW} }, { - {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SE_NW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SE_NW}, - {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SE_NW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SE_NW}, - {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SE_NW, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SE_NW} + {SPR_MINI_GOLF_HOLE_D_BASE_PART_1_SE_NE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SE_NE}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_2_SE_NE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SE_NE}, + {SPR_MINI_GOLF_HOLE_D_BASE_PART_3_SE_NE, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SE_NE} }, }; @@ -740,6 +740,72 @@ static void paint_mini_golf_hole_c(uint8 rideIndex, uint8 trackSequence, uint8 d } } +/** rct2: 0x0087F1FC */ +static void paint_mini_golf_hole_d(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId; + + int supportType = direction & 1; + if (trackSequence == 2) supportType = 1 - supportType; + bool drewSupports = wooden_a_supports_paint_setup(supportType, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); + + switch ((direction << 4) | trackSequence) { + case 0x00: + case 0x12: + paint_util_push_tunnel_left(height, TUNNEL_10); + break; + + case 0x02: + case 0x30: + paint_util_push_tunnel_right(height, TUNNEL_10); + break; + } + + rct_xy16 boundBox = (supportType & 1) ? (rct_xy16) {26, 32} : (rct_xy16) {32, 26}; + rct_xy16 boundBoxOffset = (supportType & 1) ? (rct_xy16) {3, 0} : (rct_xy16) {0, 3}; + + imageId = mini_golf_track_sprites_hole_d[direction][trackSequence][1] | RCT2_GLOBAL(0x00F44198, uint32); + + switch ((direction << 4) | trackSequence) { + case 0x01: + case 0x32: + sub_98197C(imageId, 0, 0, 2, 26, 3, height, 30, 3, height + 4, get_current_rotation()); + break; + case 0x02: + sub_98197C(imageId, 0, 0, 23, 2, 3, height, 3, 30, height + 4, get_current_rotation()); + break; + case 0x10: + sub_98197C(imageId, 0, 0, 2, 24, 3, height, 30, 3, height + 4, get_current_rotation()); + break; + case 0x20: + case 0x31: + sub_98197C(imageId, 0, 0, 26, 2, 3, height, 3, 30, height + 4, get_current_rotation()); + break; + default: + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 24, get_current_rotation()); + break; + } + + switch ((direction << 4) | trackSequence) { + case 0x02: boundBox = (rct_xy16) {23, 32}; break; + case 0x10: boundBox = (rct_xy16) {24, 32}; break; + } + + if (drewSupports) { + imageId = (supportType & 1 ? SPR_FLOOR_B : SPR_FLOOR_A) | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + + imageId = mini_golf_track_sprites_hole_d[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + } else { + imageId = mini_golf_track_sprites_hole_d[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + } +} + /** * rct2: 0x0087EDC4 */ @@ -779,6 +845,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direc case TRACK_ELEM_MINI_GOLF_HOLE_C: return paint_mini_golf_hole_c; case TRACK_ELEM_MINI_GOLF_HOLE_D: + return paint_mini_golf_hole_d; case TRACK_ELEM_MINI_GOLF_HOLE_E: return NULL; } From f7b56da72631c65e7d77fbabbac7ad12291ac74a Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 21 May 2016 11:35:12 +0200 Subject: [PATCH 11/12] Draw hole E --- src/ride/gentle/mini_golf.c | 115 +++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 569ad6e73e..731c7bb045 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -160,6 +160,31 @@ enum { SPR_MINI_GOLF_HOLE_D_TRIM_PART_1_SE_NE = 14530, SPR_MINI_GOLF_HOLE_D_TRIM_PART_2_SE_NE = 14531, SPR_MINI_GOLF_HOLE_D_TRIM_PART_3_SE_NE = 14532, + + SPR_MINI_GOLF_HOLE_E_BASE_PART_1_SE_SW = 14533, + SPR_MINI_GOLF_HOLE_E_BASE_PART_2_SE_SW = 14534, + SPR_MINI_GOLF_HOLE_E_BASE_PART_3_SE_SW = 14535, + SPR_MINI_GOLF_HOLE_E_BASE_PART_1_NE_SE = 14536, + SPR_MINI_GOLF_HOLE_E_BASE_PART_2_NE_SE = 14537, + SPR_MINI_GOLF_HOLE_E_BASE_PART_3_NE_SE = 14538, + SPR_MINI_GOLF_HOLE_E_BASE_PART_1_NW_NE = 14539, + SPR_MINI_GOLF_HOLE_E_BASE_PART_2_NW_NE = 14540, + SPR_MINI_GOLF_HOLE_E_BASE_PART_3_NW_NE = 14541, + SPR_MINI_GOLF_HOLE_E_BASE_PART_1_SW_NW = 14542, + SPR_MINI_GOLF_HOLE_E_BASE_PART_2_SW_NW = 14543, + SPR_MINI_GOLF_HOLE_E_BASE_PART_3_SW_NW = 14544, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_1_SE_SW = 14545, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_2_SE_SW = 14546, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_3_SE_SW = 14547, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_1_NE_SE = 14548, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_2_NE_SE = 14549, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_3_NE_SE = 14550, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_1_NW_NE = 14551, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_2_NW_NE = 14552, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_3_NW_NE = 14553, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_1_SW_NW = 14554, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_2_SW_NW = 14555, + SPR_MINI_GOLF_HOLE_E_TRIM_PART_3_SW_NW = 14556, }; static const uint32 mini_golf_track_sprites_25_deg_up[][3] = { @@ -326,6 +351,29 @@ static const uint32 mini_golf_track_sprites_hole_d[][3][2] = { }, }; +static const uint32 mini_golf_track_sprites_hole_e[][3][2] = { + { + {SPR_MINI_GOLF_HOLE_E_BASE_PART_1_SW_NW, SPR_MINI_GOLF_HOLE_E_TRIM_PART_1_SW_NW}, + {SPR_MINI_GOLF_HOLE_E_BASE_PART_2_SW_NW, SPR_MINI_GOLF_HOLE_E_TRIM_PART_2_SW_NW}, + {SPR_MINI_GOLF_HOLE_E_BASE_PART_3_SW_NW, SPR_MINI_GOLF_HOLE_E_TRIM_PART_3_SW_NW} + }, + { + {SPR_MINI_GOLF_HOLE_E_BASE_PART_1_NW_NE, SPR_MINI_GOLF_HOLE_E_TRIM_PART_1_NW_NE}, + {SPR_MINI_GOLF_HOLE_E_BASE_PART_2_NW_NE, SPR_MINI_GOLF_HOLE_E_TRIM_PART_2_NW_NE}, + {SPR_MINI_GOLF_HOLE_E_BASE_PART_3_NW_NE, SPR_MINI_GOLF_HOLE_E_TRIM_PART_3_NW_NE} + }, + { + {SPR_MINI_GOLF_HOLE_E_BASE_PART_1_NE_SE, SPR_MINI_GOLF_HOLE_E_TRIM_PART_1_NE_SE}, + {SPR_MINI_GOLF_HOLE_E_BASE_PART_2_NE_SE, SPR_MINI_GOLF_HOLE_E_TRIM_PART_2_NE_SE}, + {SPR_MINI_GOLF_HOLE_E_BASE_PART_3_NE_SE, SPR_MINI_GOLF_HOLE_E_TRIM_PART_3_NE_SE} + }, + { + {SPR_MINI_GOLF_HOLE_E_BASE_PART_1_SE_SW, SPR_MINI_GOLF_HOLE_E_TRIM_PART_1_SE_SW}, + {SPR_MINI_GOLF_HOLE_E_BASE_PART_2_SE_SW, SPR_MINI_GOLF_HOLE_E_TRIM_PART_2_SE_SW}, + {SPR_MINI_GOLF_HOLE_E_BASE_PART_3_SE_SW, SPR_MINI_GOLF_HOLE_E_TRIM_PART_3_SE_SW} + }, +}; + static paint_struct * mini_golf_paint_util_7c( uint8 direction, uint32 image_id, @@ -806,6 +854,71 @@ static void paint_mini_golf_hole_d(uint8 rideIndex, uint8 trackSequence, uint8 d } } +/** rct2: 0x0087F1FC */ +static void paint_mini_golf_hole_e(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId; + + int supportType = direction & 1; + if (trackSequence == 2) supportType = 1 - supportType; + bool drewSupports = wooden_a_supports_paint_setup(supportType, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); + + switch ((direction << 4) | trackSequence) { + case 0x00: + case 0x12: + paint_util_push_tunnel_left(height, TUNNEL_10); + break; + + case 0x02: + case 0x30: + paint_util_push_tunnel_right(height, TUNNEL_10); + break; + } + + rct_xy16 boundBox = (supportType & 1) ? (rct_xy16) {26, 32} : (rct_xy16) {32, 26}; + rct_xy16 boundBoxOffset = (supportType & 1) ? (rct_xy16) {3, 0} : (rct_xy16) {0, 3}; + + imageId = mini_golf_track_sprites_hole_e[direction][trackSequence][1] | RCT2_GLOBAL(0x00F44198, uint32); + + switch ((direction << 4) | trackSequence) { + case 0x01: + sub_98197C(imageId, 0, 0, 2, 26, 3, height, 30, 3, height + 4, get_current_rotation()); + case 0x02: + case 0x20: + case 0x31: + sub_98197C(imageId, 0, 0, 26, 2, 3, height, 3, 30, height + 4, get_current_rotation()); + break; + case 0x10: + sub_98197C(imageId, 0, 0, 2, 24, 3, height, 30, 3, height + 4, get_current_rotation()); + break; + case 0x32: + sub_98197C(imageId, 0, 0, 2, 23, 3, height, 30, 3, height + 4, get_current_rotation()); + break; + default: + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 24, get_current_rotation()); + break; + } + + switch ((direction << 4) | trackSequence) { + case 0x10: boundBox = (rct_xy16) {24, 32}; break; + case 0x32: boundBox = (rct_xy16) {32, 23}; break; + } + + if (drewSupports) { + imageId = (supportType & 1 ? SPR_FLOOR_B : SPR_FLOOR_A) | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + + imageId = mini_golf_track_sprites_hole_e[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + } else { + imageId = mini_golf_track_sprites_hole_e[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); + } +} + /** * rct2: 0x0087EDC4 */ @@ -847,7 +960,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direc case TRACK_ELEM_MINI_GOLF_HOLE_D: return paint_mini_golf_hole_d; case TRACK_ELEM_MINI_GOLF_HOLE_E: - return NULL; + return paint_mini_golf_hole_e; } return NULL; From d4e9faaed00f447b2fe263fbb77216087b2da250 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 21 May 2016 12:19:31 +0200 Subject: [PATCH 12/12] Share enum for floors --- src/ride/gentle/mini_golf.c | 11 ++++------- src/ride/shops/facility.c | 2 +- src/ride/shops/shop.c | 2 +- src/ride/track_paint.h | 3 +++ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 731c7bb045..67f47b097e 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -24,9 +24,6 @@ #include "../../world/map.h" enum { - SPR_FLOOR_A = 3395, - SPR_FLOOR_B = 3396, - SPR_MINI_GOLF_FLAT_SW_NE = 14404, SPR_MINI_GOLF_FLAT_NW_SE = 14405, SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE = 14406, @@ -718,7 +715,7 @@ static void paint_mini_golf_hole_ab(uint8 trackSequence, uint8 direction, int he sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 24, get_current_rotation()); if (drewSupports) { - imageId = (direction & 1 ? SPR_FLOOR_B : SPR_FLOOR_A) | RCT2_GLOBAL(0x00F4419C, uint32); + imageId = (direction & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | RCT2_GLOBAL(0x00F4419C, uint32); sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); imageId = sprites[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); @@ -777,7 +774,7 @@ static void paint_mini_golf_hole_c(uint8 rideIndex, uint8 trackSequence, uint8 d } if (drewSupports) { - imageId = (direction & 1 ? SPR_FLOOR_B : SPR_FLOOR_A) | RCT2_GLOBAL(0x00F4419C, uint32); + imageId = (direction & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | RCT2_GLOBAL(0x00F4419C, uint32); sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); imageId = mini_golf_track_sprites_hole_c[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); @@ -843,7 +840,7 @@ static void paint_mini_golf_hole_d(uint8 rideIndex, uint8 trackSequence, uint8 d } if (drewSupports) { - imageId = (supportType & 1 ? SPR_FLOOR_B : SPR_FLOOR_A) | RCT2_GLOBAL(0x00F4419C, uint32); + imageId = (supportType & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | RCT2_GLOBAL(0x00F4419C, uint32); sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); imageId = mini_golf_track_sprites_hole_d[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); @@ -908,7 +905,7 @@ static void paint_mini_golf_hole_e(uint8 rideIndex, uint8 trackSequence, uint8 d } if (drewSupports) { - imageId = (supportType & 1 ? SPR_FLOOR_B : SPR_FLOOR_A) | RCT2_GLOBAL(0x00F4419C, uint32); + imageId = (supportType & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | RCT2_GLOBAL(0x00F4419C, uint32); sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation()); imageId = mini_golf_track_sprites_hole_e[direction][trackSequence][0] | RCT2_GLOBAL(0x00F44198, uint32); diff --git a/src/ride/shops/facility.c b/src/ride/shops/facility.c index 2d92337ed9..a24fc11a35 100644 --- a/src/ride/shops/facility.c +++ b/src/ride/shops/facility.c @@ -45,7 +45,7 @@ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 dir int lengthX = (direction & 1) == 0 ? 28 : 2; int lengthY = (direction & 1) == 0 ? 2 : 28; if (hasSupports) { - uint32 foundationImageId = (direction & 1 ? 3396 : 3395) | RCT2_GLOBAL(0x00F441A4, uint32); + uint32 foundationImageId = (direction & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | RCT2_GLOBAL(0x00F441A4, uint32); sub_98197C(foundationImageId, 0, 0, lengthX, lengthY, 29, height, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height, rotation); // Door image or base diff --git a/src/ride/shops/shop.c b/src/ride/shops/shop.c index 691bae70de..d652fe90e9 100644 --- a/src/ride/shops/shop.c +++ b/src/ride/shops/shop.c @@ -45,7 +45,7 @@ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi imageId += direction; if (hasSupports) { - uint32 foundationImageId = (direction & 1 ? 3396 : 3395) | RCT2_GLOBAL(0x00F441A4, uint32); + uint32 foundationImageId = (direction & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | RCT2_GLOBAL(0x00F441A4, uint32); sub_98197C(foundationImageId, 0, 0, 28, 28, 45, height, 2, 2, height, get_current_rotation()); sub_98199C(imageId, 0, 0, 28, 28, 45, height, 2, 2, height, get_current_rotation()); diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 5d3edc91da..a43d7bffef 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -32,6 +32,9 @@ extern const uint8 track_map_4x4[][16]; extern const uint8 edges_4x4[]; enum { + SPR_FLOOR_PLANKS = 3395, + SPR_FLOOR_PLANKS_90_DEG = 3396, + SPR_FLOOR_METAL = 14567, SPR_FENCE_METAL_NE = 14568, SPR_FENCE_METAL_SE = 14569,