From 1b2a7e62a25de2855d426bcb4fa71bf78dbab81d Mon Sep 17 00:00:00 2001 From: Sam Horn Date: Sat, 10 Oct 2015 21:31:56 +1000 Subject: [PATCH] Identified 0x00982392 as a nausea lookup array --- src/addresses.h | 4 ++++ src/peep/peep.c | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 47c1513827..93eb4176bb 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -64,6 +64,10 @@ // they aren't directly referenced, for example when a game is saved and // loaded, large chunks of data is read and written to. +// An array of 8 uint16s containing the min and max nausea values for each +// of the four nausea tolerance levels. +#define RCT2_ADDRESS_NAUSEA_THRESHOLDS 0x00982390 + #define RCT2_ADDRESS_EASTEREGG_NAMES 0x00988C20 // An array of pointers to the start of a way to diff --git a/src/peep/peep.c b/src/peep/peep.c index 7e46042987..3051804498 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -7574,8 +7574,8 @@ static void peep_on_enter_ride(rct_peep *peep, int rideIndex) satisfactionFlags |= (1 << 7); } - minNausea = RCT2_ADDRESS(0x00982390, uint16)[(peep->nausea_tolerance & 3) * 2]; - maxNausea = RCT2_ADDRESS(0x00982392, uint16)[(peep->nausea_tolerance & 3) * 2]; + minNausea = RCT2_ADDRESS(RCT2_ADDRESS_NAUSEA_THRESHOLDS, uint16)[(peep->nausea_tolerance & 3) * 2]; + maxNausea = RCT2_ADDRESS(RCT2_ADDRESS_NAUSEA_THRESHOLDS, uint16)[(peep->nausea_tolerance & 3) * 2 + 1]; if (maxNausea <= ride->nausea || minNausea >= ride->nausea) { satisfactionFlags |= (1 << 2); } @@ -8042,9 +8042,9 @@ static bool peep_should_go_on_ride(rct_peep *peep, int rideIndex, int entranceNu return false; } - // Nausea calculations - ride_rating minNausea = RCT2_ADDRESS(0x00982390, uint16)[(peep->nausea_tolerance & 3) * 2] - peep->happiness; - ride_rating maxNausea = RCT2_ADDRESS(0x00982392, uint16)[(peep->nausea_tolerance & 3) * 2] + peep->happiness; + // Nausea calculations. + ride_rating maxNausea = RCT2_ADDRESS(RCT2_ADDRESS_NAUSEA_THRESHOLDS, uint16)[(peep->nausea_tolerance & 3) * 2 + 1] + peep->happiness; + if (ride->nausea > maxNausea) { if (peepAtRide) { peep_insert_new_thought(peep, PEEP_THOUGHT_TYPE_SICKENING, rideIndex); @@ -8056,7 +8056,9 @@ static bool peep_should_go_on_ride(rct_peep *peep, int rideIndex, int entranceNu peep_chose_not_to_go_on_ride(peep, rideIndex, peepAtRide, true); return false; } - if (ride->nausea >= 140 && peep->nausea > 160) { + + // Very nauseous peeps will only go on very gentle rides. + if (ride->nausea >= FIXED_2DP(1, 40) && peep->nausea > 160) { peep_chose_not_to_go_on_ride(peep, rideIndex, peepAtRide, false); return false; }