1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 22:34:33 +01:00

apply loop macros and implement more awards

This commit is contained in:
IntelOrca
2014-05-27 18:03:25 +01:00
parent 967af4f032
commit 72b2272b1f
12 changed files with 216 additions and 194 deletions

View File

@@ -21,8 +21,10 @@
#include "addresses.h"
#include "award.h"
#include "news_item.h"
#include "peep.h"
#include "ride.h"
#include "scenario.h"
#include "sprite.h"
#include "window.h"
#define NEGATIVE 0
@@ -67,6 +69,7 @@ static int award_is_deserved_most_tidy(int awardType, int activeAwardTypes)
return 0;
}
/** At least 6 open roller coasters. */
static int award_is_deserved_best_rollercoasters(int awardType, int activeAwardTypes)
{
int i, rollerCoasters;
@@ -79,7 +82,7 @@ static int award_is_deserved_best_rollercoasters(int awardType, int activeAwardT
if (RCT2_GLOBAL(object + 0x1BE, uint8) != RIDE_GROUP_ROLLERCOASTER && RCT2_GLOBAL(object + 0x1BF, uint8) != RIDE_GROUP_ROLLERCOASTER)
continue;
if (ride->status != RIDE_STATUS_OPEN || ride->lifecycle_flags & 0x400)
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400))
continue;
rollerCoasters++;
@@ -123,10 +126,32 @@ static int award_is_deserved_worse_value(int awardType, int activeAwardTypes)
return 0;
return 1;
}
/** No more than 2 people who think the vandalism is bad and no crashes. */
static int award_is_deserved_safest(int awardType, int activeAwardTypes)
{
// TODO
return 0;
int i;
uint16 spriteIndex;
rct_peep *peep;
int peepsWhoDislikeVandalism = 0;
rct_ride *ride;
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_2A != 0)
continue;
if (peep->thoughts[0].pad_3 <= 5 && peep->thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM)
peepsWhoDislikeVandalism++;
}
if (peepsWhoDislikeVandalism > 2)
return 0;
// Check for rides that have crashed maybe?
FOR_ALL_RIDES(i, ride)
if (ride->var_1AE != 0)
return 0;
return 1;
}
static int award_is_deserved_best_staff(int awardType, int activeAwardTypes)
@@ -147,10 +172,39 @@ static int award_is_deserved_worst_food(int awardType, int activeAwardTypes)
return 0;
}
/** At least 4 restrooms, 1 restroom per 128 guests and no more than 16 guests who think they need the restroom. */
static int award_is_deserved_best_restrooms(int awardType, int activeAwardTypes)
{
// TODO
return 0;
unsigned int i, numRestrooms, guestsWhoNeedRestroom;
rct_ride *ride;
uint16 spriteIndex;
rct_peep *peep;
// Count open restrooms
numRestrooms = 0;
FOR_ALL_RIDES(i, ride)
if (ride->type == RIDE_TYPE_BATHROOM && ride->status == RIDE_STATUS_OPEN)
numRestrooms++;
// At least 4 open restrooms
if (numRestrooms < 4)
return 0;
// At least one open restroom for every 128 guests
if (numRestrooms < RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) / 128U)
return 0;
// Count number of guests who are thinking they need the restroom
guestsWhoNeedRestroom = 0;
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_2A != 0)
continue;
if (peep->thoughts[0].pad_3 <= 5 && peep->thoughts[0].type == PEEP_THOUGHT_TYPE_BATHROOM)
guestsWhoNeedRestroom++;
}
return (guestsWhoNeedRestroom <= 16);
}
/** More than half of the rides have satisfication <= 6 and park rating <= 650. */
@@ -196,7 +250,7 @@ static int award_is_deserved_best_water_rides(int awardType, int activeAwardType
if (RCT2_GLOBAL(object + 0x1BE, uint8) != RIDE_GROUP_WATER && RCT2_GLOBAL(object + 0x1BF, uint8) != RIDE_GROUP_WATER)
continue;
if (ride->status != RIDE_STATUS_OPEN || ride->lifecycle_flags & 0x400)
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400))
continue;
waterRides++;
@@ -205,22 +259,74 @@ static int award_is_deserved_best_water_rides(int awardType, int activeAwardType
return (waterRides >= 6);
}
/** At least 6 custom designed rides. */
static int award_is_deserved_best_custom_designed_rides(int awardType, int activeAwardTypes)
{
// TODO
return 0;
int i, customDesignedRides;
rct_ride *ride;
if (activeAwardTypes & (1 << PARK_AWARD_MOST_DISAPPOINTING))
return 0;
customDesignedRides = 0;
FOR_ALL_RIDES(i, ride) {
if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x10000000))
continue;
if (ride->lifecycle_flags & 0x40000)
continue;
if (ride->excitement < RIDE_RATING(5, 50))
continue;
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400))
continue;
customDesignedRides++;
}
return (customDesignedRides >= 6);
}
/** At least 5 colourful rides and more than half of the rides are colourful. */
static int award_is_deserved_most_dazzling_ride_colours(int awardType, int activeAwardTypes)
{
// TODO
return 0;
int i, countedRides, colourfulRides;
rct_ride *ride;
if (activeAwardTypes & (1 << PARK_AWARD_MOST_DISAPPOINTING))
return 0;
countedRides = 0;
colourfulRides = 0;
FOR_ALL_RIDES(i, ride) {
if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x10000000))
continue;
countedRides++;
if (ride->var_1BC == 5 || ride->var_1BC == 14 || ride->var_1BC == 20 || ride->var_1BC == 30)
colourfulRides++;
}
return (colourfulRides >= 5 && colourfulRides >= countedRides - colourfulRides);
}
/** At least 10 peeps and more than 1/64 of total guests are lost or can't find something. */
static int award_is_deserved_most_confusing_layout(int awardType, int activeAwardTypes)
{
// TODO
return 0;
unsigned int peepsCounted, peepsLost;
uint16 spriteIndex;
rct_peep *peep;
peepsCounted = 0;
peepsLost = 0;
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_2A != 0)
continue;
peepsCounted++;
if (peep->thoughts[0].pad_3 <= 5 && peep->thoughts[0].type == PEEP_THOUGHT_TYPE_LOST || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_CANT_FIND)
peepsLost++;
}
return (peepsLost >= 10 && peepsLost >= peepsCounted / 64);
}
/** At least 10 open gentle rides. */
@@ -236,7 +342,7 @@ static int award_is_deserved_best_gentle_rides(int awardType, int activeAwardTyp
if (RCT2_GLOBAL(object + 0x1BE, uint8) != RIDE_GROUP_GENTLE && RCT2_GLOBAL(object + 0x1BF, uint8) != RIDE_GROUP_GENTLE)
continue;
if (ride->status != RIDE_STATUS_OPEN || ride->lifecycle_flags & 0x400)
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400))
continue;
gentleRides++;
@@ -283,6 +389,9 @@ void award_update_all()
int i, activeAwardTypes, freeAwardEntryIndex;
rct_award *awards;
RCT2_CALLPROC_EBPSAFE(0x0066A86C);
return;
awards = RCT2_ADDRESS(RCT2_ADDRESS_AWARD_LIST, rct_award);
// Only add new awards if park is open

View File

@@ -71,16 +71,13 @@ void finance_payment(money32 amount, rct_expenditure_type type)
void finance_pay_wages()
{
rct_peep* peep;
uint16 sprite_idx;
uint16 spriteIndex;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800)
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_11)
return;
for (sprite_idx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_idx != SPRITE_INDEX_NULL; sprite_idx = peep->next) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].peep);
if (peep->type == PEEP_TYPE_STAFF)
finance_payment(wage_table[peep->staff_type] / 4, RCT_EXPENDITURE_TYPE_WAGES);
}
FOR_ALL_STAFF(spriteIndex, peep)
finance_payment(wage_table[peep->staff_type] / 4, RCT_EXPENDITURE_TYPE_WAGES);
}
/**
@@ -120,12 +117,10 @@ void finance_pay_interest()
*/
void finance_pay_ride_upkeep()
{
int i;
rct_ride* ride;
for (int i = 0; i < MAX_RIDES; i++) {
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->type == RIDE_TYPE_NULL)
continue;
FOR_ALL_RIDES(i, ride) {
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)) {
ride->build_date = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
ride->var_196 = 25855; // durability?

View File

@@ -192,7 +192,7 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
*z = map_element_height(*x, *y);
break;
case NEWS_ITEM_PEEP_ON_RIDE:
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]).peep;
peep = GET_PEEP(subject);
*x = peep->x;
*y = peep->y;
*z = peep->z;
@@ -221,7 +221,7 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
*z = vehicle->z;
break;
case NEWS_ITEM_PEEP:
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]).peep;
peep = GET_PEEP(subject);
*x = peep->x;
*y = peep->y;
*z = peep->z;
@@ -295,7 +295,7 @@ void news_item_open_subject(int type, int subject) {
break;
case NEWS_ITEM_PEEP_ON_RIDE:
case NEWS_ITEM_PEEP:
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]).peep;
peep = GET_PEEP(subject);
RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, (int)peep, 0, 0, 0);
break;
case NEWS_ITEM_MONEY:

View File

@@ -182,7 +182,7 @@ int calculate_park_rating()
// Guests
{
rct_peep* peep;
uint16 sprite_idx;
uint16 spriteIndex;
int num_happy_peeps;
short _bp;
@@ -192,10 +192,7 @@ int calculate_park_rating()
// Guests, happiness, ?
num_happy_peeps = 0;
_bp = 0;
for (sprite_idx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_idx != SPRITE_INDEX_NULL; sprite_idx = peep->next) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].peep);
if (peep->type != PEEP_TYPE_GUEST)
continue;
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_2A != 0)
continue;
if (peep->happiness > 128)
@@ -228,11 +225,7 @@ int calculate_park_rating()
//
_ax = 0;
num_rides = 0;
for (i = 0; i < 255; i++) {
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->type == RIDE_TYPE_NULL)
continue;
FOR_ALL_RIDES(i, ride) {
_ax += 100 - ride->var_199;
if (ride->excitement != -1){
@@ -374,14 +367,12 @@ static int park_calculate_guest_generation_probability()
{
unsigned int probability;
int i, suggestedMaxGuests, totalRideValue;
rct_ride *ride;
// Calculate suggested guest maximum (based on ride type) and total ride value
suggestedMaxGuests = 0;
totalRideValue = 0;
for (i = 0; i < MAX_RIDES; i++) {
rct_ride *ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i];
if (ride->type == RIDE_TYPE_NULL)
continue;
FOR_ALL_RIDES(i, ride) {
if (ride->status != RIDE_STATUS_OPEN)
continue;
if (ride->lifecycle_flags & 0x80)
@@ -403,10 +394,7 @@ static int park_calculate_guest_generation_probability()
// If difficult guest generation, extra guests are available for good rides
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) {
suggestedMaxGuests = min(suggestedMaxGuests, 1000);
for (i = 0; i < MAX_RIDES; i++) {
rct_ride *ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i];
if (ride->type == RIDE_TYPE_NULL)
continue;
FOR_ALL_RIDES(i, ride) {
if (ride->lifecycle_flags & 0x80)
continue;
if (ride->lifecycle_flags & 0x400)

View File

@@ -30,18 +30,12 @@
int peep_get_staff_count()
{
uint16 sprite_index;
uint16 spriteIndex;
rct_peep *peep;
int count = 0;
sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
while (sprite_index != SPRITE_INDEX_NULL) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_index].peep);
sprite_index = peep->next;
if (peep->type == PEEP_TYPE_STAFF)
count++;
}
FOR_ALL_STAFF(spriteIndex, peep)
count++;
return count;
}
@@ -53,18 +47,14 @@ int peep_get_staff_count()
void peep_update_all()
{
int i;
uint16 sprite_index;
uint16 spriteIndex;
rct_peep* peep;
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)
return;
sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
i = 0;
while (sprite_index != 0xFFFF) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_index].peep);
sprite_index = peep->next;
FOR_ALL_PEEPS(spriteIndex, peep) {
if ((i & 0x7F) != (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) {
RCT2_CALLPROC_X(0x0068FC1E, 0, 0, 0, 0, (int)peep, 0, 0);
} else {
@@ -86,7 +76,7 @@ void peep_problem_warnings_update()
{
rct_peep* peep;
rct_ride* ride;
uint16 sprite_idx;
uint16 spriteIndex;
uint16 guests_in_park = RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16);
int hunger_counter = 0, lost_counter = 0, noexit_counter = 0, thirst_counter = 0,
litter_counter = 0, disgust_counter = 0, bathroom_counter = 0 ,vandalism_counter = 0;
@@ -94,11 +84,8 @@ void peep_problem_warnings_update()
RCT2_GLOBAL(RCT2_ADDRESS_RIDE_COUNT, sint16) = ride_get_count(); // refactor this to somewhere else
for (sprite_idx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_idx != SPRITE_INDEX_NULL; sprite_idx = peep->next) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].peep);
if (peep->type != PEEP_TYPE_GUEST || peep->var_2A != 0 || peep->thoughts[0].pad_3 > 5)
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_2A != 0 || peep->thoughts[0].pad_3 > 5)
continue;
switch (peep->thoughts[0].type) {
@@ -213,7 +200,7 @@ void peep_problem_warnings_update()
void peep_update_crowd_noise()
{
rct_viewport *viewport;
uint16 sprite_index;
uint16 spriteIndex;
rct_peep *peep;
int visiblePeeps;
@@ -235,15 +222,10 @@ void peep_update_crowd_noise()
// Count the number of peeps visible
visiblePeeps = 0;
sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
while (sprite_index != SPRITE_INDEX_NULL) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_index].peep);
sprite_index = peep->next;
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_16 == 0x8000)
continue;
if (peep->type != PEEP_TYPE_GUEST)
continue;
if (viewport->view_x > peep->var_1A)
continue;
if (viewport->view_x + viewport->view_width < peep->var_16)
@@ -300,17 +282,10 @@ void peep_update_crowd_noise()
*/
void peep_applause()
{
uint16 sprite_index;
uint16 spriteIndex;
rct_peep* peep;
// For each guest
sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
while (sprite_index != 0xFFFF) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_index].peep);
sprite_index = peep->next;
if (peep->type != PEEP_TYPE_GUEST)
continue;
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_2A != 0)
continue;

View File

@@ -417,6 +417,25 @@ typedef struct {
uint32 item_standard_flags; // 0xFC
} rct_peep;
/** Helper macro until rides are stored in this module. */
#define GET_PEEP(sprite_index) &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_index].peep)
/**
* Helper macro loop for enumerating through all the non null rides. To avoid needing a end loop counterpart, statements are
* applied in tautology if statements.
*/
#define FOR_ALL_PEEPS(sprite_index, peep) \
for (sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_index != SPRITE_INDEX_NULL; sprite_index = peep->next) \
if ((peep = GET_PEEP(sprite_index)) || 1)
#define FOR_ALL_GUESTS(sprite_index, peep) \
FOR_ALL_PEEPS(sprite_index, peep) \
if (peep->type == PEEP_TYPE_GUEST)
#define FOR_ALL_STAFF(sprite_index, peep) \
FOR_ALL_PEEPS(sprite_index, peep) \
if (peep->type == PEEP_TYPE_STAFF)
int peep_get_staff_count();
void peep_update_all();
void peep_problem_warnings_update();

View File

@@ -101,11 +101,8 @@ int ride_get_count()
rct_ride *ride;
int i, count = 0;
for (i = 0; i < MAX_RIDES; i++) {
ride = GET_RIDE(i);
if (ride->type != RIDE_TYPE_NULL)
count++;
}
FOR_ALL_RIDES(i, ride)
count++;
return count;
}
@@ -159,13 +156,10 @@ void ride_init_all()
void reset_all_ride_build_dates() {
int i;
rct_ride *ride;
for (i = 0; i < MAX_RIDES; i++) {
ride = GET_RIDE(i);
if (ride->type != RIDE_TYPE_NULL) {
//mov ax, current_month_year
//sub [esi + 180h], ax
ride->build_date -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
}
FOR_ALL_RIDES(i, ride) {
//mov ax, current_month_year
//sub [esi + 180h], ax
ride->build_date -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
}
}
@@ -174,17 +168,15 @@ void reset_all_ride_build_dates() {
*/
void ride_update_favourited_stat()
{
int i;
rct_ride *ride;
uint16 spriteIndex;
rct_peep* peep;
for (int i = 0; i < MAX_RIDES; i++) {
ride = GET_RIDE(i);
if (ride->type != RIDE_TYPE_NULL)
ride->guests_favourite = 0;
FOR_ALL_RIDES(i, ride)
ride->guests_favourite = 0;
}
for (int sprite_idx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_idx != SPRITE_INDEX_NULL; sprite_idx = peep->next) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].peep);
FOR_ALL_PEEPS(spriteIndex, peep) {
if (peep->var_08 != 4)
return;
if (peep->favourite_ride != 0xff) {
@@ -195,6 +187,7 @@ void ride_update_favourited_stat()
}
}
window_invalidate_by_id(WC_RIDE_LIST, 0);
}

View File

@@ -109,10 +109,13 @@ typedef struct {
// used in computing excitement, nausea, etc
uint8 var_198;
uint8 var_199;
uint8 pad_19A[0x1A];
uint8 pad_19A[0x14];
uint8 var_1AE;
uint8 pad_1AF[0x05];
money32 profit; // 0x1B4
uint8 queue_time[4]; // 0x1B8
uint8 pad_1BC[0x11];
uint8 var_1BC;
uint8 pad_1BD[0x10];
uint8 var_1CD;
uint16 guests_favourite; // 0x1CE
uint32 lifecycle_flags; // 0x1D0
@@ -330,7 +333,7 @@ enum {
*/
#define FOR_ALL_RIDES(i, ride) \
for (i = 0; i < MAX_RIDES; i++) \
if ((ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]))->type != RIDE_TYPE_NULL)
if ((ride = GET_RIDE(i))->type != RIDE_TYPE_NULL)
extern const uint8 gRideClassifications[255];

View File

@@ -365,20 +365,15 @@ void scenario_success()
**/
void scenario_objective5_check()
{
int rcs = 0;
int i, rcs = 0;
uint8 type_already_counted[256];
rct_ride* ride;
memset(type_already_counted, 0, 256);
for (int i = 0; i < MAX_RIDES; i++) {
uint8 subtype_id;
uint32 subtype_p;
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->type == RIDE_TYPE_NULL)
continue;
subtype_id = (uint8)ride->subtype;
subtype_p = RCT2_GLOBAL(0x009ACFA4 + subtype_id * 4, uint32);
FOR_ALL_RIDES(i, ride) {
uint8 subtype_id = ride->subtype;
uint32 subtype_p = RCT2_GLOBAL(0x009ACFA4 + subtype_id * 4, uint32);
if ((RCT2_GLOBAL(subtype_p + 0x1BE, sint8) == 2 ||
RCT2_GLOBAL(subtype_p + 0x1BF, sint8) == 2) &&
@@ -400,21 +395,16 @@ void scenario_objective5_check()
**/
void scenario_objective8_check()
{
int rcs = 0;
int i, rcs = 0;
uint8 type_already_counted[256];
rct_ride* ride;
sint16 objective_length = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16);
memset(type_already_counted, 0, 256);
for (int i = 0; i < MAX_RIDES; i++) {
uint8 subtype_id;
uint32 subtype_p;
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->type == RIDE_TYPE_NULL)
continue;
subtype_id = (uint8)ride->subtype;
subtype_p = RCT2_GLOBAL(0x009ACFA4 + subtype_id * 4, uint32);
FOR_ALL_RIDES(i, ride) {
uint8 subtype_id = ride->subtype;
uint32 subtype_p = RCT2_GLOBAL(0x009ACFA4 + subtype_id * 4, uint32);
if ((RCT2_GLOBAL(subtype_p + 0x1BE, sint8) == 2 ||
RCT2_GLOBAL(subtype_p + 0x1BF, sint8) == 2) &&

View File

@@ -239,7 +239,7 @@ static void window_cheats_guests_mouseup()
#endif
rct_peep* peep;
uint16 sprite_idx;
uint16 spriteIndex;
switch (widgetIndex) {
case WIDX_CLOSE:
@@ -250,14 +250,9 @@ static void window_cheats_guests_mouseup()
window_cheats_set_page(w, widgetIndex - WIDX_TAB_1);
break;
case WIDX_HAPPY_GUESTS:
for (sprite_idx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_idx != SPRITE_INDEX_NULL; sprite_idx = peep->next) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].peep);
if (peep->type != PEEP_TYPE_GUEST)
continue;
if (peep->var_2A != 0)
continue;
peep->happiness = 255;
}
FOR_ALL_GUESTS(spriteIndex, peep)
if (peep->var_2A == 0)
peep->happiness = 255;
window_invalidate_by_id(0x40 | WC_BOTTOM_TOOLBAR, 0);
break;
}

View File

@@ -388,7 +388,7 @@ static void window_guest_list_update(rct_window *w)
*/
static void window_guest_list_scrollgetsize()
{
int i, y, numGuests, spriteIdx;
int i, y, numGuests, spriteIndex;
rct_window *w;
rct_peep *peep;
@@ -404,13 +404,7 @@ static void window_guest_list_scrollgetsize()
// Count the number of guests
numGuests = 0;
spriteIdx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
while (spriteIdx != SPRITE_INDEX_NULL) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[spriteIdx].peep);
spriteIdx = peep->next;
if (peep->type != PEEP_TYPE_GUEST)
continue;
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_2A != 0)
continue;
if (_window_guest_list_selected_filter != -1)
@@ -470,7 +464,7 @@ static void window_guest_list_scrollgetsize()
*/
static void window_guest_list_scrollmousedown()
{
int i, spriteIdx;
int i, spriteIndex;
short y;
rct_window *w;
rct_peep *peep;
@@ -492,13 +486,7 @@ static void window_guest_list_scrollmousedown()
case PAGE_INDIVIDUAL:
i = y / 10;
i += _window_guest_list_selected_page * 3173;
spriteIdx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
while (spriteIdx != SPRITE_INDEX_NULL) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[spriteIdx].peep);
spriteIdx = peep->next;
if (peep->type != PEEP_TYPE_GUEST)
continue;
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_2A != 0)
continue;
if (_window_guest_list_selected_filter != -1)
@@ -683,7 +671,7 @@ static void window_guest_list_paint()
static void window_guest_list_scrollpaint()
{
int eax, ebx, ecx, edx, esi, edi, ebp;
int spriteIdx, format, numGuests, i, j, y;
int spriteIndex, format, numGuests, i, j, y;
rct_window *w;
rct_drawpixelinfo *dpi;
rct_peep *peep;
@@ -711,13 +699,7 @@ static void window_guest_list_scrollpaint()
y = _window_guest_list_selected_page * -0x7BF2;
// For each guest
spriteIdx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
while (spriteIdx != SPRITE_INDEX_NULL) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[spriteIdx].peep);
spriteIdx = peep->next;
if (peep->type != PEEP_TYPE_GUEST)
continue;
FOR_ALL_GUESTS(spriteIndex, peep) {
peep->var_0C &= ~0x200;
if (peep->var_2A != 0)
continue;
@@ -907,7 +889,7 @@ static int sub_69B7EA(rct_peep *peep, int *outEAX)
*/
static void window_guest_list_find_groups()
{
int spriteIdx, spriteIdx2, groupIndex, faceIndex;
int spriteIndex, spriteIndex2, groupIndex, faceIndex;
rct_peep *peep, *peep2;
int eax = RCT2_GLOBAL(0x00F663AC, uint32) & 0xFFFFFF00;
@@ -921,24 +903,13 @@ static void window_guest_list_find_groups()
_window_guest_list_num_groups = 0;
// Set all guests to unassigned
spriteIdx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
while (spriteIdx != SPRITE_INDEX_NULL) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[spriteIdx].peep);
spriteIdx = peep->next;
if (peep->type != PEEP_TYPE_GUEST || peep->var_2A != 0)
continue;
peep->var_0C |= (1 << 8);
}
FOR_ALL_GUESTS(spriteIndex, peep)
if (peep->var_2A == 0)
peep->var_0C |= (1 << 8);
// For each guest / group
spriteIdx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
while (spriteIdx != SPRITE_INDEX_NULL) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[spriteIdx].peep);
spriteIdx = peep->next;
if (peep->type != PEEP_TYPE_GUEST || peep->var_2A != 0 || !(peep->var_0C & (1 << 8)))
FOR_ALL_GUESTS(spriteIndex, peep) {
if (peep->var_2A != 0 || !(peep->var_0C & (1 << 8)))
continue;
// New group, cap at 240 though
@@ -961,12 +932,8 @@ static void window_guest_list_find_groups()
_window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite_small(peep) - 5486;
// Find more peeps that belong to same group
spriteIdx2 = peep->next;
while (spriteIdx2 != SPRITE_INDEX_NULL) {
peep2 = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[spriteIdx2].peep);
spriteIdx2 = peep2->next;
if (peep2->type != PEEP_TYPE_GUEST || peep2->var_2A != 0 || !(peep2->var_0C & (1 << 8)))
FOR_ALL_GUESTS(spriteIndex2, peep2) {
if (peep2->var_2A != 0 || !(peep2->var_0C & (1 << 8)))
continue;
// Get and check if in same group

View File

@@ -695,10 +695,7 @@ static void window_ride_list_refresh_list(rct_window *w)
rct_ride *ride, *otherRide;
countA = countB = 0;
for (i = 0; i < MAX_RIDES; i++) {
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->type == RIDE_TYPE_NULL)
continue;
FOR_ALL_RIDES(i, ride) {
if (w->page != gRideClassifications[ride->type])
continue;
@@ -717,10 +714,7 @@ static void window_ride_list_refresh_list(rct_window *w)
w->var_476 = countA;
j = 0;
for (i = 0; i < MAX_RIDES; i++) {
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->type == RIDE_TYPE_NULL)
continue;
FOR_ALL_RIDES(i, ride) {
if (w->page != gRideClassifications[ride->type])
continue;
@@ -844,10 +838,7 @@ static void window_ride_list_close_all(rct_window *w)
int i;
rct_ride *ride;
for (i = 0; i < MAX_RIDES; i++) {
ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i];
if (ride->type == RIDE_TYPE_NULL)
continue;
FOR_ALL_RIDES(i, ride) {
if (w->page != gRideClassifications[ride->type])
continue;
if (ride->status == RIDE_STATUS_CLOSED)
@@ -864,10 +855,7 @@ static void window_ride_list_open_all(rct_window *w)
int i;
rct_ride *ride;
for (i = 0; i < MAX_RIDES; i++) {
ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i];
if (ride->type == RIDE_TYPE_NULL)
continue;
FOR_ALL_RIDES(i, ride) {
if (w->page != gRideClassifications[ride->type])
continue;
if (ride->status == RIDE_STATUS_OPEN)