mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge branch 'duncanspumpkin-fix_park_rating'
This commit is contained in:
commit
35ea6300fb
104
src/park.c
104
src/park.c
|
@ -76,13 +76,6 @@ int park_calculate_size()
|
||||||
*/
|
*/
|
||||||
int calculate_park_rating()
|
int calculate_park_rating()
|
||||||
{
|
{
|
||||||
{
|
|
||||||
int eax, ebx, ecx, edx, esi, edi, ebp;
|
|
||||||
RCT2_CALLFUNC_X(0x00669EAA, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
|
||||||
return eax & 0xFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
result = 1150;
|
result = 1150;
|
||||||
|
@ -115,11 +108,12 @@ int calculate_park_rating()
|
||||||
if (peep->var_C6 <= 89)
|
if (peep->var_C6 <= 89)
|
||||||
_bp++;
|
_bp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Peep happiness -500 to +0
|
// Peep happiness -500 to +0
|
||||||
result -= 500;
|
result -= 500;
|
||||||
if (num_happy_peeps > 0)
|
|
||||||
result += 2 * min(250, (RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) * 300) / num_happy_peeps);
|
if (RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) > 0)
|
||||||
|
result += 2 * min(250, (num_happy_peeps * 300) / RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16));
|
||||||
|
|
||||||
// ?
|
// ?
|
||||||
_bp -= 25;
|
_bp -= 25;
|
||||||
|
@ -130,8 +124,8 @@ int calculate_park_rating()
|
||||||
// Rides
|
// Rides
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
short _ax, _bx;
|
short _ax, total_ride_intensity = 0, total_ride_excitement = 0, average_intensity, average_excitement;
|
||||||
int num_rides;
|
int num_rides, num_exciting_rides = 0;
|
||||||
rct_ride* ride;
|
rct_ride* ride;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -143,28 +137,42 @@ int calculate_park_rating()
|
||||||
if (ride->type == RIDE_TYPE_NULL)
|
if (ride->type == RIDE_TYPE_NULL)
|
||||||
continue;
|
continue;
|
||||||
_ax += 100 - ride->var_199;
|
_ax += 100 - ride->var_199;
|
||||||
|
|
||||||
|
if (ride->excitement != -1){
|
||||||
|
total_ride_excitement += ride->excitement / 8;
|
||||||
|
total_ride_intensity += ride->intensity / 8;
|
||||||
|
num_exciting_rides++;
|
||||||
|
}
|
||||||
num_rides++;
|
num_rides++;
|
||||||
}
|
}
|
||||||
result -= 200;
|
result -= 200;
|
||||||
if (num_rides > 0)
|
if (num_rides > 0)
|
||||||
result += (_ax / num_rides) * 2;
|
result += (_ax / num_rides) * 2;
|
||||||
|
|
||||||
//
|
result -= 100;
|
||||||
_ax = 0;
|
|
||||||
_bx = 0;
|
|
||||||
for (i = 0; i < 255; i++) {
|
|
||||||
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
|
|
||||||
|
|
||||||
if (ride->type == RIDE_TYPE_NULL)
|
if (num_exciting_rides>0){
|
||||||
continue;
|
average_excitement = total_ride_excitement / num_exciting_rides;
|
||||||
if (ride->excitement == -1)
|
average_intensity = total_ride_intensity / num_exciting_rides;
|
||||||
continue;
|
|
||||||
_ax += ride->excitement / 8;
|
average_excitement -= 46;
|
||||||
_bx += ride->intensity / 8;
|
if (average_excitement < 0){
|
||||||
|
average_excitement = -average_excitement;
|
||||||
|
}
|
||||||
|
|
||||||
|
average_intensity -= 65;
|
||||||
|
if (average_intensity < 0){
|
||||||
|
average_intensity = -average_intensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
average_excitement = min(average_excitement / 2, 50);
|
||||||
|
average_intensity = min(average_intensity / 2, 50);
|
||||||
|
result += 100 - average_excitement - average_intensity;
|
||||||
}
|
}
|
||||||
_ax = min(1000, _ax);
|
|
||||||
_bx = min(1000, _bx);
|
total_ride_excitement = min(1000, total_ride_excitement);
|
||||||
result -= 200 - ((_ax + _bx) / 10);
|
total_ride_intensity = min(1000, total_ride_intensity);
|
||||||
|
result -= 200 - ((total_ride_excitement + total_ride_intensity) / 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Litter
|
// Litter
|
||||||
|
@ -178,54 +186,14 @@ int calculate_park_rating()
|
||||||
litter = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].litter);
|
litter = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].litter);
|
||||||
|
|
||||||
// Guessing this eliminates recently dropped litter
|
// Guessing this eliminates recently dropped litter
|
||||||
if (litter->var_24 - RCT2_GLOBAL(0x00F663AC, sint32) >= 7680)
|
if (litter->var_24 - RCT2_GLOBAL(0x00F663AC, uint32) >= 7680)
|
||||||
num_litter++;
|
num_litter++;
|
||||||
}
|
}
|
||||||
result -= 600 - (4 * (150 - min(150, num_litter)));
|
result -= 600 - (4 * (150 - min(150, num_litter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rides
|
|
||||||
{
|
|
||||||
int i, num_rides;
|
|
||||||
short _ax, _bx;
|
|
||||||
rct_ride* ride;
|
|
||||||
|
|
||||||
num_rides = 0;
|
|
||||||
_ax = 0;
|
|
||||||
_bx = 0;
|
|
||||||
for (i = 0; i < 255; i++) {
|
|
||||||
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
|
|
||||||
|
|
||||||
if (ride->type == RIDE_TYPE_NULL)
|
|
||||||
continue;
|
|
||||||
if (ride->excitement == -1)
|
|
||||||
continue;
|
|
||||||
_ax += ride->excitement / 8;
|
|
||||||
_bx += ride->intensity / 8;
|
|
||||||
num_rides++;
|
|
||||||
}
|
|
||||||
|
|
||||||
result -= 100;
|
|
||||||
if (num_rides > 0) {
|
|
||||||
_bx = _ax / num_rides;
|
|
||||||
_ax = _bx / num_rides;
|
|
||||||
_bx -= 46;
|
|
||||||
if (_bx >= 0)
|
|
||||||
_bx = -_bx;
|
|
||||||
_ax -= 65;
|
|
||||||
if (_ax >= 0)
|
|
||||||
_ax = -_ax;
|
|
||||||
_bx /= 2;
|
|
||||||
_ax /= 2;
|
|
||||||
_bx = min(50, _bx);
|
|
||||||
_ax = min(50, _ax);
|
|
||||||
result += 100 - _ax - _bx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result -= RCT2_GLOBAL(0x0135882E, sint16);
|
result -= RCT2_GLOBAL(0x0135882E, sint16);
|
||||||
result = clamp(0, result, 999);
|
result = clamp(0, result, 999);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ typedef struct {
|
||||||
uint32 pad_00;
|
uint32 pad_00;
|
||||||
uint16 next; // 0x04
|
uint16 next; // 0x04
|
||||||
uint8 pad_06[0x1E];
|
uint8 pad_06[0x1E];
|
||||||
sint32 var_24;
|
uint32 var_24;
|
||||||
} rct_litter;
|
} rct_litter;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in New Issue