diff --git a/src/addresses.h b/src/addresses.h index 90f044fcbd..612a913bbc 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -204,6 +204,14 @@ #define RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED 0x013587F8 #define RCT2_ADDRESS_CURRENT_INTEREST_RATE 0x0135934A +#define RCT2_ADDRESS_GUEST_INITIAL_CASH 0x013580F4 +#define RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS 0x013580E9 +#define RCT2_ADDRESS_GUEST_INITIAL_HUNGER 0x013580F6 +#define RCT2_ADDRESS_GUEST_INITIAL_THIRST 0x013580F7 + +#define RCT2_ADDRESS_LAND_COST 0x01358770 +#define RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST 0x01358772 + #define RCT2_ADDRESS_PEEP_SPAWNS 0x013573F2 #define RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL 0x013573FF diff --git a/src/park.c b/src/park.c index 72eb1cd87f..29bb2a823f 100644 --- a/src/park.c +++ b/src/park.c @@ -93,15 +93,15 @@ void park_init() RCT2_GLOBAL(0x01357CF2, uint16) = 127; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, 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_GUEST_INITIAL_CASH, uint16) = MONEY(50,00); // Cash per guest (average) + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) = calculate_guest_initial_happiness(50); // 50% + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) = 200; + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, 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(RCT2_ADDRESS_LAND_COST, uint16) = MONEY(90, 00); + RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, uint16) = MONEY(40,00); RCT2_GLOBAL(0x01358774, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = PARK_FLAGS_11 | PARK_FLAGS_SHOW_REAL_GUEST_NAMES; park_reset_history(); @@ -544,6 +544,30 @@ void park_update() park_generate_new_guests(); } +static uint8 calculate_guest_initial_happiness(uint8 percentage) { + if (percentage < 15) { + // There is a minimum of 15% happiness + percentage = 15; + } + else if (percentage > 98) { + // There is a maximum of 98% happiness + percentage = 98; + } + + /* The percentages follow this sequence: + 15 17 18 20 21 23 25 26 28 29 31 32 34 36 37 39 40 42 43 45 47 48 50 51 53... + + This sequence can be defined as PI*(9+n)/2 (the value is floored) + */ + uint8 n; + for (n = 1; n < 55; n++) { + if ((3.14159*(9 + n)) / 2 >= percentage) { + return (9 + n) * 4; + } + } + return 40; // This is the lowest possible value +} + /** * * rct2: 0x0066A231 diff --git a/src/park.h b/src/park.h index 12808a50c3..cf37909afa 100644 --- a/src/park.h +++ b/src/park.h @@ -56,4 +56,6 @@ void reset_park_entrances(); void park_update(); void park_update_histories(); +uint8 calculate_guest_initial_happiness(); + #endif