diff --git a/src/addresses.h b/src/addresses.h index a23cc338b0..18f012969f 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -153,8 +153,11 @@ #define RCT2_ADDRESS_OBJECTIVE_YEAR 0x013580F9 #define RCT2_ADDRESS_OBJECTIVE_CURRENCY 0x013580FC #define RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS 0x01358100 +#define RCT2_ADDRESS_BALANCE_HISTORY 0x0135812C #define RCT2_ADDRESS_CURRENT_PROFIT 0x01358330 +#define RCT2_ADDRESS_WEEKLY_PROFIT_HISTORY 0x0135833C #define RCT2_ADDRESS_CURRENT_PARK_VALUE 0x0135853C +#define RCT2_ADDRESS_PARK_VALUE_HISTORY 0x01358540 #define RCT2_ADDRESS_COMPLETED_COMPANY_VALUE 0x01358740 #define RCT2_ADDRESS_TOTAL_ADMISSIONS 0x01358744 #define RCT2_ADDRESS_INCOME_FROM_ADMISSIONS 0x01358748 @@ -164,6 +167,11 @@ #define RCT2_ADDRESS_CURRENT_INTEREST_RATE 0x0135934A #define RCT2_ADDRESS_EXPENDITURE_TABLE 0x01357848 #define RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL 0x013573FF + +#define RCT2_ADDRESS_HANDYMAN_COLOUR 0x01357BCD +#define RCT2_ADDRESS_MECHANIC_COLOUR 0x01357BCE +#define RCT2_ADDRESS_SECURITY_COLOUR 0x01357BCF + #define RCT2_ADDRESS_CURRENT_INTEREST_RATE 0x0135934A #define RCT2_ADDRESS_MAP_SIZE 0x01358834 diff --git a/src/finance.h b/src/finance.h index 4a81abe34f..3fc80726fb 100644 --- a/src/finance.h +++ b/src/finance.h @@ -23,6 +23,8 @@ #include "rct2.h" +#define CURRENCY(whole, fraction) ((whole) * 10 + ((fraction) / 10)) + typedef int rct_expenditure_type; enum { diff --git a/src/park.c b/src/park.c index aaa1685375..911d10997e 100644 --- a/src/park.c +++ b/src/park.c @@ -19,11 +19,14 @@ *****************************************************************************/ #include "addresses.h" +#include "finance.h" #include "map.h" #include "park.h" #include "peep.h" #include "ride.h" +#include "scenario.h" #include "sprite.h" +#include "strings.h" #include "window.h" int park_is_open() @@ -37,7 +40,84 @@ int park_is_open() */ void park_init() { - RCT2_CALLPROC_EBPSAFE(0x00667132); + int i; + + RCT2_GLOBAL(0x013CA740, uint8) = 0; + RCT2_GLOBAL(0x013573D4, uint16) = 777; + RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) = 28; + RCT2_GLOBAL(RCT2_ADDRESS_MECHANIC_COLOUR, uint8) = 28; + RCT2_GLOBAL(RCT2_ADDRESS_SECURITY_COLOUR, uint8) = 28; + RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) = 0; + RCT2_GLOBAL(0x01357BC8, uint16) = 0; + RCT2_GLOBAL(0x01357846, uint16) = 0; + RCT2_GLOBAL(0x013573FE, uint16) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = 0; + RCT2_GLOBAL(0x013580EC, uint16) = 0; + RCT2_GLOBAL(0x013580EE, uint16) = 0; + RCT2_GLOBAL(0x01357CF4, sint32) = -1; + + for (i = 0; i < 20; i++) + RCT2_ADDRESS(0x01358102, uint8)[i] = 0; + + RCT2_GLOBAL(0x01358844, uint32) = 0xFFFFFFFF; + RCT2_GLOBAL(0x01358849, uint32) = 0xFFFFFFFE; + RCT2_GLOBAL(0x0135884E, uint32) = 0xFFFFFFFD; + finance_init(); + + for (i = 0; i < 2; i++) + RCT2_ADDRESS(0x01357404, uint32)[i] = 0; + + for (i = 0; i < 56; i++) + RCT2_ADDRESS(0x01357BD0, sint32)[i] = -1; + + RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16) = CURRENCY(10, 00); + RCT2_GLOBAL(0x013573F2, sint16) = -1; + RCT2_GLOBAL(0x013573F8, sint16) = -1; + RCT2_GLOBAL(0x01357CF2, uint16) = 127; + RCT2_GLOBAL(0x013573FF, uint8) = 2; + + RCT2_GLOBAL(0x013580F4, uint16) = 500; + RCT2_GLOBAL(0x013580E9, uint8) = 128; + RCT2_GLOBAL(0x013580F6, uint8) = 200; + RCT2_GLOBAL(0x013580F7, uint8) = 200; + RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) = 1; + RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) = 4; + RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) = 1000; + RCT2_GLOBAL(0x01358770, uint16) = 900; + RCT2_GLOBAL(0x01358772, uint16) = 400; + RCT2_GLOBAL(0x01358774, uint16) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = PARK_FLAGS_11 | PARK_FLAGS_SHOW_REAL_GUEST_NAMES; + park_reset_awards_and_history(); + + rct_s6_info *info = 0x0141F570; + info->name[0] = '\0'; + format_string(info->details, STR_NO_DETAILS_YET, NULL); +} + +/** + * + * rct2: 0x0066729F + */ +void park_reset_awards_and_history() +{ + int i; + + // Reset park rating and guests in park history + for (i = 0; i < 32; i++) { + RCT2_ADDRESS(RCT2_ADDRESS_PARK_RATING_HISTORY, uint8)[i] = 255; + RCT2_ADDRESS(RCT2_ADDRESS_GUESTS_IN_PARK_HISTORY, uint8)[i] = 255; + } + + // Reset finance history + for (i = 0; i < 128; i++) { + RCT2_ADDRESS(RCT2_ADDRESS_BALANCE_HISTORY, uint32)[i] = 0x80000000; + RCT2_ADDRESS(RCT2_ADDRESS_WEEKLY_PROFIT_HISTORY, uint32)[i] = 0x80000000; + RCT2_ADDRESS(RCT2_ADDRESS_PARK_VALUE_HISTORY, uint32)[i] = 0x80000000; + } + + // Reset awards + for (i = 0; i < 4; i++) + RCT2_ADDRESS(RCT2_ADDRESS_AWARD_LIST, rct_award)[i].time = 0; } /** diff --git a/src/park.h b/src/park.h index ee91fa5b46..177e4755a5 100644 --- a/src/park.h +++ b/src/park.h @@ -59,7 +59,8 @@ enum { PARK_FLAGS_FORBID_HIGH_CONSTRUCTION = (1 << 5), // below tree height PARK_FLAGS_PREF_LESS_INTENSE_RIDES = (1 << 6), PARK_FLAGS_FORBID_MARKETING_CAMPAIGN = (1 << 7), - PARK_FLAGS_PREF_MORE_INTENSE_RIDES = (1 << 11), + PARK_FLAGS_PREF_MORE_INTENSE_RIDES = (1 << 8), + PARK_FLAGS_11 = (1 << 11), PARK_FLAGS_DIFFICULT_GUEST_GENERATION = (1 << 12), PARK_FLAGS_PARK_FREE_ENTRY = (1 << 13), PARK_FLAGS_DIFFICULT_PARK_RATING = (1 << 14), @@ -69,6 +70,7 @@ enum { int park_is_open(); void park_init(); +void park_reset_awards_and_history(); int park_calculate_size(); int calculate_park_rating(); diff --git a/src/scenario.c b/src/scenario.c index a05cc25216..954f2d489c 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -512,7 +512,7 @@ void scenario_load_and_play(rct_scenario_basic *scenario) RCT2_GLOBAL(RCT2_ADDRESS_INCOME_FROM_ADMISSIONS, uint32) = 0; RCT2_GLOBAL(0x013587D8, uint16) = 63; RCT2_CALLPROC_EBPSAFE(0x0069E869); // (loan related, called above already) - RCT2_CALLPROC_EBPSAFE(0x0066729F); // reset history / finance / awards + park_reset_awards_and_history(); reset_all_ride_build_dates(); date_reset(); RCT2_CALLPROC_EBPSAFE(0x00674576); diff --git a/src/strings.h b/src/strings.h index 1e459333b6..a2fb5f1c38 100644 --- a/src/strings.h +++ b/src/strings.h @@ -490,6 +490,8 @@ enum { STR_LIST = 3159, + STR_NO_DETAILS_YET = 3317, + STR_OBJECTIVE = 3322, STR_GAME_TOOLS = 3341,