From 663e4303006a92b18251f28712aae549385eb3fd Mon Sep 17 00:00:00 2001 From: e-foley Date: Sat, 24 Oct 2015 14:54:15 -0700 Subject: [PATCH 1/3] cap airtime bonus Caps airtime addition to excitement rating rather than allowing infinite subtraction --- src/ride/ride_ratings.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/ride/ride_ratings.c b/src/ride/ride_ratings.c index 7e8b49d5f0..37ae617dea 100644 --- a/src/ride/ride_ratings.c +++ b/src/ride/ride_ratings.c @@ -794,17 +794,13 @@ static void ride_ratings_apply_adjustments(rct_ride *ride, rating_tuple *ratings // Apply total air time if (RideData4[ride->type].flags & RIDE_TYPE_FLAG4_HAS_AIR_TIME) { - uint16 totalAirTime = ride->total_air_time; if (rideEntry->flags & RIDE_ENTRY_FLAG_11) { - if (totalAirTime >= 96) { - totalAirTime -= 96; - ratings->excitement -= totalAirTime / 8; - ratings->nausea += totalAirTime / 16; - } + // Limit airtime bonus for heartline twister coaster (see issues #2031 and #2064) + ratings->excitement += min(ride->total_air_time, 96) / 8; } else { - ratings->excitement += totalAirTime / 8; - ratings->nausea += totalAirTime / 16; + ratings->excitement += ride->total_air_time / 8; } + ratings->nausea += ride->total_air_time / 16; } } From 73eed6830afd7c6c720f3b04a6aa9656c7e9a48b Mon Sep 17 00:00:00 2001 From: e-foley Date: Sat, 24 Oct 2015 14:59:55 -0700 Subject: [PATCH 2/3] remove unnecessary rating conditioning Remove old workaround to issue #2064 --- src/ride/ride_ratings.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/ride/ride_ratings.c b/src/ride/ride_ratings.c index 37ae617dea..c24642406b 100644 --- a/src/ride/ride_ratings.c +++ b/src/ride/ride_ratings.c @@ -624,13 +624,6 @@ static void ride_ratings_calculate(rct_ride *ride) calcFunc(ride); } - if (ride->ratings.excitement != -1) { - // Prevent negative ratings - ride->ratings.excitement = max(0, ride->ratings.excitement); - ride->ratings.intensity = max(0, ride->ratings.intensity); - ride->ratings.nausea = max(0, ride->ratings.nausea); - } - // Original ride calculation // calcFunc = RCT2_ADDRESS(0x0097E050, ride_ratings_calculation)[ride->type]; // RCT2 CALLPROC X((int)calcFunc, 0, 0, 0, 0, 0, (int)ride, 0); From 5f799ac6c4ec35e947168759c9fdc428f0765d4e Mon Sep 17 00:00:00 2001 From: e-foley Date: Mon, 2 Nov 2015 20:23:22 -0800 Subject: [PATCH 3/3] contain rating mods in pp directives --- src/ride/ride_ratings.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/ride/ride_ratings.c b/src/ride/ride_ratings.c index c24642406b..696896d50b 100644 --- a/src/ride/ride_ratings.c +++ b/src/ride/ride_ratings.c @@ -624,6 +624,15 @@ static void ride_ratings_calculate(rct_ride *ride) calcFunc(ride); } + #ifdef ORIGINAL_RATINGS + if (ride->ratings.excitement != -1) { + // Address underflows allowed by original RCT2 code + ride->ratings.excitement = max(0, ride->ratings.excitement); + ride->ratings.intensity = max(0, ride->ratings.intensity); + ride->ratings.nausea = max(0, ride->ratings.nausea); + } + #endif + // Original ride calculation // calcFunc = RCT2_ADDRESS(0x0097E050, ride_ratings_calculation)[ride->type]; // RCT2 CALLPROC X((int)calcFunc, 0, 0, 0, 0, 0, (int)ride, 0); @@ -786,6 +795,21 @@ static void ride_ratings_apply_adjustments(rct_ride *ride, rating_tuple *ratings ratings->nausea += ((ratings->nausea * rideEntry->nausea_multipler ) >> 7); // Apply total air time + #ifdef ORIGINAL_RATINGS + if (RideData4[ride->type].flags & RIDE_TYPE_FLAG4_HAS_AIR_TIME) { + uint16 totalAirTime = ride->total_air_time; + if (rideEntry->flags & RIDE_ENTRY_FLAG_11) { + if (totalAirTime >= 96) { + totalAirTime -= 96; + ratings->excitement -= totalAirTime / 8; + ratings->nausea += totalAirTime / 16; + } + } else { + ratings->excitement += totalAirTime / 8; + ratings->nausea += totalAirTime / 16; + } + } + #else if (RideData4[ride->type].flags & RIDE_TYPE_FLAG4_HAS_AIR_TIME) { if (rideEntry->flags & RIDE_ENTRY_FLAG_11) { // Limit airtime bonus for heartline twister coaster (see issues #2031 and #2064) @@ -795,6 +819,7 @@ static void ride_ratings_apply_adjustments(rct_ride *ride, rating_tuple *ratings } ratings->nausea += ride->total_air_time / 16; } + #endif } /**