From 8889530869ff5f4edc67a77ed24495636191638b Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 11 Aug 2016 20:43:31 +0200 Subject: [PATCH 1/7] Use wage_table --- src/management/finance.c | 6 +++++- src/management/finance.h | 1 + src/windows/staff.c | 2 +- src/windows/staff_list.c | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/management/finance.c b/src/management/finance.c index a6b2aacbe2..5c3220b829 100644 --- a/src/management/finance.c +++ b/src/management/finance.c @@ -25,7 +25,11 @@ #include "../world/sprite.h" #include "finance.h" -// Monthly staff wages +/** + * Monthly staff wages + * + * rct2: 0x00992A00 + */ const money32 wage_table[4] = { MONEY(50,00), // Handyman MONEY(80,00), // Mechanic diff --git a/src/management/finance.h b/src/management/finance.h index 7232619f12..b304293bea 100644 --- a/src/management/finance.h +++ b/src/management/finance.h @@ -53,6 +53,7 @@ enum { #define gWeeklyProfitAverageDivisor RCT2_GLOBAL(RCT2_ADDRESS_WEEKLY_PROFIT_AVERAGE_DIVISOR, uint16) extern const money32 research_cost_table[4]; +extern const money32 wage_table[4]; extern money32 *gCashHistory; extern money32 *gWeeklyProfitHistory; diff --git a/src/windows/staff.c b/src/windows/staff.c index 09c722a537..b5b1e35af9 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -1059,7 +1059,7 @@ void window_staff_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) int y = w->y + window_staff_stats_widgets[WIDX_RESIZE].top + 4; if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { - set_format_arg(0, uint32, RCT2_ADDRESS(0x00992A00, uint16)[peep->staff_type]); + set_format_arg(0, money32, wage_table[peep->staff_type]); gfx_draw_string_left(dpi, STR_STAFF_STAT_WAGES, gCommonFormatArgs, 0, x, y); y += 10; } diff --git a/src/windows/staff_list.c b/src/windows/staff_list.c index 079902722d..d763fc80d2 100644 --- a/src/windows/staff_list.c +++ b/src/windows/staff_list.c @@ -596,7 +596,7 @@ void window_staff_list_paint(rct_window *w, rct_drawpixelinfo *dpi) } if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { - set_format_arg(0, uint32, RCT2_ADDRESS(0x00992A00, uint16)[selectedTab]); + set_format_arg(0, money32, wage_table[selectedTab]); gfx_draw_string_left(dpi, STR_COST_PER_MONTH, gCommonFormatArgs, 0, w->x + w->width - 155, w->y + 0x20); } From 69bbf7ea3bbc9d031ff1897c4f4b168c2d074e4a Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 11 Aug 2016 20:52:56 +0200 Subject: [PATCH 2/7] Use RequiredSelectedObjects --- src/windows/editor_inventions_list.c | 7 ++++--- src/windows/editor_object_selection.c | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/windows/editor_inventions_list.c b/src/windows/editor_inventions_list.c index 66119e0de9..e8e7ce013f 100644 --- a/src/windows/editor_inventions_list.c +++ b/src/windows/editor_inventions_list.c @@ -249,6 +249,8 @@ static void research_rides_setup(){ } } +extern rct_object_entry RequiredSelectedObjects[7]; + /** * * rct2: 0x0068590C @@ -256,9 +258,8 @@ static void research_rides_setup(){ */ static void research_scenery_sets_setup(){ - for (rct_object_entry* object = RCT2_ADDRESS(0x0098DA74, rct_object_entry); - (object->flags & 0xFF) != 0xFF; - object++){ + for (int i = 0; i < countof(RequiredSelectedObjects); i++) { + rct_object_entry * object = &RequiredSelectedObjects[i]; uint8 entry_type, entry_index; if (!find_object_in_entry_group(object, &entry_type, &entry_index)) diff --git a/src/windows/editor_object_selection.c b/src/windows/editor_object_selection.c index 4e42e41c5e..40f601cbd6 100644 --- a/src/windows/editor_object_selection.c +++ b/src/windows/editor_object_selection.c @@ -249,7 +249,8 @@ static void filter_update_counts(); void reset_selected_object_count_and_size(); static int sub_6AB211(); -static rct_object_entry RequiredSelectedObjects[] = { +/** rct2: 0x0098DA74 */ +rct_object_entry RequiredSelectedObjects[] = { // Objects that are always required { 0x00000087, { "SCGTREES" }, 0 }, // Scenery: Trees { 0x00000087, { "SCGSHRUB" }, 0 }, // Scenery: Shrubs and Ornaments From 71c1f13ffad7789f32a7f490afac1e1f0f0fc048 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 11 Aug 2016 21:30:15 +0200 Subject: [PATCH 3/7] Integrate 0x0098D8B4 --- src/windows/footpath.c | 47 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/src/windows/footpath.c b/src/windows/footpath.c index 2d4e9bdcaf..b1daa55f8e 100644 --- a/src/windows/footpath.c +++ b/src/windows/footpath.c @@ -146,6 +146,49 @@ static sint8 _window_footpath_provisional_path_arrow_timer; static uint8 _lastUpdatedCameraRotation = UINT8_MAX; static bool _footpathErrorOccured; + +enum +{ + FOOTHPATH_IS_SLOPED = (1 << 2), + IRREGULAR_SLOPE = (1 << 3), +}; + +/** rct2: 0x0098D8B4 */ +const uint8 default_path_slope[] = { + 0, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + FOOTHPATH_IS_SLOPED | 2, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + FOOTHPATH_IS_SLOPED | 3, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + FOOTHPATH_IS_SLOPED | 1, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + FOOTHPATH_IS_SLOPED | 0, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, + IRREGULAR_SLOPE, +}; + static void window_footpath_mousedown_direction(int direction); static void window_footpath_mousedown_slope(int slope); static void window_footpath_show_footpath_types_dialog(rct_window *w, rct_widget *widget, int showQueues); @@ -688,7 +731,7 @@ static void window_footpath_set_provisional_path_at_point(int x, int y) footpath_provisional_update(); // Set provisional path - slope = RCT2_ADDRESS(0x0098D8B4, uint8)[mapElement->properties.surface.slope & 0x1F]; + slope = default_path_slope[mapElement->properties.surface.slope & 0x1F]; if (interactionType == VIEWPORT_INTERACTION_ITEM_FOOTPATH) slope = mapElement->properties.surface.slope & 7; pathType = (gFootpathSelectedType << 7) + (gFootpathSelectedId & 0xFF); @@ -765,7 +808,7 @@ static void window_footpath_place_path_at_point(int x, int y) return; // Set path - presentType = RCT2_ADDRESS(0x0098D8B4, uint8)[mapElement->properties.path.type & 0x1F]; + presentType = default_path_slope[mapElement->properties.path.type & 0x1F]; if (interactionType == VIEWPORT_INTERACTION_ITEM_FOOTPATH) presentType = mapElement->properties.path.type & 7; z = mapElement->base_height; From ace68bb4913c7a947b41b964c02f5ea2d0e8d2a2 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 11 Aug 2016 21:32:53 +0200 Subject: [PATCH 4/7] Use byte_98D800 --- src/peep/staff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/peep/staff.c b/src/peep/staff.c index 3deb79db67..90985b00e7 100644 --- a/src/peep/staff.c +++ b/src/peep/staff.c @@ -684,6 +684,8 @@ static uint8 staff_handyman_direction_to_nearest_litter(rct_peep* peep){ return nextDirection; } +extern const uint8 byte_98D800[4]; + /** * * rct2: 0x006BF931 @@ -697,7 +699,7 @@ static uint8 staff_handyman_direction_to_uncut_grass(rct_peep* peep, uint8 valid return 0xFF; if (peep->next_var_29 & 0x4) { - if ((mapElement->properties.surface.slope & MAP_ELEMENT_SLOPE_MASK) != RCT2_ADDRESS(0x0098D800, uint8)[peep->next_var_29 & 0x3]) + if ((mapElement->properties.surface.slope & MAP_ELEMENT_SLOPE_MASK) != byte_98D800[peep->next_var_29 & 0x3]) return 0xFF; } else if ((mapElement->properties.surface.slope & MAP_ELEMENT_SLOPE_MASK) != 0) From f3bc1f13bca3cc2b36188e6e068a6bcdc75c6613 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 11 Aug 2016 21:38:27 +0200 Subject: [PATCH 5/7] Integrate 0x0098D7F0 --- src/world/footpath.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/world/footpath.c b/src/world/footpath.c index cb636c8f5b..a702293862 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -62,6 +62,26 @@ static const uint16 EntranceDirections[] = { (4 | 1), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_PARK_ENTRANCE }; +/** rct2: 0x0098D7F0 */ +static const uint8 connected_path_count[] = { + 0, // 0b0000 + 1, // 0b0001 + 1, // 0b0010 + 2, // 0b0011 + 1, // 0b0100 + 2, // 0b0101 + 2, // 0b0110 + 3, // 0b0111 + 1, // 0b1000 + 2, // 0b1001 + 2, // 0b1010 + 3, // 0b1011 + 2, // 0b1100 + 3, // 0b1101 + 3, // 0b1110 + 4, // 0b1111 +}; + static int entrance_get_directions(rct_map_element *mapElement) { uint8 entranceType = mapElement->properties.entrance.type; @@ -1070,7 +1090,7 @@ static bool footpath_disconnect_queue_from_path(int x, int y, rct_map_element *m if (footpath_element_is_sloped(mapElement)) return false; - uint8 c = RCT2_ADDRESS(0x0098D7F0, uint8)[mapElement->properties.path.edges & 0x0F]; + uint8 c = connected_path_count[mapElement->properties.path.edges & 0x0F]; if ((action < 0) ? (c >= 2) : (c < 2)) return false; if (action < 0) { @@ -1180,7 +1200,7 @@ static void loc_6A6D7E( return; } if (footpath_element_is_queue(mapElement)) { - if (RCT2_ADDRESS(0x0098D7F0, uint8)[mapElement->properties.path.edges & 0x0F] < 2) { + if (connected_path_count[mapElement->properties.path.edges & 0x0F] < 2) { neighbour_list_push(neighbourList, 4, direction, mapElement->properties.path.ride_index, mapElement->properties.entrance.index); } else { if (map_element_get_type(initialMapElement) == MAP_ELEMENT_TYPE_PATH && From a5601b6558941b7a78b9d7d8a9b82ba9055c6c2e Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 11 Aug 2016 22:21:15 +0200 Subject: [PATCH 6/7] Include data at 0x0098D7EC --- src/world/footpath.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/world/footpath.c b/src/world/footpath.c index a702293862..06653d355a 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -170,6 +170,11 @@ static void loc_6A6620(int flags, int x, int y, rct_map_element *mapElement) map_invalidate_tile_full(x, y); } +/** rct2: 0x0098D7EC */ +static const uint8 byte_98D7EC[] = { + 207, 159, 63, 111 +}; + static money32 footpath_element_insert(int type, int x, int y, int z, int slope, int flags, uint8 pathItemType) { rct_map_element *mapElement; @@ -187,7 +192,7 @@ static money32 footpath_element_insert(int type, int x, int y, int z, int slope, bl = 15; zHigh = z + 4; if (slope & 4) { - bl = RCT2_ADDRESS(0x0098D7EC, uint8)[slope & 3]; + bl = byte_98D7EC[slope & 3]; zHigh += 2; } @@ -516,7 +521,7 @@ static money32 footpath_place_from_track(int type, int x, int y, int z, int slop uint8 bl = 15; int zHigh = z + 4; if (slope & 4) { - bl = RCT2_ADDRESS(0x0098D7EC, uint8)[slope & 3]; + bl = byte_98D7EC[slope & 3]; zHigh += 2; } From 76b470ac266cb5b0248530a909bbaf5f3c2a40ca Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 11 Aug 2016 22:31:47 +0200 Subject: [PATCH 7/7] Integrate data at 0x0098D7E0 --- src/windows/footpath.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/windows/footpath.c b/src/windows/footpath.c index b1daa55f8e..b5f02c1d2a 100644 --- a/src/windows/footpath.c +++ b/src/windows/footpath.c @@ -189,6 +189,13 @@ const uint8 default_path_slope[] = { IRREGULAR_SLOPE, }; +/** rct2: 0x0098D7E0 */ +unsigned char footpath_construction_preview_images[][4] = { + {5, 10, 5, 10}, // Flat + {16, 17, 18, 19}, // Upwards + {18, 19, 16, 17}, // Downwards +}; + static void window_footpath_mousedown_direction(int direction); static void window_footpath_mousedown_slope(int slope); static void window_footpath_show_footpath_types_dialog(rct_window *w, rct_widget *widget, int showQueues); @@ -591,12 +598,13 @@ static void window_footpath_paint(rct_window *w, rct_drawpixelinfo *dpi) if (!(w->disabled_widgets & (1 << WIDX_CONSTRUCT))) { // Get construction image - image = (gFootpathConstructDirection + get_current_rotation()) % 4; + uint8 direction = (gFootpathConstructDirection + get_current_rotation()) % 4; + uint8 slope = 0; if (gFootpathConstructSlope == 2) - image += 4; + slope = 1; else if (gFootpathConstructSlope == 6) - image += 8; - image = RCT2_ADDRESS(0x0098D7E0, uint8)[image]; + slope = 2; + image = footpath_construction_preview_images[slope][direction]; selectedPath = gFootpathSelectedId; pathType = get_footpath_entry(selectedPath);