/** * * rct2: 0x0066D2AC */ void window_about_open() { rct_window* window; // Check if window is already open window = window_bring_to_front_by_id(WC_ABOUT, 0); if (window != NULL) return; window = window_create( RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 200, max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 165), 400, 330, (uint32*)window_about_events, WC_ABOUT, 0 ); window->widgets = window_about_widgets; window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_MUSIC_CREDITS) | (1 << WIDX_PUBLISHER_CREDITS); window_init_scroll_widgets(window); window->colours[0] = 7; window->colours[1] = 7; window->colours[2] = 7; }
/** * * rct2: 0x0069E16F */ void window_new_campaign_open(sint16 campaignType) { // RCT2_CALLPROC_X(0x0069E16F, campaignType, 0, 0, 0, 0, 0, 0); rct_window *w; rct_ride *ride; int i, numApplicableRides; w = window_bring_to_front_by_id(WC_NEW_CAMPAIGN, 0); if (w != NULL) { if (w->campaign.campaign_type == campaignType) return; window_close(w); } w = window_create_auto_pos(350, 107, (uint32*)window_new_campaign_events, WC_NEW_CAMPAIGN, 0); w->widgets = window_new_campaign_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RIDE_DROPDOWN) | (1 << WIDX_RIDE_DROPDOWN_BUTTON) | (1 << WIDX_WEEKS_INCREASE_BUTTON) | (1 << WIDX_WEEKS_DECREASE_BUTTON) | (1 << WIDX_START_BUTTON); w->var_020 = 0x300; window_init_scroll_widgets(w); w->colours[0] = 19; w->colours[1] = 19; w->colours[2] = 19; window_new_campaign_widgets[WIDX_TITLE].image = STR_MARKETING_VOUCHERS_FOR_FREE_ENTRY_TO_THE_PARK + campaignType; // Campaign type w->campaign.campaign_type = campaignType; // Number of weeks w->campaign.no_weeks = 2; // Currently selected ride w->campaign.ride_id = SELECTED_RIDE_UNDEFINED; // Get all applicable rides numApplicableRides = 0; window_new_campaign_rides[0] = 255; FOR_ALL_RIDES(i, ride) { if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x03820000)) window_new_campaign_rides[numApplicableRides++] = i; } window_new_campaign_rides[numApplicableRides] = 255; // Take top 40 most reliable rides if (numApplicableRides > 40) { qsort(window_new_campaign_rides, countof(window_new_campaign_rides), sizeof(uint8), ride_reliability_compare); numApplicableRides = 40; } // Sort rides by name qsort(window_new_campaign_rides, numApplicableRides, sizeof(uint8), ride_name_compare); }
/** * * rct2: 0x0066E464 */ void window_news_open() { rct_window* window; // Check if window is already open window = window_bring_to_front_by_id(WC_RECENT_NEWS, 0); if (window == NULL) { window = window_create_auto_pos( 400, 300, (uint32*)window_news_events, WC_RECENT_NEWS, 0 ); window->widgets = window_news_widgets; window->enabled_widgets = (1 << WIDX_CLOSE); window_init_scroll_widgets(window); window->colours[0] = 1; window->colours[1] = 1; window->colours[2] = 0; window->var_480 = -1; } // sub_66E4BA: int width, height; rct_widget *widget; window_get_scroll_size(window, 0, &width, &height); widget = &window_news_widgets[WIDX_SCROLL]; window->scrolls[0].v_top = max(0, height - (widget->bottom - widget->top - 1)); widget_scroll_update_thumbs(window, WIDX_SCROLL); }
/** * * rct2: 0x006BEE98 */ void window_staff_peep_open(rct_peep* peep) { rct_window* w = window_bring_to_front_by_id(WC_PEEP, peep->sprite_index); if (w == NULL) { w = window_create_auto_pos(190, 180, (uint32*)window_staff_peep_overview_events, WC_PEEP, (uint16)0x400); w->widgets = RCT2_GLOBAL(0x9AF81C, rct_widget*); w->enabled_widgets = RCT2_GLOBAL(0x9929B0, uint32); w->number = peep->sprite_index; w->page = 0; w->viewport_focus_coordinates.y = 0; w->frame_no = 0; RCT2_GLOBAL((int*)w + 0x496, uint16) = 0; // missing, var_494 should perhaps be uint16? window_staff_peep_disable_widgets(w); w->min_width = 190; w->min_height = 180; w->max_width = 500; w->max_height = 450; w->flags = 1 << 8; w->colours[0] = 1; w->colours[1] = 4; w->colours[2] = 4; }
/** * * rct2: 0x006ACC28 */ void window_ride_main_open(int rideIndex) { rct_window *w; w = window_bring_to_front_by_id(WC_RIDE, rideIndex); if (w == NULL) { w = window_ride_open(rideIndex); w->ride.var_482 = -1; } if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) { if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) ) { tool_cancel(); } } w->page = 0; w->width = 316; w->height = 180; window_invalidate(w); w->widgets = window_ride_page_widgets[0]; w->enabled_widgets = 0x007DBFF4; w->var_020 = 0; w->event_handlers = window_ride_page_events[0]; w->pressed_widgets = 0; RCT2_CALLPROC_X(0x006AEB9F, 0, 0, 0, 0, (int)w, 0, 0); window_init_scroll_widgets(w); w->ride.var_480 = 0; RCT2_CALLPROC_X(0x006AF994, 0, 0, 0, 0, (int)w, 0, 0); }
/** * * rct2: 0x006A7C43 */ void window_footpath_open() { rct_window* window; // Check if window is already open window = window_bring_to_front_by_id(WC_FOOTPATH, 0); if (window != NULL) return; window = window_create( 0, 29, 106, 381, (uint32*)window_footpath_events, WC_FOOTPATH, 0 ); window->widgets = window_footpath_widgets; window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_FOOTPATH_TYPE) | (1 << WIDX_QUEUELINE_TYPE) | (1 << WIDX_DIRECTION_NW) | (1 << WIDX_DIRECTION_NE) | (1 << WIDX_DIRECTION_SW) | (1 << WIDX_DIRECTION_SE) | (1 << WIDX_SLOPEDOWN) | (1 << WIDX_LEVEL) | (1 << WIDX_SLOPEUP) | (1 << WIDX_CONSTRUCT) | (1 << WIDX_REMOVE) | (1 << WIDX_CONSTRUCT_ON_LAND) | (1 << WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL); window_init_scroll_widgets(window); window_push_others_right(window); show_gridlines(); window->colours[0] = 24; window->colours[1] = 24; window->colours[2] = 24; tool_cancel(); RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_LAND; tool_set(window, WIDX_CONSTRUCT_ON_LAND, 17); RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6); RCT2_GLOBAL(RCT2_ADDRESS_PATH_ERROR_OCCURED, uint8) = 0; RCT2_CALLPROC_EBPSAFE(0x006A855C); }
/** * * rct2: 0x0068C88A */ void window_map_open() { rct_window* w; int* var; // Check if window is already open w = window_bring_to_front_by_id(WC_MAP, 0); if (w != NULL) { w->selected_tab = 0; w->var_490 = 0; return; } var = (int*)rct2_malloc(0x40000); if (var == NULL) return; RCT2_GLOBAL(0x00F1AD68, uint32) = (uint32)var; w = window_create_auto_pos(245, 259, (uint32*)window_map_events, WC_MAP, 0x0400); w->widgets = window_map_widgets; w->enabled_widgets = (1 << 2) | (1 << 4) | (1 << 5) | (1 << 8) | (1 << 9) | (1 << 14) | (1 << 15) | (1 << 10) | (1 << 16) | (1 << 17) | (1 << 18) | (1 << 19) | (1 << 11) | (1 << 20) | (1 << 12); //TODO: .text:0068C943 or dword ptr [esi+20h], 300h window_init_scroll_widgets(w); w->var_480 = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint16); RCT2_CALLPROC_EBPSAFE(0x0068CA6C); RCT2_GLOBAL(0x00F64F05, uint8) = 0; RCT2_CALLPROC_EBPSAFE(0x0068C990); w->colours[0] = 12; w->colours[1] = 24; }
/** * 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->frame_no = 0; window->list_information_type = 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->no_list_items = 0; window->selected_list_item = -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, rct_widget*); 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); }
void window_cheats_open() { rct_window* window; // Check if window is already open window = window_bring_to_front_by_id(WC_CHEATS, 0); if (window != NULL) return; window = window_create(32, 32, WW, WH, (uint32*)window_cheats_money_events, WC_CHEATS, 0); window->widgets = window_cheats_money_widgets; window->enabled_widgets = window_cheats_page_enabled_widgets[0]; window_init_scroll_widgets(window); window->page = WINDOW_CHEATS_PAGE_MONEY; window->colours[0] = 1; window->colours[1] = 19; window->colours[2] = 19; }
void window_cheats_open() { rct_window* window; // Check if window is already open window = window_bring_to_front_by_id(WC_CHEATS, 0); if (window != NULL) return; window = window_create(32, 32, WW, WH, window_cheats_events, WC_CHEATS, 0); window->widgets = window_cheats_widgets; window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_HIGH_MONEY); window_init_scroll_widgets(window); window->page = WINDOW_CHEATS_PAGE_MONEY; window->colours[0] = 1; window->colours[1] = 19; window->colours[2] = 19; }
/** * * rct2: 0x0066DCBE */ void window_save_prompt_open() { int stringId, x, y; rct_window* window; unsigned short prompt_mode; rct_widget *widgets; uint64 enabled_widgets; prompt_mode = RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16); // do not show save prompt if we're in the title demo and click on load game if (prompt_mode != PM_QUIT && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO) { game_load_or_quit_no_save_prompt(); return; } // Check if window is already open window = window_bring_to_front_by_id(WC_SAVE_PROMPT, 0); if (window) { window_close(window); } if (prompt_mode == PM_QUIT) { widgets = window_quit_prompt_widgets; enabled_widgets = (1 << WQIDX_CLOSE) | (1 << WQIDX_OK) | (1 << WQIDX_CANCEL); x = 177; y = 34; } else { widgets = window_save_prompt_widgets; enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_SAVE) | (1 << WIDX_DONT_SAVE) | (1 << WIDX_CANCEL); x = 260; y = 50; } window = window_create( (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2) - x / 2, max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - y / 2), x, y, (uint32*)window_save_prompt_events, WC_SAVE_PROMPT, WF_TRANSPARENT | WF_STICK_TO_FRONT ); window->widgets = widgets; window->enabled_widgets = enabled_widgets; window_init_scroll_widgets(window); window->colours[0] = 154; // Pause the game RCT2_GLOBAL(0x009DEA6E, uint8) |= 2; pause_sounds(); window_invalidate_by_id(0x80 | WC_TOP_TOOLBAR, 0); stringId = prompt_mode + STR_LOAD_GAME; if (stringId == STR_LOAD_GAME && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) stringId = STR_LOAD_LANDSCAPE; if (stringId == STR_QUIT_GAME && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) stringId = STR_QUIT_SCENARIO_EDITOR; window_save_prompt_widgets[WIDX_TITLE].image = stringId; window_save_prompt_widgets[WIDX_LABEL].image = prompt_mode + STR_SAVE_BEFORE_LOADING; if (!gGeneral_config.confirmation_prompt) { /* game_load_or_quit_no_save_prompt() will exec requested task and close this window * immediately again. * TODO restructure these functions when we're sure game_load_or_quit_no_save_prompt() * and game_load_or_quit() are not called by the original binary anymore. */ if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0D) { game_load_or_quit_no_save_prompt(); return; } if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) != 0) { if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) != 1) { RCT2_CALLPROC_EBPSAFE(0x0066EE54); game_load_or_quit_no_save_prompt(); return; } else { tutorial_stop(); game_load_or_quit_no_save_prompt(); return; } } if (RCT2_GLOBAL(0x009DEA66, uint16) < 3840) { game_load_or_quit_no_save_prompt(); return; } } }