From 001dd3bcf6055489a571044566aeda05da6eae75 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 14 Apr 2016 09:59:01 +0200 Subject: [PATCH 01/11] Fix wrong function call --- src/interface/viewport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface/viewport.c b/src/interface/viewport.c index e7afdebfe9..0d07c41c79 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -1093,7 +1093,7 @@ int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si */ int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation) { - RCT2_CALLPROC_X(RCT2_ADDRESS(0x0098196C, uint32)[get_current_rotation()], + RCT2_CALLPROC_X(RCT2_ADDRESS(0x0098198C, uint32)[get_current_rotation()], x_offset | (z_offset << 8), image_id, y_offset, From e529532dddc25d4d93019590a6c5c2bc5fbb6584 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 14 Apr 2016 10:00:12 +0200 Subject: [PATCH 02/11] Add parameters to sub_98198C --- src/drawing/supports.c | 2 +- src/interface/viewport.c | 9 ++++++++- src/interface/viewport.h | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/drawing/supports.c b/src/drawing/supports.c index f2200a3539..6e3570e581 100644 --- a/src/drawing/supports.c +++ b/src/drawing/supports.c @@ -288,7 +288,7 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin hasSupports = true; } else { hasSupports = true; - if (!sub_98198C(imageId, 0, 0, lengthX, lengthY, ah, z, rotation)) { + if (!sub_98198C(imageId, 0, 0, lengthX, lengthY, ah, z, rotation, byte_97B23C[special].var_0, byte_97B23C[special].var_1, byte_97B23C[special].var_2 + z)) { int edi = RCT2_GLOBAL(0x009DEA58, uint32); RCT2_GLOBAL(edi + 0x20, uint32) = imageColourFlags; } diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 0d07c41c79..8fc599186c 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -1089,10 +1089,17 @@ int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si * @param z_offset (ah) * @param height (edx) * @param rotation + * @param word_52 (0x009DEA52) + * @param word_54 (0x009DEA54) + * @param word_56 (0x009DEA56) * @return ?? */ -int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation) +int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56) { + RCT2_GLOBAL(0x009DEA52, uint16) = word_52; + RCT2_GLOBAL(0x009DEA54, uint16) = word_54; + RCT2_GLOBAL(0x009DEA56, uint16) = word_56; + RCT2_CALLPROC_X(RCT2_ADDRESS(0x0098198C, uint32)[get_current_rotation()], x_offset | (z_offset << 8), image_id, diff --git a/src/interface/viewport.h b/src/interface/viewport.h index 55086127c3..d2f1e41c4e 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -133,7 +133,7 @@ void sub_688217(); int sub_98196C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); -int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); +int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56); int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, int bottom); From a6cbd392c64b600a799abdc225b53ab3d384676d Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 14 Apr 2016 10:08:40 +0200 Subject: [PATCH 03/11] Add parameter to 9c --- src/interface/viewport.c | 15 +++++++++------ src/interface/viewport.h | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 8fc599186c..5de7b89ec6 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -868,9 +868,16 @@ void sub_688485(){ * @param z_offset (ah) * @param height (edx) * @param rotation + * @param word_52 (0x009DEA52) + * @param word_54 (0x009DEA54) + * @param word_56 (0x009DEA56) * @return ?? */ -int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation) { +int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56) { + RCT2_GLOBAL(0x009DEA52, uint16) = word_52; + RCT2_GLOBAL(0x009DEA54, uint16) = word_54; + RCT2_GLOBAL(0x009DEA56, uint16) = word_56; + RCT2_CALLPROC_X(RCT2_ADDRESS(0x98199C, uint32_t)[get_current_rotation()], x_offset | (z_offset << 8), image_id, @@ -1511,11 +1518,7 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele if (entrance->scrolling_mode == 0xFF) break; - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height + entrance->text_height; - - sub_98199C(scrolling_text_setup(park_text_id, scroll, entrance->scrolling_mode + direction / 2), 0, 0, 0x1C, 0x1C, 0x2F, height + entrance->text_height, 0); + sub_98199C(scrolling_text_setup(park_text_id, scroll, entrance->scrolling_mode + direction / 2), 0, 0, 0x1C, 0x1C, 0x2F, height + entrance->text_height, 0, 2, 2, height + entrance->text_height); break; case 1: case 2: diff --git a/src/interface/viewport.h b/src/interface/viewport.h index d2f1e41c4e..e4377d7b61 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -134,7 +134,7 @@ void sub_688217(); int sub_98196C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56); -int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); +int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56); void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, int bottom); From 3bb22142351d97105c2234c5270fdf1bbcf5b43c Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 14 Apr 2016 11:07:41 +0200 Subject: [PATCH 04/11] Pass 0x009DEA52-0x009DEA56 as parameters --- src/drawing/supports.c | 28 +++--- src/interface/viewport.c | 110 ++++++++-------------- src/interface/viewport.h | 2 +- src/ride/track_paint.c | 191 +++++++++++++-------------------------- 4 files changed, 109 insertions(+), 222 deletions(-) diff --git a/src/drawing/supports.c b/src/drawing/supports.c index 6e3570e581..8507fc4c96 100644 --- a/src/drawing/supports.c +++ b/src/drawing/supports.c @@ -200,16 +200,9 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin } else { imageId += word_97B3C4[slope & 0x1F]; imageId |= imageColourFlags; + sub_98197C(imageId, 0, 0, 32, 32, 11, z, rotation, 0, 0, z + 2); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = z + 2; - sub_98197C(imageId, 0, 0, 32, 32, 11, z, rotation); - - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = z + 16 + 2; - sub_98197C(imageId + 4, 0, 0, 32, 32, 11, z + 16, rotation); + sub_98197C(imageId + 4, 0, 0, 32, 32, 11, z + 16, rotation, 0, 0, z + 16 + 2); hasSupports = true; } @@ -231,9 +224,10 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin imageId += word_97B3C4[slope & 0x1F]; imageId |= imageColourFlags; - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = z + 2; + uint16 word_9DEA52 = 0; + uint16 word_9DEA54 = 0; + uint16 word_9DEA56 = z + 2; + // Todo: check whether this function call is correct sub_98196C(imageId, 0, 0, 32, 32, 11, z, rotation); hasSupports = true; } @@ -277,18 +271,18 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin imageId += special; imageId |= imageColourFlags; - RCT2_GLOBAL(0x009DEA52, uint16) = byte_97B23C[special].var_0; - RCT2_GLOBAL(0x009DEA54, uint16) = byte_97B23C[special].var_1; - RCT2_GLOBAL(0x009DEA56, uint16) = byte_97B23C[special].var_2 + z; + uint16 word_9DEA52 = byte_97B23C[special].var_0; + uint16 word_9DEA54 = byte_97B23C[special].var_1; + uint16 word_9DEA56 = byte_97B23C[special].var_2 + z; uint16 lengthY = byte_97B23C[special].var_3; uint16 lengthX = byte_97B23C[special].var_4; uint8 ah = byte_97B23C[special].var_5; if (byte_97B23C[special].var_6 == 0 || RCT2_GLOBAL(0x009DEA58, uint32) == 0) { - sub_98197C(imageId, 0, 0, lengthX, lengthY, ah, z, rotation); + sub_98197C(imageId, 0, 0, lengthX, lengthY, ah, z, rotation, word_9DEA52, word_9DEA54, word_9DEA56); hasSupports = true; } else { hasSupports = true; - if (!sub_98198C(imageId, 0, 0, lengthX, lengthY, ah, z, rotation, byte_97B23C[special].var_0, byte_97B23C[special].var_1, byte_97B23C[special].var_2 + z)) { + if (!sub_98198C(imageId, 0, 0, lengthX, lengthY, ah, z, rotation, word_9DEA52, word_9DEA54, word_9DEA56)) { int edi = RCT2_GLOBAL(0x009DEA58, uint32); RCT2_GLOBAL(edi + 0x20, uint32) = imageColourFlags; } diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 5de7b89ec6..0840c9adc9 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -927,10 +927,12 @@ int sub_98196C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si * @param z_offset (ah) * @param height (edx) * @param rotation - * @return ?? + * @param word_52 (0x009DEA52) + * @param word_54 (0x009DEA54) + * @param word_56 (0x009DEA56) */ -int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation){ - int ebp = z_offset + RCT2_GLOBAL(0x9DEA56, sint16); +int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, sint16 s_unk_x, sint16 s_unk_y, sint16 word_56) { + int ebp = z_offset + word_56; RCT2_GLOBAL(0xF1AD28, paint_struct*) = 0; RCT2_GLOBAL(0xF1AD2C, uint32) = 0; @@ -995,8 +997,8 @@ int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si }; rct_xy16 s_unk = { - .x = RCT2_GLOBAL(0x9DEA52, sint16), - .y = RCT2_GLOBAL(0x9DEA54, sint16) + .x = s_unk_x, + .y = s_unk_y }; // Unsure why rots 1 and 3 need to swap @@ -1024,7 +1026,7 @@ int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si } ps->other_x = boundBox.x + s_unk.x + RCT2_GLOBAL(0x9DE568, sint16); - ps->some_x = RCT2_GLOBAL(0x009DEA56, sint16); + ps->some_x = word_56; ps->some_y = ebp; ps->other_y = boundBox.y + s_unk.y + RCT2_GLOBAL(0x009DE56C, sint16); ps->var_1A = 0; @@ -1134,10 +1136,7 @@ void viewport_vehicle_paint_setup(rct_vehicle *vehicle, int imageDirection) if (vehicle->flags & SPRITE_FLAGS_IS_CRASHED_VEHICLE_SPRITE) { uint32 ebx = 22965 + vehicle->var_C5; - RCT2_GLOBAL(0x9DEA52, uint16) = 0; - RCT2_GLOBAL(0x9DEA54, uint16) = 0; - RCT2_GLOBAL(0x9DEA56, uint16) = z + 2; - sub_98197C(ebx, 0, 0, 1, 1, 0, z, get_current_rotation()); + sub_98197C(ebx, 0, 0, 1, 1, 0, z, get_current_rotation(), 0, 0, z + 2); return; } @@ -1212,11 +1211,7 @@ void viewport_litter_paint_setup(rct_litter *litter, int imageDirection) uint32 image_id = imageDirection + RCT2_ADDRESS(0x97EF6C, uint32)[litter->type * 2]; - RCT2_GLOBAL(0x9DEA52, uint16) = 0xFFFC; - RCT2_GLOBAL(0x9DEA54, uint16) = 0xFFFC; - RCT2_GLOBAL(0x9DEA56, uint16) = litter->z + 2; - - sub_98197C(image_id, 0, 0, 4, 4, 0xFF, litter->z, get_current_rotation()); + sub_98197C(image_id, 0, 0, 4, 4, 0xFF, litter->z, get_current_rotation(), 0xFFFC, 0xFFFC, litter->z + 2); } @@ -1334,16 +1329,16 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma // Each entrance is split into 2 images for drawing // Certain entrance styles have another 2 images to draw for coloured windows - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, uint16) = height; + uint16 word_9DEA52 = 2; + uint16 word_9DEA54 = 2; + uint16 word_9DEA56 = height; sint8 ah = is_exit ? 0x23 : 0x33; sint16 lengthY = (direction & 1) ? 28 : 2; sint16 lengthX = (direction & 1) ? 2 : 28; - sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); if (transparant_image_id){ if (is_exit){ @@ -1352,28 +1347,22 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma else{ transparant_image_id |= style->sprite_index + direction + 16; } - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, 0); + sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, 0, 2, 2, height); } image_id += 4; - RCT2_GLOBAL(0x009DEA52, uint16) = (direction & 1) ? 28 : 2; - RCT2_GLOBAL(0x009DEA54, uint16) = (direction & 1) ? 2 : 28; - RCT2_GLOBAL(0x009DEA56, uint16) = height; + word_9DEA52 = (direction & 1) ? 28 : 2; + word_9DEA54 = (direction & 1) ? 2 : 28; + word_9DEA56 = height; - sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); if (transparant_image_id){ transparant_image_id += 4; - RCT2_GLOBAL(0x009DEA52, uint16) = (direction & 1) ? 28 : 2; - RCT2_GLOBAL(0x009DEA54, uint16) = (direction & 1) ? 2 : 28; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, 0); + sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, 0, (direction & 1) ? 28 : 2, (direction & 1) ? 2 : 28, height); } uint32 eax = 0xFFFF0600 | ((height / 16) & 0xFF); @@ -1416,10 +1405,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma uint16 string_width = gfx_get_string_width(entrance_string); uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width; - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, uint16) = height + style->height; - sub_98199C(scrolling_text_setup(string_id, scroll, style->scrolling_mode), 0, 0, 0x1C, 0x1C, 0x33, height + style->height, 0); + sub_98199C(scrolling_text_setup(string_id, scroll, style->scrolling_mode), 0, 0, 0x1C, 0x1C, 0x33, height + style->height, 0, 2, 2, height + style->height); } image_id = RCT2_GLOBAL(0x009E32BC, uint32); @@ -1473,20 +1459,11 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele switch (part_index){ case 0: image_id = (path_entry->image + 5 * (1 + (direction & 1))) | ghost_id; - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height; - - sub_98197C(image_id, 0, 0, 32, 0x1C, 0, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 0x1C, 0, height, get_current_rotation(), 0, 2, height); entrance = (rct_entrance_type*)object_entry_groups[OBJECT_TYPE_PARK_ENTRANCE].chunks[0]; image_id = (entrance->image_id + direction * 3) | ghost_id; - - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height + 32; - - sub_98197C(image_id, 0, 0, 0x1C, 0x1C, 0x2F, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 0x1C, 0x1C, 0x2F, height, get_current_rotation(), 2, 2, height + 32); if ((direction + 1) & (1 << 1)) break; @@ -1524,12 +1501,7 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele case 2: entrance = (rct_entrance_type*)object_entry_groups[OBJECT_TYPE_PARK_ENTRANCE].chunks[0]; image_id = (entrance->image_id + part_index + direction * 3) | ghost_id; - - RCT2_GLOBAL(0x009DEA52, uint16) = 3; - RCT2_GLOBAL(0x009DEA54, uint16) = 3; - RCT2_GLOBAL(0x009DEA56, sint16) = height; - - sub_98197C(image_id, 0, 0, 0x1A, di, 0x4F, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 0x1A, di, 0x4F, height, get_current_rotation(), 3, 3, height); break; } @@ -1592,10 +1564,7 @@ void viewport_track_paint_setup(uint8 direction, int height, rct_map_element *ma uint32 ebx = 0x20381689 + (height + 8) / 16; ebx += RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16); ebx -= RCT2_GLOBAL(0x01359208, uint16); - RCT2_GLOBAL(0x009DEA52, uint16) = 1000; - RCT2_GLOBAL(0x009DEA54, uint16) = 1000; - RCT2_GLOBAL(0x009DEA56, uint16) = 2047; - sub_98197C(ebx, 16, 16, 1, 1, 0, height + ax + 3, get_current_rotation()); + sub_98197C(ebx, 16, 16, 1, 1, 0, height + ax + 3, get_current_rotation(), 1000, 1000, 2047); } } @@ -1674,12 +1643,7 @@ void viewport_entrance_paint_setup(uint8 direction, int height, rct_map_element* image_id -= RCT2_GLOBAL(0x01359208, sint16); - RCT2_GLOBAL(0x009DEA52, uint16) = 31; - RCT2_GLOBAL(0x009DEA54, uint16) = 31; - RCT2_GLOBAL(0x009DEA56, sint16) = z; - RCT2_GLOBAL(0x009DEA56, uint16) += 64; - - sub_98197C(image_id, 16, 16, 1, 1, 0, height, get_current_rotation()); + sub_98197C(image_id, 16, 16, 1, 1, 0, height, get_current_rotation(), 31, 31, z + 64); } } @@ -1700,6 +1664,7 @@ void viewport_entrance_paint_setup(uint8 direction, int height, rct_map_element* */ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* map_element) { + uint16 word_9DEA52, word_9DEA54, word_9DEA56; rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8_t) = VIEWPORT_INTERACTION_ITEM_BANNER; @@ -1713,9 +1678,9 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m direction += map_element->properties.banner.position; direction &= 3; - RCT2_GLOBAL(0x9DEA56, uint16_t) = height + 2; - - RCT2_GLOBAL(0x9DEA52, uint32_t) = RCT2_ADDRESS(0x98D884, uint32)[direction * 2]; + word_9DEA52 = RCT2_ADDRESS(0x98D884, uint16)[direction * 2]; + word_9DEA54 = RCT2_ADDRESS(0x98D884 + 2, uint16)[direction * 2]; + word_9DEA56 = height + 2; uint32 base_id = (direction << 1) + banner_scenery->image; uint32 image_id = base_id; @@ -1731,11 +1696,12 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m 0x20000000; } - sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, get_current_rotation()); - RCT2_GLOBAL(0x9DEA52, uint32) = RCT2_ADDRESS(0x98D888, uint32)[direction * 2]; + sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); + word_9DEA52 = RCT2_ADDRESS(0x98D888, uint16)[direction * 2]; + word_9DEA54 = RCT2_ADDRESS(0x98D888 + 2, uint16)[direction * 2]; image_id++; - sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); // Opposite direction direction ^= 2; @@ -1766,7 +1732,7 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m uint16 string_width = gfx_get_string_width(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char)); uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width; - sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, 0); + sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, 0, word_9DEA52, word_9DEA54, word_9DEA56); } /** @@ -1821,17 +1787,13 @@ static void sub_68B3FB(int x, int y) arrowRotation + (RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_DIRECTION, uint8) & 0xFC) + 0x20900C27; - int arrowZ = RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_Z, uint16); RCT2_GLOBAL(0x9DE568, sint16) = x; RCT2_GLOBAL(0x9DE56C, sint16) = y; RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8) = VIEWPORT_INTERACTION_ITEM_NONE; - RCT2_GLOBAL(0x9DEA52, uint16) = 0; - RCT2_GLOBAL(0x9DEA54, uint16) = 0; - RCT2_GLOBAL(0x9DEA56, uint16) = arrowZ + 18; - sub_98197C(imageId, 0, 0, 32, 32, 0xFF, arrowZ, rotation); + sub_98197C(imageId, 0, 0, 32, 32, 0xFF, arrowZ, rotation, 0, 0, arrowZ + 18); } int bx = dx + 52; diff --git a/src/interface/viewport.h b/src/interface/viewport.h index e4377d7b61..d2cccd0477 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -132,7 +132,7 @@ void sub_688485(); void sub_688217(); int sub_98196C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); -int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); +int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, sint16 s_unk_x, sint16 s_unk_y, sint16 word_56); int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56); int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56); diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index a356391eb1..5c5a2cdae0 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -41,11 +41,7 @@ static void top_spin_paint_tile_0(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; @@ -98,6 +94,7 @@ static sint8 TopSpinSeatPositionOffset[] = { * rct2: 0x0076750D */ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 direction, int height, rct_map_element* mapElement) { + uint16 word_9DEA52, word_9DEA54, word_9DEA56; // As we will be drawing a vehicle we need to backup the mapElement that // is assigned to the drawings. rct_map_element* curMapElement = RCT2_GLOBAL(0x009DE578, rct_map_element*); @@ -122,9 +119,9 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di seatRotation = vehicle->bank_rotation; } - RCT2_GLOBAL(0x009DEA52, sint16) = al + 16; - RCT2_GLOBAL(0x009DEA54, sint16) = cl + 16; - RCT2_GLOBAL(0x009DEA56, sint16) = height; + word_9DEA52 = al + 16; + word_9DEA54 = cl + 16; + word_9DEA56 = height; //di uint8 lengthX = 24; @@ -144,7 +141,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di // Left back bottom support image_id += 572; - sub_98197C(image_id, al, cl, lengthX, lengthY, 90, height, get_current_rotation()); + sub_98197C(image_id, al, cl, lengthX, lengthY, 90, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); image_id = RCT2_GLOBAL(0x00F441A0, uint32); if (image_id == 0x20000000) { @@ -174,7 +171,10 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di lengthY, 90, height, - 0); + 0, + word_9DEA52, + word_9DEA54, + word_9DEA56); uint32 seatImageId; @@ -238,7 +238,10 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di lengthY, 90, seatCoords.z, - 0); + 0, + word_9DEA52, + word_9DEA54, + word_9DEA56); rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); if (dpi->zoom_level < 2 && vehicle != NULL && vehicle->num_peeps != 0) { @@ -249,7 +252,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 76; - sub_98199C(image_id, (sint8)seatCoords.x, (sint8)seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0, word_9DEA52, word_9DEA54, word_9DEA56); if (vehicle->num_peeps > 2) { image_id = @@ -259,7 +262,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 152; - sub_98199C(image_id, (sint8)seatCoords.x, (sint8)seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0, word_9DEA52, word_9DEA54, word_9DEA56); } if (vehicle->num_peeps > 4) { @@ -270,7 +273,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 228; - sub_98199C(image_id, (sint8)seatCoords.x, (sint8)seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0, word_9DEA52, word_9DEA54, word_9DEA56); } if (vehicle->num_peeps > 6) { @@ -281,7 +284,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 304; - sub_98199C(image_id, (sint8)seatCoords.x, (sint8)seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0, word_9DEA52, word_9DEA54, word_9DEA56); } } @@ -307,7 +310,10 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di lengthY, 90, height, - 0); + 0, + word_9DEA52, + word_9DEA54, + word_9DEA56); image_id = RCT2_GLOBAL(0x00F441A0, uint32); if (image_id == 0x20000000) { @@ -328,9 +334,12 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di cl, lengthX, lengthY, - 90, + 90, height, - 0); + 0, + word_9DEA52, + word_9DEA54, + word_9DEA56); RCT2_GLOBAL(0x009DE578, rct_map_element*) = curMapElement; RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8) = VIEWPORT_INTERACTION_ITEM_RIDE; @@ -346,10 +355,7 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -362,11 +368,8 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; - sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0); + sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 0, 2, height + 2); } entranceLoc = @@ -376,11 +379,8 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; - sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0); + sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 0, 2, height + 2); } top_spin_paint_vehicle(32, 32, rideIndex, direction, height, mapElement); @@ -415,10 +415,7 @@ static void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -431,11 +428,8 @@ static void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; - sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0); + sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 2, 0, height + 2); } RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; @@ -465,10 +459,7 @@ static void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -481,11 +472,8 @@ static void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; - sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0); + sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 0, 2, height + 2); } RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; @@ -515,10 +503,7 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -531,11 +516,8 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; - sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0); + sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 2, 0, height + 2); } entranceLoc = @@ -546,10 +528,7 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 30; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; - sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation(), 0, 30, height + 2); } top_spin_paint_vehicle(32, -32, rideIndex, direction, height, mapElement); @@ -584,10 +563,7 @@ static void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; @@ -600,10 +576,7 @@ static void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 30; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; - sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation(), 0, 30, height + 2); } top_spin_paint_vehicle(0, -32, rideIndex, direction, height, mapElement); @@ -635,10 +608,10 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + uint16 word_9DEA52 = 0; + uint16 word_9DEA54 = 0; + uint16 word_9DEA56 = height; + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -651,11 +624,8 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; - sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0); + sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 0, 2, height + 2); } entranceLoc = @@ -665,11 +635,11 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 30; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; + word_9DEA52 = 30; + word_9DEA54 = 2; + word_9DEA56 = height + 2; - sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); } top_spin_paint_vehicle(-32, 32, rideIndex, direction, height, mapElement); @@ -704,10 +674,7 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22134 | RCT2_GLOBAL(0x00F44198, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; @@ -721,10 +688,7 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 29; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 3; - sub_98197C(image_id, 0, 0, 1, 28, 7, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 1, 28, 7, height, get_current_rotation(), 29, 0, height + 3); } entranceLoc = @@ -735,10 +699,7 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 29; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 3; - sub_98197C(image_id, 0, 0, 28, 1, 7, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 28, 1, 7, height, get_current_rotation(), 0, 29, height + 3); } top_spin_paint_vehicle(-32, -32, rideIndex, direction, height, mapElement); @@ -773,10 +734,7 @@ static void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 0; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; @@ -789,11 +747,8 @@ static void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - RCT2_GLOBAL(0x009DEA52, uint16) = 30; - RCT2_GLOBAL(0x009DEA54, uint16) = 0; - RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; - sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation()); + sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation(), 30, 0, height + 2); } top_spin_paint_vehicle(-32, 0, rideIndex, direction, height, mapElement); @@ -1020,20 +975,11 @@ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi 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(foundationImageId, 0, 0, 28, 28, 45, height, rotation); + sub_98197C(foundationImageId, 0, 0, 28, 28, 45, height, rotation, 2, 2, height16); - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98199C(imageId, 0, 0, 28, 28, 45, height, rotation); + sub_98199C(imageId, 0, 0, 28, 28, 45, height, rotation, 2, 2, height16); } else { - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98197C(imageId, 0, 0, 28, 28, 45, height, rotation); + sub_98197C(imageId, 0, 0, 28, 28, 45, height, rotation, 2, 2, height16); } height16 += 48; @@ -1090,38 +1036,23 @@ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 dir uint32 foundationImageId = RCT2_GLOBAL(0x00F441A4, uint32); foundationImageId |= 3395; - RCT2_GLOBAL(0x009DEA52, uint16) = direction == 3 ? 28 : 2; - RCT2_GLOBAL(0x009DEA54, uint16) = direction == 0 ? 28 : 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98197C(foundationImageId, 0, 0, lengthX, lengthY, 29, height, rotation); + sub_98197C(foundationImageId, 0, 0, lengthX, lengthY, 29, height, rotation, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16); // Door image or base - RCT2_GLOBAL(0x009DEA52, uint16) = direction == 3 ? 28 : 2; - RCT2_GLOBAL(0x009DEA54, uint16) = direction == 0 ? 28 : 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98199C(imageId, 0, 0, lengthX, lengthY, 29, height, rotation); + sub_98199C(imageId, 0, 0, lengthX, lengthY, 29, height, rotation, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16); } else { // Door image or base - RCT2_GLOBAL(0x009DEA52, uint16) = direction == 3 ? 28 : 2; - RCT2_GLOBAL(0x009DEA54, uint16) = direction == 0 ? 28 : 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98197C(imageId, 0, 0, lengthX, lengthY, 29, height, rotation); + sub_98197C(imageId, 0, 0, lengthX, lengthY, 29, height, rotation, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16); } // Base image if door was drawn if (direction == 1) { imageId += 2; - RCT2_GLOBAL(0x009DEA52, uint16) = 28; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98197C(imageId, 0, 0, 2, 28, 29, height, rotation); + sub_98197C(imageId, 0, 0, 2, 28, 29, height, rotation, 28, 2, height16); } else if (direction == 2) { imageId += 4; - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 28; - RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98197C(imageId, 0, 0, 28, 2, 29, height, rotation); + sub_98197C(imageId, 0, 0, 28, 2, 29, height, rotation, 2, 28, height16); } height16 += 32; From 0e5b32bd565968a3ad7462b610711e33bc70520f Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 14 Apr 2016 11:17:39 +0200 Subject: [PATCH 05/11] Inline variables --- src/interface/viewport.c | 12 ++---------- src/ride/track_paint.c | 10 ++-------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 0840c9adc9..4dc580c18e 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -1329,16 +1329,12 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma // Each entrance is split into 2 images for drawing // Certain entrance styles have another 2 images to draw for coloured windows - uint16 word_9DEA52 = 2; - uint16 word_9DEA54 = 2; - uint16 word_9DEA56 = height; - sint8 ah = is_exit ? 0x23 : 0x33; sint16 lengthY = (direction & 1) ? 28 : 2; sint16 lengthX = (direction & 1) ? 2 : 28; - sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); + sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation(), 2, 2, height); if (transparant_image_id){ if (is_exit){ @@ -1353,11 +1349,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma image_id += 4; - word_9DEA52 = (direction & 1) ? 28 : 2; - word_9DEA54 = (direction & 1) ? 2 : 28; - word_9DEA56 = height; - - sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); + sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation(), (direction & 1) ? 28 : 2, (direction & 1) ? 2 : 28, height); if (transparant_image_id){ transparant_image_id += 4; diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 5c5a2cdae0..7d318c3a31 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -608,10 +608,7 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); - uint16 word_9DEA52 = 0; - uint16 word_9DEA54 = 0; - uint16 word_9DEA56 = height; - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -635,11 +632,8 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - word_9DEA52 = 30; - word_9DEA54 = 2; - word_9DEA56 = height + 2; - sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); + sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation(), 30, 2, height + 2); } top_spin_paint_vehicle(-32, 32, rideIndex, direction, height, mapElement); From cb9b31f87370ef4d899d5db10089b6e215812822 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 14 Apr 2016 11:49:44 +0200 Subject: [PATCH 06/11] Remove leading whitespace --- src/interface/viewport.c | 1 - src/ride/track_paint.c | 30 ------------------------------ 2 files changed, 31 deletions(-) diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 4dc580c18e..3665855878 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -1353,7 +1353,6 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma if (transparant_image_id){ transparant_image_id += 4; - sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, 0, (direction & 1) ? 28 : 2, (direction & 1) ? 2 : 28, height); } diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 7d318c3a31..e88e957b76 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -140,7 +140,6 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += rideEntry->vehicles[0].base_image_id; // Left back bottom support image_id += 572; - sub_98197C(image_id, al, cl, lengthX, lengthY, 90, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); image_id = RCT2_GLOBAL(0x00F441A0, uint32); @@ -354,7 +353,6 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); @@ -366,9 +364,7 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di rct_ride* ride = get_ride(rideIndex); if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { - image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 0, 2, height + 2); } @@ -377,9 +373,7 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di (((y / 32) + loc_7667AC[get_current_rotation()].y) << 8); if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { - image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 0, 2, height + 2); } @@ -414,7 +408,6 @@ static void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); @@ -426,9 +419,7 @@ static void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 di rct_ride* ride = get_ride(rideIndex); if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { - image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 2, 0, height + 2); } @@ -458,7 +449,6 @@ static void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); @@ -470,9 +460,7 @@ static void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 di rct_ride* ride = get_ride(rideIndex); if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { - image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 0, 2, height + 2); } @@ -502,7 +490,6 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); @@ -514,9 +501,7 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di rct_ride* ride = get_ride(rideIndex); if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { - image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 2, 0, height + 2); } @@ -527,7 +512,6 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation(), 0, 30, height + 2); } @@ -562,7 +546,6 @@ static void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); @@ -575,7 +558,6 @@ static void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation(), 0, 30, height + 2); } @@ -607,7 +589,6 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); @@ -619,9 +600,7 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di rct_ride* ride = get_ride(rideIndex); if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { - image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 0, 2, height + 2); } @@ -632,7 +611,6 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation(), 30, 2, height + 2); } @@ -667,7 +645,6 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22134 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); @@ -681,7 +658,6 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 1, 28, 7, height, get_current_rotation(), 29, 0, height + 3); } @@ -692,7 +668,6 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 28, 1, 7, height, get_current_rotation(), 0, 29, height + 3); } @@ -727,7 +702,6 @@ static void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); @@ -741,7 +715,6 @@ static void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation(), 30, 0, height + 2); } top_spin_paint_vehicle(-32, 0, rideIndex, direction, height, mapElement); @@ -968,7 +941,6 @@ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi if (hasSupports) { uint32 foundationImageId = RCT2_GLOBAL(0x00F441A4, uint32); foundationImageId |= 3395; - sub_98197C(foundationImageId, 0, 0, 28, 28, 45, height, rotation, 2, 2, height16); sub_98199C(imageId, 0, 0, 28, 28, 45, height, rotation, 2, 2, height16); @@ -1029,14 +1001,12 @@ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 dir if (hasSupports) { uint32 foundationImageId = RCT2_GLOBAL(0x00F441A4, uint32); foundationImageId |= 3395; - sub_98197C(foundationImageId, 0, 0, lengthX, lengthY, 29, height, rotation, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16); // Door image or base sub_98199C(imageId, 0, 0, lengthX, lengthY, 29, height, rotation, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16); } else { // Door image or base - sub_98197C(imageId, 0, 0, lengthX, lengthY, 29, height, rotation, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16); } From 18a36298b497491a3ad25effa2064605e42bb9ff Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 17 Apr 2016 09:42:34 +0200 Subject: [PATCH 07/11] Update method signature --- src/drawing/supports.c | 8 +- src/interface/viewport.c | 195 ++++++++++++++++++++++----------------- src/interface/viewport.h | 8 +- src/ride/track_paint.c | 120 ++++++++---------------- 4 files changed, 156 insertions(+), 175 deletions(-) diff --git a/src/drawing/supports.c b/src/drawing/supports.c index 8507fc4c96..8f75f3f3f0 100644 --- a/src/drawing/supports.c +++ b/src/drawing/supports.c @@ -200,9 +200,9 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin } else { imageId += word_97B3C4[slope & 0x1F]; imageId |= imageColourFlags; - sub_98197C(imageId, 0, 0, 32, 32, 11, z, rotation, 0, 0, z + 2); + sub_98197C(imageId, 0, 0, 32, 32, 11, z, 0, 0, z + 2, rotation); - sub_98197C(imageId + 4, 0, 0, 32, 32, 11, z + 16, rotation, 0, 0, z + 16 + 2); + sub_98197C(imageId + 4, 0, 0, 32, 32, 11, z + 16, 0, 0, z + 16 + 2, rotation); hasSupports = true; } @@ -278,11 +278,11 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin uint16 lengthX = byte_97B23C[special].var_4; uint8 ah = byte_97B23C[special].var_5; if (byte_97B23C[special].var_6 == 0 || RCT2_GLOBAL(0x009DEA58, uint32) == 0) { - sub_98197C(imageId, 0, 0, lengthX, lengthY, ah, z, rotation, word_9DEA52, word_9DEA54, word_9DEA56); + sub_98197C(imageId, 0, 0, lengthX, lengthY, ah, z, word_9DEA52, word_9DEA54, word_9DEA56, rotation); hasSupports = true; } else { hasSupports = true; - if (!sub_98198C(imageId, 0, 0, lengthX, lengthY, ah, z, rotation, word_9DEA52, word_9DEA54, word_9DEA56)) { + if (!sub_98198C(imageId, 0, 0, lengthX, lengthY, ah, z, word_9DEA52, word_9DEA54, word_9DEA56, rotation)) { int edi = RCT2_GLOBAL(0x009DEA58, uint32); RCT2_GLOBAL(edi + 0x20, uint32) = imageColourFlags; } diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 3665855878..03e82c7aa4 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -863,28 +863,35 @@ void sub_688485(){ * @param image_id (ebx) * @param x_offset (al) * @param y_offset (cl) - * @param length_x (di) - * @param length_y (si) - * @param z_offset (ah) - * @param height (edx) - * @param rotation - * @param word_52 (0x009DEA52) - * @param word_54 (0x009DEA54) - * @param word_56 (0x009DEA56) + * @param bound_box_length_x (di) + * @param bound_box_length_y (si) + * @param bound_box_length_z (ah) + * @param z_offset (edx) + * @param bound_box_offset_x (0x009DEA52) + * @param bound_box_offset_y (0x009DEA54) + * @param bound_box_offset_z (0x009DEA56) + * @param rotation (ebp) * @return ?? */ -int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56) { - RCT2_GLOBAL(0x009DEA52, uint16) = word_52; - RCT2_GLOBAL(0x009DEA54, uint16) = word_54; - RCT2_GLOBAL(0x009DEA56, uint16) = word_56; +int sub_98199C( + int image_id, + sint8 x_offset, sint8 y_offset, + sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, + int z_offset, + uint16 bound_box_offset_x, uint16 bound_box_offset_y, uint16 bound_box_offset_z, + uint32 rotation +) { + RCT2_GLOBAL(0x009DEA52, uint16) = bound_box_offset_x; + RCT2_GLOBAL(0x009DEA54, uint16) = bound_box_offset_y; + RCT2_GLOBAL(0x009DEA56, uint16) = bound_box_offset_z; RCT2_CALLPROC_X(RCT2_ADDRESS(0x98199C, uint32_t)[get_current_rotation()], - x_offset | (z_offset << 8), + x_offset | (bound_box_length_z << 8), image_id, y_offset, - height, - length_y, - length_x, + z_offset, + bound_box_length_y, + bound_box_length_x, rotation); return 1; } @@ -895,22 +902,27 @@ int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si * @param image_id (ebx) * @param x_offset (al) * @param y_offset (cl) - * @param length_x (di) - * @param length_y (si) - * @param z_offset (ah) - * @param height (edx) - * @param rotation + * @param bound_box_length_x (di) + * @param bound_box_length_y (si) + * @param bound_box_length_z (ah) + * @param z_offset (edx) + * @param rotation (ebp) * @return ?? */ -int sub_98196C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation) -{ +int sub_98196C( + int image_id, + sint8 x_offset, sint8 y_offset, + sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, + int z_offset, + uint32 rotation +) { RCT2_CALLPROC_X(RCT2_ADDRESS(0x0098196C, uint32)[get_current_rotation()], - x_offset | (z_offset << 8), + x_offset | (bound_box_length_z << 8), image_id, y_offset, - height, - length_y, - length_x, + z_offset, + bound_box_length_y, + bound_box_length_x, rotation ); return 1; @@ -922,17 +934,24 @@ int sub_98196C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si * @param image_id (ebx) * @param x_offset (al) * @param y_offset (cl) - * @param length_x (di) - * @param length_y (si) - * @param z_offset (ah) - * @param height (edx) - * @param rotation - * @param word_52 (0x009DEA52) - * @param word_54 (0x009DEA54) - * @param word_56 (0x009DEA56) + * @param bound_box_length_x (di) + * @param bound_box_length_y (si) + * @param bound_box_length_z (ah) + * @param z_offset (edx) + * @param bound_box_offset_x (0x009DEA52) + * @param bound_box_offset_y (0x009DEA54) + * @param bound_box_offset_z (0x009DEA56) + * @param rotation (ebp) */ -int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, sint16 s_unk_x, sint16 s_unk_y, sint16 word_56) { - int ebp = z_offset + word_56; +int sub_98197C( + int image_id, + sint8 x_offset, sint8 y_offset, + sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, + int z_offset, + sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z, + uint32 rotation +) { + int ebp = bound_box_length_z + bound_box_offset_z; RCT2_GLOBAL(0xF1AD28, paint_struct*) = 0; RCT2_GLOBAL(0xF1AD2C, uint32) = 0; @@ -950,7 +969,7 @@ int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si rct_xyz16 coord_3d = { .x = x_offset, .y = y_offset, - .z = height + .z = z_offset }; switch (rotation) { @@ -992,13 +1011,13 @@ int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si if (bottom > dpi->y + dpi->height)return 1; rct_xy16 boundBox = { - .x = length_x, - .y = length_y + .x = bound_box_length_x, + .y = bound_box_length_y }; - rct_xy16 s_unk = { - .x = s_unk_x, - .y = s_unk_y + rct_xy16 boundBoxOffset = { + .x = bound_box_offset_x, + .y = bound_box_offset_y }; // Unsure why rots 1 and 3 need to swap @@ -1006,32 +1025,32 @@ int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si case 0: boundBox.x--; boundBox.y--; - rotate_map_coordinates(&s_unk.x, &s_unk.y, 0); + rotate_map_coordinates(&boundBoxOffset.x, &boundBoxOffset.y, 0); rotate_map_coordinates(&boundBox.x, &boundBox.y, 0); break; case 1: boundBox.x--; - rotate_map_coordinates(&s_unk.x, &s_unk.y, 3); + rotate_map_coordinates(&boundBoxOffset.x, &boundBoxOffset.y, 3); rotate_map_coordinates(&boundBox.x, &boundBox.y, 3); break; case 2: rotate_map_coordinates(&boundBox.x, &boundBox.y, 2); - rotate_map_coordinates(&s_unk.x, &s_unk.y, 2); + rotate_map_coordinates(&boundBoxOffset.x, &boundBoxOffset.y, 2); break; case 3: boundBox.y--; rotate_map_coordinates(&boundBox.x, &boundBox.y, 1); - rotate_map_coordinates(&s_unk.x, &s_unk.y, 1); + rotate_map_coordinates(&boundBoxOffset.x, &boundBoxOffset.y, 1); break; } - ps->other_x = boundBox.x + s_unk.x + RCT2_GLOBAL(0x9DE568, sint16); - ps->some_x = word_56; + ps->other_x = boundBox.x + boundBoxOffset.x + RCT2_GLOBAL(0x9DE568, sint16); + ps->some_x = bound_box_offset_z; ps->some_y = ebp; - ps->other_y = boundBox.y + s_unk.y + RCT2_GLOBAL(0x009DE56C, sint16); + ps->other_y = boundBox.y + boundBoxOffset.y + RCT2_GLOBAL(0x009DE56C, sint16); ps->var_1A = 0; - ps->attached_x = s_unk.x + RCT2_GLOBAL(0x9DE568, sint16); - ps->attached_y = s_unk.y + RCT2_GLOBAL(0x009DE56C, sint16); + ps->attached_x = boundBoxOffset.x + RCT2_GLOBAL(0x9DE568, sint16); + ps->attached_y = boundBoxOffset.y + RCT2_GLOBAL(0x009DE56C, sint16); ps->attached_ps = NULL; ps->var_20 = NULL; ps->sprite_type = RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8); @@ -1093,29 +1112,35 @@ int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, si * @param image_id (ebx) * @param x_offset (al) * @param y_offset (cl) - * @param length_x (di) - * @param length_y (si) - * @param z_offset (ah) - * @param height (edx) + * @param bound_box_length_x (di) + * @param bound_box_length_y (si) + * @param bound_box_length_z (ah) + * @param z_offset (edx) + * @param bound_box_offset_x (0x009DEA52) + * @param bound_box_offset_y (0x009DEA54) + * @param bound_box_offset_z (0x009DEA56) * @param rotation - * @param word_52 (0x009DEA52) - * @param word_54 (0x009DEA54) - * @param word_56 (0x009DEA56) * @return ?? */ -int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56) -{ - RCT2_GLOBAL(0x009DEA52, uint16) = word_52; - RCT2_GLOBAL(0x009DEA54, uint16) = word_54; - RCT2_GLOBAL(0x009DEA56, uint16) = word_56; +int sub_98198C( + int image_id, + sint8 x_offset, sint8 y_offset, + sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, + int z_offset, + uint16 bound_box_offset_x, uint16 bound_box_offset_y, uint16 bound_box_offset_z, + uint32 rotation +) { + RCT2_GLOBAL(0x009DEA52, uint16) = bound_box_offset_x; + RCT2_GLOBAL(0x009DEA54, uint16) = bound_box_offset_y; + RCT2_GLOBAL(0x009DEA56, uint16) = bound_box_offset_z; RCT2_CALLPROC_X(RCT2_ADDRESS(0x0098198C, uint32)[get_current_rotation()], - x_offset | (z_offset << 8), + x_offset | (bound_box_length_z << 8), image_id, y_offset, - height, - length_y, - length_x, + z_offset, + bound_box_length_y, + bound_box_length_x, rotation ); return 1; @@ -1136,7 +1161,7 @@ void viewport_vehicle_paint_setup(rct_vehicle *vehicle, int imageDirection) if (vehicle->flags & SPRITE_FLAGS_IS_CRASHED_VEHICLE_SPRITE) { uint32 ebx = 22965 + vehicle->var_C5; - sub_98197C(ebx, 0, 0, 1, 1, 0, z, get_current_rotation(), 0, 0, z + 2); + sub_98197C(ebx, 0, 0, 1, 1, 0, z, 0, 0, z + 2, get_current_rotation()); return; } @@ -1211,7 +1236,7 @@ void viewport_litter_paint_setup(rct_litter *litter, int imageDirection) uint32 image_id = imageDirection + RCT2_ADDRESS(0x97EF6C, uint32)[litter->type * 2]; - sub_98197C(image_id, 0, 0, 4, 4, 0xFF, litter->z, get_current_rotation(), 0xFFFC, 0xFFFC, litter->z + 2); + sub_98197C(image_id, 0, 0, 4, 4, 0xFF, litter->z, 0xFFFC, 0xFFFC, litter->z + 2, get_current_rotation()); } @@ -1334,7 +1359,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma sint16 lengthY = (direction & 1) ? 28 : 2; sint16 lengthX = (direction & 1) ? 2 : 28; - sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation(), 2, 2, height); + sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, 2, 2, height, get_current_rotation()); if (transparant_image_id){ if (is_exit){ @@ -1344,16 +1369,16 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma transparant_image_id |= style->sprite_index + direction + 16; } - sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, 0, 2, 2, height); + sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, 2, 2, height, 0); } image_id += 4; - sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, get_current_rotation(), (direction & 1) ? 28 : 2, (direction & 1) ? 2 : 28, height); + sub_98197C(image_id, 0, 0, lengthX, lengthY, ah, height, (direction & 1) ? 28 : 2, (direction & 1) ? 2 : 28, height, get_current_rotation()); if (transparant_image_id){ transparant_image_id += 4; - sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, 0, (direction & 1) ? 28 : 2, (direction & 1) ? 2 : 28, height); + sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, (direction & 1) ? 28 : 2, (direction & 1) ? 2 : 28, height, 0); } uint32 eax = 0xFFFF0600 | ((height / 16) & 0xFF); @@ -1396,7 +1421,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma uint16 string_width = gfx_get_string_width(entrance_string); uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width; - sub_98199C(scrolling_text_setup(string_id, scroll, style->scrolling_mode), 0, 0, 0x1C, 0x1C, 0x33, height + style->height, 0, 2, 2, height + style->height); + sub_98199C(scrolling_text_setup(string_id, scroll, style->scrolling_mode), 0, 0, 0x1C, 0x1C, 0x33, height + style->height, 2, 2, height + style->height, 0); } image_id = RCT2_GLOBAL(0x009E32BC, uint32); @@ -1450,11 +1475,11 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele switch (part_index){ case 0: image_id = (path_entry->image + 5 * (1 + (direction & 1))) | ghost_id; - sub_98197C(image_id, 0, 0, 32, 0x1C, 0, height, get_current_rotation(), 0, 2, height); + sub_98197C(image_id, 0, 0, 32, 0x1C, 0, height, 0, 2, height, get_current_rotation()); entrance = (rct_entrance_type*)object_entry_groups[OBJECT_TYPE_PARK_ENTRANCE].chunks[0]; image_id = (entrance->image_id + direction * 3) | ghost_id; - sub_98197C(image_id, 0, 0, 0x1C, 0x1C, 0x2F, height, get_current_rotation(), 2, 2, height + 32); + sub_98197C(image_id, 0, 0, 0x1C, 0x1C, 0x2F, height, 2, 2, height + 32, get_current_rotation()); if ((direction + 1) & (1 << 1)) break; @@ -1486,13 +1511,13 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele if (entrance->scrolling_mode == 0xFF) break; - sub_98199C(scrolling_text_setup(park_text_id, scroll, entrance->scrolling_mode + direction / 2), 0, 0, 0x1C, 0x1C, 0x2F, height + entrance->text_height, 0, 2, 2, height + entrance->text_height); + sub_98199C(scrolling_text_setup(park_text_id, scroll, entrance->scrolling_mode + direction / 2), 0, 0, 0x1C, 0x1C, 0x2F, height + entrance->text_height, 2, 2, height + entrance->text_height, 0); break; case 1: case 2: entrance = (rct_entrance_type*)object_entry_groups[OBJECT_TYPE_PARK_ENTRANCE].chunks[0]; image_id = (entrance->image_id + part_index + direction * 3) | ghost_id; - sub_98197C(image_id, 0, 0, 0x1A, di, 0x4F, height, get_current_rotation(), 3, 3, height); + sub_98197C(image_id, 0, 0, 0x1A, di, 0x4F, height, 3, 3, height, get_current_rotation()); break; } @@ -1555,7 +1580,7 @@ void viewport_track_paint_setup(uint8 direction, int height, rct_map_element *ma uint32 ebx = 0x20381689 + (height + 8) / 16; ebx += RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16); ebx -= RCT2_GLOBAL(0x01359208, uint16); - sub_98197C(ebx, 16, 16, 1, 1, 0, height + ax + 3, get_current_rotation(), 1000, 1000, 2047); + sub_98197C(ebx, 16, 16, 1, 1, 0, height + ax + 3, 1000, 1000, 2047, get_current_rotation()); } } @@ -1634,7 +1659,7 @@ void viewport_entrance_paint_setup(uint8 direction, int height, rct_map_element* image_id -= RCT2_GLOBAL(0x01359208, sint16); - sub_98197C(image_id, 16, 16, 1, 1, 0, height, get_current_rotation(), 31, 31, z + 64); + sub_98197C(image_id, 16, 16, 1, 1, 0, height, 31, 31, z + 64, get_current_rotation()); } } @@ -1687,12 +1712,12 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m 0x20000000; } - sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); + sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, word_9DEA52, word_9DEA54, word_9DEA56, get_current_rotation()); word_9DEA52 = RCT2_ADDRESS(0x98D888, uint16)[direction * 2]; word_9DEA54 = RCT2_ADDRESS(0x98D888 + 2, uint16)[direction * 2]; image_id++; - sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); + sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, word_9DEA52, word_9DEA54, word_9DEA56, get_current_rotation()); // Opposite direction direction ^= 2; @@ -1723,7 +1748,7 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m uint16 string_width = gfx_get_string_width(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char)); uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width; - sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, 0, word_9DEA52, word_9DEA54, word_9DEA56); + sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, word_9DEA52, word_9DEA54, word_9DEA56, 0); } /** @@ -1784,7 +1809,7 @@ static void sub_68B3FB(int x, int y) RCT2_GLOBAL(0x9DE56C, sint16) = y; RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8) = VIEWPORT_INTERACTION_ITEM_NONE; - sub_98197C(imageId, 0, 0, 32, 32, 0xFF, arrowZ, rotation, 0, 0, arrowZ + 18); + sub_98197C(imageId, 0, 0, 32, 32, 0xFF, arrowZ, 0, 0, arrowZ + 18, rotation); } int bx = dx + 52; diff --git a/src/interface/viewport.h b/src/interface/viewport.h index d2cccd0477..ce9321cb36 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -131,10 +131,10 @@ void painter_setup(); void sub_688485(); void sub_688217(); -int sub_98196C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation); -int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, sint16 s_unk_x, sint16 s_unk_y, sint16 word_56); -int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56); -int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 length_x, sint16 length_y, sint8 z_offset, int height, uint32 rotation, uint16 word_52, uint16 word_54, uint16 word_56); +int sub_98196C(int image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, int z_offset, uint32 rotation); +int sub_98197C(int image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, int z_offset, sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z, uint32 rotation); +int sub_98198C(int image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, int z_offset, uint16 bound_box_offset_x, uint16 bound_box_offset_y, uint16 bound_box_offset_z, uint32 rotation); +int sub_98199C(int image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, int z_offset, uint16 bound_box_offset_x, uint16 bound_box_offset_y, uint16 bound_box_offset_z, uint32 rotation); void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, int bottom); diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index e88e957b76..bf1c4614e5 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -41,7 +41,7 @@ static void top_spin_paint_tile_0(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation()); RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; @@ -140,7 +140,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += rideEntry->vehicles[0].base_image_id; // Left back bottom support image_id += 572; - sub_98197C(image_id, al, cl, lengthX, lengthY, 90, height, get_current_rotation(), word_9DEA52, word_9DEA54, word_9DEA56); + sub_98197C(image_id, al, cl, lengthX, lengthY, 90, height, word_9DEA52, word_9DEA54, word_9DEA56, get_current_rotation()); image_id = RCT2_GLOBAL(0x00F441A0, uint32); if (image_id == 0x20000000) { @@ -162,18 +162,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di // Left hand arm image_id += 380; - sub_98199C( - image_id, - al, - cl, - lengthX, - lengthY, - 90, - height, - 0, - word_9DEA52, - word_9DEA54, - word_9DEA56); + sub_98199C(image_id, al, cl, lengthX, lengthY, 90, height, word_9DEA52, word_9DEA54, word_9DEA56, 0); uint32 seatImageId; @@ -229,18 +218,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di RCT2_GLOBAL(0x014280B9, sint8) = (sint8)seatCoords.y; RCT2_GLOBAL(0x014280BA, sint16) = seatCoords.z; - sub_98199C( - image_id, - (sint8)seatCoords.x, - (sint8)seatCoords.y, - lengthX, - lengthY, - 90, - seatCoords.z, - 0, - word_9DEA52, - word_9DEA54, - word_9DEA56); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); if (dpi->zoom_level < 2 && vehicle != NULL && vehicle->num_peeps != 0) { @@ -251,7 +229,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 76; - sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0, word_9DEA52, word_9DEA54, word_9DEA56); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); if (vehicle->num_peeps > 2) { image_id = @@ -261,7 +239,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 152; - sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0, word_9DEA52, word_9DEA54, word_9DEA56); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); } if (vehicle->num_peeps > 4) { @@ -272,7 +250,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 228; - sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0, word_9DEA52, word_9DEA54, word_9DEA56); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); } if (vehicle->num_peeps > 6) { @@ -283,7 +261,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 304; - sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, 0, word_9DEA52, word_9DEA54, word_9DEA56); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); } } @@ -301,18 +279,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di // Right hand arm image_id += 476; - sub_98199C( - image_id, - al, - cl, - lengthX, - lengthY, - 90, - height, - 0, - word_9DEA52, - word_9DEA54, - word_9DEA56); + sub_98199C(image_id, al, cl, lengthX, lengthY, 90, height, word_9DEA52, word_9DEA54, word_9DEA56, 0); image_id = RCT2_GLOBAL(0x00F441A0, uint32); if (image_id == 0x20000000) { @@ -327,18 +294,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di // Right back bottom support image_id += 573; - sub_98199C( - image_id, - al, - cl, - lengthX, - lengthY, - 90, - height, - 0, - word_9DEA52, - word_9DEA54, - word_9DEA56); + sub_98199C(image_id, al, cl, lengthX, lengthY, 90, height, word_9DEA52, word_9DEA54, word_9DEA56, 0); RCT2_GLOBAL(0x009DE578, rct_map_element*) = curMapElement; RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8) = VIEWPORT_INTERACTION_ITEM_RIDE; @@ -353,7 +309,7 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation()); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -365,7 +321,7 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 0, 2, height + 2); + sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 2, height + 2, 0); } entranceLoc = @@ -374,7 +330,7 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 0, 2, height + 2); + sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 2, height + 2, 0); } top_spin_paint_vehicle(32, 32, rideIndex, direction, height, mapElement); @@ -408,7 +364,7 @@ static void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation()); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -420,7 +376,7 @@ static void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 2, 0, height + 2); + sub_98199C(image_id, 0, 0, 1, 32, 7, height, 2, 0, height + 2, 0); } RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; @@ -449,7 +405,7 @@ static void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation()); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -461,7 +417,7 @@ static void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 0, 2, height + 2); + sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 2, height + 2, 0); } RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; @@ -490,7 +446,7 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation()); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -502,7 +458,7 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 2, 0, height + 2); + sub_98199C(image_id, 0, 0, 1, 32, 7, height, 2, 0, height + 2, 0); } entranceLoc = @@ -512,7 +468,7 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation(), 0, 30, height + 2); + sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 30, height + 2, get_current_rotation()); } top_spin_paint_vehicle(32, -32, rideIndex, direction, height, mapElement); @@ -546,7 +502,7 @@ static void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation()); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; @@ -558,7 +514,7 @@ static void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation(), 0, 30, height + 2); + sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 30, height + 2, get_current_rotation()); } top_spin_paint_vehicle(0, -32, rideIndex, direction, height, mapElement); @@ -589,7 +545,7 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation()); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint16 entranceLoc = @@ -601,7 +557,7 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 0, 2, height + 2); + sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 2, height + 2, 0); } entranceLoc = @@ -611,7 +567,7 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation(), 30, 2, height + 2); + sub_98197C(image_id, 0, 0, 1, 32, 7, height, 30, 2, height + 2, get_current_rotation()); } top_spin_paint_vehicle(-32, 32, rideIndex, direction, height, mapElement); @@ -645,7 +601,7 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22134 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation()); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; @@ -658,7 +614,7 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 1, 28, 7, height, get_current_rotation(), 29, 0, height + 3); + sub_98197C(image_id, 0, 0, 1, 28, 7, height, 29, 0, height + 3, get_current_rotation()); } entranceLoc = @@ -668,7 +624,7 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 28, 1, 7, height, get_current_rotation(), 0, 29, height + 3); + sub_98197C(image_id, 0, 0, 28, 1, 7, height, 0, 29, height + 3, get_current_rotation()); } top_spin_paint_vehicle(-32, -32, rideIndex, direction, height, mapElement); @@ -702,7 +658,7 @@ static void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 di wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation(), 0, 0, height); + sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation()); sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; @@ -715,7 +671,7 @@ static void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 di if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32); - sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation(), 30, 0, height + 2); + sub_98197C(image_id, 0, 0, 1, 32, 7, height, 30, 0, height + 2, get_current_rotation()); } top_spin_paint_vehicle(-32, 0, rideIndex, direction, height, mapElement); @@ -941,11 +897,11 @@ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi if (hasSupports) { uint32 foundationImageId = RCT2_GLOBAL(0x00F441A4, uint32); foundationImageId |= 3395; - sub_98197C(foundationImageId, 0, 0, 28, 28, 45, height, rotation, 2, 2, height16); + sub_98197C(foundationImageId, 0, 0, 28, 28, 45, height, 2, 2, height16, rotation); - sub_98199C(imageId, 0, 0, 28, 28, 45, height, rotation, 2, 2, height16); + sub_98199C(imageId, 0, 0, 28, 28, 45, height, 2, 2, height16, rotation); } else { - sub_98197C(imageId, 0, 0, 28, 28, 45, height, rotation, 2, 2, height16); + sub_98197C(imageId, 0, 0, 28, 28, 45, height, 2, 2, height16, rotation); } height16 += 48; @@ -1001,22 +957,22 @@ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 dir if (hasSupports) { uint32 foundationImageId = RCT2_GLOBAL(0x00F441A4, uint32); foundationImageId |= 3395; - sub_98197C(foundationImageId, 0, 0, lengthX, lengthY, 29, height, rotation, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16); + sub_98197C(foundationImageId, 0, 0, lengthX, lengthY, 29, height, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16, rotation); // Door image or base - sub_98199C(imageId, 0, 0, lengthX, lengthY, 29, height, rotation, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16); + sub_98199C(imageId, 0, 0, lengthX, lengthY, 29, height, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16, rotation); } else { // Door image or base - sub_98197C(imageId, 0, 0, lengthX, lengthY, 29, height, rotation, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16); + sub_98197C(imageId, 0, 0, lengthX, lengthY, 29, height, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height16, rotation); } // Base image if door was drawn if (direction == 1) { imageId += 2; - sub_98197C(imageId, 0, 0, 2, 28, 29, height, rotation, 28, 2, height16); + sub_98197C(imageId, 0, 0, 2, 28, 29, height, 28, 2, height16, rotation); } else if (direction == 2) { imageId += 4; - sub_98197C(imageId, 0, 0, 28, 2, 29, height, rotation, 2, 28, height16); + sub_98197C(imageId, 0, 0, 28, 2, 29, height, 2, 28, height16, rotation); } height16 += 32; From eabbdb7e3009659a702b5d1e593980568a289dd8 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 17 Apr 2016 10:31:50 +0200 Subject: [PATCH 08/11] Identify structure members --- src/drawing/supports.c | 126 ++++++++++++++++++++--------------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/src/drawing/supports.c b/src/drawing/supports.c index 8f75f3f3f0..e80e0188dd 100644 --- a/src/drawing/supports.c +++ b/src/drawing/supports.c @@ -42,67 +42,71 @@ const uint16 WoodenCurveSupportImageIds[] = { }; typedef struct { - uint8 var_0; - uint8 var_1; - uint8 var_2; - uint8 var_3; - uint8 var_4; - uint8 var_5; + struct { + uint8 x, y, z; + } offset; + struct { + uint8 y, x, z; + } length; +} unk_supports_desc_bound_box; + +typedef struct { + unk_supports_desc_bound_box bounding_box; uint8 var_6; uint8 var_7; } unk_supports_desc; /* 0x0097B23C */ const unk_supports_desc byte_97B23C[] = { - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 10, 0, 0, 10, 32, 44, 1, 1 }, - { 0, 10, 0, 32, 10, 44, 1, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 10, 0, 0, 10, 32, 44, 1, 1 }, - { 0, 10, 0, 32, 10, 44, 1, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 10, 0, 2, 10, 32, 76, 1, 1 }, - { 0, 10, 2, 32, 10, 76, 1, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 4, 0, 1 }, - { 0, 0, 0, 1, 1, 4, 0, 1 }, - { 0, 0, 0, 1, 1, 4, 0, 1 }, - { 0, 0, 0, 1, 1, 4, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 0, 0, 0, 1, 1, 8, 0, 1 }, - { 2, 2, 1, 28, 28, 2, 0, 1 }, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{10, 0, 0}, {10, 32, 44}}, 1, 1}, + {{{0, 10, 0}, {32, 10, 44}}, 1, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{10, 0, 0}, {10, 32, 44}}, 1, 1}, + {{{0, 10, 0}, {32, 10, 44}}, 1, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{10, 0, 2}, {10, 32, 76}}, 1, 1}, + {{{0, 10, 2}, {32, 10, 76}}, 1, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 4}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 4}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 4}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 4}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{0, 0, 0}, {1, 1, 8}}, 0, 1}, + {{{2, 2, 1}, {28, 28, 2}}, 0, 1}, }; /* 0x0097B3C4 */ @@ -271,18 +275,14 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin imageId += special; imageId |= imageColourFlags; - uint16 word_9DEA52 = byte_97B23C[special].var_0; - uint16 word_9DEA54 = byte_97B23C[special].var_1; - uint16 word_9DEA56 = byte_97B23C[special].var_2 + z; - uint16 lengthY = byte_97B23C[special].var_3; - uint16 lengthX = byte_97B23C[special].var_4; - uint8 ah = byte_97B23C[special].var_5; + unk_supports_desc_bound_box bBox = byte_97B23C[special].bounding_box; + if (byte_97B23C[special].var_6 == 0 || RCT2_GLOBAL(0x009DEA58, uint32) == 0) { - sub_98197C(imageId, 0, 0, lengthX, lengthY, ah, z, word_9DEA52, word_9DEA54, word_9DEA56, rotation); + sub_98197C(imageId, 0, 0, bBox.length.x, bBox.length.y, bBox.length.z, z, bBox.offset.x, bBox.offset.y, bBox.offset.z + z, rotation); hasSupports = true; } else { hasSupports = true; - if (!sub_98198C(imageId, 0, 0, lengthX, lengthY, ah, z, word_9DEA52, word_9DEA54, word_9DEA56, rotation)) { + if (!sub_98198C(imageId, 0, 0, bBox.length.x, bBox.length.y, bBox.length.z, z, bBox.offset.x, bBox.offset.y, bBox.offset.z + z, rotation)) { int edi = RCT2_GLOBAL(0x009DEA58, uint32); RCT2_GLOBAL(edi + 0x20, uint32) = imageColourFlags; } From d78077ce22b5a4fb465ddb8ae155106d6bd593d3 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Mon, 18 Apr 2016 15:34:06 +0200 Subject: [PATCH 09/11] Convert method call to sub_98197C --- src/drawing/supports.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/drawing/supports.c b/src/drawing/supports.c index e80e0188dd..4d75807e74 100644 --- a/src/drawing/supports.c +++ b/src/drawing/supports.c @@ -228,11 +228,7 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin imageId += word_97B3C4[slope & 0x1F]; imageId |= imageColourFlags; - uint16 word_9DEA52 = 0; - uint16 word_9DEA54 = 0; - uint16 word_9DEA56 = z + 2; - // Todo: check whether this function call is correct - sub_98196C(imageId, 0, 0, 32, 32, 11, z, rotation); + sub_98197C(imageId, 0, 0, 32, 32, 11, z, 0, 0, z + 2, rotation); hasSupports = true; } z += 16; From a610b372fdf38f747782d848f3dc1f6a258b7251 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Mon, 18 Apr 2016 15:35:33 +0200 Subject: [PATCH 10/11] Name addresses --- src/addresses.h | 4 ++++ src/interface/viewport.c | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index bc235a15f4..3fcbe8f0d4 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -211,6 +211,10 @@ #define RCT2_ADDRESS_MAP_ARROW_Z 0x009DEA4C #define RCT2_ADDRESS_MAP_ARROW_DIRECTION 0x009DEA4E +#define RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_X 0x009DEA52 +#define RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_Y 0x009DEA54 +#define RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_Z 0x009DEA56 + #define RCT2_ADDRESS_COMMAND_MAP_X 0x009DEA5E #define RCT2_ADDRESS_COMMAND_MAP_Y 0x009DEA60 #define RCT2_ADDRESS_COMMAND_MAP_Z 0x009DEA62 diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 03e82c7aa4..916f350764 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -881,9 +881,9 @@ int sub_98199C( uint16 bound_box_offset_x, uint16 bound_box_offset_y, uint16 bound_box_offset_z, uint32 rotation ) { - RCT2_GLOBAL(0x009DEA52, uint16) = bound_box_offset_x; - RCT2_GLOBAL(0x009DEA54, uint16) = bound_box_offset_y; - RCT2_GLOBAL(0x009DEA56, uint16) = bound_box_offset_z; + RCT2_GLOBAL(RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_X, uint16) = bound_box_offset_x; + RCT2_GLOBAL(RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_Y, uint16) = bound_box_offset_y; + RCT2_GLOBAL(RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_Z, uint16) = bound_box_offset_z; RCT2_CALLPROC_X(RCT2_ADDRESS(0x98199C, uint32_t)[get_current_rotation()], x_offset | (bound_box_length_z << 8), @@ -1130,9 +1130,9 @@ int sub_98198C( uint16 bound_box_offset_x, uint16 bound_box_offset_y, uint16 bound_box_offset_z, uint32 rotation ) { - RCT2_GLOBAL(0x009DEA52, uint16) = bound_box_offset_x; - RCT2_GLOBAL(0x009DEA54, uint16) = bound_box_offset_y; - RCT2_GLOBAL(0x009DEA56, uint16) = bound_box_offset_z; + RCT2_GLOBAL(RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_X, uint16) = bound_box_offset_x; + RCT2_GLOBAL(RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_Y, uint16) = bound_box_offset_y; + RCT2_GLOBAL(RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_Z, uint16) = bound_box_offset_z; RCT2_CALLPROC_X(RCT2_ADDRESS(0x0098198C, uint32)[get_current_rotation()], x_offset | (bound_box_length_z << 8), From e49abad3ffbc88b393d35bc879e67f32f799fb59 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Mon, 18 Apr 2016 15:36:15 +0200 Subject: [PATCH 11/11] Rename local variables --- src/interface/viewport.c | 18 +++++++++--------- src/ride/track_paint.c | 26 +++++++++++++------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 916f350764..1dd117956f 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -1680,7 +1680,7 @@ void viewport_entrance_paint_setup(uint8 direction, int height, rct_map_element* */ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* map_element) { - uint16 word_9DEA52, word_9DEA54, word_9DEA56; + uint16 boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ; rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8_t) = VIEWPORT_INTERACTION_ITEM_BANNER; @@ -1694,9 +1694,9 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m direction += map_element->properties.banner.position; direction &= 3; - word_9DEA52 = RCT2_ADDRESS(0x98D884, uint16)[direction * 2]; - word_9DEA54 = RCT2_ADDRESS(0x98D884 + 2, uint16)[direction * 2]; - word_9DEA56 = height + 2; + boundBoxOffsetX = RCT2_ADDRESS(0x98D884, uint16)[direction * 2]; + boundBoxOffsetY = RCT2_ADDRESS(0x98D884 + 2, uint16)[direction * 2]; + boundBoxOffsetZ = height + 2; uint32 base_id = (direction << 1) + banner_scenery->image; uint32 image_id = base_id; @@ -1712,12 +1712,12 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m 0x20000000; } - sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, word_9DEA52, word_9DEA54, word_9DEA56, get_current_rotation()); - word_9DEA52 = RCT2_ADDRESS(0x98D888, uint16)[direction * 2]; - word_9DEA54 = RCT2_ADDRESS(0x98D888 + 2, uint16)[direction * 2]; + sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, get_current_rotation()); + boundBoxOffsetX = RCT2_ADDRESS(0x98D888, uint16)[direction * 2]; + boundBoxOffsetY = RCT2_ADDRESS(0x98D888 + 2, uint16)[direction * 2]; image_id++; - sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, word_9DEA52, word_9DEA54, word_9DEA56, get_current_rotation()); + sub_98197C(image_id, 0, 0, 1, 1, 0x15, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, get_current_rotation()); // Opposite direction direction ^= 2; @@ -1748,7 +1748,7 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m uint16 string_width = gfx_get_string_width(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char)); uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width; - sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, word_9DEA52, word_9DEA54, word_9DEA56, 0); + sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, 0); } /** diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index bf1c4614e5..ca861e3867 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -94,7 +94,7 @@ static sint8 TopSpinSeatPositionOffset[] = { * rct2: 0x0076750D */ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 direction, int height, rct_map_element* mapElement) { - uint16 word_9DEA52, word_9DEA54, word_9DEA56; + uint16 boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ; // As we will be drawing a vehicle we need to backup the mapElement that // is assigned to the drawings. rct_map_element* curMapElement = RCT2_GLOBAL(0x009DE578, rct_map_element*); @@ -119,9 +119,9 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di seatRotation = vehicle->bank_rotation; } - word_9DEA52 = al + 16; - word_9DEA54 = cl + 16; - word_9DEA56 = height; + boundBoxOffsetX = al + 16; + boundBoxOffsetY = cl + 16; + boundBoxOffsetZ = height; //di uint8 lengthX = 24; @@ -140,7 +140,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += rideEntry->vehicles[0].base_image_id; // Left back bottom support image_id += 572; - sub_98197C(image_id, al, cl, lengthX, lengthY, 90, height, word_9DEA52, word_9DEA54, word_9DEA56, get_current_rotation()); + sub_98197C(image_id, al, cl, lengthX, lengthY, 90, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, get_current_rotation()); image_id = RCT2_GLOBAL(0x00F441A0, uint32); if (image_id == 0x20000000) { @@ -162,7 +162,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di // Left hand arm image_id += 380; - sub_98199C(image_id, al, cl, lengthX, lengthY, 90, height, word_9DEA52, word_9DEA54, word_9DEA56, 0); + sub_98199C(image_id, al, cl, lengthX, lengthY, 90, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, 0); uint32 seatImageId; @@ -218,7 +218,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di RCT2_GLOBAL(0x014280B9, sint8) = (sint8)seatCoords.y; RCT2_GLOBAL(0x014280BA, sint16) = seatCoords.z; - sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, 0); rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); if (dpi->zoom_level < 2 && vehicle != NULL && vehicle->num_peeps != 0) { @@ -229,7 +229,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 76; - sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, 0); if (vehicle->num_peeps > 2) { image_id = @@ -239,7 +239,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 152; - sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, 0); } if (vehicle->num_peeps > 4) { @@ -250,7 +250,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 228; - sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, 0); } if (vehicle->num_peeps > 6) { @@ -261,7 +261,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di image_id += 0xA0000000; image_id += 304; - sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, word_9DEA52, word_9DEA54, word_9DEA56, 0); + sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, 0); } } @@ -279,7 +279,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di // Right hand arm image_id += 476; - sub_98199C(image_id, al, cl, lengthX, lengthY, 90, height, word_9DEA52, word_9DEA54, word_9DEA56, 0); + sub_98199C(image_id, al, cl, lengthX, lengthY, 90, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, 0); image_id = RCT2_GLOBAL(0x00F441A0, uint32); if (image_id == 0x20000000) { @@ -294,7 +294,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di // Right back bottom support image_id += 573; - sub_98199C(image_id, al, cl, lengthX, lengthY, 90, height, word_9DEA52, word_9DEA54, word_9DEA56, 0); + sub_98199C(image_id, al, cl, lengthX, lengthY, 90, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, 0); RCT2_GLOBAL(0x009DE578, rct_map_element*) = curMapElement; RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8) = VIEWPORT_INTERACTION_ITEM_RIDE;