From 81a8434873f7d3aece4f25ab3b7f92b4c71ec580 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Tue, 14 Jul 2015 23:37:22 +0100 Subject: [PATCH] fix and refactor rct1_process_scenario_flags --- src/rct1.c | 40 +++++++++++++++------------------------- src/rct1.h | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/rct1.c b/src/rct1.c index ce8394e4ed..2b1f33bcf5 100644 --- a/src/rct1.c +++ b/src/rct1.c @@ -54,8 +54,8 @@ static void rct1_fix_scenery(); static void rct1_fix_entrance_positions(); static void rct1_reset_research(); -static void sub_69F06A(); -static void sub_666DFD(); +static void rct1_process_scenario_flags(); +static void rct1_reset_park_entrance_path_type(); static void rct1_clear_extra_sprite_entries(); static void rct1_clear_extra_tile_entries(); static void rct1_fix_colours(); @@ -214,7 +214,7 @@ void rct1_fix_landscape() RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint8) = 0; rct1_clear_extra_tile_entries(); - sub_69F06A(); + rct1_process_scenario_flags(); rct1_fix_colours(); rct1_fix_z(); rct1_fix_paths(); @@ -479,48 +479,38 @@ static void rct1_reset_research() * * rct2: 0x0069F06A */ -static void sub_69F06A() +static void rct1_process_scenario_flags() { - RCT2_CALLPROC_EBPSAFE(0x0069F06A); return; + uint32 scenarioFlags = RCT2_GLOBAL(0x013CE770, uint32); - // TODO, bug with the following code - RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 0) | (1 << 1) | (1 << 14) | (1 << 2) | (1 << 3); - if (!(RCT2_GLOBAL(0x013CE770, uint32) & (1 << 4))) { - RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 4); - banner_init(); // 6B9CB0 + if (!(scenarioFlags & RCT1_SCENARIO_FLAG_ENABLE_BANNERS)) { + banner_init(); } - if (!(RCT2_GLOBAL(0x013CE770, uint32) & (1 << 6))) { - RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 6); + if (!(scenarioFlags & (1 << 6))) { sub_69E891(); } - RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 7); - if (!(RCT2_GLOBAL(0x013CE770, uint32) & (1 << 8))) { - RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 8); - sub_666DFD(); + if (!(scenarioFlags & RCT1_SCENARIO_FLAG_CUSTOM_PARK_ENTRANCE_PATH)) { + rct1_reset_park_entrance_path_type(); } - if (!(RCT2_GLOBAL(0x013CE770, uint32) & (1 << 9))) { - RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 9); + if (!(scenarioFlags & RCT1_SCENARIO_FLAG_NO_CASH_RESET)) { finance_reset_cash_to_initial(); } - if (!(RCT2_GLOBAL(0x013CE770, uint32) & (1 << 13))) { - RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 13); + if (!(scenarioFlags & RCT1_SCENARIO_FLAG_CUSTOM_MAP_SIZE)) { RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) = 127 * 32; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, uint16) = 4350; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) = 128; + RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16) = 128; RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16) = 4095; } - if (!(RCT2_GLOBAL(0x013CE770, uint32) & (1 << 15))) { - RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 15); + if (!(scenarioFlags & (1 << 15))) { RCT2_GLOBAL(0x01358838, uint32) = 0; } - RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 16) | (1 << 18) | (1 << 19); } /** * * rct2: 0x00666DFD */ -static void sub_666DFD() +static void rct1_reset_park_entrance_path_type() { int x, y; rct_map_element *mapElement; diff --git a/src/rct1.h b/src/rct1.h index 2b6b19b539..07acdc4b95 100644 --- a/src/rct1.h +++ b/src/rct1.h @@ -477,6 +477,29 @@ typedef struct{ uint16 start_track_data_AA_CF; // 0xC4 }rct_track_td4; // Information based off RCTTechDepot +enum { + RCT1_SCENARIO_FLAG_0 = 1 << 0, + RCT1_SCENARIO_FLAG_1 = 1 << 1, + RCT1_SCENARIO_FLAG_2 = 1 << 2, + RCT1_SCENARIO_FLAG_3 = 1 << 3, + RCT1_SCENARIO_FLAG_ENABLE_BANNERS = 1 << 4, + RCT1_SCENARIO_FLAG_5 = 1 << 5, + RCT1_SCENARIO_FLAG_6 = 1 << 6, + RCT1_SCENARIO_FLAG_7 = 1 << 7, + RCT1_SCENARIO_FLAG_CUSTOM_PARK_ENTRANCE_PATH = 1 << 8, + RCT1_SCENARIO_FLAG_NO_CASH_RESET = 1 << 9, + RCT1_SCENARIO_FLAG_10 = 1 << 10, + RCT1_SCENARIO_FLAG_11 = 1 << 11, + RCT1_SCENARIO_FLAG_12 = 1 << 12, + RCT1_SCENARIO_FLAG_CUSTOM_MAP_SIZE = 1 << 13, + RCT1_SCENARIO_FLAG_14 = 1 << 14, + RCT1_SCENARIO_FLAG_15 = 1 << 15, + RCT1_SCENARIO_FLAG_16 = 1 << 16, + RCT1_SCENARIO_FLAG_17 = 1 << 17, + RCT1_SCENARIO_FLAG_18 = 1 << 18, + RCT1_SCENARIO_FLAG_19 = 1 << 19, +}; + extern const uint8 RCT1ColourConversionTable[32]; char **gVehicleHierarchies[0x60];