From 1ff2d68061aed48b22e401f0559e6a0fb6615577 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Fri, 20 Nov 2015 21:59:55 +0000 Subject: [PATCH] implement track paint shop implement track paint shop, part 2 implement track paint shop, part 3 implement track paint shop, part 4 --- src/ride/track_data.c | 34 +++---- src/ride/track_paint.c | 197 +++++++++++++++++++++++++++++++++++++++++ src/ride/track_paint.h | 1 + 3 files changed, 215 insertions(+), 17 deletions(-) diff --git a/src/ride/track_data.c b/src/ride/track_data.c index 5746f2118e..17efa05e0a 100644 --- a/src/ride/track_data.c +++ b/src/ride/track_data.c @@ -5499,14 +5499,14 @@ const uint32 RideTypeTrackPaintFunctionsOld[91] = { 0x0075C9D0, // RIDE_TYPE_DODGEMS 0x008A83E0, // RIDE_TYPE_PIRATE_SHIP 0x00760070, // RIDE_TYPE_SWINGING_INVERTER_SHIP - 0x00761160, // RIDE_TYPE_FOOD_STALL - 0x00761160, // RIDE_TYPE_1D - 0x00761160, // RIDE_TYPE_DRINK_STALL - 0x00761160, // RIDE_TYPE_1F - 0x00761160, // RIDE_TYPE_SHOP + 0, // RIDE_TYPE_FOOD_STALL + 0, // RIDE_TYPE_1D + 0, // RIDE_TYPE_DRINK_STALL + 0, // RIDE_TYPE_1F + 0, // RIDE_TYPE_SHOP 0x0076190C, // RIDE_TYPE_MERRY_GO_ROUND - 0x00761160, // RIDE_TYPE_22 - 0x00761160, // RIDE_TYPE_INFORMATION_KIOSK + 0, // RIDE_TYPE_22 + 0, // RIDE_TYPE_INFORMATION_KIOSK 0x00762D44, // RIDE_TYPE_TOILETS 0x008A8CC8, // RIDE_TYPE_FERRIS_WHEEL 0x00763520, // RIDE_TYPE_MOTION_SIMULATOR @@ -5516,7 +5516,7 @@ const uint32 RideTypeTrackPaintFunctionsOld[91] = { 0x00768BAC, // RIDE_TYPE_REVERSE_FREEFALL_COASTER 0x0076C5BC, // RIDE_TYPE_LIFT 0x008A9C08, // RIDE_TYPE_VERTICAL_DROP_ROLLER_COASTER - 0x00761160, // RIDE_TYPE_CASH_MACHINE + 0, // RIDE_TYPE_CASH_MACHINE 0x0076D658, // RIDE_TYPE_TWIST 0x0076E7B0, // RIDE_TYPE_HAUNTED_HOUSE 0x00762D44, // RIDE_TYPE_FIRST_AID @@ -5594,15 +5594,15 @@ const uint32 RideTypeTrackPaintFunctions[91] = { 0, // RIDE_TYPE_DODGEMS 0, // RIDE_TYPE_PIRATE_SHIP 0, // RIDE_TYPE_SWINGING_INVERTER_SHIP - 0, // RIDE_TYPE_FOOD_STALL - 0, // RIDE_TYPE_1D - 0, // RIDE_TYPE_DRINK_STALL - 0, // RIDE_TYPE_1F - 0, // RIDE_TYPE_SHOP + (uint32)shop_track_paint_functions, // RIDE_TYPE_FOOD_STALL + (uint32)shop_track_paint_functions, // RIDE_TYPE_1D + (uint32)shop_track_paint_functions, // RIDE_TYPE_DRINK_STALL + (uint32)shop_track_paint_functions, // RIDE_TYPE_1F + (uint32)shop_track_paint_functions, // RIDE_TYPE_SHOP 0, // RIDE_TYPE_MERRY_GO_ROUND - 0, // RIDE_TYPE_22 - 0, // RIDE_TYPE_INFORMATION_KIOSK - 0, // RIDE_TYPE_TOILETS + (uint32)shop_track_paint_functions, // RIDE_TYPE_22 + (uint32)shop_track_paint_functions, // RIDE_TYPE_INFORMATION_KIOSK + (uint32)shop_track_paint_functions, // RIDE_TYPE_TOILETS 0, // RIDE_TYPE_FERRIS_WHEEL 0, // RIDE_TYPE_MOTION_SIMULATOR 0, // RIDE_TYPE_3D_CINEMA @@ -5611,7 +5611,7 @@ const uint32 RideTypeTrackPaintFunctions[91] = { 0, // RIDE_TYPE_REVERSE_FREEFALL_COASTER 0, // RIDE_TYPE_LIFT 0, // RIDE_TYPE_VERTICAL_DROP_ROLLER_COASTER - 0, // RIDE_TYPE_CASH_MACHINE + (uint32)shop_track_paint_functions, // RIDE_TYPE_CASH_MACHINE 0, // RIDE_TYPE_TWIST 0, // RIDE_TYPE_HAUNTED_HOUSE 0, // RIDE_TYPE_FIRST_AID diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index e95844c3a5..bf4ade6109 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -1065,3 +1065,200 @@ void top_spin_paint_setup_rot_3(uint8 rideIndex, uint8 trackSequence, uint8 dire } return; } + +void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement); + +/* 0x00761358 */ +TRACK_PAINT_FUNCTION shop_base_functions[] = { + shop_paint_setup, + shop_paint_setup, + shop_paint_setup, + shop_paint_setup, +}; + +/* 0x00761160 */ +TRACK_PAINT_FUNCTION* shop_track_paint_functions[] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + shop_base_functions, // 118 + NULL, + NULL, + shop_base_functions // 121 +}; + +/** + * + * rct2: 0x00761378 + * rct2: 0x007614DB + * rct2: 0x0076163F + * rct2: 0x007617A5 + */ +void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) +{ + int al = sub_6629BC(height, 0, RCT2_GLOBAL(0x00F441A4, uint32), direction & 1); + + 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_type *rideEntry = GET_RIDE_ENTRY(ride->subtype); + rct_ride_type_vehicle *firstVehicleEntry = &rideEntry->vehicles[0]; + + uint32 imageId = RCT2_GLOBAL(0x00F44198, uint32); + if (imageId & 0x80000000) { + imageId &= 0x60FFFFFF; + } + imageId += firstVehicleEntry->base_image_id; + imageId += direction; + + sint16 height16 = (sint16)height; + int rotation = get_current_rotation(); + if (al) { + RCT2_GLOBAL(0x009DEA52, uint16) = 2; + RCT2_GLOBAL(0x009DEA54, uint16) = 2; + RCT2_GLOBAL(0x009DEA56, sint16) = height16; + sub_98197C(0, 45, imageId, 0, height, 28, 28, rotation); + } else { + uint32 foundationImageId = RCT2_GLOBAL(0x00F441A4, uint32); + foundationImageId |= 3395; + + RCT2_GLOBAL(0x009DEA52, uint16) = 2; + RCT2_GLOBAL(0x009DEA54, uint16) = 2; + RCT2_GLOBAL(0x009DEA56, sint16) = height16; + sub_98197C(0, 45, foundationImageId, 0, height, 28, 28, rotation); + + RCT2_GLOBAL(0x009DEA52, uint16) = 2; + RCT2_GLOBAL(0x009DEA54, uint16) = 2; + RCT2_GLOBAL(0x009DEA56, sint16) = height16; + sub_98199C(0, 45, imageId, 0, height, 28, 28, rotation); + } + + height16 += 48; + if (RCT2_GLOBAL(0x00141E9D8, sint16) < height16) { + RCT2_GLOBAL(0x00141E9D8, sint16) = height16; + RCT2_GLOBAL(0x00141E9DA, sint16) = 32; + } +} diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index f020078c8a..cea5f99250 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -6,5 +6,6 @@ typedef void (*TRACK_PAINT_FUNCTION)(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement); extern TRACK_PAINT_FUNCTION* top_spin_track_paint_functions[]; +extern TRACK_PAINT_FUNCTION* shop_track_paint_functions[]; #endif \ No newline at end of file