diff --git a/src/drawing/supports.c b/src/drawing/supports.c index 4d75807e74..8b829cbac7 100644 --- a/src/drawing/supports.c +++ b/src/drawing/supports.c @@ -152,7 +152,7 @@ const uint16 word_97B3C4[] = { * @param special (ax) Used for curved supports. * @param height (dx) The height of the supports. * @param imageColourFlags (ebp) The colour and palette flags for the support sprites. - * @param underground (Carry flag) true if underground. + * @param[out] underground (Carry flag) true if underground. * @returns (al) true if any supports have been drawn, otherwise false. */ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags, bool* underground) diff --git a/src/ride/track_data.c b/src/ride/track_data.c index 2a7d6ecec6..aff3bd999b 100644 --- a/src/ride/track_data.c +++ b/src/ride/track_data.c @@ -5491,7 +5491,7 @@ const uint32 RideTypeTrackPaintFunctionsOld[91] = { 0x0071BC40, // RIDE_TYPE_MINE_TRAIN_COASTER 0x00743EC8, // RIDE_TYPE_CHAIRLIFT 0x008A7784, // RIDE_TYPE_CORKSCREW_ROLLER_COASTER - 0x008A81E8, // RIDE_TYPE_MAZE + 0, // RIDE_TYPE_MAZE 0x0074840C, // RIDE_TYPE_SPIRAL_SLIDE 0x0074A668, // RIDE_TYPE_GO_KARTS 0x0074DDEC, // RIDE_TYPE_LOG_FLUME @@ -5586,7 +5586,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = { 0, // RIDE_TYPE_MINE_TRAIN_COASTER 0, // RIDE_TYPE_CHAIRLIFT 0, // RIDE_TYPE_CORKSCREW_ROLLER_COASTER - 0, // RIDE_TYPE_MAZE + get_track_paint_function_maze, // RIDE_TYPE_MAZE 0, // RIDE_TYPE_SPIRAL_SLIDE 0, // RIDE_TYPE_GO_KARTS 0, // RIDE_TYPE_LOG_FLUME diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index ca861e3867..77bc1c768c 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -860,6 +860,179 @@ TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int directi return NULL; } +enum { + SPR_MAZE_BASE_HEDGE = 21938, + SPR_MAZE_BASE_BRICK = 21951, + SPR_MAZE_BASE_ICE = 21964, + SPR_MAZE_BASE_WOOD = 21977, +}; + +enum { + SPR_MAZE_OFFSET_WALL_CENTER = 0, + SPR_MAZE_OFFSET_WALL_INNER_NE_SW, + SPR_MAZE_OFFSET_WALL_INNER_NW_SE, + SPR_MAZE_OFFSET_WALL_TOP_LEFT, + SPR_MAZE_OFFSET_WALL_TOP_RIGHT, + SPR_MAZE_OFFSET_WALL_BOTTOM_RIGHT, + SPR_MAZE_OFFSET_WALL_BOTTOM_LEFT, + SPR_MAZE_OFFSET_COLUMN_CENTER, + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT, + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT, + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT, + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT, + SPR_MAZE_OFFSET_COLUMN_CORNER, +}; + +/** + * rct: 0x004ACF4A + */ +static void maze_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + uint16 maze_entry = mapElement->properties.track.maze_entry; + maze_entry = rol16(maze_entry, direction * 4); + + // draw ground + int image_id = 2485 | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98196C(image_id, 0, 0, 32, 32, 0, height, get_current_rotation()); + + wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32), NULL); + + RCT2_GLOBAL(0x0141E9B4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9B8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9BC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9C0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9C8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9CC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9D0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9D4, uint16) = 0xFFFF; + + int base_image_id; + switch (get_ride(rideIndex)->track_colour_supports[0]) { + case 0: base_image_id = SPR_MAZE_BASE_BRICK; break; + case 1: base_image_id = SPR_MAZE_BASE_HEDGE; break; + case 2: base_image_id = SPR_MAZE_BASE_ICE; break; + case 3: base_image_id = SPR_MAZE_BASE_WOOD; break; + } + + base_image_id |= RCT2_GLOBAL(0x00F441A0, uint32); + + + image_id = base_image_id + SPR_MAZE_OFFSET_WALL_CENTER; + if (maze_entry & (1 << 3)) + sub_98197C(image_id, 2, 2, 10, 10, 9, height, 3, 3, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 7)) + sub_98197C(image_id, 2, 18, 10, 10, 9, height, 3, 19, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 11)) + sub_98197C(image_id, 18, 18, 10, 10, 9, height, 19, 19, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 15)) + sub_98197C(image_id, 18, 2, 10, 10, 9, height, 19, 3, height + 2, get_current_rotation()); + + + image_id = base_image_id + SPR_MAZE_OFFSET_WALL_TOP_LEFT; + if (maze_entry & (1 << 0)) + sub_98197C(image_id, 2, 0, 10, 1, 9, height, 3, 1, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 13)) + sub_98197C(image_id, 18, 0, 10, 1, 9, height, 19, 1, height + 2, get_current_rotation()); + + + image_id = base_image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_RIGHT; + if (maze_entry & (1 << 5)) + sub_98197C(image_id, 2, 30, 10, 1, 9, height, 3, 30, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 8)) + sub_98197C(image_id, 18, 30, 10, 1, 9, height, 19, 30, height + 2, get_current_rotation()); + + + image_id = base_image_id + SPR_MAZE_OFFSET_WALL_TOP_RIGHT; + if (maze_entry & (1 << 1)) + sub_98197C(image_id, 0, 2, 1, 10, 9, height, 1, 3, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 4)) + sub_98197C(image_id, 0, 18, 1, 10, 9, height, 1, 19, height + 2, get_current_rotation()); + + + image_id = base_image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_LEFT; + if (maze_entry & (1 << 12)) + sub_98197C(image_id, 30, 2, 1, 10, 9, height, 30, 3, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 9)) + sub_98197C(image_id, 30, 18, 1, 10, 9, height, 30, 19, height + 2, get_current_rotation()); + + + image_id = base_image_id + SPR_MAZE_OFFSET_WALL_INNER_NE_SW; + if (maze_entry & (1 << 2)) + sub_98197C(image_id, 2, 14, 10, 4, 9, height, 3, 14, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 10)) + sub_98197C(image_id, 18, 14, 10, 4, 9, height, 19, 14, height + 2, get_current_rotation()); + + + image_id = base_image_id + SPR_MAZE_OFFSET_WALL_INNER_NW_SE; + if (maze_entry & (1 << 14)) + sub_98197C(image_id, 14, 2, 4, 10, 9, height, 14, 3, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 6)) + sub_98197C(image_id, 14, 18, 4, 10, 9, height, 14, 19, height + 2, get_current_rotation()); + + + image_id = base_image_id + SPR_MAZE_OFFSET_COLUMN_CORNER; + if (maze_entry & (1 << 0 | 1 << 1)) + sub_98197C(image_id, 0, 0, 1, 1, 9, height, 1, 1, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 4 | 1 << 5)) + sub_98197C(image_id, 0, 30, 1, 1, 9, height, 1, 30, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 8 | 1 << 9)) + sub_98197C(image_id, 30, 30, 1, 1, 9, height, 30, 30, height + 2, get_current_rotation()); + + if (maze_entry & (1 << 12 | 1 << 13)) + sub_98197C(image_id, 30, 0, 1, 1, 9, height, 30, 1, height + 2, get_current_rotation()); + + + if (maze_entry & (1 << 0 | 1 << 13 | 1 << 14)) + sub_98197C(base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT, 14, 0, 2, 1, 9, height, 15, 1, height + 2, get_current_rotation()); + + + if (maze_entry & (1 << 5 | 1 << 6 | 1 << 8)) + sub_98197C(base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT, 14, 30, 2, 1, 9, height, 15, 30, height + 2, get_current_rotation()); + + + if (maze_entry & (1 << 1 | 1 << 2 | 1 << 4)) + sub_98197C(base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT, 0, 14, 1, 2, 9, height, 1, 15, height + 2, get_current_rotation()); + + + if (maze_entry & (1 << 9 | 1 << 10 | 1 << 12)) + sub_98197C(base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT, 30, 14, 1, 2, 9, height, 30, 15, height + 2, get_current_rotation()); + + + if (maze_entry & (1 << 2 | 1 << 6 | 1 << 10 | 1 << 14)) { + sub_98197C(base_image_id + SPR_MAZE_OFFSET_COLUMN_CENTER, 14, 14, 2, 2, 8, height, 15, 15, height + 2, get_current_rotation()); + + RCT2_GLOBAL(0x141E9C4, uint16) = height + 12; + RCT2_GLOBAL(0x141E9C6, uint8) = 0x20; + } + + 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) = 0x20; + } +} + +/** + * rct2: 0x008A81E8 + */ +TRACK_PAINT_FUNCTION get_track_paint_function_maze(int trackType, int direction) { + if (trackType != 101) { + return NULL; + } + + return maze_paint_setup; +} + /** * * rct2: 0x00761378 diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 410a85ce1d..72a9e2bcec 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -6,6 +6,7 @@ typedef void (*TRACK_PAINT_FUNCTION)(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement); typedef TRACK_PAINT_FUNCTION (*TRACK_PAINT_FUNCTION_GETTER)(int trackType, int direction); +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);