/** * * rct2: 0x006D35CD */ static void window_track_delete_prompt_open() { rct_window *w; window_close_by_class(WC_TRACK_DELETE_PROMPT); w = window_create( max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 250) / 2), (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 44) / 2, 250, 74, (uint32*)window_track_delete_prompt_events, WC_TRACK_DELETE_PROMPT, WF_STICK_TO_FRONT ); w->widgets = window_track_delete_prompt_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RENAME) | (1 << WIDX_DELETE); window_init_scroll_widgets(w); w->flags |= WF_TRANSPARENT; w->colours[0] = 26; w->colours[1] = 26; w->colours[2] = 26; }
void window_text_input_raw_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, utf8string existing_text, int maxLength) { _maxInputLength = maxLength; window_close_by_class(WC_TEXTINPUT); // Clear the text input buffer memset(text_input, 0, maxLength); // Enter in the the text input buffer any existing // text. if (existing_text != NULL) safe_strcpy(text_input, existing_text, maxLength); // In order to prevent strings that exceed the maxLength // from crashing the game. text_input[maxLength - 1] = '\0'; // This is the text displayed above the input box input_text_description = description; // 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; // Window will be in the center of the screen rct_window* w = window_create_centred( WW, height, &window_text_input_events, WC_TEXTINPUT, WF_STICK_TO_FRONT ); w->widgets = window_text_input_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_CANCEL) | (1 << WIDX_OKAY); window_text_input_widgets[WIDX_TITLE].image = title; // Save calling window details so that the information // can be passed back to the correct window & widget calling_class = call_w->classification; calling_number = call_w->number; calling_widget = call_widget; platform_start_text_input(text_input, maxLength); window_init_scroll_widgets(w); w->colours[0] = call_w->colours[0]; w->colours[1] = call_w->colours[1]; w->colours[2] = call_w->colours[2]; }
/** * * rct2: 0x006EE77A */ void window_map_tooltip_update_visibility() { int cursorX, cursorY, inputFlags; cursorX = gCursorState.x; cursorY = gCursorState.y; inputFlags = gInputFlags; // Check for cursor movement _cursorHoldDuration++; if (abs(cursorX - _lastCursorX) > 5 || abs(cursorY - _lastCursorY) > 5 || (inputFlags & INPUT_FLAG_5)) _cursorHoldDuration = 0; _lastCursorX = cursorX; _lastCursorY = cursorY; // Show or hide tooltip rct_string_id stringId; memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id)); if (_cursorHoldDuration < 25 || stringId == STR_NONE || (gInputPlaceObjectModifier & 3) || window_find_by_class(WC_ERROR) != NULL ) { window_close_by_class(WC_MAP_TOOLTIP); } else { window_map_tooltip_open(); } }
static void input_update_tooltip(rct_window *w, int widgetIndex, int x, int y) { if (gTooltipWidget.window_classification == 255) { if (gTooltipNotShownTicks < 500 || (gTooltipCursorX == x && gTooltipCursorY == y)) { gTooltipTimeout = RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, uint16); int time = 2000; if (gTooltipNotShownTicks >= 1) { time = 0; } if (time > gTooltipTimeout) { gTooltipNotShownTicks++; return; } window_tooltip_open(w, widgetIndex, x, y); } } else { if (( (w != NULL) && (gTooltipWidget.window_classification != w->classification || gTooltipWidget.window_number != w->number) ) || gTooltipWidget.widget_index != widgetIndex ) { window_tooltip_close(); } gTooltipTimeout += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, uint16); if (gTooltipTimeout >= 8000) { window_close_by_class(WC_TOOLTIP); } } }
/** * * rct2: 0x006D348F */ void window_track_manage_open() { // RCT2_CALLPROC_EBPSAFE(0x006D348F); rct_window *w, *trackDesignListWindow; window_close_by_class(WC_MANAGE_TRACK_DESIGN); w = window_create( max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 250) / 2), (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 44) / 2, 250, 44, (uint32*)window_track_manage_events, WC_MANAGE_TRACK_DESIGN, WF_STICK_TO_FRONT ); w->widgets = window_track_manage_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RENAME) | (1 << WIDX_DELETE); window_init_scroll_widgets(w); w->flags |= WF_TRANSPARENT; w->colours[0] = 1; w->colours[1] = 1; w->colours[2] = 1; trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST); if (trackDesignListWindow != NULL) trackDesignListWindow->track_list.var_484 |= 1; }
static void input_update_tooltip(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y) { if (gTooltipWidget.window_classification == 255) { if (gTooltipCursorX == x && gTooltipCursorY == y) { _tooltipNotShownTicks++; if (_tooltipNotShownTicks > 50) { gTooltipTimeout = 0; window_tooltip_open(w, widgetIndex, x, y); } } } else { reset_tooltip_not_shown(); if (w == NULL || gTooltipWidget.window_classification != w->classification || gTooltipWidget.window_number != w->number || gTooltipWidget.widget_index != widgetIndex ) { window_tooltip_close(); } gTooltipTimeout += gTicksSinceLastUpdate; if (gTooltipTimeout >= 8000) { window_close_by_class(WC_TOOLTIP); } } }
/** * * rct2: 0x006E98C6 */ void window_tooltip_close() { window_close_by_class(WC_TOOLTIP); gTooltipTimeout = 0; gTooltipWidget.window_classification = 255; RCT2_GLOBAL(0x0142006C, sint32) = -1; RCT2_GLOBAL(0x009DE51E, uint8) = 0; }
/** * * rct2: 0x006B3CFF */ rct_window *window_new_ride_open() { rct_window *w; w = window_bring_to_front_by_class(WC_CONSTRUCT_RIDE); if (w != NULL) return w; // Not sure what these windows are window_close_by_class(WC_TRACK_DESIGN_LIST); window_close_by_class(WC_TRACK_DESIGN_PLACE); w = window_create_auto_pos(601, 370, &window_new_ride_events, WC_CONSTRUCT_RIDE, WF_10); w->widgets = window_new_ride_widgets; w->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) | (1 << WIDX_TAB_7) | (1 << 14) | (1 << 15); window_init_scroll_widgets(w); w->frame_no = 0; w->new_ride.selected_ride_id = -1; w->new_ride.highlighted_ride_id = -1; _lastTrackDesignCountRideType.type = 255; _lastTrackDesignCountRideType.entry_index = 255; window_new_ride_populate_list(); w->new_ride.highlighted_ride_id = _windowNewRideHighlightedItem[_windowNewRideCurrentTab].ride_type_and_entry; if (w->new_ride.highlighted_ride_id == -1) w->new_ride.highlighted_ride_id = _windowNewRideListItems[0].ride_type_and_entry; w->width = 1; window_new_ride_refresh_widget_sizing(w); window_new_ride_scroll_to_focused_ride(w); return w; }
/** * * rct2: 0x006E98C6 */ void window_tooltip_close() { window_close_by_class(WC_TOOLTIP); RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) = 255; RCT2_GLOBAL(0x0142006C, sint32) = -1; RCT2_GLOBAL(0x009DE51E, uint8) = 0; }
static void window_loadsave_close(rct_window *w) { if (_listItems != NULL) { free(_listItems); _listItems = NULL; } window_close_by_class(WC_LOADSAVE_OVERWRITE_PROMPT); }
/** * * rct2: 0x006CFF34 */ static void window_track_place_tooldown(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y) { sint32 i; sint16 mapX, mapY, mapZ; money32 cost; uint8 rideIndex; window_track_place_clear_provisional(); map_invalidate_map_selection_tiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; sub_68A15E(x, y, &mapX, &mapY, nullptr, nullptr); if (mapX == LOCATION_NULL) return; // Try increasing Z until a feasible placement is found mapZ = window_track_place_get_base_z(mapX, mapY); for (i = 0; i < 7; i++) { gDisableErrorWindowSound = true; window_track_place_attempt_placement(_trackDesign, mapX, mapY, mapZ, 1, &cost, &rideIndex); gDisableErrorWindowSound = false; if (cost != MONEY32_UNDEFINED) { window_close_by_class(WC_ERROR); audio_play_sound_at_location(SOUND_PLACE_ITEM, mapX, mapY, mapZ); _currentRideIndex = rideIndex; if (track_design_are_entrance_and_exit_placed()) { auto intent = Intent(WC_RIDE); intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex); context_open_intent(&intent); window_close(w); } else { ride_initialise_construction_window(rideIndex); w = window_find_by_class(WC_RIDE_CONSTRUCTION); window_event_mouse_up_call(w, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); } return; } // Check if player did not have enough funds if (gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES) break; mapZ += 8; } // Unable to build track audio_play_sound_at_location(SOUND_ERROR, mapX, mapY, mapZ); }
static void window_title_editor_close(rct_window *w) { // Close the related windows window_close_by_class(WC_TITLE_COMMAND_EDITOR); FreeTitleSequence(_editingTitleSequence); _editingTitleSequence = NULL; _isSequencePlaying = false; _sequenceName = NULL; free(_renameSavePath); _renameSavePath = NULL; }
static void window_title_editor_close(rct_window * w) { title_stop_previewing_sequence(); // Close the related windows window_close_by_class(WC_TITLE_COMMAND_EDITOR); FreeTitleSequence(_editingTitleSequence); _editingTitleSequence = nullptr; _sequenceName = nullptr; SafeFree(_renameSavePath); }
rct_window * window_shortcut_change_open(sint32 selected_key) { // Move this to window_shortcut_change_open window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT); // Save the item we are selecting for new window gKeyboardShortcutChangeId = selected_key; rct_window * w = window_create_centred(WW, WH, &window_shortcut_change_events, WC_CHANGE_KEYBOARD_SHORTCUT, 0); w->widgets = window_shortcut_change_widgets; w->enabled_widgets = (1ULL << WIDX_CLOSE); window_init_scroll_widgets(w); return w; }
void window_shortcut_change_open(int selected_key){ // Move this to window_shortcut_change_open window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT); // Save the item we are selecting for new window RCT2_GLOBAL(0x9DE511, uint8) = selected_key; rct_window* w = window_create_auto_pos(WW, WH, (uint32*)window_shortcut_change_events, WC_CHANGE_KEYBOARD_SHORTCUT, 0); w->widgets = window_shortcut_change_widgets; w->enabled_widgets = (1 << 2); window_init_scroll_widgets(w); w->colours[0] = 7; w->colours[1] = 7; w->colours[2] = 7; }
/** * * rct2: 0x006D386D */ rct_window* window_install_track_open(const utf8* path) { _trackDesign = track_design_open(path); if (_trackDesign == nullptr) { context_show_error(STR_UNABLE_TO_LOAD_FILE, STR_NONE); return nullptr; } object_manager_unload_all_objects(); if (_trackDesign->type == RIDE_TYPE_NULL) { log_error("Failed to load track (ride type null): %s", path); return nullptr; } if (object_manager_load_object(&_trackDesign->vehicle_object) == nullptr) { log_error("Failed to load track (vehicle load fail): %s", path); return nullptr; } window_close_by_class(WC_EDITOR_OBJECT_SELECTION); window_close_construction_windows(); gTrackDesignSceneryToggle = false; _currentTrackPieceDirection = 2; int32_t screenWidth = context_get_width(); int32_t screenHeight = context_get_height(); int32_t x = screenWidth / 2 - 201; int32_t y = std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200); rct_window* w = window_create(x, y, WW, WH, &window_install_track_events, WC_INSTALL_TRACK, 0); w->widgets = window_install_track_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY) | (1 << WIDX_INSTALL) | (1 << WIDX_CANCEL); window_init_scroll_widgets(w); w->track_list.track_list_being_updated = false; window_push_others_right(w); _trackPath = path; _trackName = GetNameFromTrackPath(path); _trackDesignPreviewPixels.resize(4 * TRACK_PREVIEW_IMAGE_SIZE); window_install_track_update_preview(); window_invalidate(w); return w; }
/** * * rct2: 0x006E3E91 */ void keyboard_shortcut_set(int key) { int i; // Unmap shortcut that already uses this key for (i = 0; i < 32; i++) { if (key == gShortcutKeys[i]) { gShortcutKeys[i] = 0xFFFF; break; } } // Map shortcut to this key gShortcutKeys[RCT2_GLOBAL(0x009DE511, uint8)] = key; window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT); window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST); config_save(); }
static rct_window *window_overwrite_prompt_open(const char *name, const char *path) { rct_window *w; window_close_by_class(WC_LOADSAVE_OVERWRITE_PROMPT); w = window_create_centred(OVERWRITE_WW, OVERWRITE_WH, &window_overwrite_prompt_events, WC_LOADSAVE_OVERWRITE_PROMPT, WF_STICK_TO_FRONT); w->widgets = window_overwrite_prompt_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_OVERWRITE_CANCEL) | (1 << WIDX_OVERWRITE_OVERWRITE); window_init_scroll_widgets(w); w->flags |= WF_TRANSPARENT; w->colours[0] = 154; safe_strcpy(_window_overwrite_prompt_name, name, sizeof(_window_overwrite_prompt_name)); safe_strcpy(_window_overwrite_prompt_path, path, sizeof(_window_overwrite_prompt_path)); return w; }
/** * * rct2: 0x006AB1CE */ bool window_editor_bottom_toolbar_check_object_selection() { rct_window *w; int missingObjectType = editor_check_object_selection(); if (missingObjectType < 0) { window_close_by_class(WC_EDITOR_OBJECT_SELECTION); return true; } window_error_open(STR_INVALID_SELECTION_OF_OBJECTS, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); w = window_find_by_class(WC_EDITOR_OBJECT_SELECTION); if (w != NULL) { // Click tab with missing object window_event_mouse_up_call(w, 4 + missingObjectType); } return false; }
/** * * rct2: 0x006AB1CE */ static bool window_editor_bottom_toolbar_check_object_selection() { rct_window *w; sint32 missingObjectType = editor_check_object_selection(); if (missingObjectType < 0) { window_close_by_class(WC_EDITOR_OBJECT_SELECTION); return true; } window_error_open(STR_INVALID_SELECTION_OF_OBJECTS, gGameCommandErrorText); w = window_find_by_class(WC_EDITOR_OBJECT_SELECTION); if (w != NULL) { // Click tab with missing object window_event_mouse_up_call(w, WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 + missingObjectType); } return false; }
void UpdateSceneryGroupIndexes() { if (_loadedObjects != nullptr) { for (size_t i = 0; i < OBJECT_ENTRY_COUNT; i++) { Object * loadedObject = _loadedObjects[i]; if (loadedObject != nullptr) { rct_scenery_entry * sceneryEntry; switch (loadedObject->GetObjectType()) { case OBJECT_TYPE_SMALL_SCENERY: sceneryEntry = (rct_scenery_entry *)loadedObject->GetLegacyData(); sceneryEntry->small_scenery.scenery_tab_id = GetPrimarySceneryGroupEntryIndex(loadedObject); break; case OBJECT_TYPE_LARGE_SCENERY: sceneryEntry = (rct_scenery_entry *)loadedObject->GetLegacyData(); sceneryEntry->large_scenery.scenery_tab_id = GetPrimarySceneryGroupEntryIndex(loadedObject); break; case OBJECT_TYPE_WALLS: sceneryEntry = (rct_scenery_entry *)loadedObject->GetLegacyData(); sceneryEntry->wall.scenery_tab_id = GetPrimarySceneryGroupEntryIndex(loadedObject); break; case OBJECT_TYPE_BANNERS: sceneryEntry = (rct_scenery_entry *)loadedObject->GetLegacyData(); sceneryEntry->banner.scenery_tab_id = GetPrimarySceneryGroupEntryIndex(loadedObject); break; case OBJECT_TYPE_PATH_BITS: sceneryEntry = (rct_scenery_entry *)loadedObject->GetLegacyData(); sceneryEntry->path_bit.scenery_tab_id = GetPrimarySceneryGroupEntryIndex(loadedObject); break; case OBJECT_TYPE_SCENERY_SETS: auto sgObject = static_cast<SceneryGroupObject *>(loadedObject); sgObject->UpdateEntryIndexes(); break; } } } // HACK Scenery window will lose its tabs after changing the the scenery group indexing // for now just close it, but it will be better to later tell it to invalidate the tabs window_close_by_class(WC_SCENERY); } }
static void window_overwrite_prompt_mouseup(rct_window *w, int widgetIndex) { rct_window *loadsaveWindow; switch (widgetIndex) { case WIDX_OVERWRITE_OVERWRITE: loadsaveWindow = window_find_by_class(WC_LOADSAVE); if (loadsaveWindow != NULL) window_loadsave_select(loadsaveWindow, _window_overwrite_prompt_path); // As the window_loadsave_select function can change the order of the // windows we can't use window_close(w). window_close_by_class(WC_LOADSAVE_OVERWRITE_PROMPT); break; case WIDX_OVERWRITE_CANCEL: case WIDX_OVERWRITE_CLOSE: window_close(w); break; } }
/** * * rct2: 0x006D3523 */ static void window_track_manage_textinput() { rct_window *w; short widgetIndex; uint8 result; char *text; window_textinput_get_registers(w, widgetIndex, result, text); if (widgetIndex != WIDX_RENAME || !result) return; if (track_rename(text)) { window_close_by_class(WC_TRACK_DELETE_PROMPT); window_close(w); } else { window_error_open(STR_CANT_RENAME_TRACK_DESIGN, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16)); } }
/** * * rct2: 0x006D3823 */ static void window_track_delete_prompt_mouseup() { rct_window *w; short widgetIndex; window_widget_get_registers(w, widgetIndex); switch (widgetIndex) { case WIDX_CLOSE: case WIDX_PROMPT_CANCEL: window_close(w); break; case WIDX_PROMPT_DELETE: window_close(w); if (track_delete()) window_close_by_class(WC_MANAGE_TRACK_DESIGN); else window_error_open(STR_CANT_DELETE_TRACK_DESIGN, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16)); break; } }
static void window_title_editor_load_sequence(size_t index) { if (index >= title_sequence_manager_get_count()) return; const char * path = title_sequence_manager_get_path(index); TitleSequence * titleSequence = LoadTitleSequence(path); if (titleSequence == nullptr) { context_show_error(STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, STR_NONE); return; } _selectedTitleSequence = index; size_t predefinedIndex = title_sequence_manager_get_predefined_index(index); _isSequenceReadOnly = (predefinedIndex != SIZE_MAX); _sequenceName = title_sequence_manager_get_name(index); FreeTitleSequence(_editingTitleSequence); _editingTitleSequence = titleSequence; window_close_by_class(WC_TITLE_COMMAND_EDITOR); }
/** * * rct2: 0x006852F4 */ static void window_editor_inventions_list_drag_open(rct_research_item* researchItem) { char buffer[256], *ptr; int32_t stringWidth; rct_window* w; window_close_by_class(WC_EDITOR_INVENTION_LIST_DRAG); _editorInventionsListDraggedItem = researchItem; rct_string_id stringId = research_item_get_name(researchItem); ptr = buffer; if (researchItem->type == RESEARCH_ENTRY_TYPE_RIDE && !RideGroupManager::RideTypeIsIndependent(researchItem->baseRideType)) { const auto rideEntry = get_ride_entry(researchItem->entryIndex); const rct_string_id rideGroupName = get_ride_naming(researchItem->baseRideType, rideEntry).name; rct_string_id args[] = { rideGroupName, stringId, }; format_string(ptr, 256, STR_INVENTIONS_LIST_RIDE_AND_VEHICLE_NAME, &args); } else { format_string(ptr, 256, stringId, nullptr); } stringWidth = gfx_get_string_width(buffer); window_editor_inventions_list_drag_widgets[0].right = stringWidth; w = window_create( gTooltipCursorX - (stringWidth / 2), gTooltipCursorY - 7, stringWidth, 14, &window_editor_inventions_list_drag_events, WC_EDITOR_INVENTION_LIST_DRAG, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING); w->widgets = window_editor_inventions_list_drag_widgets; w->colours[1] = COLOUR_WHITE; input_window_position_begin(w, 0, gTooltipCursorX, gTooltipCursorY); }
static void window_title_menu_mouseup(rct_window *w, rct_widgetindex widgetIndex) { rct_window *windowToOpen = nullptr; switch (widgetIndex) { case WIDX_START_NEW_GAME: windowToOpen = window_find_by_class(WC_SCENARIO_SELECT); if (windowToOpen != nullptr) { window_bring_to_front(windowToOpen); } else { window_close_by_class(WC_LOADSAVE); window_close_by_class(WC_SERVER_LIST); window_scenarioselect_open(window_title_menu_scenarioselect_callback, false); } break; case WIDX_CONTINUE_SAVED_GAME: windowToOpen = window_find_by_class(WC_LOADSAVE); if (windowToOpen != nullptr) { window_bring_to_front(windowToOpen); } else { window_close_by_class(WC_SCENARIO_SELECT); window_close_by_class(WC_SERVER_LIST); game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0); } break; case WIDX_MULTIPLAYER: windowToOpen = window_find_by_class(WC_SERVER_LIST); if (windowToOpen != nullptr) { window_bring_to_front(windowToOpen); } else { window_close_by_class(WC_SCENARIO_SELECT); window_close_by_class(WC_LOADSAVE); context_open_window(WC_SERVER_LIST); } break; } }
void window_network_status_close() { window_close_by_class(WC_NETWORK_STATUS); }
void window_dropdown_close() { window_close_by_class(WC_DROPDOWN); }
void input_handle_keyboard(bool isTitle) { if (gOpenRCT2Headless) { return; } if (!gConsoleOpen) { if (!isTitle) { // Handle mouse scrolling if (input_get_state() == INPUT_STATE_NORMAL && gConfigGeneral.edge_scrolling) { if (!(gInputPlaceObjectModifier & (PLACE_OBJECT_MODIFIER_SHIFT_Z | PLACE_OBJECT_MODIFIER_COPY_Z))) { game_handle_edge_scroll(); } } } // Handle modifier keys and key scrolling gInputPlaceObjectModifier = PLACE_OBJECT_MODIFIER_NONE; const uint8 * keysState = context_get_keys_state(); if (keysState[SDL_SCANCODE_LSHIFT] || keysState[SDL_SCANCODE_RSHIFT]) { gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_SHIFT_Z; } if (keysState[SDL_SCANCODE_LCTRL] || keysState[SDL_SCANCODE_RCTRL]) { gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_COPY_Z; } if (keysState[SDL_SCANCODE_LALT] || keysState[SDL_SCANCODE_RALT]) { gInputPlaceObjectModifier |= 4; } #ifdef __MACOSX__ if (keysState[SDL_SCANCODE_LGUI] || keysState[SDL_SCANCODE_RGUI]) { gInputPlaceObjectModifier |= 8; } #endif if (!isTitle) { game_handle_key_scroll(); } } if (gConfigGeneral.use_virtual_floor) { if (gInputPlaceObjectModifier & (PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z)) virtual_floor_enable(); else virtual_floor_disable(); } // Handle key input sint32 key; while (!gOpenRCT2Headless && (key = get_next_key()) != 0) { if (key == 255) continue; // Reserve backtick for console if (key == SDL_SCANCODE_GRAVE) { if ((gConfigGeneral.debugging_tools && !context_is_input_active()) || gConsoleOpen) { window_cancel_textbox(); console_toggle(); } continue; } else if (gConsoleOpen) { input_handle_console(key); continue; } else if (!isTitle && gChatOpen) { input_handle_chat(key); continue; } key |= gInputPlaceObjectModifier << 8; rct_window * w = window_find_by_class(WC_TEXTINPUT); if (w != nullptr) { char keychar = input_scancode_to_rct_keycode(key & 0xFF); window_text_input_key(w, keychar); } else if (!gUsingWidgetTextBox) { w = window_find_by_class(WC_CHANGE_KEYBOARD_SHORTCUT); if (w != nullptr) { keyboard_shortcuts_set(key); window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT); window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST); } else { keyboard_shortcut_handle(key); } } } }