From 701dd77b54dc11c87ec9c6b7d2120ac894df48df Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 16 Apr 2016 16:04:24 +0200 Subject: [PATCH] Decompile paint function for rides 50, 52, 53, 54 --- src/ride/track_data.c | 10 ++++---- src/ride/track_paint.c | 55 ++++++++++++++++++++++++++++++++++++++++++ src/ride/track_paint.h | 1 + 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/ride/track_data.c b/src/ride/track_data.c index aff3bd999b..de1d196956 100644 --- a/src/ride/track_data.c +++ b/src/ride/track_data.c @@ -5551,11 +5551,11 @@ const uint32 RideTypeTrackPaintFunctionsOld[91] = { 0x00898384, // RIDE_TYPE_MAGIC_CARPET 0x008995D4, // RIDE_TYPE_SUBMARINE_RIDE 0x0089B0C0, // RIDE_TYPE_RIVER_RAFTS - 0x00761160, // RIDE_TYPE_50 + 0, // RIDE_TYPE_50 0x008A13B4, // RIDE_TYPE_ENTERPRISE - 0x00761160, // RIDE_TYPE_52 - 0x00761160, // RIDE_TYPE_53 - 0x00761160, // RIDE_TYPE_54 + 0, // RIDE_TYPE_52 + 0, // RIDE_TYPE_53 + 0, // RIDE_TYPE_54 0x00000000, // RIDE_TYPE_55 0x008B005C, // RIDE_TYPE_INVERTED_IMPULSE_COASTER 0x008A46D8, // RIDE_TYPE_MINI_ROLLER_COASTER @@ -5646,7 +5646,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = { 0, // RIDE_TYPE_MAGIC_CARPET 0, // RIDE_TYPE_SUBMARINE_RIDE 0, // RIDE_TYPE_RIVER_RAFTS - 0, // RIDE_TYPE_50 + get_track_paint_function_50_52_53_54, // RIDE_TYPE_50 0, // RIDE_TYPE_ENTERPRISE 0, // RIDE_TYPE_52 0, // RIDE_TYPE_53 diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 5382faa93d..917ac9579d 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -1163,3 +1163,58 @@ TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direct } return NULL; } + +/** + * rct2: 0x00761378, 0x007614DB, 0x0076163F, 0x007617A5 + */ +static void ride_50_52_53_54_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + bool supportsDrawn = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32), NULL); + + RCT2_GLOBAL(0x0141E9D0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9C4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9CC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9B8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9BC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9B4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9C0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9C8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9D4, uint16) = 0xFFFF; + + rct_ride *ride = get_ride(rideIndex); + + rct_ride_entry *rideEntry = get_ride_entry(ride->subtype); + + uint32 image_id = RCT2_GLOBAL(0x00F44198, uint32); + if (image_id & 0x80000000) { + image_id &= 0x60FFFFFF; + } + + image_id += rideEntry->vehicles[0].base_image_id; + image_id += direction; + if (supportsDrawn) { + uint32 ebx = (direction & 1 ? 3396 : 3395) | RCT2_GLOBAL(0x00F441A4, uint32); + sub_98197C(ebx, 0, 0, 28, 28, 45, height, 2, 2, height, get_current_rotation()); + + sub_98199C(image_id, 0, 0, 28, 28, 45, height, 2, 2, height, get_current_rotation()); + } else { + sub_98197C(image_id, 0, 0, 28, 28, 45, height, 2, 2, height, get_current_rotation()); + } + + height += 48; + 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) = 0x20; + } +} + +/** + * rct2: 0x00761160 + */ +TRACK_PAINT_FUNCTION get_track_paint_function_50_52_53_54(int trackType, int direction) { + switch (trackType) { + case 118: + case 121: + return ride_50_52_53_54_paint_setup; + } + return NULL; +} diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 72a9e2bcec..6a9e5ef772 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -10,5 +10,6 @@ TRACK_PAINT_FUNCTION get_track_paint_function_maze(int trackType, int direction) TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_shop(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direction); +TRACK_PAINT_FUNCTION get_track_paint_function_50_52_53_54(int trackType, int direction); #endif