From acab4d351ea9ec2d0b7a1365cde8294e077960dd Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 17 May 2016 20:02:30 +0200 Subject: [PATCH] Clean up shop drawing --- src/ride/shops/misc.c | 53 ------------------------------------------ src/ride/shops/shop.c | 28 +++++----------------- src/ride/track_data.c | 8 +++---- src/ride/track_paint.h | 1 - 4 files changed, 10 insertions(+), 80 deletions(-) diff --git a/src/ride/shops/misc.c b/src/ride/shops/misc.c index 06ad312ecd..d12f791795 100644 --- a/src/ride/shops/misc.c +++ b/src/ride/shops/misc.c @@ -22,57 +22,4 @@ #include "../../world/map.h" #include "../track_paint.h" -/** - * 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/shops/shop.c b/src/ride/shops/shop.c index bc52cb8e15..691bae70de 100644 --- a/src/ride/shops/shop.c +++ b/src/ride/shops/shop.c @@ -33,16 +33,6 @@ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi { bool hasSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32), NULL); - RCT2_GLOBAL(0x0141E9D0, sint16) = -1; - RCT2_GLOBAL(0x0141E9C4, sint16) = -1; - RCT2_GLOBAL(0x0141E9CC, sint16) = -1; - RCT2_GLOBAL(0x0141E9B8, sint16) = -1; - RCT2_GLOBAL(0x0141E9BC, sint16) = -1; - RCT2_GLOBAL(0x0141E9B4, sint16) = -1; - RCT2_GLOBAL(0x0141E9C0, sint16) = -1; - RCT2_GLOBAL(0x0141E9C8, sint16) = -1; - RCT2_GLOBAL(0x0141E9D4, sint16) = -1; - rct_ride *ride = get_ride(rideIndex); rct_ride_entry *rideEntry = get_ride_entry(ride->subtype); rct_ride_entry_vehicle *firstVehicleEntry = &rideEntry->vehicles[0]; @@ -54,23 +44,17 @@ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi imageId += firstVehicleEntry->base_image_id; imageId += direction; - sint16 height16 = (sint16)height; - int rotation = get_current_rotation(); if (hasSupports) { - uint32 foundationImageId = RCT2_GLOBAL(0x00F441A4, uint32); - foundationImageId |= 3395; - sub_98197C(foundationImageId, 0, 0, 28, 28, 45, height, 2, 2, height16, rotation); + uint32 foundationImageId = (direction & 1 ? 3396 : 3395) | 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, height16, rotation); + sub_98199C(imageId, 0, 0, 28, 28, 45, height, 2, 2, height, get_current_rotation()); } else { - sub_98197C(imageId, 0, 0, 28, 28, 45, height, 2, 2, height16, rotation); + sub_98197C(imageId, 0, 0, 28, 28, 45, height, 2, 2, height, get_current_rotation()); } - height16 += 48; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height16) { - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height16; - RCT2_GLOBAL(0x00141E9DA, uint8) = 32; - } + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 48, 0x20); } /* 0x00761160 */ diff --git a/src/ride/track_data.c b/src/ride/track_data.c index 2787531eb9..069504b189 100644 --- a/src/ride/track_data.c +++ b/src/ride/track_data.c @@ -5642,11 +5642,11 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = { 0, // RIDE_TYPE_MAGIC_CARPET 0, // RIDE_TYPE_SUBMARINE_RIDE 0, // RIDE_TYPE_RIVER_RAFTS - get_track_paint_function_50_52_53_54, // RIDE_TYPE_50 + get_track_paint_function_shop, // RIDE_TYPE_50 0, // RIDE_TYPE_ENTERPRISE - 0, // RIDE_TYPE_52 - 0, // RIDE_TYPE_53 - 0, // RIDE_TYPE_54 + get_track_paint_function_shop, // RIDE_TYPE_52 + get_track_paint_function_shop, // RIDE_TYPE_53 + get_track_paint_function_shop, // RIDE_TYPE_54 0, // RIDE_TYPE_55 0, // RIDE_TYPE_INVERTED_IMPULSE_COASTER 0, // RIDE_TYPE_MINI_ROLLER_COASTER diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 47df4fd202..4a7c8d6c7b 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -79,6 +79,5 @@ TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int directi 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_crooked_house(int trackType, int direction); -TRACK_PAINT_FUNCTION get_track_paint_function_50_52_53_54(int trackType, int direction); #endif