This commit is contained in:
Duncan Frost 2014-05-05 20:27:40 +01:00
commit 2b900bebb3
6 changed files with 404 additions and 137 deletions

View File

@ -182,12 +182,12 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
switch (type) {
case NEWS_ITEM_RIDE:
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[subject]);
if (ride->var_050 == 0xFFFF) {
if (ride->overall_view == 0xFFFF) {
*x = SPRITE_LOCATION_NULL;
break;
}
*x = (ride->var_050 & 0xFF) * 32 + 16;
*y = (ride->var_050 >> 8) * 32 + 16;
*x = (ride->overall_view & 0xFF) * 32 + 16;
*y = (ride->overall_view >> 8) * 32 + 16;
*z = map_element_height(*x, *y);
break;
case NEWS_ITEM_PEEP_ON_RIDE:

View File

@ -230,13 +230,69 @@ enum PEEP_FLAGS {
PEEP_FLAGS_ICE_CREAM = (1 << 25) // Unconfirmed
};
enum PEEP_NAUSEA_TOLERANCE{
enum PEEP_NAUSEA_TOLERANCE {
PEEP_NAUSEA_TOLERANCE_NONE,
PEEP_NAUSEA_TOLERANCE_LOW,
PEEP_NAUSEA_TOLERANCE_AVERAGE,
PEEP_NAUSEA_TOLERANCE_HIGH
};
enum PEEP_ITEM {
// item_standard_flags
PEEP_ITEM_BALLOON = (1 << 0),
PEEP_ITEM_TOY = (1 << 1),
PEEP_ITEM_MAP = (1 << 2),
PEEP_ITEM_PHOTO = (1 << 3),
PEEP_ITEM_UMBRELLA = (1 << 4),
PEEP_ITEM_DRINK = (1 << 5),
PEEP_ITEM_BURGER = (1 << 6),
PEEP_ITEM_FRIES = (1 << 7),
PEEP_ITEM_ICE_CREAM = (1 << 8),
PEEP_ITEM_COTTON_CANDY = (1 << 9),
PEEP_ITEM_EMPTY_CAN = (1 << 10),
PEEP_ITEM_RUBBISH = (1 << 11),
PEEP_ITEM_EMPTY_BURGER_BOX = (1 << 12),
PEEP_ITEM_PIZZA = (1 << 13),
PEEP_ITEM_VOUCHER = (1 << 14),
PEEP_ITEM_POPCORN = (1 << 15),
PEEP_ITEM_HOT_DOG = (1 << 16),
PEEP_ITEM_TENTACLE = (1 << 17),
PEEP_ITEM_HAT = (1 << 18),
PEEP_ITEM_CANDY_APPLE = (1 << 19),
PEEP_ITEM_TSHIRT = (1 << 20),
PEEP_ITEM_DONUT = (1 << 21),
PEEP_ITEM_COFFEE = (1 << 22),
PEEP_ITEM_EMPTY_CUP = (1 << 23),
PEEP_ITEM_CHICKEN = (1 << 24),
PEEP_ITEM_LEMONADE = (1 << 25),
PEEP_ITEM_EMPTY_BOX = (1 << 26),
PEEP_ITEM_EMPTY_BOTTLE = (1 << 27),
// item_extra_flags
PEEP_ITEM_PHOTO2 = (1 << 0),
PEEP_ITEM_PHOTO3 = (1 << 1),
PEEP_ITEM_PHOTO4 = (1 << 2),
PEEP_ITEM_PRETZEL = (1 << 3),
PEEP_ITEM_CHOCOLATE = (1 << 4),
PEEP_ITEM_ICED_TEA = (1 << 5),
PEEP_ITEM_FUNNEL_CAKE = (1 << 6),
PEEP_ITEM_SUNGLASSES = (1 << 7),
PEEP_ITEM_BEEF_NOODLES = (1 << 8),
PEEP_ITEM_FRIED_RICE_NOODLES = (1 << 9),
PEEP_ITEM_WONTON_SOUP = (1 << 10),
PEEP_ITEM_MEATBALL_SOUP = (1 << 11),
PEEP_ITEM_FRUIT_JUICE = (1 << 12),
PEEP_ITEM_SOYBEAN_MILK = (1 << 13),
PEEP_ITEM_SU_JONGKWA = (1 << 14),
PEEP_ITEM_SUB_SANDWICH = (1 << 15),
PEEP_ITEM_COOKIE = (1 << 16),
PEEP_ITEM_EMPTY_BOWL_RED = (1 << 17),
PEEP_ITEM_EMPTY_DRINK_CARTON = (1 << 18),
PEEP_ITEM_EMPTY_JUICE_CUP = (1 << 19),
PEEP_ITEM_ROAST_SAUSAGE = (1 << 20),
PEEP_ITEM_EMPTY_BOWL_BLUE = (1 << 21)
};
typedef struct {
uint8 type;
uint8 item;
@ -292,7 +348,7 @@ typedef struct {
uint8 photo2_ride_ref; // 0x5C
uint8 photo3_ride_ref; // 0x5D
uint8 photo4_ride_ref; // 0x5E
uint8 pad_5F[0x09];
uint8 pad_5F[0x09]; // 0x5C
uint8 current_ride; // 0x68
uint8 pad_69;
uint8 current_train; // 0x6A

View File

@ -113,7 +113,7 @@ int ride_get_total_queue_length(rct_ride *ride)
{
int i, queueLength = 0;
for (i = 0; i < 4; i++)
if (ride->var_06A[i] != 0xFFFF)
if (ride->entrances[i] != 0xFFFF)
queueLength += ride->queue_length[i];
return queueLength;
}
@ -122,7 +122,7 @@ int ride_get_max_queue_time(rct_ride *ride)
{
int i, queueTime = 0;
for (i = 0; i < 4; i++)
if (ride->var_06A[i] != 0xFFFF)
if (ride->entrances[i] != 0xFFFF)
queueTime = max(queueTime, ride->queue_time[i]);
return queueTime;
}

View File

@ -31,16 +31,20 @@ typedef struct {
uint8 type; // 0x000
uint8 subtype; // 0x001
uint16 pad_002;
uint8 var_004;
uint8 pad_005[0x44];
uint8 mode; // 0x004
uint8 colour_scheme_type; // 0x005
uint16 car_colours[32]; // 0x006
uint8 pad_046[0x03];
uint8 status; // 0x049
uint16 var_04A;
uint32 var_04C;
uint16 var_050; // 0x050
uint8 pad_052[0x18];
uint16 var_06A[4]; // probably entrance map coordinates
uint8 pad_072[0x14];
uint16 train_car_map[1]; // 0x86 Points to the first car in the train
uint16 overall_view; // 0x050
uint16 station_starts[4]; // 0x052
uint8 pad_05A[0x10];
uint16 entrances[4]; // 0x06A
uint16 exits[4]; // 0x072
uint8 pad_07A[0x0C];
uint16 train_car_map[1]; // 0x086 Points to the first car in the train
uint8 pad_088[0x68];
sint16 var_0F0;
sint16 var_0F2;
@ -56,7 +60,8 @@ typedef struct {
sint16 running_cost; // 0x132
sint16 var_134;
sint16 var_136;
uint8 pad_138[0x08];
sint16 price; // 0x138
uint8 pad_13A[0x06];
sint16 excitement; // 0x140
sint16 intensity; // 0x142
uint16 nausea; // 0x144
@ -197,6 +202,52 @@ enum {
RIDE_STATUS_TESTING
};
enum {
RIDE_MODE_NORMAL = 0,
RIDE_MODE_CONTINUOUS_CIRCUIT,
RIDE_MODE_REVERSE_INCLINED_SHUTTLE,
RIDE_MODE_POWERED_LAUNCH, // RCT1 style?
RIDE_MODE_SHUTTLE,
RIDE_MODE_BOAT_HIRE,
RIDE_MODE_UPWARD_LAUNCH,
RIDE_MODE_ROTATING_LIFT,
RIDE_MODE_STATION_TO_STATION,
RIDE_MODE_SINGLE_RIDE_PER_ADMISSION,
RIDE_MODE_UNLIMITED_RIDES_PER_ADMISSION,
RIDE_MODE_MAZE,
RIDE_MODE_RACE,
RIDE_MODE_BUMPERCAR,
RIDE_MODE_SWING,
RIDE_MODE_SHOP_STALL,
RIDE_MODE_ROTATION,
RIDE_MODE_FORWARD_ROTATION,
RIDE_MODE_BACKWARD_ROTATION,
RIDE_MODE_FILM_AVENGING_AVIATORS,
RIDE_MODE_3D_FILM_MOUSE_TAILS,
RIDE_MODE_SPACE_RINGS,
RIDE_MODE_BEGINNERS,
RIDE_MODE_LIM_POWERED_LAUNCH,
RIDE_MODE_FILM_THRILL_RIDERS,
RIDE_MODE_3D_FILM_STORM_CHASERS,
RIDE_MODE_3D_FILM_SPACE_RAIDERS,
RIDE_MODE_INTENSE,
RIDE_MODE_BERSERK,
RIDE_MODE_HAUNTED_HOUSE,
RIDE_MODE_CIRCUS_SHOW,
RIDE_MODE_DOWNWARD_LAUNCH,
RIDE_MODE_CROOKED_HOUSE,
RIDE_MODE_FREEFALL_DROP,
RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED,
RIDE_MODE_POWERED_LAUNCH2, // RCT2 style?
RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED
};
enum {
RIDE_COLOUR_SCHEME_ALL_SAME,
RIDE_COLOUR_SCHEME_DIFFERENT_PER_TRAIN,
RIDE_COLOUR_SCHEME_DIFFERENT_PER_CAR
};
#define MAX_RIDES 255
#define MAX_RIDE_MEASUREMENTS 8

View File

@ -115,21 +115,22 @@ static uint32 window_guest_list_events[] = {
window_guest_list_scrollpaint
};
static int window_guest_list_highlighted_index;
static int window_guest_list_selected_tab;
static int window_guest_list_selected_filter;
static int window_guest_list_selected_page;
static int window_guest_list_selected_view;
static int window_guest_list_num_pages;
static int window_guest_list_num_groups;
static int _window_guest_list_highlighted_index;
static int _window_guest_list_selected_tab;
static int _window_guest_list_selected_filter;
static int _window_guest_list_selected_page;
static int _window_guest_list_selected_view;
static int _window_guest_list_num_pages;
static int _window_guest_list_num_groups;
static uint16 window_guest_list_groups_num_guests[240];
static uint8 window_guest_list_groups_guest_faces[13440];
static uint16 _window_guest_list_groups_num_guests[240];
static uint32 _window_guest_list_groups_argument_1[240];
static uint32 _window_guest_list_groups_argument_2[240];
static uint8 _window_guest_list_groups_guest_faces[240 * 58];
static void window_guest_list_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w);
static void window_guest_list_refresh_list(rct_window *w);
static void window_guest_list_close_all(rct_window *w);
static void window_guest_list_open_all(rct_window *w);
static int window_guest_list_is_peep_in_filter(rct_peep* peep);
static void window_guest_list_find_groups();
static int get_guest_face_sprite(rct_peep *peep);
/**
*
@ -139,9 +140,6 @@ void window_guest_list_open()
{
rct_window* window;
RCT2_CALLPROC_EBPSAFE(0x006992E3);
return;
// Check if window is already open
window = window_bring_to_front_by_id(WC_RIDE_LIST, 0);
if (window != NULL)
@ -160,12 +158,12 @@ void window_guest_list_open()
(1 << WIDX_TAB_2);
window_init_scroll_widgets(window);
window_guest_list_highlighted_index = -1;
_window_guest_list_highlighted_index = -1;
window->var_490 = 0;
window_guest_list_selected_tab = 0;
window_guest_list_selected_filter = -1;
window_guest_list_selected_page = 0;
window_guest_list_num_pages = 1;
_window_guest_list_selected_tab = 1;
_window_guest_list_selected_filter = -1;
_window_guest_list_selected_page = 0;
_window_guest_list_num_pages = 1;
window_guest_list_widgets[WIDX_PAGE_DROPDOWN].type = WWT_EMPTY;
window_guest_list_widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WWT_EMPTY;
window->var_492 = 0;
@ -242,16 +240,16 @@ static void window_guest_list_mousedown()
switch (widgetIndex) {
case WIDX_TAB_1:
case WIDX_TAB_2:
if (window_guest_list_selected_filter == -1)
if (window_guest_list_selected_tab == widgetIndex - WIDX_TAB_1)
if (_window_guest_list_selected_filter == -1)
if (_window_guest_list_selected_tab == widgetIndex - WIDX_TAB_1)
break;
window_guest_list_selected_tab = widgetIndex - WIDX_TAB_1;
window_guest_list_selected_page = 0;
window_guest_list_num_pages = 1;
_window_guest_list_selected_tab = widgetIndex - WIDX_TAB_1;
_window_guest_list_selected_page = 0;
_window_guest_list_num_pages = 1;
window_guest_list_widgets[WIDX_PAGE_DROPDOWN].type = WWT_EMPTY;
window_guest_list_widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WWT_EMPTY;
w->var_490 = 0;
window_guest_list_selected_filter = -1;
_window_guest_list_selected_filter = -1;
window_invalidate(w);
w->scrolls[0].v_top = 0;
break;
@ -264,7 +262,7 @@ static void window_guest_list_mousedown()
widget->bottom - widget->top + 1,
w->colours[1],
0x80,
window_guest_list_num_pages,
_window_guest_list_num_pages,
widget->right - widget->left - 3
);
@ -272,7 +270,7 @@ static void window_guest_list_mousedown()
gDropdownItemsFormat[i] = 1142;
gDropdownItemsArgs[i] = STR_PAGE_1 + i;
}
RCT2_GLOBAL(0x009DED38, uint32) |= (1 << window_guest_list_selected_view);
RCT2_GLOBAL(0x009DED38, uint32) |= (1 << _window_guest_list_selected_view);
break;
case WIDX_INFO_TYPE_DROPDOWN_BUTTON:
widget = &w->widgets[widgetIndex - 1];
@ -291,7 +289,7 @@ static void window_guest_list_mousedown()
gDropdownItemsFormat[i] = 1142;
gDropdownItemsArgs[i] = STR_ACTIONS + i;
}
RCT2_GLOBAL(0x009DED38, uint32) |= (1 << window_guest_list_selected_view);
RCT2_GLOBAL(0x009DED38, uint32) |= (1 << _window_guest_list_selected_view);
break;
}
}
@ -313,13 +311,13 @@ static void window_guest_list_dropdown()
case WIDX_PAGE_DROPDOWN_BUTTON:
if (dropdownIndex == -1)
break;
window_guest_list_selected_page = dropdownIndex;
_window_guest_list_selected_page = dropdownIndex;
window_invalidate(w);
break;
case WIDX_INFO_TYPE_DROPDOWN_BUTTON:
if (dropdownIndex == -1)
break;
window_guest_list_selected_view = dropdownIndex;
_window_guest_list_selected_view = dropdownIndex;
window_invalidate(w);
break;
}
@ -338,36 +336,9 @@ static void window_guest_list_update()
if (RCT2_GLOBAL(0x00F1AF20, uint16) != 0)
RCT2_GLOBAL(0x00F1AF20, uint16)--;
w->var_490++;
if (w->var_490 >= (window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 24 : 32))
if (w->var_490 >= (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 24 : 32))
w->var_490 = 0;
widget_invalidate(WC_GUEST_LIST, 0, WIDX_TAB_1 + window_guest_list_selected_tab);
}
/**
*
* rct2: 0x0069B865
*/
int window_guest_list_is_peep_in_filter(rct_peep* peep)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
char temp;
temp = window_guest_list_selected_view;
window_guest_list_selected_view = window_guest_list_selected_filter;
esi = peep;
RCT2_CALLFUNC_X(0x0069B7EA, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
ebx &= 0xFFFF;
window_guest_list_selected_view = temp;
eax = (RCT2_GLOBAL(0x013CE952, uint16) << 16) | ebx;
if (((RCT2_GLOBAL(0x00F1EDF6, uint32) >> 16) & 0xFFFF) == 0xFFFF && window_guest_list_selected_filter == 1)
eax |= 0xFFFF;
if (eax == RCT2_GLOBAL(0x00F1EDF6, uint32) && RCT2_GLOBAL(0x013CE954, uint32) == RCT2_GLOBAL(0x00F1EDFA, uint32))
return 0;
return 1;
widget_invalidate(WC_GUEST_LIST, 0, WIDX_TAB_1 + _window_guest_list_selected_tab);
}
/**
@ -382,7 +353,7 @@ static void window_guest_list_scrollgetsize()
__asm mov w, esi
switch (window_guest_list_selected_tab) {
switch (_window_guest_list_selected_tab) {
case PAGE_INDIVIDUAL:
// Count the number of guests
numGuests = 0;
@ -396,7 +367,7 @@ static void window_guest_list_scrollgetsize()
continue;
if (peep->var_2A != 0)
continue;
if (window_guest_list_selected_filter != -1)
if (_window_guest_list_selected_filter != -1)
if (window_guest_list_is_peep_in_filter(peep))
continue;
numGuests++;
@ -406,22 +377,22 @@ static void window_guest_list_scrollgetsize()
break;
case PAGE_SUMMARISED:
// Find the groups
RCT2_CALLPROC_EBPSAFE(0x0069B5AE);
w->var_492 = window_guest_list_num_groups;
y = window_guest_list_num_groups * 21;
window_guest_list_find_groups();
w->var_492 = _window_guest_list_num_groups;
y = _window_guest_list_num_groups * 21;
break;
}
RCT2_GLOBAL(0x00F1EE09, uint32) = numGuests;
i = window_guest_list_selected_page;
for (i = window_guest_list_selected_page - 1; i >= 0; i--)
i = _window_guest_list_selected_page;
for (i = _window_guest_list_selected_page - 1; i >= 0; i--)
y -= 0x7BF2;
if (y < 0)
y = 0;
if (y > 0x7BF2)
y = 0x7BF2;
if (window_guest_list_highlighted_index != -1) {
window_guest_list_highlighted_index = -1;
if (_window_guest_list_highlighted_index != -1) {
_window_guest_list_highlighted_index = -1;
window_invalidate(w);
}
@ -451,10 +422,10 @@ static void window_guest_list_scrollmousedown()
__asm mov y, dx
__asm mov w, esi
switch (window_guest_list_selected_tab) {
switch (_window_guest_list_selected_tab) {
case PAGE_INDIVIDUAL:
i = y / 10;
i += window_guest_list_selected_page * 3173;
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);
@ -464,7 +435,7 @@ static void window_guest_list_scrollmousedown()
continue;
if (peep->var_2A != 0)
continue;
if (window_guest_list_selected_filter != -1)
if (_window_guest_list_selected_filter != -1)
if (window_guest_list_is_peep_in_filter(peep))
continue;
@ -479,11 +450,11 @@ static void window_guest_list_scrollmousedown()
break;
case PAGE_SUMMARISED:
i = y / 21;
if (i < window_guest_list_num_groups) {
RCT2_GLOBAL(0x00F1EDF6, uint32) = ((int*)0x00F1B016)[i * 2];
RCT2_GLOBAL(0x00F1EDFA, uint32) = ((int*)0x00F1B01A)[i * 2];
window_guest_list_selected_filter = window_guest_list_selected_view;
window_guest_list_selected_tab = PAGE_INDIVIDUAL;
if (i < _window_guest_list_num_groups) {
RCT2_GLOBAL(0x00F1EDF6, uint32) = _window_guest_list_groups_argument_1[i];
RCT2_GLOBAL(0x00F1EDFA, uint32) = _window_guest_list_groups_argument_2[i];
_window_guest_list_selected_filter = _window_guest_list_selected_view;
_window_guest_list_selected_tab = PAGE_INDIVIDUAL;
window_invalidate(w);
w->scrolls[0].v_top = 0;
}
@ -504,10 +475,10 @@ static void window_guest_list_scrollmouseover()
__asm mov y, dx
__asm mov w, esi
i = y / (window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 10 : 21);
i += window_guest_list_selected_page * 3173;
if (i != window_guest_list_highlighted_index) {
window_guest_list_highlighted_index = i;
i = y / (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 10 : 21);
i += _window_guest_list_selected_page * 3173;
if (i != _window_guest_list_highlighted_index) {
_window_guest_list_highlighted_index = i;
window_invalidate(w);
}
}
@ -533,11 +504,11 @@ static void window_guest_list_invalidate()
w->pressed_widgets &= ~(1 << WIDX_TAB_1);
w->pressed_widgets &= ~(1 << WIDX_TAB_2);
w->pressed_widgets |= (1 << (window_guest_list_selected_tab + WIDX_TAB_1));
w->pressed_widgets |= (1 << (_window_guest_list_selected_tab + WIDX_TAB_1));
window_guest_list_widgets[WIDX_INFO_TYPE_DROPDOWN].image = STR_ACTIONS + window_guest_list_selected_view;
window_guest_list_widgets[WIDX_INFO_TYPE_DROPDOWN].image = STR_ACTIONS + _window_guest_list_selected_view;
window_guest_list_widgets[WIDX_MAP].type = WWT_EMPTY;
if (window_guest_list_selected_tab == PAGE_INDIVIDUAL && window_guest_list_selected_filter != -1)
if (_window_guest_list_selected_tab == PAGE_INDIVIDUAL && _window_guest_list_selected_filter != -1)
window_guest_list_widgets[WIDX_MAP].type = WWT_FLATBTN;
window_guest_list_widgets[WIDX_BACKGROUND].right = w->width - 1;
@ -550,7 +521,7 @@ static void window_guest_list_invalidate()
window_guest_list_widgets[WIDX_GUEST_LIST].right = w->width - 4;
window_guest_list_widgets[WIDX_GUEST_LIST].bottom = w->height - 15;
window_guest_list_widgets[WIDX_PAGE_DROPDOWN].image = window_guest_list_selected_page + 3440;
window_guest_list_widgets[WIDX_PAGE_DROPDOWN].image = _window_guest_list_selected_page + 3440;
}
/**
@ -570,7 +541,7 @@ static void window_guest_list_paint()
window_draw_widgets(w, dpi);
// Tab 1 image
i = (window_guest_list_selected_tab == 0 ? w->var_490 & 0x0FFFFFFFC : 0);
i = (_window_guest_list_selected_tab == 0 ? w->var_490 & 0x0FFFFFFFC : 0);
i += ((int*)*((int*)0x00982708))[0] + 1;
i |= 0xA1600000;
gfx_draw_sprite(
@ -581,7 +552,7 @@ static void window_guest_list_paint()
);
// Tab 2 image
i = (window_guest_list_selected_tab == 1 ? w->var_490 / 4 : 0);
i = (_window_guest_list_selected_tab == 1 ? w->var_490 / 4 : 0);
gfx_draw_sprite(
dpi,
5568 + i,
@ -592,10 +563,10 @@ static void window_guest_list_paint()
// Filter description
x = w->x + 6;
y = w->y + window_guest_list_widgets[WIDX_TAB_CONTENT_PANEL].top + 3;
if (window_guest_list_selected_tab == PAGE_INDIVIDUAL) {
if (window_guest_list_selected_filter != -1) {
if (_window_guest_list_selected_tab == PAGE_INDIVIDUAL) {
if (_window_guest_list_selected_filter != -1) {
if (RCT2_GLOBAL(0x00F1EDF6, sint16) != -1)
format = STR_GUESTS_FILTER + window_guest_list_selected_filter;
format = STR_GUESTS_FILTER + _window_guest_list_selected_filter;
else
format = STR_GUESTS_FILTER_THINKING_ABOUT;
} else {
@ -607,7 +578,7 @@ static void window_guest_list_paint()
gfx_draw_string_left_clipped(dpi, format, 0x00F1EDF6, 0, x, y, 310);
// Number of guests (list items)
if (window_guest_list_selected_tab == PAGE_INDIVIDUAL) {
if (_window_guest_list_selected_tab == PAGE_INDIVIDUAL) {
x = w->x + 4;
y = w->y + window_guest_list_widgets[WIDX_GUEST_LIST].bottom + 2;
RCT2_GLOBAL(0x013CE952, sint16) = w->var_492;
@ -615,19 +586,6 @@ static void window_guest_list_paint()
}
}
/**
*
* rct2: 0x00698721
*/
static int get_guest_face_sprite(rct_peep *peep)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
esi = peep;
ebp = 999;
RCT2_CALLFUNC_X(0x00698721, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
return ebp;
}
/**
*
* rct2: 0x00699701
@ -647,10 +605,10 @@ static void window_guest_list_scrollpaint()
// Background fill
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ((char*)0x0141FC48)[w->colours[1] * 8]);
switch (window_guest_list_selected_tab) {
switch (_window_guest_list_selected_tab) {
case PAGE_INDIVIDUAL:
i = 0;
y = window_guest_list_selected_page * -0x7BF2;
y = _window_guest_list_selected_page * -0x7BF2;
// For each guest
spriteIdx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
@ -663,7 +621,7 @@ static void window_guest_list_scrollpaint()
peep->var_0C &= ~0x200;
if (peep->var_2A != 0)
continue;
if (window_guest_list_selected_filter != -1) {
if (_window_guest_list_selected_filter != -1) {
if (window_guest_list_is_peep_in_filter(peep))
continue;
RCT2_GLOBAL(0x009AC861, uint16) |= 1;
@ -678,7 +636,7 @@ static void window_guest_list_scrollpaint()
// Highlight backcolour and text colour (format)
format = 1191;
if (i == window_guest_list_highlighted_index) {
if (i == _window_guest_list_highlighted_index) {
gfx_fill_rect(dpi, 0, y, 800, y + 9, 0x02000031);
format = 1193;
}
@ -688,7 +646,7 @@ static void window_guest_list_scrollpaint()
RCT2_GLOBAL(0x013CE954, uint32) = peep->id;
gfx_draw_string_left_clipped(dpi, format, 0x013CE952, 0, 0, y - 1, 113);
switch (window_guest_list_selected_view) {
switch (_window_guest_list_selected_view) {
case VIEW_ACTIONS:
// Guest face
gfx_draw_sprite(dpi, get_guest_face_sprite(peep), 118, y);
@ -743,7 +701,7 @@ static void window_guest_list_scrollpaint()
y = 0;
// For each group of guests
for (i = 0; i < window_guest_list_num_groups; i++) {
for (i = 0; i < _window_guest_list_num_groups; i++) {
// Check if y is beyond the scroll control
if (y + 22 >= dpi->y) {
// Check if y is beyond the scroll control
@ -752,20 +710,20 @@ static void window_guest_list_scrollpaint()
// Highlight backcolour and text colour (format)
format = 1191;
if (i == window_guest_list_highlighted_index) {
if (i == _window_guest_list_highlighted_index) {
gfx_fill_rect(dpi, 0, y, 800, y + 20, 0x02000031);
format = 1193;
}
// Draw guest faces
numGuests = window_guest_list_groups_num_guests[i];
numGuests = _window_guest_list_groups_num_guests[i];
for (j = 0; j < 56 && j < numGuests; j++)
gfx_draw_sprite(dpi, window_guest_list_groups_guest_faces[numGuests * 56 + j] + 5486, j * 8, y + 9);
gfx_draw_sprite(dpi, _window_guest_list_groups_guest_faces[numGuests * 56 + j] + 5486, j * 8, y + 9);
// Draw action
RCT2_GLOBAL(0x013CE952, uint16) = ((uint32*)0x00F1B016)[i * 2] & 0xFFFF;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = ((uint32*)0x00F1B016)[i * 2] >> 16;
RCT2_GLOBAL(0x013CE952 + 4, uint32) = ((int*)0x00F1B01A)[i * 2];
RCT2_GLOBAL(0x013CE952, uint16) = _window_guest_list_groups_argument_1[i] & 0xFFFF;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = _window_guest_list_groups_argument_1[i] >> 16;
RCT2_GLOBAL(0x013CE952 + 4, uint32) = _window_guest_list_groups_argument_2[i];
RCT2_GLOBAL(0x013CE952 + 10, uint32) = numGuests;
gfx_draw_string_left_clipped(dpi, format, 0x013CE952, 0, 0, y - 1, 414);
@ -777,4 +735,206 @@ static void window_guest_list_scrollpaint()
}
break;
}
}
/**
*
* rct2: 0x0069B865
*/
static int window_guest_list_is_peep_in_filter(rct_peep* peep)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
char temp;
temp = _window_guest_list_selected_view;
_window_guest_list_selected_view = _window_guest_list_selected_filter;
esi = peep;
RCT2_CALLFUNC_X(0x0069B7EA, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
ebx &= 0xFFFF;
_window_guest_list_selected_view = temp;
eax = (RCT2_GLOBAL(0x013CE952, uint16) << 16) | ebx;
if (((RCT2_GLOBAL(0x00F1EDF6, uint32) >> 16) & 0xFFFF) == 0xFFFF && _window_guest_list_selected_filter == 1)
eax |= 0xFFFF;
if (eax == RCT2_GLOBAL(0x00F1EDF6, uint32) && RCT2_GLOBAL(0x013CE954, uint32) == RCT2_GLOBAL(0x00F1EDFA, uint32))
return 0;
return 1;
}
static int sub_69B7EA(rct_peep *peep, int *outEAX)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
switch (_window_guest_list_selected_view) {
case VIEW_ACTIONS:
eax = peep->var_0A;
RCT2_CALLFUNC_X(0x00698B0D, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
RCT2_GLOBAL(0x013CE952, uint16) = ecx & 0xFFFF;
RCT2_GLOBAL(0x013CE952 + 2, uint32) = edx;
*outEAX = eax;
return ebx & 0xFFFF;
case VIEW_THOUGHTS:
if (peep->thoughts[0].pad_3 <= 5) {
eax = peep->thoughts[0].item;
ebx = peep->thoughts[0].type;
if (peep->thoughts[0].type != PEEP_THOUGHT_TYPE_NONE) {
RCT2_CALLFUNC_X(0x00698342, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
RCT2_GLOBAL(0x013CE952, uint16) = *((uint16*)esi);
RCT2_GLOBAL(0x013CE952 + 2, uint32) = *((uint32*)(esi + 2));
*outEAX = eax;
return ebx & 0xFFFF;
}
}
RCT2_GLOBAL(0x013CE952, uint16) = 0;
RCT2_GLOBAL(0x013CE952 + 2, uint32) = 0;
*outEAX = 0;
return 0;
}
}
/**
*
* rct2: 0x0069B5AE
*/
static void window_guest_list_find_groups()
{
int spriteIdx, spriteIdx2, groupIndex, faceIndex;
rct_peep *peep, *peep2;
int eax = RCT2_GLOBAL(0x00F663AC, uint32) & 0xFFFFFF00;
if (_window_guest_list_selected_view == RCT2_GLOBAL(0x00F1EE02, uint32))
if (RCT2_GLOBAL(0x00F1AF20, uint16) != 0 || eax == RCT2_GLOBAL(0x00F1AF1C, uint32))
return;
RCT2_GLOBAL(0x00F1AF1C, uint32) = eax;
RCT2_GLOBAL(0x00F1EE02, uint32) = _window_guest_list_selected_view;
RCT2_GLOBAL(0x00F1AF20, uint16) = 320;
_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 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)))
continue;
// New group, cap at 240 though
groupIndex = _window_guest_list_num_groups;
if (groupIndex >= 240)
break;
int ax = peep->var_0A;
_window_guest_list_num_groups++;
_window_guest_list_groups_num_guests[groupIndex] = 1;
peep->var_0C &= ~(1 << 8);
int bx = sub_69B7EA(peep, &eax);
eax = (RCT2_GLOBAL(0x013CE952, uint16) << 16) | bx;
RCT2_GLOBAL(0x00F1EDF6, uint32) = eax;
_window_guest_list_groups_argument_1[groupIndex] = eax;
RCT2_GLOBAL(0x00F1EDFA, uint32) = RCT2_GLOBAL(0x013CE952 + 2, uint32);
_window_guest_list_groups_argument_2[groupIndex] = RCT2_GLOBAL(0x013CE952 + 2, uint32);
RCT2_ADDRESS(0x00F1AF26, uint8)[groupIndex] = groupIndex;
faceIndex = groupIndex * 56;
_window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite(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)))
continue;
// Get and check if in same group
// BUG this doesn't work!
bx = sub_69B7EA(peep2, &eax);
if (bx != RCT2_GLOBAL(0x00F1EDF6, uint32) || (eax & 0xFFFF) != RCT2_GLOBAL(0x013CE952, uint16) || eax != RCT2_GLOBAL(0x013CE952 + 2, uint32))
continue;
// Assign guest
_window_guest_list_groups_num_guests[groupIndex]++;
peep2->var_0C &= ~(1 << 8);
// Add face sprite, cap at 56 though
if (_window_guest_list_groups_num_guests[groupIndex] < 56)
continue;
_window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite(peep2) - 5486;
}
if (RCT2_GLOBAL(0x00F1EDF6, uint16) == 0) {
_window_guest_list_num_groups--;
continue;
}
ax = _window_guest_list_groups_num_guests[groupIndex];
int edi = 0;
while (1) {
if (edi >= groupIndex)
goto nextPeep;
if (ax > _window_guest_list_groups_num_guests[edi])
break;
edi++;
}
int ecx = _window_guest_list_groups_argument_1[groupIndex];
int edx = _window_guest_list_groups_argument_2[groupIndex];
int bl = RCT2_ADDRESS(0x00F1AF26, uint8)[groupIndex];
int temp;
do {
temp = ax;
ax = _window_guest_list_groups_num_guests[edi];
_window_guest_list_groups_num_guests[edi] = temp;
temp = ecx;
ecx = _window_guest_list_groups_argument_1[edi];
_window_guest_list_groups_argument_1[edi] = temp;
temp = edx;
edx = _window_guest_list_groups_argument_2[edi];
_window_guest_list_groups_argument_2[edi] = temp;
RCT2_ADDRESS(0x00F1AF26, uint8)[edi] = bl;
bl = RCT2_ADDRESS(0x00F1AF26, uint8)[edi];
} while (++edi <= groupIndex);
nextPeep:
;
}
}
/**
*
* rct2: 0x00698721
*/
static int get_guest_face_sprite(rct_peep *peep)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
esi = peep;
ebp = 999;
RCT2_CALLFUNC_X(0x00698721, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
return ebp;
}

View File

@ -497,14 +497,14 @@ static void window_ride_list_scrollpaint()
formatSecondary = STR_POPULARITY_UNKNOWN_LABEL;
if ((ride->var_158 & 0xFF) != 255) {
formatSecondary = STR_POPULARITY_LABEL;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_158 * 4) & 0xFF;
}
RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_158 & 0xFF) * 4;
}
break;
case INFORMATION_TYPE_SATISFACTION:
formatSecondary = STR_SATISFACTION_UNKNOWN_LABEL;
if ((ride->var_14A & 0xFF) != 255) {
formatSecondary = STR_SATISFACTION_LABEL;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_14A * 5) & 0xFF;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_14A & 0xFF) * 5;
}
break;
case INFORMATION_TYPE_PROFIT:
@ -647,7 +647,7 @@ static void window_ride_list_refresh_list(rct_window *w)
case INFORMATION_TYPE_POPULARITY:
while (--k >= 0) {
otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]);
if ((ride->var_158 * 4) & 0xFF <= (otherRide->var_158 * 4) & 0xFF)
if ((ride->var_158 & 0xFF) * 4 <= (otherRide->var_158 & 0xFF) * 4)
break;
swapper = w->var_076[k];
@ -658,7 +658,7 @@ static void window_ride_list_refresh_list(rct_window *w)
case INFORMATION_TYPE_SATISFACTION:
while (--k >= 0) {
otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]);
if ((ride->var_14A * 5) & 0xFF <= (otherRide->var_14A * 5) & 0xFF)
if ((ride->var_14A & 0xFF) * 5 <= (otherRide->var_14A & 0xFF) * 5)
break;
swapper = w->var_076[k];