From aaef0e5e64cd3bed476e3a8bc457173e00a5a5e5 Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Sun, 25 May 2014 17:21:54 +0100 Subject: [PATCH 1/4] Labelling addresses, adding initial happiness calculation --- src/addresses.h | 8 ++++++++ src/park.c | 36 ++++++++++++++++++++++++++++++------ src/park.h | 2 ++ 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index a13f7d286b..ddea02037e 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -198,6 +198,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 f4a591e718..62def6f9fa 100644 --- a/src/park.c +++ b/src/park.c @@ -79,15 +79,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 quest (avarage) + 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_awards_and_history(); @@ -508,4 +508,28 @@ void park_update() // Generate new guests 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 } \ No newline at end of file diff --git a/src/park.h b/src/park.h index 3d4d778caa..b3320c8136 100644 --- a/src/park.h +++ b/src/park.h @@ -90,4 +90,6 @@ void reset_park_entrances(); void park_update(); +uint8 calculate_guest_initial_happiness(); + #endif From b5e6058cde2f6491d7d789dfef31ea445b704fe2 Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Mon, 26 May 2014 13:29:30 +0100 Subject: [PATCH 2/4] Fixing spelling mistake --- src/park.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/park.c b/src/park.c index 62def6f9fa..72407f5c37 100644 --- a/src/park.c +++ b/src/park.c @@ -79,7 +79,7 @@ void park_init() RCT2_GLOBAL(0x01357CF2, uint16) = 127; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2; - RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, uint16) = MONEY(50,00); // Cash per quest (avarage) + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, uint16) = MONEY(50,00); // Cash per quest (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; From 69a819c029a41080a15f1aea9410e477793ae65f Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Mon, 26 May 2014 14:08:19 +0100 Subject: [PATCH 3/4] Fixing spelling mistake (guest) --- src/park.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/park.c b/src/park.c index 72407f5c37..babef06148 100644 --- a/src/park.c +++ b/src/park.c @@ -79,7 +79,7 @@ void park_init() RCT2_GLOBAL(0x01357CF2, uint16) = 127; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2; - RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, uint16) = MONEY(50,00); // Cash per quest (average) + 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; From 455a1e7b066f70975f3e8720541fb1b158ea58b3 Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Sat, 14 Jun 2014 15:57:05 +0100 Subject: [PATCH 4/4] Forgot to save before merge.. --- src/park.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/park.c b/src/park.c index 21db6f57b1..a792fa3976 100644 --- a/src/park.c +++ b/src/park.c @@ -544,7 +544,6 @@ void park_update() park_generate_new_guests(); } -<<<<<<< HEAD static uint8 calculate_guest_initial_happiness(uint8 percentage) { if (percentage < 15) { // There is a minimum of 15% happiness @@ -556,10 +555,10 @@ static uint8 calculate_guest_initial_happiness(uint8 percentage) { } /* 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... + 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) - */ + 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) { @@ -567,7 +566,8 @@ static uint8 calculate_guest_initial_happiness(uint8 percentage) { } } return 40; // This is the lowest possible value -======= +} + /** * * rct2: 0x0066A231 @@ -575,5 +575,4 @@ static uint8 calculate_guest_initial_happiness(uint8 percentage) { void park_update_histories() { RCT2_CALLPROC_EBPSAFE(0x0066A231); ->>>>>>> upstream/master } \ No newline at end of file