/** * * rct2: 0x006CFA31 */ static void window_track_list_mouseup(rct_window *w, int widgetIndex) { switch (widgetIndex) { case WIDX_CLOSE: window_close(w); if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) { window_close_by_number(WC_MANAGE_TRACK_DESIGN, w->number); window_close_by_number(WC_TRACK_DELETE_PROMPT, w->number); trackmanager_load(); } break; case WIDX_ROTATE: RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8)++; RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) %= 4; window_invalidate(w); break; case WIDX_TOGGLE_SCENERY: RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) ^= 1; reset_track_list_cache(); window_invalidate(w); break; case WIDX_BACK: window_close(w); if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) { window_close_by_number(WC_MANAGE_TRACK_DESIGN, w->number); window_close_by_number(WC_TRACK_DELETE_PROMPT, w->number); trackmanager_load(); } else { window_new_ride_open(); } break; } }
/** * * rct2: 0x00670FD8 */ static void window_editor_scenario_options_park_mouseup(rct_window *w, int widgetIndex) { switch (widgetIndex) { case WIDX_CLOSE: window_close(w); break; case WIDX_TAB_1: case WIDX_TAB_2: case WIDX_TAB_3: window_editor_scenario_options_set_page(w, widgetIndex - WIDX_TAB_1); break; case WIDX_FORBID_TREE_REMOVAL: RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_FORBID_TREE_REMOVAL; window_invalidate(w); break; case WIDX_FORBID_LANDSCAPE_CHANGES: RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_FORBID_LANDSCAPE_CHANGES; window_invalidate(w); break; case WIDX_FORBID_HIGH_CONSTRUCTION: RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; window_invalidate(w); break; case WIDX_HARD_PARK_RATING: RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_DIFFICULT_PARK_RATING; window_invalidate(w); break; case WIDX_HARD_GUEST_GENERATION: RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_DIFFICULT_GUEST_GENERATION; window_invalidate(w); break; } }
/** * * rct2: 0x0067049D */ static void window_editor_scenario_options_financial_mouseup(rct_window *w, int widgetIndex) { switch (widgetIndex) { case WIDX_CLOSE: window_close(w); break; case WIDX_TAB_1: case WIDX_TAB_2: case WIDX_TAB_3: window_editor_scenario_options_set_page(w, widgetIndex - WIDX_TAB_1); break; case WIDX_NO_MONEY: if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) { RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_NO_MONEY_SCENARIO; } else { RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_NO_MONEY; // Invalidate all windows that have anything to do with finance window_invalidate_by_class(WC_RIDE); window_invalidate_by_class(WC_PEEP); window_invalidate_by_class(WC_PARK_INFORMATION); window_invalidate_by_class(WC_FINANCES); window_invalidate_by_class(WC_BOTTOM_TOOLBAR); window_invalidate_by_class(WC_TOP_TOOLBAR); } window_invalidate(w); break; case WIDX_FORBID_MARKETING: RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_FORBID_MARKETING_CAMPAIGN; window_invalidate(w); break; } }
/** * * rct2: 0x678162 */ static void window_scenarioselect_scrollmouseover(rct_window *w, int scrollIndex, int x, int y) { bool originalShowLockedInformation = _showLockedInformation; _showLockedInformation = false; const scenario_index_entry *selected = NULL; for (sc_list_item *listItem = _listItems; listItem->type != LIST_ITEM_TYPE_END; listItem++) { switch (listItem->type) { case LIST_ITEM_TYPE_HEADING: y -= 18; break; case LIST_ITEM_TYPE_SCENARIO: y -= 24; if (y < 0) { if (listItem->scenario.is_locked) { _showLockedInformation = true; } else { selected = listItem->scenario.scenario; } } break; } if (y < 0) { break; } } if (w->highlighted_scenario != selected) { w->highlighted_scenario = selected; window_invalidate(w); } else if (_showLockedInformation != originalShowLockedInformation) { window_invalidate(w); } }
/** * * rct2: 0x006CFEAC */ static void window_track_place_mouseup(rct_window *w, rct_widgetindex widgetIndex) { switch (widgetIndex) { case WIDX_CLOSE: window_close(w); break; case WIDX_ROTATE: window_track_place_clear_provisional(); _currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3; window_invalidate(w); _window_track_place_last_x = -1; window_track_place_draw_mini_preview(_trackDesign); break; case WIDX_MIRROR: track_design_mirror(_trackDesign); _currentTrackPieceDirection = (0 - _currentTrackPieceDirection) & 3; window_invalidate(w); _window_track_place_last_x = -1; window_track_place_draw_mini_preview(_trackDesign); break; case WIDX_SELECT_DIFFERENT_DESIGN: window_close(w); auto intent = Intent(WC_TRACK_DESIGN_LIST); intent.putExtra(INTENT_EXTRA_RIDE_TYPE, _window_track_list_item.type); intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, _window_track_list_item.entry_index); context_open_intent(&intent); break; } }
void window_research_open() { rct_window *w; w = window_bring_to_front_by_class(WC_RESEARCH); if (w == NULL) { w = window_create_auto_pos(530, 257, window_research_page_events[0], WC_RESEARCH, WF_10); w->widgets = window_research_page_widgets[0]; w->enabled_widgets = window_research_page_enabled_widgets[0]; w->number = 0; w->page = 0; w->frame_no = 0; w->disabled_widgets = 0; research_update_uncompleted_types(); } w->page = 0; window_invalidate(w); w->width = 300; w->height = 196; window_invalidate(w); w->widgets = window_research_page_widgets[0]; w->enabled_widgets = window_research_page_enabled_widgets[0]; w->hold_down_widgets = 0; w->event_handlers = window_research_page_events[0]; w->pressed_widgets = 0; w->disabled_widgets = 0; window_init_scroll_widgets(w); }
/** * * rct2: 0x00699C55 */ static void window_guest_list_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height) { int i, y, numGuests, spriteIndex; rct_peep *peep; switch (_window_guest_list_selected_tab) { case PAGE_INDIVIDUAL: // Count the number of guests numGuests = 0; FOR_ALL_GUESTS(spriteIndex, peep) { if (peep->outside_of_park != 0) continue; if (_window_guest_list_selected_filter != -1) if (window_guest_list_is_peep_in_filter(peep)) continue; if (_window_guest_list_tracking_only && !(peep->flags & PEEP_FLAGS_TRACKING)) continue; numGuests++; } w->var_492 = numGuests; y = numGuests * 10; RCT2_GLOBAL(0x00F1EE09, uint32) = numGuests; break; case PAGE_SUMMARISED: // Find the groups window_guest_list_find_groups(); w->var_492 = _window_guest_list_num_groups; y = _window_guest_list_num_groups * 21; break; default: log_error("Improper tab selected: %d, bailing out.", _window_guest_list_selected_tab); return; } 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; window_invalidate(w); } i = y - window_guest_list_widgets[WIDX_GUEST_LIST].bottom + window_guest_list_widgets[WIDX_GUEST_LIST].top + 21; if (i < 0) i = 0; if (i < w->scrolls[0].v_top) { w->scrolls[0].v_top = i; window_invalidate(w); } *width = 447; *height = y; }
static void window_news_options_invalidate(rct_window *w) { // Set pressed tab w->pressed_widgets &= ~(1ULL << WIDX_TAB_PARK); w->pressed_widgets &= ~(1ULL << WIDX_TAB_RIDE); w->pressed_widgets &= ~(1ULL << WIDX_TAB_GUEST); w->pressed_widgets |= (1ULL << (WIDX_TAB_PARK + w->page)); // Set checkboxes rct_widget *baseCheckBox = &w->widgets[WIDX_CHECKBOX_0]; sint32 y = baseCheckBox->top; sint32 checkboxWidgetIndex = WIDX_CHECKBOX_0; rct_widget *checkboxWidget = &w->widgets[checkboxWidgetIndex]; for (size_t i = 0; i < Util::CountOf(NewsItemOptionDefinitions); i++) { const notification_def *ndef = &NewsItemOptionDefinitions[i]; if (ndef->category != w->page) continue; w->enabled_widgets |= (1ULL << checkboxWidgetIndex); checkboxWidget->type = WWT_CHECKBOX; checkboxWidget->left = baseCheckBox->left; checkboxWidget->right = baseCheckBox->right; checkboxWidget->top = y; checkboxWidget->bottom = checkboxWidget->top + LIST_ROW_HEIGHT + 3; checkboxWidget->text = ndef->caption; const bool *configValue = get_notification_value_ptr(ndef); widget_set_checkbox_value(w, checkboxWidgetIndex, *configValue); checkboxWidgetIndex++; checkboxWidget++; y += LIST_ROW_HEIGHT + 3; } // Remove unused checkboxes while (checkboxWidget->type != WWT_LAST) { w->enabled_widgets &= ~(1ULL << checkboxWidgetIndex); checkboxWidget->type = WWT_EMPTY; checkboxWidgetIndex++; checkboxWidget++; } // Resize window to fit checkboxes exactly y += 3; if (w->height != y) { window_invalidate(w); w->height = y; w->widgets[WIDX_BACKGROUND].bottom = y - 1; w->widgets[WIDX_TAB_CONTENT_PANEL].bottom = y - 1; window_invalidate(w); } }
static void window_scenarioselect_mousedown(int widgetIndex, rct_window*w, rct_widget* widget) { if (widgetIndex >= WIDX_TAB1 && widgetIndex <= WIDX_TAB5) { w->selected_tab = widgetIndex - 4; w->var_494 = 0; window_invalidate(w); window_event_resize_call(w); window_event_invalidate_call(w); window_init_scroll_widgets(w); window_invalidate(w); } }
/** * * rct2: 0x00699EA3 */ static void window_guest_list_resize(rct_window *w) { w->min_width = 350; w->min_height = 330; if (w->width < w->min_width) { window_invalidate(w); w->width = w->min_width; } if (w->height < w->min_height) { window_invalidate(w); w->height = w->min_height; } }
static void window_editor_inventions_list_resize(rct_window* w) { if (w->width < w->min_width) { window_invalidate(w); w->width = w->min_width; } if (w->height < w->min_height) { window_invalidate(w); w->height = w->min_height; } }
static void window_player_list_resize(rct_window *w) { if (w->width < w->min_width) { window_invalidate(w); w->width = w->min_width; } if (w->height < w->min_height) { window_invalidate(w); w->height = w->min_height; } window_player_list_refresh_list(w); }
static void window_scenarioselect_mousedown(int widgetIndex, rct_window*w, rct_widget* widget) { if (widgetIndex >= WIDX_TAB1 && widgetIndex <= WIDX_TAB8) { w->selected_tab = widgetIndex - 4; w->highlighted_scenario = NULL; initialise_list_items(w); window_invalidate(w); window_event_resize_call(w); window_event_invalidate_call(w); window_init_scroll_widgets(w); window_invalidate(w); } }
/* rct2: 0x6ba517 */ static void window_banner_dropdown() { short widgetIndex, dropdownIndex; rct_window* w; window_dropdown_get_registers(w, widgetIndex, dropdownIndex); rct_banner* banner = &gBanners[w->number]; switch(widgetIndex){ case WIDX_MAIN_COLOR: if ( dropdownIndex == 0xFFFF) return; banner->colour = (uint8)dropdownIndex; window_invalidate(w); break; case WIDX_TEXT_COLOR_DROPDOWN_BUTTON: if ( dropdownIndex == 0xFFFF) return; banner->text_colour = dropdownIndex + 1; //Can be replaced with a buffer 34 chars wide ( 32 character + 1 colour_format + 1 '\0') uint8* text_buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, uint8); format_string(text_buffer, banner->string_idx, 0); if (text_buffer[0] < FORMAT_COLOUR_CODE_START || text_buffer[0] > FORMAT_COLOUR_CODE_END){ int end_point = strlen(text_buffer) + 1; strncpy(text_buffer + 1, text_buffer, 32); text_buffer[end_point] = '\0'; } text_buffer[0] = banner->text_colour + FORMAT_COLOUR_CODE_START; int string_id = 0, ebx = 0, ecx = 128, edx = 0, ebp = 0, esi = 0; // Allocate text_buffer to a new string_id? RCT2_CALLFUNC_X(0x6C421D, &string_id, &ebx, &ecx, &edx, &esi, (int*)&text_buffer, &ebp); if (string_id){ rct_string_id prev_string_id = banner->string_idx; banner->string_idx = string_id; // De-allocate previous string id? RCT2_CALLPROC_X(0x6C42AC, prev_string_id, 0, 0, 0, 0, 0, 0); window_invalidate(w); } else{ window_error_open(2984, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); } break; } }
/** * * rct2: 0x00664064 */ static void window_land_mouseup() { int limit; short widgetIndex; rct_window *w; window_widget_get_registers(w, widgetIndex); switch (widgetIndex) { case WIDX_CLOSE: window_close(w); break; case WIDX_DECREMENT: // Decrement land tool size RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)--; // FEATURE: minimum size is always 0 limit = 0; // limit = (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2 ? 0 : 1); if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) < limit) RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = limit; // Invalidate the window window_invalidate(w); break; case WIDX_INCREMENT: // Increment land tool size RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)++; // FEATURE: maximum size is 64 limit = 64; // limit = (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2 ? 7 : 5); if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > limit) RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = limit; // Invalidate the window window_invalidate(w); break; case WIDX_PAINTMODE: LandPaintMode ^= 1; window_invalidate(w); break; case WIDX_PREVIEW: window_land_inputsize(w); break; } }
static void window_text_input_invalidate(rct_window *w) { // Work out the existing size of the window char wrapped_string[512]; safe_strcpy(wrapped_string, text_input, 512); int no_lines = 0, font_height = 0; // String length needs to add 12 either side of box // +13 for cursor when max length. gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines, &font_height); int height = no_lines * 10 + WH; // Change window size if required. if (height != w->height) { window_invalidate(w); window_set_resize(w, WW, height, WW, height); } window_text_input_widgets[WIDX_OKAY].top = height - 21; window_text_input_widgets[WIDX_OKAY].bottom = height - 10; window_text_input_widgets[WIDX_CANCEL].top = height - 21; window_text_input_widgets[WIDX_CANCEL].bottom = height - 10; window_text_input_widgets[WIDX_BACKGROUND].bottom = height - 1; }
static void window_tile_inspector_tool_down() { short widgetIndex; rct_window* w; short x, y; int direction; window_tool_get_registers(w, widgetIndex, x, y); screen_pos_to_map_pos(&x, &y, &direction); if (x == (short)0x8000) { return; } window_tile_inspector_tile_x = x >> 5; window_tile_inspector_tile_y = y >> 5; rct_map_element *element = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y); int numItems = 0; do { numItems++; } while (!map_element_is_last_for_tile(element++)); window_tile_inspector_item_count = numItems; w->scrolls[0].v_top = 0; window_invalidate(w); }
/** * * rct2: 0x00699AAF */ static void window_guest_list_mouseup(rct_window* w, rct_widgetindex widgetIndex) { switch (widgetIndex) { case WIDX_CLOSE: window_close(w); break; case WIDX_MAP: context_open_window(WC_MAP); break; case WIDX_TRACKING: _window_guest_list_tracking_only = !_window_guest_list_tracking_only; if (_window_guest_list_tracking_only) w->pressed_widgets |= (1 << WIDX_TRACKING); else w->pressed_widgets &= ~(1 << WIDX_TRACKING); window_invalidate(w); w->scrolls[0].v_top = 0; break; case WIDX_FILTER_BY_NAME: if (strnlen(_window_guest_list_filter_name, sizeof(_window_guest_list_filter_name)) > 0) { // Unset the search filter. _window_guest_list_filter_name[0] = '\0'; w->pressed_widgets &= ~(1 << WIDX_FILTER_BY_NAME); } else { window_text_input_open( w, WIDX_FILTER_BY_NAME, STR_GUESTS_FILTER_BY_NAME, STR_GUESTS_ENTER_NAME_TO_SEARCH, STR_STRING, (uintptr_t)&_window_guest_list_filter_name, sizeof(_window_guest_list_filter_name)); } break; } }
/** * * rct2: 0x006CD887 */ void window_maze_construction_update_pressed_widgets() { rct_window *w; w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w == NULL) return; uint64 pressedWidgets = w->pressed_widgets; pressedWidgets &= ~(1ULL << WIDX_MAZE_BUILD_MODE); pressedWidgets &= ~(1ULL << WIDX_MAZE_MOVE_MODE); pressedWidgets &= ~(1ULL << WIDX_MAZE_FILL_MODE); switch (_rideConstructionState) { case RIDE_CONSTRUCTION_STATE_MAZE_BUILD: pressedWidgets |= (1ULL << WIDX_MAZE_BUILD_MODE); break; case RIDE_CONSTRUCTION_STATE_MAZE_MOVE: pressedWidgets |= (1ULL << WIDX_MAZE_MOVE_MODE); break; case RIDE_CONSTRUCTION_STATE_MAZE_FILL: pressedWidgets |= (1ULL << WIDX_MAZE_FILL_MODE); break; } w->pressed_widgets = pressedWidgets; window_invalidate(w); }
/* rct2: 0x678162 */ static void window_scenarioselect_scrollmouseover(rct_window *w, int scrollIndex, int x, int y) { int i; rct_scenario_basic *scenario, *selected; selected = NULL; for (i = 0; i < gScenarioListCount; i++) { scenario = &gScenarioList[i]; if (scenario->category != w->selected_tab) continue; if (!(scenario->flags & SCENARIO_FLAGS_VISIBLE)) continue; y -= 24; if (y >= 0) continue; selected = scenario; break; } if (w->var_494 != (uint32)selected) { w->var_494 = (uint32)selected; window_invalidate(w); } }
/* rct2: 0x6ba50c */ static void window_banner_textinput() { short widgetIndex; rct_window *w; uint8 result; uint8* text; window_text_input_get_registers(w, widgetIndex, result, text); if (widgetIndex == WIDX_BANNER_TEXT && result) { rct_banner* banner = &gBanners[w->number]; uint8* text_buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, uint8); text_buffer[0] = banner->text_colour + FORMAT_COLOUR_CODE_START; strncpy(text_buffer + 1, text, 32); int string_id = 0, ebx = 0, ecx = 128, edx = 0, ebp = 0, esi = 0; RCT2_CALLFUNC_X(0x6C421D, &string_id, &ebx, &ecx, &edx, &esi, (int*)&text_buffer, &ebp); if (string_id){ rct_string_id prev_string_id = banner->string_idx; banner->string_idx = string_id; // De-allocate previous string id? RCT2_CALLPROC_X(0x6C42AC, prev_string_id, 0, 0, 0, 0, 0, 0); window_invalidate(w); } else{ window_error_open(2984, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); } } }
static void window_themes_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { if (text == NULL || text[0] == 0) return; switch (widgetIndex) { case WIDX_THEMES_DUPLICATE_BUTTON: case WIDX_THEMES_RENAME_BUTTON: if (filename_valid_characters(text)) { bool nameTaken = false; sint32 numAvailableThemes = (sint32)theme_manager_get_num_available_themes(); for (sint32 i = 0; i < numAvailableThemes; i++) { const utf8 * themeName = theme_manager_get_available_theme_name(i); if (strcmp(themeName, text) == 0) { if (widgetIndex != WIDX_THEMES_RENAME_BUTTON) { window_error_open(STR_THEMES_ERR_NAME_ALREADY_EXISTS, STR_NONE); } nameTaken = true; break; } } if (!nameTaken) { if (widgetIndex == WIDX_THEMES_DUPLICATE_BUTTON) { theme_duplicate(text); } else { theme_rename(text); } window_invalidate(w); } } else { window_error_open(STR_ERROR_INVALID_CHARACTERS, STR_NONE); } break; } }
void doMouseDown(EventRecord *eventStrucPtr) { WindowRef windowRef; WindowPartCode partCode, zoomPart; BitMap screenBits; Rect constraintRect, mainScreenRect; Point standardStateHeightAndWidth; long newSize; partCode = FindWindow(eventStrucPtr->where,&windowRef); switch(partCode) { case inMenuBar: break; case inContent: if(windowRef != FrontWindow()) SelectWindow(windowRef); else doInContent(eventStrucPtr,windowRef); break; case inDrag: DragWindow(windowRef,eventStrucPtr->where,NULL); break; case inGoAway: break; case inGrow: constraintRect.top = 75; constraintRect.left = 250; constraintRect.bottom = constraintRect.right = 32767; newSize = GrowWindow(windowRef,eventStrucPtr->where,&constraintRect); if (newSize != 0) SizeWindow(windowRef,LoWord(newSize),HiWord(newSize),true); window_adjust_scrollbars(windowRef); window_invalidate(windowRef); break; case inZoomIn: case inZoomOut: mainScreenRect = GetQDGlobalsScreenBits(&screenBits)->bounds; standardStateHeightAndWidth.v = mainScreenRect.bottom; standardStateHeightAndWidth.h = mainScreenRect.right; if(IsWindowInStandardState(windowRef,&standardStateHeightAndWidth,NULL)) zoomPart = inZoomIn; else zoomPart = inZoomOut; if(TrackBox(windowRef,eventStrucPtr->where,partCode)) { ZoomWindowIdeal(windowRef,zoomPart,&standardStateHeightAndWidth); window_adjust_scrollbars(windowRef); } break; } }
/** * * rct2: 0x6BA7B5 */ static void window_banner_unknown_14(rct_window *w) { rct_viewport* view = w->viewport; w->viewport = 0; view->width = 0; viewport_update_pointers(); rct_banner* banner = &gBanners[w->number]; sint32 view_x = (banner->x << 5) + 16; sint32 view_y = (banner->y << 5) + 16; sint32 view_z = w->frame_no; // Create viewport rct_widget* viewportWidget = &window_banner_widgets[WIDX_VIEWPORT]; viewport_create( w, w->x + viewportWidget->left + 1, w->y + viewportWidget->top + 1, (viewportWidget->right - viewportWidget->left) - 1, (viewportWidget->bottom - viewportWidget->top) - 1, 0, view_x, view_y, view_z, 0, -1 ); w->viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0; window_invalidate(w); }
rct_window *window_mapgen_open() { rct_window *w; w = window_bring_to_front_by_class(WC_MAPGEN); if (w == NULL) { w = window_create_centred( 300, 200, window_mapgen_page_events[0], WC_MAPGEN, WF_10 ); w->number = 0; w->frame_no = 0; } w->page = WINDOW_MAPGEN_PAGE_BASE; window_invalidate(w); w->widgets = window_mapgen_page_widgets[WINDOW_MAPGEN_PAGE_BASE]; w->enabled_widgets = window_mapgen_page_enabled_widgets[WINDOW_MAPGEN_PAGE_BASE]; w->hold_down_widgets = window_mapgen_page_hold_down_widgets[WINDOW_MAPGEN_PAGE_BASE]; w->event_handlers = window_mapgen_page_events[WINDOW_MAPGEN_PAGE_BASE]; w->pressed_widgets = 0; w->disabled_widgets = 0; window_init_scroll_widgets(w); return w; }
/** * Closes the specified window. * rct2: 0x006ECD4C * * @param window The window to close (esi). */ void window_close(rct_window* window) { int num_windows; if (window == NULL) return; // Call close event of window RCT2_CALLPROC_X(window->event_handlers[WE_CLOSE], 0, 0, 0, 0, (int)window, 0, 0); window = window_find_by_id(window->classification, window->number); // Remove viewport if (window->viewport != NULL) { window->viewport->width = 0; window->viewport = NULL; } // Invalidate the window (area) window_invalidate(window); // Remove window from list and reshift all windows RCT2_NEW_WINDOW--; num_windows = (RCT2_NEW_WINDOW - window); if (num_windows > 0) memmove(window, window + 1, num_windows * sizeof(rct_window)); viewport_update_pointers(); }
static void window_mapgen_textinput(rct_window *w, int widgetIndex, char *text) { int value; char* end; if (text == NULL) return; value = strtol(text, &end, 10); if (*end != '\0') { return; } switch (widgetIndex) { case WIDX_MAP_SIZE: case WIDX_SIMPLEX_MAP_SIZE: // The practical size is 2 lower than the technical size value += 2; _mapSize = clamp(MINIMUM_MAP_SIZE_TECHNICAL, value, MAXIMUM_MAP_SIZE_TECHNICAL); break; case WIDX_BASE_HEIGHT: _baseHeight = clamp(BASESIZE_MIN, (value * 2) + 12, BASESIZE_MAX); break; case WIDX_WATER_LEVEL: _waterLevel = clamp(WATERLEVEL_MIN, (value * 2) + 12, WATERLEVEL_MAX); break; } window_invalidate(w); }
static void window_player_list_scrollmousedown(rct_window *w, int scrollIndex, int x, int y) { if (network_get_mode() != NETWORK_MODE_SERVER) { return; } int index; index = y / 10; if (index >= w->no_list_items) return; w->selected_list_item = index; window_invalidate(w); rct_widget *listWidget = &w->widgets[WIDX_LIST]; int ddx = w->x + listWidget->left + x; int ddy = w->y + listWidget->top + y; if (index == 0) { return; } _dropdownPlayerId = network_get_player_id(index); if (_dropdownPlayerId == network_get_current_player_id()) { return; } gDropdownItemsFormat[0] = STR_KICK_PLAYER; window_dropdown_show_text(ddx, ddy, 0, 7, 0, 1); }
/** * * rct2: 0x00671060 */ static void window_editor_scenario_options_park_dropdown(rct_window *w, int widgetIndex, int dropdownIndex) { if (widgetIndex == WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN && dropdownIndex != -1) { if(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) { if (dropdownIndex == 0) { if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY)) { RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) |= PARK_FLAGS_PARK_FREE_ENTRY; RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = MONEY(0, 00); } } else { if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY) { RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_PARK_FREE_ENTRY; RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = MONEY(10, 00); } } } else { if (dropdownIndex == 0) { if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY)) { RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) |= PARK_FLAGS_PARK_FREE_ENTRY; } } else { if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY) { RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_PARK_FREE_ENTRY; } } window_invalidate_by_class(WC_PARK_INFORMATION); window_invalidate_by_class(WC_RIDE); } window_invalidate(w); } }
/* If this function is NULL, polling is not needed */ static int display_update(void *handle, void *device, int x, int y, int w, int h) { UInt64 t1; UInt64 t2; int delta; IMAGE *img = image_find(handle, device); if (img == NULL) return -1; Microseconds((UnsignedWide*)&t1); delta = (t1 - img->update_time) / 1000000L; if (img->update_interval < 1) img->update_interval = 1; /* seconds */ if (delta < 0) img->update_time = t1; else if (delta > img->update_interval) { /* redraw window */ window_invalidate(img->windowRef); /* Make sure the update interval is at least 10 times * what it takes to paint the window */ Microseconds((UnsignedWide*)&t2); delta = (t2 - t1) / 1000; if (delta < 0) delta += 60000; /* delta = time to redraw */ if (delta > img->update_interval * 100) img->update_interval = delta/100; img->update_time = t2; } return gsdll_poll(handle); }