diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 00362abcc4..89c9d0d52b 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -110,6 +110,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index dd606605a9..00b53db492 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -332,6 +332,9 @@ Source Files + + Windows + diff --git a/src/game.c b/src/game.c index 5da9973f5d..76bd399391 100644 --- a/src/game.c +++ b/src/game.c @@ -1627,7 +1627,7 @@ int game_load_save() void sub_0x0069E9A7(){ //RCT2_CALLPROC_EBPSAFE(0x0069E9A7); //return; - for (rct_sprite* spr = RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite); spr < (rct_sprite*)RCT2_ADDRESS_SPRITES_NEXT_INDEX; ++spr){ + for (rct_sprite* spr = g_sprite_list; spr < (rct_sprite*)RCT2_ADDRESS_SPRITES_NEXT_INDEX; ++spr){ if (spr->unknown.sprite_identifier != 0xFF){ RCT2_CALLPROC_X(0x0069E9D3, spr->unknown.x, 0, spr->unknown.y, spr->unknown.z, (int)spr, 0, 0); } diff --git a/src/marketing.c b/src/marketing.c index 15b7192035..57808a3a73 100644 --- a/src/marketing.c +++ b/src/marketing.c @@ -44,7 +44,7 @@ int marketing_get_campaign_guest_generation_probability(int campaign) probability /= 8; break; case ADVERTISING_CAMPAIGN_RIDE_FREE: - ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[RCT2_ADDRESS(0x01358116, uint8)[campaign]]); + ride = &g_ride_list[RCT2_ADDRESS(0x01358116, uint8)[campaign]]; if (ride->price < 3) probability /= 8; break; diff --git a/src/news_item.c b/src/news_item.c index f9584cdaa4..e2053594e5 100644 --- a/src/news_item.c +++ b/src/news_item.c @@ -182,7 +182,7 @@ 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]); + ride = &g_ride_list[subject]; if (ride->overall_view == 0xFFFF) { *x = SPRITE_LOCATION_NULL; break; @@ -205,17 +205,17 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int * } // Find which ride peep is on - ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]); + ride = &g_ride_list[peep->current_ride]; if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) { *x = SPRITE_LOCATION_NULL; break; } // Find the first car of the train peep is on - vehicle = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[ride->train_car_map[peep->current_train]]).vehicle; + vehicle = &(g_sprite_list[ride->train_car_map[peep->current_train]]).vehicle; // Find the actual car peep is on for (i = 0; i < peep->current_car; i++) - vehicle = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[vehicle->next_vehicle_on_train]).vehicle; + vehicle = &(g_sprite_list[vehicle->next_vehicle_on_train]).vehicle; *x = vehicle->x; *y = vehicle->y; *z = vehicle->z; diff --git a/src/park.c b/src/park.c index 0d45e8a597..72eb1cd87f 100644 --- a/src/park.c +++ b/src/park.c @@ -262,7 +262,7 @@ int calculate_park_rating() num_litter = 0; for (sprite_idx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_LITTER, uint16); sprite_idx != SPRITE_INDEX_NULL; sprite_idx = litter->next) { - litter = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].litter); + litter = &(g_sprite_list[sprite_idx].litter); // Guessing this eliminates recently dropped litter if (litter->var_24 - RCT2_GLOBAL(0x00F663AC, uint32) >= 7680) @@ -305,7 +305,7 @@ money32 calculate_park_value() // Sum ride values result = 0; for (i = 0; i < 255; i++) { - ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]); + ride = &g_ride_list[i]; result += calculate_ride_value(ride); } diff --git a/src/peep.c b/src/peep.c index 437bc56c3f..00dd073ff1 100644 --- a/src/peep.c +++ b/src/peep.c @@ -58,7 +58,7 @@ void peep_update_all() spriteIndex = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); i = 0; while (spriteIndex != SPRITE_INDEX_NULL) { - peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[spriteIndex].peep); + peep = &(g_sprite_list[spriteIndex].peep); spriteIndex = peep->next; if ((i & 0x7F) != (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) { @@ -181,7 +181,7 @@ void peep_problem_warnings_update() hunger_counter++; break; } - ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->var_C5]; + ride = &g_ride_list[peep->var_C5]; if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x80000)) hunger_counter++; break; @@ -191,7 +191,7 @@ void peep_problem_warnings_update() thirst_counter++; break; } - ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->var_C5]; + ride = &g_ride_list[peep->var_C5]; if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x1000000)) thirst_counter++; break; @@ -201,7 +201,7 @@ void peep_problem_warnings_update() bathroom_counter++; break; } - ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->var_C5]; + ride = &g_ride_list[peep->var_C5]; if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x2000000)) bathroom_counter++; break; diff --git a/src/peep.h b/src/peep.h index 2ddc702b7d..f71907cd36 100644 --- a/src/peep.h +++ b/src/peep.h @@ -420,7 +420,7 @@ typedef struct { } 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) +#define GET_PEEP(sprite_index) &(g_sprite_list[sprite_index].peep) /** * Helper macro loop for enumerating through all the non null rides. To avoid needing a end loop counterpart, statements are diff --git a/src/ride.c b/src/ride.c index bbaa1db97f..7dc493efd6 100644 --- a/src/ride.c +++ b/src/ride.c @@ -99,6 +99,8 @@ const uint8 gRideClassifications[255] = { #pragma endregion +rct_ride* g_ride_list = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride); + int ride_get_count() { rct_ride *ride; @@ -139,7 +141,7 @@ void ride_init_all() rct_ride_measurement *ride_measurement; for (i = 0; i < MAX_RIDES; i++) { - ride = GET_RIDE(i); + ride = &g_ride_list[i]; ride->type = RIDE_TYPE_NULL; } @@ -183,7 +185,7 @@ void ride_update_favourited_stat() if (peep->var_08 != 4) return; if (peep->favourite_ride != 0xff) { - ride = GET_RIDE(peep->favourite_ride); + ride = &g_ride_list[peep->favourite_ride]; ride->guests_favourite++; ride->var_14D |= 1; @@ -280,7 +282,7 @@ void ride_shop_connected(rct_ride* ride, int ride_idx) } uint8 track_type = tile->properties.track.type; - ride = GET_RIDE(tile->properties.track.ride_index); + ride = &g_ride_list[tile->properties.track.ride_index]; if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x80000) { entrance_directions = RCT2_ADDRESS(0x0099CA64, uint8)[track_type * 16]; } else { diff --git a/src/ride.h b/src/ride.h index bcbc0c86dd..80357bc764 100644 --- a/src/ride.h +++ b/src/ride.h @@ -326,8 +326,11 @@ enum { #define MAX_RIDE_MEASUREMENTS 8 #define RIDE_RELIABILITY_UNDEFINED 0xFFFF +// rct2: 0x013628F8 +extern rct_ride* g_ride_list; + /** Helper macros until rides are stored in this module. */ -#define GET_RIDE(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[x])) +#define GET_RIDE(x) (&g_ride_list[x]) #define GET_RIDE_MEASUREMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_MEASUREMENTS, rct_ride_measurement)[x])) /** @@ -335,7 +338,7 @@ enum { */ #define FOR_ALL_RIDES(i, ride) \ for (i = 0; i < MAX_RIDES; i++) \ - if ((ride = GET_RIDE(i))->type != RIDE_TYPE_NULL) + if ((ride = &g_ride_list[i])->type != RIDE_TYPE_NULL) extern const uint8 gRideClassifications[255]; diff --git a/src/scenario.c b/src/scenario.c index d9aedb7fc4..38c95bf5fd 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -501,7 +501,7 @@ void scenario_objectives_check() rct_ride* ride; int rcs = 0; for (int i = 0; i < MAX_RIDES; i++) { - ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]); + ride = &g_ride_list[i]; if (ride->status && ride->excitement > objective_currency) rcs++; } diff --git a/src/sprite.c b/src/sprite.c index b947a81f72..c2c80cb5dd 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -22,6 +22,8 @@ #include #include "sprite.h" +rct_sprite* g_sprite_list = RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite); + /** * * rct2: 0x006736C7 @@ -37,7 +39,7 @@ void create_balloon(int x, int y, int z, int colour) */ void reset_sprite_list(){ RCT2_GLOBAL(0x1388698, uint16) = 0; - memset((rct_sprite*)RCT2_ADDRESS_SPRITE_LIST, 0, sizeof(rct_sprite)* 0x2710); + memset(g_sprite_list, 0, sizeof(rct_sprite)* 0x2710); for (int i = 0; i < 6; ++i){ RCT2_ADDRESS(RCT2_ADDRESS_SPRITES_NEXT_INDEX, uint16)[i] = -1; @@ -46,7 +48,7 @@ void reset_sprite_list(){ rct_sprite* previous_spr = (rct_sprite*)SPRITE_INDEX_NULL; - rct_sprite* spr = RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite); + rct_sprite* spr = g_sprite_list; for (int i = 0; i < 0x2710; ++i){ spr->unknown.sprite_identifier = 0xFF; spr->unknown.sprite_index = i; @@ -82,7 +84,7 @@ void reset_0x69EBE4(){ //return; memset((uint16*)0xF1EF60, -1, 0x10001*2); - rct_sprite* spr = RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite); + rct_sprite* spr = g_sprite_list; for (; spr < (rct_sprite*)RCT2_ADDRESS_SPRITES_NEXT_INDEX; spr++){ if (spr->unknown.sprite_identifier != 0xFF){ diff --git a/src/sprite.h b/src/sprite.h index d2c36b6371..f42388dd8e 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -67,6 +67,9 @@ typedef union { rct_vehicle vehicle; } rct_sprite; +// rct2: 0x010E63BC +extern rct_sprite* g_sprite_list; + void create_balloon(int x, int y, int z, int colour); void reset_sprite_list(); void reset_0x69EBE4(); diff --git a/src/vehicle.c b/src/vehicle.c index a96bb51282..2bf9f92029 100644 --- a/src/vehicle.c +++ b/src/vehicle.c @@ -42,7 +42,7 @@ void vehicle_update_all() sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_VEHICLE, uint16); while (sprite_index != SPRITE_INDEX_NULL) { - vehicle = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_index].vehicle); + vehicle = &(g_sprite_list[sprite_index].vehicle); sprite_index = vehicle->next; vehicle_update(vehicle); diff --git a/src/window.h b/src/window.h index ec54076f1b..de50344044 100644 --- a/src/window.h +++ b/src/window.h @@ -23,6 +23,7 @@ #include "gfx.h" #include "park.h" +#include "peep.h" #include "rct2.h" struct rct_window; @@ -354,6 +355,7 @@ void window_water_open(); void window_guest_list_open(); void window_map_open(); void window_options_open(); +void window_peep_open(rct_peep* peep); void window_park_awards_open(); void window_park_entrance_open(); void window_park_guests_open(); diff --git a/src/window_guest_list.c b/src/window_guest_list.c index bea5fa5863..e1a71208ab 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -477,7 +477,8 @@ static void window_guest_list_scrollmousedown() if (i == 0) { // Open guest window - RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, (int)peep, 0, 0, 0); + window_peep_open(peep); + break; } else { i--; @@ -829,7 +830,7 @@ void get_arguments_from_thought(rct_peep_thought thought, uint32* argument_1, ui int esi = 0x9AC86C; if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 1){ - rct_ride* ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST,rct_ride)[thought.item]); + rct_ride* ride = &g_ride_list[thought.item]; esi = &(ride->var_04A); } else if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 2){ @@ -879,7 +880,7 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum case PEEP_STATE_LEAVING_RIDE: case PEEP_STATE_ENTERING_RIDE: *argument_1 = STR_ON_RIDE; - ride = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]; + ride = g_ride_list[peep->current_ride]; if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride.type*8, uint32)& 0x400000){ *argument_1 = STR_IN_RIDE; } @@ -887,14 +888,14 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum *argument_2 = ride.var_04C; break; case PEEP_STATE_BUYING: - ride = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]; + ride = g_ride_list[peep->current_ride]; *argument_1 = STR_AT_RIDE | (ride.var_04A << 16); *argument_2 = ride.var_04C; break; case PEEP_STATE_WALKING: case 0x14: if (peep->var_C5 != 0xFF){ - ride = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->var_C5]; + ride = g_ride_list[peep->var_C5]; *argument_1 = STR_HEADING_FOR | (ride.var_04A << 16); *argument_2 = ride.var_04C; } @@ -905,7 +906,7 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum break; case PEEP_STATE_QUEUING_FRONT: case PEEP_STATE_QUEUING: - ride = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]; + ride = g_ride_list[peep->current_ride]; *argument_1 = STR_QUEUING_FOR | (ride.var_04A << 16); *argument_2 = ride.var_04C; break; @@ -915,7 +916,7 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum break; case PEEP_STATE_WATCHING: if (peep->current_ride != 0xFF){ - ride = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]; + ride = g_ride_list[peep->current_ride]; *argument_1 = STR_WATCHING_RIDE | (ride.var_04A << 16); *argument_2 = ride.var_04C; if (peep->current_seat & 0x1) @@ -964,23 +965,23 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum *argument_2 = 0; } else{ - ride = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]; + ride = g_ride_list[peep->current_ride]; *argument_1 = STR_RESPONDING_TO_RIDE_BREAKDOWN_CALL | (ride.var_04A << 16); *argument_2 = ride.var_04C; } break; case PEEP_STATE_FIXING: - ride = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]; + ride = g_ride_list[peep->current_ride]; *argument_1 = STR_FIXING_RIDE | (ride.var_04A << 16); *argument_2 = ride.var_04C; break; case PEEP_STATE_HEADING_TO_INSPECTION: - ride = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]; + ride = g_ride_list[peep->current_ride]; *argument_1 = STR_HEADING_TO_RIDE_FOR_INSPECTION | (ride.var_04A << 16); *argument_2 = ride.var_04C; break; case PEEP_STATE_INSPECTING: - ride = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]; + ride = g_ride_list[peep->current_ride]; *argument_1 = STR_INSPECTING_RIDE | (ride.var_04A << 16); *argument_2 = ride.var_04C; break; diff --git a/src/window_park.c b/src/window_park.c index d47358c7fd..2f65603d65 100644 --- a/src/window_park.c +++ b/src/window_park.c @@ -1188,7 +1188,7 @@ static void window_park_scroll_to_viewport(rct_window *w) return; if (*((uint32*)&w->var_486) & 0x80000000) { - rct_sprite *sprite = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[w->var_482]); + rct_sprite *sprite = &(g_sprite_list[w->var_482]); x = sprite->unknown.x; y = sprite->unknown.y; z = sprite->unknown.z; diff --git a/src/window_peep.c b/src/window_peep.c new file mode 100644 index 0000000000..daa92a38a3 --- /dev/null +++ b/src/window_peep.c @@ -0,0 +1,175 @@ +/***************************************************************************** +* Copyright (c) 2014 Ted John, Duncan Frost +* OpenRCT2, an open source clone of Roller Coaster Tycoon 2. +* +* This file is part of OpenRCT2. +* +* OpenRCT2 is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. + +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*****************************************************************************/ + +#include "addresses.h" +#include "game.h" +#include "peep.h" +#include "string_ids.h" +#include "sprite.h" +#include "sprites.h" +#include "widget.h" +#include "window.h" +#include "window_dropdown.h" + +enum WINDOW_PEEP_PAGE { + WINDOW_PEEP_OVERVIEW, + WINDOW_PEEP_STATS, + WINDOW_PEEP_RIDES, + WINDOW_PEEP_FINANCE, + WINDOW_PEEP_THOUGHTS, + WINDOW_PEEP_INVENTORY +}; + +enum WINDOW_PEEP_WIDGET_IDX { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_PAGE_BACKGROUND, + WIDX_TAB_1, + WIDX_TAB_2, + WIDX_TAB_3, + WIDX_TAB_4, + WIDX_TAB_5, + WIDX_TAB_6, +}; + +void window_peep_emptysub(){}; + +rct_widget window_peep_overview_widgets[] = { + { WWT_FRAME, 0, 0, 191, 0, 156, 0x0FFFFFFFF, STR_NONE }, // Panel / Background + { WWT_CAPTION, 0, 1, 190, 1, 14, 865, STR_WINDOW_TITLE_TIP }, // Title + { WWT_CLOSEBOX, 0, 179, 189, 2, 13, 824, STR_CLOSE_WINDOW_TIP }, // Close x button + { WWT_RESIZE, 1, 1, 191, 43, 156, 0x0FFFFFFFF, STR_NONE }, // Resize + { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1938 }, // Tab 1 + { WWT_TAB, 1, 73, 64, 17, 43, 0x2000144E, 1940}, // Tab 2 + { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 1941}, // Tab 3 + { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 1942}, // Tab 4 + { WWT_TAB, 1, 127, 157, 17, 43, 0x2000144E, 1943}, // Tab 5 + { WWT_TAB, 1, 158, 188, 17, 43, 0x2000144E, 1944}, // Tab 6 + { WWT_12, 1, 3, 166, 45, 56, 0x0FFFFFFFF, STR_NONE}, // Label Thought marquee + { WWT_VIEWPORT, 1, 3, 166, 57, 143, 0x0FFFFFFFF, STR_NONE }, // Viewport + { WWT_12, 1, 3, 166, 144, 154, 0x0FFFFFFFF, STR_NONE}, // Label Action + { WWT_FLATBTN, 1, 167, 190, 45, 68, SPR_RENAME, 1706}, // Rename Button + { WWT_FLATBTN, 1, 167, 190, 69, 92, 0x1430, 1055}, // Pickup Button + { WWT_FLATBTN, 1, 167, 190, 93, 116, SPR_LOCATE, STR_LOCATE_SUBJECT_TIP},// Locate Button + { WWT_FLATBTN, 1, 167, 190, 117, 140, SPR_TRACK_PEEP, 1930}, // Track Button + { WIDGETS_END }, +}; + +rct_widget *window_peep_page_widgets[] = { + window_peep_overview_widgets +}; + +static void* window_peep_overview_events[] = { + 0x696A75, + 0x696A06, + 0x696FBE, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + 0x696F45, + window_peep_emptysub, + window_peep_emptysub, + 0x696A5F, + 0x696A54, + window_peep_emptysub, + window_peep_emptysub, + 0x696A49, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + 0x696A6A, + 0x697076, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + 0x696749, //Invalidate + 0x696887, //Paint + 0x69707C +}; + +void* window_peep_page_events[] = { + window_peep_overview_events +}; + +uint32 window_peep_page_enabled_widgets[] = { + (1 << WIDX_CLOSE) | + (1 << WIDX_TAB_1) | + (1 << WIDX_TAB_2) | + (1 << WIDX_TAB_3) | + (1 << WIDX_TAB_4) | + (1 << WIDX_TAB_5) | + (1 << WIDX_TAB_6) +}; + +/** + * rct2: 0x006989E9 + * + */ +void window_peep_open(rct_peep* peep){ + + if (peep->type == PEEP_TYPE_STAFF){ + RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, (int)peep, 0, 0, 0); + } + + rct_window* window; + + window = window_bring_to_front_by_id(WC_PEEP, peep->sprite_index); + if (window == NULL){ + window = window_create_auto_pos(192, 157, (uint32*)window_peep_overview_events, WC_PEEP, 0); + window->widgets = window_peep_overview_widgets; + window->enabled_widgets = window_peep_page_enabled_widgets[0]; + window->number = peep->sprite_index; + window->page = 0; + window->var_482 = 0; + window->var_48E = 0; + window->var_490 = 0; + window->var_492 = 0; + window->var_494 = 0; + RCT2_CALLPROC_X(0x006987A6, 0, 0, 0, 0, (int)window, 0, 0); + window->min_width = 192; + window->min_height = 157; + window->max_width = 500; + window->max_height = 450; + window->flags = 8; + window->var_476 = 0; + window->var_47A = -1; + window->colours[0] = 1; + window->colours[1] = 15; + window->colours[2] = 15; + window->var_482 = -1; + } + + window->page = 0; + RCT2_CALLPROC_X(0x006EB13A, 0, 0, 0, 0, (int)window, 0, 0); + + window->widgets = RCT2_GLOBAL(0x981D0C, uint32); + window->enabled_widgets = RCT2_GLOBAL(0x981D3C,uint32); + window->var_020 = RCT2_GLOBAL(0x981D54,uint32); + window->event_handlers = RCT2_GLOBAL(0x981D24,uint32); + window->pressed_widgets = 0; + + RCT2_CALLPROC_X(0x006987A6, 0, 0, 0, 0, (int)window, 0, 0); + window_init_scroll_widgets(window); + RCT2_CALLPROC_X(0x0069883C, 0, 0, 0, 0, (int)window, 0, 0); +} diff --git a/src/window_ride_list.c b/src/window_ride_list.c index 8dff8e2433..a32c142236 100644 --- a/src/window_ride_list.c +++ b/src/window_ride_list.c @@ -557,7 +557,7 @@ static void window_ride_list_scrollpaint() } // Get ride - ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[i]]; + ride = &g_ride_list[w->var_076[i]]; // Ride name gfx_draw_string_left_clipped(dpi, format, &ride->var_04A, 0, 0, y - 1, 159); @@ -703,7 +703,7 @@ static void window_ride_list_refresh_list(rct_window *w) RCT2_GLOBAL(0x013CE952, uint32) = ride->var_04C; RCT2_CALLPROC_X(0x006C2538, ride->var_04A, 0, 0x013CE952, 0, 0, 0x0141ED68, 0); while (--k >= 0) { - otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); + otherRide = &g_ride_list[w->var_076[k]]; RCT2_GLOBAL(0x013CE952, uint32) = otherRide->var_04C; RCT2_CALLPROC_X(0x006C2538, otherRide->var_04A, 0, 0x013CE952, 0, 0, 0x0141EF68, 0); if (strcmp((char*)0x0141ED68, (char*)0x0141EF68) >= 0) @@ -716,7 +716,7 @@ static void window_ride_list_refresh_list(rct_window *w) break; case INFORMATION_TYPE_POPULARITY: while (--k >= 0) { - otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); + otherRide = &g_ride_list[w->var_076[k]]; if ((ride->var_158 & 0xFF) * 4 <= (otherRide->var_158 & 0xFF) * 4) break; @@ -727,7 +727,7 @@ static void window_ride_list_refresh_list(rct_window *w) break; case INFORMATION_TYPE_SATISFACTION: while (--k >= 0) { - otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); + otherRide = &g_ride_list[w->var_076[k]]; if ((ride->var_14A & 0xFF) * 5 <= (otherRide->var_14A & 0xFF) * 5) break; @@ -738,7 +738,7 @@ static void window_ride_list_refresh_list(rct_window *w) break; case INFORMATION_TYPE_PROFIT: while (--k >= 0) { - otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); + otherRide = &g_ride_list[w->var_076[k]]; if (ride->profit <= otherRide->profit) break; @@ -749,7 +749,7 @@ static void window_ride_list_refresh_list(rct_window *w) break; case INFORMATION_TYPE_QUEUE_LENGTH: while (--k >= 0) { - otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); + otherRide = &g_ride_list[w->var_076[k]]; if (ride_get_total_queue_length(ride) <= ride_get_total_queue_length(otherRide)) break; @@ -760,7 +760,7 @@ static void window_ride_list_refresh_list(rct_window *w) break; case INFORMATION_TYPE_QUEUE_TIME: while (--k >= 0) { - otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); + otherRide = &g_ride_list[w->var_076[k]]; if (ride_get_max_queue_time(ride) <= ride_get_max_queue_time(otherRide)) break; @@ -771,7 +771,7 @@ static void window_ride_list_refresh_list(rct_window *w) break; case INFORMATION_TYPE_RELIABILITY: while (--k >= 0) { - otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); + otherRide = &g_ride_list[w->var_076[k]]; if (ride->var_196 >> 8 <= otherRide->var_196 >> 8) break; @@ -782,7 +782,7 @@ static void window_ride_list_refresh_list(rct_window *w) break; case INFORMATION_TYPE_DOWN_TIME: while (--k >= 0) { - otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); + otherRide = &g_ride_list[w->var_076[k]]; if (ride->var_199 <= otherRide->var_199) break; @@ -793,7 +793,7 @@ static void window_ride_list_refresh_list(rct_window *w) break; case INFORMATION_TYPE_GUESTS_FAVOURITE: while (--k >= 0) { - otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); + otherRide = &g_ride_list[w->var_076[k]]; if (ride->guests_favourite <= otherRide->guests_favourite) break;