From 85087f8a86436aacaee480919f4e4d48036aab14 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 25 Mar 2016 14:54:28 +0100 Subject: [PATCH 1/5] Draw maze tracks --- src/ride/track_data.c | 4 +- src/ride/track_paint.c | 265 +++++++++++++++++++++++++++++++++++++++++ src/ride/track_paint.h | 1 + 3 files changed, 268 insertions(+), 2 deletions(-) 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..c525f3dc97 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -860,6 +860,271 @@ TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int directi return NULL; } +enum { + MAZE_WALL_HEDGE = 21938, + MAZE_WALL_BRICK = 21951, + MAZE_WALL_ICE = 21964, + MAZE_WALL_WOOD = 21977, +}; + +/** + * rct: 0x004ACF4A + */ +static void maze_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + // eax: ride->type + // ebx: trackDirectionList + // ecx: direction + // edx: height + // esi: mapElement + // edi: rideIndex * sizeof(rct_ride) + // ebp: trackSequence + + uint16 bp = mapElement->properties.track.maze_entry; + switch (direction) { + case 1: + bp = rol16(bp, 4); + break; + case 2: + bp = ror16(bp, 8); + break; + case 3: + bp = ror16(bp, 4); + break; + } + + // 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), false); + + RCT2_GLOBAL(0x0141E9B4, sint16) = -1; + RCT2_GLOBAL(0x0141E9B8, sint16) = -1; + RCT2_GLOBAL(0x0141E9BC, sint16) = -1; + RCT2_GLOBAL(0x0141E9C0, sint16) = -1; + RCT2_GLOBAL(0x0141E9C8, sint16) = -1; + RCT2_GLOBAL(0x0141E9CC, sint16) = -1; + RCT2_GLOBAL(0x0141E9D0, sint16) = -1; + RCT2_GLOBAL(0x0141E9D4, sint16) = -1; + + rct_ride *ride = get_ride(rideIndex); + int esi = ride->track_colour_supports[0]; + + if (esi == 0) image_id = MAZE_WALL_BRICK; + if (esi == 1) image_id = MAZE_WALL_HEDGE; + if (esi == 2) image_id = MAZE_WALL_ICE; + if (esi == 3) image_id = MAZE_WALL_WOOD; + + image_id |= RCT2_GLOBAL(0x00F441A0, uint32); + + if (bp & (1 << 3)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 3; + RCT2_GLOBAL(0x009DEA54, uint16) = 3; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id, 2, 2, 10, 10, 9, height, get_current_rotation()); + } + + if (bp & (1 << 7)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 3; + RCT2_GLOBAL(0x009DEA54, uint16) = 19; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id, 2, 18, 10, 10, 9, height, get_current_rotation()); + } + + if (bp & (1 << 11)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 19; + RCT2_GLOBAL(0x009DEA54, uint16) = 19; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id, 18, 18, 10, 10, 9, height, get_current_rotation()); + } + + if (bp & (1 << 15)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 19; + RCT2_GLOBAL(0x009DEA54, uint16) = 3; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id, 18, 2, 10, 10, 9, height, get_current_rotation()); + } + + + if (bp & (1 << 0)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 3; + RCT2_GLOBAL(0x009DEA54, uint16) = 1; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 3, 2, 0, 10, 1, 9, height, get_current_rotation()); + } + + if (bp & (1 << 13)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 19; + RCT2_GLOBAL(0x009DEA54, uint16) = 1; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 3, 18, 0, 10, 1, 9, height, get_current_rotation()); + } + + + if (bp & (1 << 5)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 3; + RCT2_GLOBAL(0x009DEA54, uint16) = 30; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 5, 2, 30, 10, 1, 9, height, get_current_rotation()); + } + + if (bp & (1 << 8)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 19; + RCT2_GLOBAL(0x009DEA54, uint16) = 30; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 5, 18, 30, 10, 1, 9, height, get_current_rotation()); + } + + + if (bp & (1 << 1)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 1; + RCT2_GLOBAL(0x009DEA54, uint16) = 3; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 4, 0, 2, 1, 10, 9, height, get_current_rotation()); + } + + if (bp & (1 << 4)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 1; + RCT2_GLOBAL(0x009DEA54, uint16) = 19; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 4, 0, 18, 1, 10, 9, height, get_current_rotation()); + } + + + if (bp & (1 << 12)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 30; + RCT2_GLOBAL(0x009DEA54, uint16) = 3; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 6, 30, 2, 1, 10, 9, height, get_current_rotation()); + } + + if (bp & (1 << 9)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 30; + RCT2_GLOBAL(0x009DEA54, uint16) = 19; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 6, 30, 18, 1, 10, 9, height, get_current_rotation()); + } + + + if (bp & (1 << 2)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 3; + RCT2_GLOBAL(0x009DEA54, uint16) = 14; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 1, 2, 14, 10, 4, 9, height, get_current_rotation()); + } + + if (bp & (1 << 10)) { + RCT2_GLOBAL(0x009DEA52, uint16) = 19; + RCT2_GLOBAL(0x009DEA54, uint16) = 14; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 1, 18, 14, 10, 4, 9, height, get_current_rotation()); + } + + + if (bp & 0x4000) { + RCT2_GLOBAL(0x009DEA52, uint16) = 14; + RCT2_GLOBAL(0x009DEA54, uint16) = 3; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 2, 14, 2, 4, 10, 9, height, get_current_rotation()); + } + + if (bp & 0x40) { + RCT2_GLOBAL(0x009DEA52, uint16) = 14; + RCT2_GLOBAL(0x009DEA54, uint16) = 19; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 2, 14, 18, 4, 10, 9, height, get_current_rotation()); + } + + + if (bp & 0x3) { + RCT2_GLOBAL(0x009DEA52, uint16) = 1; + RCT2_GLOBAL(0x009DEA54, uint16) = 1; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 12, 0, 0, 1, 1, 9, height, get_current_rotation()); + } + + if (bp & 0x30) { + RCT2_GLOBAL(0x009DEA52, uint16) = 1; + RCT2_GLOBAL(0x009DEA54, uint16) = 30; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 12, 0, 30, 1, 1, 9, height, get_current_rotation()); + } + + if (bp & 0x300) { + RCT2_GLOBAL(0x009DEA52, uint16) = 30; + RCT2_GLOBAL(0x009DEA54, uint16) = 30; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 12, 30, 30, 1, 1, 9, height, get_current_rotation()); + } + + if (bp & 0x3000) { + RCT2_GLOBAL(0x009DEA52, uint16) = 1; + RCT2_GLOBAL(0x009DEA54, uint16) = 1; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 12, 30, 0, 1, 1, 9, height, get_current_rotation()); + } + + + if (bp & 0x6001) { + RCT2_GLOBAL(0x009DEA52, uint16) = 15; + RCT2_GLOBAL(0x009DEA54, uint16) = 1; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 9, 14, 0, 2, 1, 9, height, get_current_rotation()); + } + + + if (bp & 0x160) { + RCT2_GLOBAL(0x009DEA52, uint16) = 15; + RCT2_GLOBAL(0x009DEA54, uint16) = 30; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 11, 14, 30, 2, 1, 9, height, get_current_rotation()); + } + + + if (bp & 0x16) { + RCT2_GLOBAL(0x009DEA52, uint16) = 1; + RCT2_GLOBAL(0x009DEA54, uint16) = 15; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 8, 0, 14, 1, 2, 9, height, get_current_rotation()); + } + + + if (bp & 0x1600) { + RCT2_GLOBAL(0x009DEA52, uint16) = 30; + RCT2_GLOBAL(0x009DEA54, uint16) = 15; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 10, 30, 14, 1, 2, 9, height, get_current_rotation()); + } + + + if (bp & 0x4444) { + RCT2_GLOBAL(0x009DEA52, uint16) = 15; + RCT2_GLOBAL(0x009DEA54, uint16) = 15; + RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; + sub_98197C(image_id + 7, 14, 14, 2, 2, 8, height, get_current_rotation()); + + RCT2_GLOBAL(0x141E9C4, uint16) = height + 12; + RCT2_GLOBAL(0x141E9C6, uint16) = 32; + } + + 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: 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); From db302b89a19cc0bd00f186a2d5dd12f86aedf7d7 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 10 Apr 2016 19:16:09 +0200 Subject: [PATCH 2/5] Fix wrong value --- src/ride/track_paint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index c525f3dc97..2b664bd1c4 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -1058,7 +1058,7 @@ static void maze_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi } if (bp & 0x3000) { - RCT2_GLOBAL(0x009DEA52, uint16) = 1; + RCT2_GLOBAL(0x009DEA52, uint16) = 30; RCT2_GLOBAL(0x009DEA54, uint16) = 1; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; sub_98197C(image_id + 12, 30, 0, 1, 1, 9, height, get_current_rotation()); From d8c952d5032336eddd97c34664d9b0971b852174 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 10 Apr 2016 19:57:42 +0200 Subject: [PATCH 3/5] Clean up code --- src/ride/track_paint.c | 147 +++++++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 70 deletions(-) diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 2b664bd1c4..2d4fb258d4 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -861,10 +861,26 @@ TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int directi } enum { - MAZE_WALL_HEDGE = 21938, - MAZE_WALL_BRICK = 21951, - MAZE_WALL_ICE = 21964, - MAZE_WALL_WOOD = 21977, + 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, }; /** @@ -879,18 +895,8 @@ static void maze_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi // edi: rideIndex * sizeof(rct_ride) // ebp: trackSequence - uint16 bp = mapElement->properties.track.maze_entry; - switch (direction) { - case 1: - bp = rol16(bp, 4); - break; - case 2: - bp = ror16(bp, 8); - break; - case 3: - bp = ror16(bp, 4); - break; - } + 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); @@ -910,198 +916,199 @@ static void maze_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi rct_ride *ride = get_ride(rideIndex); int esi = ride->track_colour_supports[0]; - if (esi == 0) image_id = MAZE_WALL_BRICK; - if (esi == 1) image_id = MAZE_WALL_HEDGE; - if (esi == 2) image_id = MAZE_WALL_ICE; - if (esi == 3) image_id = MAZE_WALL_WOOD; + if (esi == 0) image_id = SPR_MAZE_BASE_BRICK; + if (esi == 1) image_id = SPR_MAZE_BASE_HEDGE; + if (esi == 2) image_id = SPR_MAZE_BASE_ICE; + if (esi == 3) image_id = SPR_MAZE_BASE_WOOD; image_id |= RCT2_GLOBAL(0x00F441A0, uint32); - if (bp & (1 << 3)) { + + if (maze_entry & (1 << 3)) { RCT2_GLOBAL(0x009DEA52, uint16) = 3; RCT2_GLOBAL(0x009DEA54, uint16) = 3; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id, 2, 2, 10, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_CENTER, 2, 2, 10, 10, 9, height, get_current_rotation()); } - if (bp & (1 << 7)) { + if (maze_entry & (1 << 7)) { RCT2_GLOBAL(0x009DEA52, uint16) = 3; RCT2_GLOBAL(0x009DEA54, uint16) = 19; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id, 2, 18, 10, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_CENTER, 2, 18, 10, 10, 9, height, get_current_rotation()); } - if (bp & (1 << 11)) { + if (maze_entry & (1 << 11)) { RCT2_GLOBAL(0x009DEA52, uint16) = 19; RCT2_GLOBAL(0x009DEA54, uint16) = 19; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id, 18, 18, 10, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_CENTER, 18, 18, 10, 10, 9, height, get_current_rotation()); } - if (bp & (1 << 15)) { + if (maze_entry & (1 << 15)) { RCT2_GLOBAL(0x009DEA52, uint16) = 19; RCT2_GLOBAL(0x009DEA54, uint16) = 3; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id, 18, 2, 10, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_CENTER, 18, 2, 10, 10, 9, height, get_current_rotation()); } - if (bp & (1 << 0)) { + if (maze_entry & (1 << 0)) { RCT2_GLOBAL(0x009DEA52, uint16) = 3; RCT2_GLOBAL(0x009DEA54, uint16) = 1; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 3, 2, 0, 10, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_TOP_LEFT, 2, 0, 10, 1, 9, height, get_current_rotation()); } - if (bp & (1 << 13)) { + if (maze_entry & (1 << 13)) { RCT2_GLOBAL(0x009DEA52, uint16) = 19; RCT2_GLOBAL(0x009DEA54, uint16) = 1; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 3, 18, 0, 10, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_TOP_LEFT, 18, 0, 10, 1, 9, height, get_current_rotation()); } - if (bp & (1 << 5)) { + if (maze_entry & (1 << 5)) { RCT2_GLOBAL(0x009DEA52, uint16) = 3; RCT2_GLOBAL(0x009DEA54, uint16) = 30; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 5, 2, 30, 10, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_RIGHT, 2, 30, 10, 1, 9, height, get_current_rotation()); } - if (bp & (1 << 8)) { + if (maze_entry & (1 << 8)) { RCT2_GLOBAL(0x009DEA52, uint16) = 19; RCT2_GLOBAL(0x009DEA54, uint16) = 30; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 5, 18, 30, 10, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_RIGHT, 18, 30, 10, 1, 9, height, get_current_rotation()); } - if (bp & (1 << 1)) { + if (maze_entry & (1 << 1)) { RCT2_GLOBAL(0x009DEA52, uint16) = 1; RCT2_GLOBAL(0x009DEA54, uint16) = 3; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 4, 0, 2, 1, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_TOP_RIGHT, 0, 2, 1, 10, 9, height, get_current_rotation()); } - if (bp & (1 << 4)) { + if (maze_entry & (1 << 4)) { RCT2_GLOBAL(0x009DEA52, uint16) = 1; RCT2_GLOBAL(0x009DEA54, uint16) = 19; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 4, 0, 18, 1, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_TOP_RIGHT, 0, 18, 1, 10, 9, height, get_current_rotation()); } - if (bp & (1 << 12)) { + if (maze_entry & (1 << 12)) { RCT2_GLOBAL(0x009DEA52, uint16) = 30; RCT2_GLOBAL(0x009DEA54, uint16) = 3; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 6, 30, 2, 1, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_LEFT, 30, 2, 1, 10, 9, height, get_current_rotation()); } - if (bp & (1 << 9)) { + if (maze_entry & (1 << 9)) { RCT2_GLOBAL(0x009DEA52, uint16) = 30; RCT2_GLOBAL(0x009DEA54, uint16) = 19; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 6, 30, 18, 1, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_LEFT, 30, 18, 1, 10, 9, height, get_current_rotation()); } - if (bp & (1 << 2)) { + if (maze_entry & (1 << 2)) { RCT2_GLOBAL(0x009DEA52, uint16) = 3; RCT2_GLOBAL(0x009DEA54, uint16) = 14; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 1, 2, 14, 10, 4, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_INNER_NE_SW, 2, 14, 10, 4, 9, height, get_current_rotation()); } - if (bp & (1 << 10)) { + if (maze_entry & (1 << 10)) { RCT2_GLOBAL(0x009DEA52, uint16) = 19; RCT2_GLOBAL(0x009DEA54, uint16) = 14; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 1, 18, 14, 10, 4, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_INNER_NE_SW, 18, 14, 10, 4, 9, height, get_current_rotation()); } - if (bp & 0x4000) { + if (maze_entry & (1 << 14)) { RCT2_GLOBAL(0x009DEA52, uint16) = 14; RCT2_GLOBAL(0x009DEA54, uint16) = 3; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 2, 14, 2, 4, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_INNER_NW_SE, 14, 2, 4, 10, 9, height, get_current_rotation()); } - if (bp & 0x40) { + if (maze_entry & (1 << 6)) { RCT2_GLOBAL(0x009DEA52, uint16) = 14; RCT2_GLOBAL(0x009DEA54, uint16) = 19; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 2, 14, 18, 4, 10, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_INNER_NW_SE, 14, 18, 4, 10, 9, height, get_current_rotation()); } - if (bp & 0x3) { + if (maze_entry & (1 << 0 | 1 << 1)) { RCT2_GLOBAL(0x009DEA52, uint16) = 1; RCT2_GLOBAL(0x009DEA54, uint16) = 1; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 12, 0, 0, 1, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CORNER, 0, 0, 1, 1, 9, height, get_current_rotation()); } - if (bp & 0x30) { + if (maze_entry & (1 << 4 | 1 << 5)) { RCT2_GLOBAL(0x009DEA52, uint16) = 1; RCT2_GLOBAL(0x009DEA54, uint16) = 30; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 12, 0, 30, 1, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CORNER, 0, 30, 1, 1, 9, height, get_current_rotation()); } - if (bp & 0x300) { + if (maze_entry & (1 << 8 | 1 << 9)) { RCT2_GLOBAL(0x009DEA52, uint16) = 30; RCT2_GLOBAL(0x009DEA54, uint16) = 30; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 12, 30, 30, 1, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CORNER, 30, 30, 1, 1, 9, height, get_current_rotation()); } - if (bp & 0x3000) { + if (maze_entry & (1 << 12 | 1 << 13)) { RCT2_GLOBAL(0x009DEA52, uint16) = 30; RCT2_GLOBAL(0x009DEA54, uint16) = 1; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 12, 30, 0, 1, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CORNER, 30, 0, 1, 1, 9, height, get_current_rotation()); } - if (bp & 0x6001) { + if (maze_entry & (1 << 0 | 1 << 13 | 1 << 14)) { RCT2_GLOBAL(0x009DEA52, uint16) = 15; RCT2_GLOBAL(0x009DEA54, uint16) = 1; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 9, 14, 0, 2, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT, 14, 0, 2, 1, 9, height, get_current_rotation()); } - if (bp & 0x160) { + if (maze_entry & (1 << 5 | 1 << 6 | 1 << 8)) { RCT2_GLOBAL(0x009DEA52, uint16) = 15; RCT2_GLOBAL(0x009DEA54, uint16) = 30; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 11, 14, 30, 2, 1, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT, 14, 30, 2, 1, 9, height, get_current_rotation()); } - if (bp & 0x16) { + if (maze_entry & (1 << 1 | 1 << 2 | 1 << 4)) { RCT2_GLOBAL(0x009DEA52, uint16) = 1; RCT2_GLOBAL(0x009DEA54, uint16) = 15; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 8, 0, 14, 1, 2, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT, 0, 14, 1, 2, 9, height, get_current_rotation()); } - if (bp & 0x1600) { + if (maze_entry & (1 << 9 | 1 << 10 | 1 << 12)) { RCT2_GLOBAL(0x009DEA52, uint16) = 30; RCT2_GLOBAL(0x009DEA54, uint16) = 15; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 10, 30, 14, 1, 2, 9, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT, 30, 14, 1, 2, 9, height, get_current_rotation()); } - if (bp & 0x4444) { + if (maze_entry & (1 << 2 | 1 << 6 | 1 << 10 | 1 << 14)) { RCT2_GLOBAL(0x009DEA52, uint16) = 15; RCT2_GLOBAL(0x009DEA54, uint16) = 15; RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + 7, 14, 14, 2, 2, 8, height, get_current_rotation()); + sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CENTER, 14, 14, 2, 2, 8, height, get_current_rotation()); RCT2_GLOBAL(0x141E9C4, uint16) = height + 12; RCT2_GLOBAL(0x141E9C6, uint16) = 32; From c1572f4f588305bb9260610fe3ed8429b6066cdc Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 17 Apr 2016 10:11:28 +0200 Subject: [PATCH 4/5] Update method signature --- src/ride/track_paint.c | 246 +++++++++++++---------------------------- 1 file changed, 74 insertions(+), 172 deletions(-) diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 2d4fb258d4..8dcb01ebab 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -887,14 +887,6 @@ enum { * rct: 0x004ACF4A */ static void maze_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { - // eax: ride->type - // ebx: trackDirectionList - // ecx: direction - // edx: height - // esi: mapElement - // edi: rideIndex * sizeof(rct_ride) - // ebp: trackSequence - uint16 maze_entry = mapElement->properties.track.maze_entry; maze_entry = rol16(maze_entry, direction * 4); @@ -904,220 +896,130 @@ static void maze_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32), false); - RCT2_GLOBAL(0x0141E9B4, sint16) = -1; - RCT2_GLOBAL(0x0141E9B8, sint16) = -1; - RCT2_GLOBAL(0x0141E9BC, sint16) = -1; - RCT2_GLOBAL(0x0141E9C0, sint16) = -1; - RCT2_GLOBAL(0x0141E9C8, sint16) = -1; - RCT2_GLOBAL(0x0141E9CC, sint16) = -1; - RCT2_GLOBAL(0x0141E9D0, sint16) = -1; - RCT2_GLOBAL(0x0141E9D4, sint16) = -1; + RCT2_GLOBAL(0x0141E9B4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9B8, sint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9BC, sint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9C0, sint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9C8, sint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9CC, sint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9D0, sint16) = 0xFFFF; + RCT2_GLOBAL(0x0141E9D4, sint16) = 0xFFFF; rct_ride *ride = get_ride(rideIndex); int esi = ride->track_colour_supports[0]; + int base_image_id; - if (esi == 0) image_id = SPR_MAZE_BASE_BRICK; - if (esi == 1) image_id = SPR_MAZE_BASE_HEDGE; - if (esi == 2) image_id = SPR_MAZE_BASE_ICE; - if (esi == 3) image_id = SPR_MAZE_BASE_WOOD; + if (esi == 0) base_image_id = SPR_MAZE_BASE_BRICK; + if (esi == 1) base_image_id = SPR_MAZE_BASE_HEDGE; + if (esi == 2) base_image_id = SPR_MAZE_BASE_ICE; + if (esi == 3) base_image_id = SPR_MAZE_BASE_WOOD; - image_id |= RCT2_GLOBAL(0x00F441A0, uint32); + base_image_id |= RCT2_GLOBAL(0x00F441A0, uint32); - if (maze_entry & (1 << 3)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 3; - RCT2_GLOBAL(0x009DEA54, uint16) = 3; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_CENTER, 2, 2, 10, 10, 9, height, get_current_rotation()); - } + 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 3; - RCT2_GLOBAL(0x009DEA54, uint16) = 19; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_CENTER, 2, 18, 10, 10, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 19; - RCT2_GLOBAL(0x009DEA54, uint16) = 19; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_CENTER, 18, 18, 10, 10, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 19; - RCT2_GLOBAL(0x009DEA54, uint16) = 3; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_CENTER, 18, 2, 10, 10, 9, height, 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()); - if (maze_entry & (1 << 0)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 3; - RCT2_GLOBAL(0x009DEA54, uint16) = 1; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_TOP_LEFT, 2, 0, 10, 1, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 19; - RCT2_GLOBAL(0x009DEA54, uint16) = 1; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_TOP_LEFT, 18, 0, 10, 1, 9, height, 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()); - if (maze_entry & (1 << 5)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 3; - RCT2_GLOBAL(0x009DEA54, uint16) = 30; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_RIGHT, 2, 30, 10, 1, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 19; - RCT2_GLOBAL(0x009DEA54, uint16) = 30; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_RIGHT, 18, 30, 10, 1, 9, height, 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()); - if (maze_entry & (1 << 1)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 1; - RCT2_GLOBAL(0x009DEA54, uint16) = 3; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_TOP_RIGHT, 0, 2, 1, 10, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 1; - RCT2_GLOBAL(0x009DEA54, uint16) = 19; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_TOP_RIGHT, 0, 18, 1, 10, 9, height, 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()); - if (maze_entry & (1 << 12)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 30; - RCT2_GLOBAL(0x009DEA54, uint16) = 3; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_LEFT, 30, 2, 1, 10, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 30; - RCT2_GLOBAL(0x009DEA54, uint16) = 19; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_LEFT, 30, 18, 1, 10, 9, height, 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()); - if (maze_entry & (1 << 2)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 3; - RCT2_GLOBAL(0x009DEA54, uint16) = 14; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_INNER_NE_SW, 2, 14, 10, 4, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 19; - RCT2_GLOBAL(0x009DEA54, uint16) = 14; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_INNER_NE_SW, 18, 14, 10, 4, 9, height, 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()); - if (maze_entry & (1 << 14)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 14; - RCT2_GLOBAL(0x009DEA54, uint16) = 3; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_INNER_NW_SE, 14, 2, 4, 10, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 14; - RCT2_GLOBAL(0x009DEA54, uint16) = 19; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_WALL_INNER_NW_SE, 14, 18, 4, 10, 9, height, 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()); - if (maze_entry & (1 << 0 | 1 << 1)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 1; - RCT2_GLOBAL(0x009DEA54, uint16) = 1; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CORNER, 0, 0, 1, 1, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 1; - RCT2_GLOBAL(0x009DEA54, uint16) = 30; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CORNER, 0, 30, 1, 1, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 30; - RCT2_GLOBAL(0x009DEA54, uint16) = 30; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CORNER, 30, 30, 1, 1, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 30; - RCT2_GLOBAL(0x009DEA54, uint16) = 1; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CORNER, 30, 0, 1, 1, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 15; - RCT2_GLOBAL(0x009DEA54, uint16) = 1; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT, 14, 0, 2, 1, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 15; - RCT2_GLOBAL(0x009DEA54, uint16) = 30; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT, 14, 30, 2, 1, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 1; - RCT2_GLOBAL(0x009DEA54, uint16) = 15; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT, 0, 14, 1, 2, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 30; - RCT2_GLOBAL(0x009DEA54, uint16) = 15; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT, 30, 14, 1, 2, 9, height, 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)) { - RCT2_GLOBAL(0x009DEA52, uint16) = 15; - RCT2_GLOBAL(0x009DEA54, uint16) = 15; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 2; - sub_98197C(image_id + SPR_MAZE_OFFSET_COLUMN_CENTER, 14, 14, 2, 2, 8, height, get_current_rotation()); + 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, uint16) = 32; + 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) = 32; + RCT2_GLOBAL(0x141E9DA, uint8) = 0x20; } } From 6e3375a3d4237b3ea89051c7f6d748041dac2344 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Mon, 18 Apr 2016 21:18:48 +0200 Subject: [PATCH 5/5] Small fixes --- src/drawing/supports.c | 2 +- src/ride/track_paint.c | 29 ++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) 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_paint.c b/src/ride/track_paint.c index 8dcb01ebab..77bc1c768c 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -894,25 +894,24 @@ static void maze_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi 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), false); + wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32), NULL); RCT2_GLOBAL(0x0141E9B4, uint16) = 0xFFFF; - RCT2_GLOBAL(0x0141E9B8, sint16) = 0xFFFF; - RCT2_GLOBAL(0x0141E9BC, sint16) = 0xFFFF; - RCT2_GLOBAL(0x0141E9C0, sint16) = 0xFFFF; - RCT2_GLOBAL(0x0141E9C8, sint16) = 0xFFFF; - RCT2_GLOBAL(0x0141E9CC, sint16) = 0xFFFF; - RCT2_GLOBAL(0x0141E9D0, sint16) = 0xFFFF; - RCT2_GLOBAL(0x0141E9D4, sint16) = 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; - rct_ride *ride = get_ride(rideIndex); - int esi = ride->track_colour_supports[0]; int base_image_id; - - if (esi == 0) base_image_id = SPR_MAZE_BASE_BRICK; - if (esi == 1) base_image_id = SPR_MAZE_BASE_HEDGE; - if (esi == 2) base_image_id = SPR_MAZE_BASE_ICE; - if (esi == 3) base_image_id = SPR_MAZE_BASE_WOOD; + 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);