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; } }
static void window_themes_mouseup(rct_window *w, rct_widgetindex widgetIndex) { size_t activeAvailableThemeIndex; const utf8 * activeThemeName; switch (widgetIndex) { case WIDX_THEMES_CLOSE: window_close(w); break; case WIDX_THEMES_DUPLICATE_BUTTON:; activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); window_text_input_open(w, widgetIndex, STR_TITLE_EDITOR_ACTION_DUPLICATE, STR_THEMES_PROMPT_ENTER_THEME_NAME, STR_STRING, (uintptr_t)activeThemeName, 64); break; case WIDX_THEMES_DELETE_BUTTON: if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) { window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE); } else { theme_delete(); } break; case WIDX_THEMES_RENAME_BUTTON: if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) { window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE); } else { activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); window_text_input_open(w, widgetIndex, STR_TRACK_MANAGE_RENAME, STR_THEMES_PROMPT_ENTER_THEME_NAME, STR_STRING, (uintptr_t)activeThemeName, 64); } break; } }
/** * * rct2: 0x006AB0B6 */ static void window_editor_object_selection_scroll_mousedown() { short x, y, scrollIndex; rct_window *w; window_scrollmouse_get_registers(w, scrollIndex, x, y); // Used for in-game object selection cheat to prevent crashing the game // when windows attempt to draw objects that don't exist any more window_close_all_except_class(WC_EDITOR_OBJECT_SELECTION); uint8 object_selection_flags; rct_object_entry* installed_entry; int selected_object = get_object_from_object_selection((w->selected_tab & 0xFF), y, &object_selection_flags, &installed_entry); if (selected_object == -1 || (object_selection_flags & 0x20)) return; window_invalidate(w); sound_play_panned(SOUND_CLICK_1, RCT2_GLOBAL(0x142406C,uint32), 0, 0, 0); if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) { if (!window_editor_object_selection_select_object(1, installed_entry)) return; // Close any other open windows such as options/colour schemes to prevent a crash. window_close_all(); //window_close(w); //This function calls window_track_list_open window_editor_object_selection_manage_tracks(); return; } int ebx = 6; // If already selected if (!(object_selection_flags & 1)) ebx = 7; RCT2_GLOBAL(0xF43411, uint8) = 0; if (!window_editor_object_selection_select_object(ebx, installed_entry)) { rct_string_id error_title = ebx & 1 ? STR_UNABLE_TO_SELECT_THIS_OBJECT : STR_UNABLE_TO_DE_SELECT_THIS_OBJECT; window_error_open(error_title, RCT2_GLOBAL(0x141E9AC, uint16)); return; } if (!RCT2_GLOBAL(0xF43411, uint8) & 1) return; window_error_open(STR_WARNING_TOO_MANY_OBJECTS_SELECTED, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED); }
static bool window_title_editor_check_can_edit() { bool commandEditorOpen = (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != NULL); if (_isSequenceReadOnly) { window_error_open(STR_ERROR_CANT_CHANGE_TITLE_SEQUENCE, STR_NONE); } else if (_isSequencePlaying) { window_error_open(STR_TITLE_EDITOR_ERR_CANT_EDIT_WHILE_PLAYING, STR_TITLE_EDITOR_PRESS_STOP_TO_CONTINUE_EDITING); } else if (commandEditorOpen) { window_error_open(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE); } else { return true; } return false; }
/** * * rct2: 0x0066ECC1 */ void tutorial_start(int type) { strcpy((char*)0x009BC677, "Tutorial not implemented."); window_error_open(3165, -1); // RCT2_CALLPROC_X(0x0066ECC1, type, 0, 0, 0, 0, 0, 0); }
/* 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)); } } }
/** * * rct2: 0x0066F7C0 */ void window_editor_bottom_toolbar_jump_forward_to_save_scenario() { rct_s6_info *s6Info = (rct_s6_info*)0x0141F570; int parkFlagsBackup, success; char path[256]; if (!scenario_prepare_for_save()) { window_error_open(STR_UNABLE_TO_SAVE_SCENARIO_FILE, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); gfx_invalidate_screen(); return; } window_close_all(); window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO, s6Info->name); return; if (!show_save_scenario_dialog(path)) { gfx_invalidate_screen(); return; } // s6Info->editor_step = 255; // Ensure path has .SC6 extension path_set_extension(path, ".SC6"); // Save the scenario parkFlagsBackup = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32); RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_18; SDL_RWops* rw = SDL_RWFromFile(path, "wb+"); if (rw != NULL) { success = scenario_save(rw, gConfigGeneral.save_plugin_data ? 3 : 2); SDL_RWclose(rw); } RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = parkFlagsBackup; if (success) { title_load(); } else { window_error_open(STR_SCENARIO_SAVE_FAILED, -1); s6Info->editor_step = EDITOR_STEP_OBJECTIVE_SELECTION; } }
void window_themes_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y) { if (y / _row_height < get_colour_scheme_tab_count()) { sint32 y2 = y % _row_height; _colour_index_1 = y / _row_height; _colour_index_2 = ((x - _button_offset_x) / 12); rct_windowclass wc = get_window_class_tab_index(_colour_index_1); sint32 numColours = theme_desc_get_num_colours(wc); if (_colour_index_2 < numColours) { if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 && y2 >= _button_offset_y && y2 < _button_offset_y + 11) { if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) { window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME); } else { window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].type = WWT_COLOURBTN; window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].left = _button_offset_x + _colour_index_2 * 12 + window_themes_widgets[WIDX_THEMES_LIST].left; window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].top = _colour_index_1 * _row_height + _button_offset_y - w->scrolls[0].v_top + window_themes_widgets[WIDX_THEMES_LIST].top; window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].right = window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].left + 12; window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].bottom = window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].top + 12; uint8 colour = theme_get_colour(wc, _colour_index_2); window_dropdown_show_colour(w, &(window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK]), w->colours[1], colour); widget_invalidate(w, WIDX_THEMES_LIST); } } else if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 - 1 && y2 >= _check_offset_y && y2 < _check_offset_y + 11) { if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) { window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME); } else { uint8 colour = theme_get_colour(wc, _colour_index_2); if (colour & COLOUR_FLAG_TRANSLUCENT) { colour &= ~COLOUR_FLAG_TRANSLUCENT; } else { colour |= COLOUR_FLAG_TRANSLUCENT; } theme_set_colour(wc, _colour_index_2, colour); colour_scheme_update_all(); window_invalidate_all(); } } } } }
/** * * rct2: 0x006D2804, 0x006D264D */ bool track_design_save(uint8 rideIndex) { rct_ride* ride = get_ride(rideIndex); if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED)){ window_error_open(STR_CANT_SAVE_TRACK_DESIGN, gGameCommandErrorText); return false; } if (!ride_has_ratings(ride)) { window_error_open(STR_CANT_SAVE_TRACK_DESIGN, gGameCommandErrorText); return false; } if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_TRACK)) { window_error_open(STR_CANT_SAVE_TRACK_DESIGN, gGameCommandErrorText); return false; } _trackDesign = track_design_save_to_td6(rideIndex); if (_trackDesign == NULL) { window_error_open(STR_CANT_SAVE_TRACK_DESIGN, gGameCommandErrorText); return false; } if (gTrackDesignSaveMode) { if (!track_design_save_copy_scenery_to_td6(_trackDesign)) { free(_trackDesign->track_elements); free(_trackDesign->entrance_elements); free(_trackDesign); return false; } } utf8 track_name[256]; format_string(track_name, sizeof(track_name), ride->name, &ride->name_arguments); window_loadsave_open(LOADSAVETYPE_TRACK | LOADSAVETYPE_SAVE, track_name); window_loadsave_set_loadsave_callback(track_design_save_callback); return true; }
/** * * rct2: 0x0066F758 */ void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up() { if (editor_check_park()) { window_close_all(); window_editor_inventions_list_open(); g_editor_step = EDITOR_STEP_INVENTIONS_LIST_SET_UP; } else { window_error_open(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16)); } gfx_invalidate_screen(); }
/** * * rct2: 0x0066F7C0 */ void window_editor_bottom_toolbar_jump_forward_to_save_scenario() { if (!scenario_prepare_for_save()) { window_error_open(STR_UNABLE_TO_SAVE_SCENARIO_FILE, gGameCommandErrorText); gfx_invalidate_screen(); return; } window_close_all(); window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO, gS6Info.name); }
/** * * rct2: 0x0066F758 */ void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up() { if (editor_check_park()) { window_close_all(); window_editor_inventions_list_open(); gS6Info.editor_step = EDITOR_STEP_INVENTIONS_LIST_SET_UP; } else { window_error_open(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, gGameCommandErrorText); } gfx_invalidate_screen(); }
/** * * rct2: 0x006CFB82 */ static void window_track_list_select(rct_window *w, int index) { utf8 *trackDesignItem, *trackDesignList = RCT2_ADDRESS(RCT2_ADDRESS_TRACK_LIST, utf8); rct_track_design *trackDesign; w->track_list.var_480 = index; audio_play_sound_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0); if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) && index == 0) { window_close(w); ride_construct_new(_window_track_list_item); return; } if (RCT2_GLOBAL(0x00F44153, uint8) != 0) RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) = 1; if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER)) index--; trackDesignItem = trackDesignList + (index * 128); RCT2_GLOBAL(0x00F4403C, utf8*) = trackDesignItem; window_track_list_format_name( (char*)0x009BC313, trackDesignItem, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER ? 0 : FORMAT_WHITE, 1); char track_path[MAX_PATH] = { 0 }; substitute_path(track_path, (char*)RCT2_ADDRESS_TRACKS_PATH, trackDesignItem); if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) { window_track_manage_open(); return; } if (!load_track_design(track_path)) { w->track_list.var_480 = 0xFFFF; window_invalidate(w); return; } trackDesign = track_get_info(index, NULL); if (trackDesign == NULL) return; if (trackDesign->track_td6.track_flags & 4) window_error_open(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, -1); window_close(w); window_track_place_open(); }
static void window_title_editor_rename_park(size_t index, const utf8 * name) { if (!filename_valid_characters(name)) { window_error_open(STR_ERROR_INVALID_CHARACTERS, STR_NONE); return; } for (size_t i = 0; i < _editingTitleSequence->NumSaves; i++) { if (i != index) { const utf8 * savePath = _editingTitleSequence->Saves[i]; if (_strcmpi(savePath, name) == 0) { window_error_open(STR_ERROR_EXISTING_NAME, STR_NONE); return; } } } if (TileSequenceRenamePark(_editingTitleSequence, index, name)) { TileSequenceSave(_editingTitleSequence); } }
static void window_loadsave_textinput(rct_window *w, int widgetIndex, char *text) { char path[MAX_PATH]; int i, overwrite; if (text == NULL || text[0] == 0) return; if (gLoadSaveTitleSequenceSave) { if (filename_valid_characters(text)) { if (!title_sequence_save_exists(gCurrentTitleSequence, text)) { title_sequence_add_save(gCurrentTitleSequence, path, text); } else { window_error_open(5404, STR_NONE); } } else { window_error_open(5243, STR_NONE); } return; } safe_strcpy(path, _directory, sizeof(path)); strncat(path, text, sizeof(path) - strnlen(path, MAX_PATH) - 1); strncat(path, _extension, sizeof(path) - strnlen(path, MAX_PATH) - 1); overwrite = 0; for (i = 0; i < _listItemsCount; i++) { if (_stricmp(_listItems[i].path, path) == 0) { overwrite = 1; break; } } if (overwrite) window_overwrite_prompt_open(text, path); else window_loadsave_select(w, path); }
/** * * rct2: 0x0066F7C0 */ void window_editor_bottom_toolbar_jump_forward_to_save_scenario() { rct_s6_info *s6Info = (rct_s6_info*)0x0141F570; if (!scenario_prepare_for_save()) { window_error_open(STR_UNABLE_TO_SAVE_SCENARIO_FILE, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); gfx_invalidate_screen(); return; } window_close_all(); window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO, s6Info->name); }
/** * * rct2: 0x006CFB82 */ static void window_track_list_select(rct_window *w, int index) { uint8 *trackDesignItem, *trackDesignList = (uint8*)0x00F441EC; rct_track_design *trackDesign; w->track_list.var_480 = index; sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0); if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER & 8) && index == 0) { window_close(w); ride_construct_new(_window_track_list_item); return; } if (RCT2_GLOBAL(0x00F44153, uint8) != 0) RCT2_GLOBAL(0x00F44152, uint8) = 1; if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER & 8)) index--; trackDesignItem = trackDesignList + (index * 128);; RCT2_GLOBAL(0x00F4403C, uint8*) = trackDesignItem; window_track_list_format_name( (char*)0x009BC313, trackDesignItem, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER & 8 ? 0 : FORMAT_WHITE ); subsitute_path((char*)0x0141EF68, (char*)RCT2_ADDRESS_TRACKS_PATH, trackDesignItem); if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER & 8) { window_track_manage_open(); return; } if (!RCT2_CALLPROC_X(0x0067726A, 0, 0, 0, 0, 0, 0, 0)) { w->track_list.var_480 = 0xFFFF; window_invalidate(w); return; } trackDesign = track_get_info(index, NULL); if (trackDesign->var_06 & 4) window_error_open(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, -1); window_close(w); window_track_place_open(); }
/* 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: 0x006CFB82 */ static void window_track_list_select(rct_window *w, sint32 index) { w->track_list.var_480 = index; // Displays a message if the ride can't load, fix #4080 if (_loadedTrackDesign == NULL) { window_error_open(STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_TRACK_LOAD_FAILED_ERROR); return; } audio_play_sound(SOUND_CLICK_1, 0, w->x + (w->width / 2)); if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { if (index == 0) { window_close(w); ride_construct_new(_window_track_list_item); return; } index--; } rct_track_td6 *td6 = _loadedTrackDesign; if (td6 != NULL && (td6->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE)) { gTrackDesignSceneryToggle = true; } track_design_file_ref *tdRef = &_trackDesigns[index]; if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { window_track_manage_open(tdRef); } else { if (_loadedTrackDesignIndex != TRACK_DESIGN_INDEX_UNLOADED && (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE)) { window_error_open(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, STR_NONE); } window_track_place_open(tdRef); } }
static void window_title_editor_textinput(rct_window *w, sint32 widgetIndex, char *text) { if (str_is_null_or_empty(text)) { return; } switch (widgetIndex) { case WIDX_TITLE_EDITOR_NEW_BUTTON: case WIDX_TITLE_EDITOR_DUPLICATE_BUTTON: case WIDX_TITLE_EDITOR_RENAME_SAVE_BUTTON: if (filename_valid_characters(text)) { if (title_sequence_manager_get_index_for_name(text) == SIZE_MAX) { if (widgetIndex == WIDX_TITLE_EDITOR_NEW_BUTTON) { size_t newIndex = title_sequence_manager_create(text); window_title_editor_load_sequence(newIndex); } else if (widgetIndex == WIDX_TITLE_EDITOR_DUPLICATE_BUTTON) { size_t newIndex = title_sequence_manager_duplicate(_selectedTitleSequence, text); window_title_editor_load_sequence(newIndex); } else { size_t newIndex = title_sequence_manager_rename(_selectedTitleSequence, text); window_title_editor_load_sequence(newIndex); } config_save_default(); window_invalidate(w); } else { window_error_open(STR_ERROR_EXISTING_NAME, STR_NONE); } } else { window_error_open(STR_ERROR_INVALID_CHARACTERS, STR_NONE); } break; case WIDX_TITLE_EDITOR_RENAME_SAVE: window_title_editor_rename_park(w->selected_list_item, text); break; } }
/** * * rct2: 0x006D2B07 */ void track_design_save_select_map_element(sint32 interactionType, sint32 x, sint32 y, rct_map_element *mapElement, bool collect) { if (track_design_save_contains_map_element(mapElement)) { if (!collect) { track_design_save_remove_map_element(interactionType, x, y, mapElement); } } else { if (collect) { if (!track_design_save_add_map_element(interactionType, x, y, mapElement)) { window_error_open( STR_SAVE_TRACK_SCENERY_UNABLE_TO_SELECT_ADDITIONAL_ITEM_OF_SCENERY, STR_SAVE_TRACK_SCENERY_TOO_MANY_ITEMS_SELECTED ); } } } }
void game_logic_update() { short stringId, _dx; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, sint32)++; RCT2_GLOBAL(0x00F663AC, sint32)++; RCT2_GLOBAL(0x009DEA66, sint16)++; if (RCT2_GLOBAL(0x009DEA66, sint16) == 0) RCT2_GLOBAL(0x009DEA66, sint16)--; sub_68B089(); scenario_update(); climate_update(); RCT2_CALLPROC_EBPSAFE(0x006646E1); RCT2_CALLPROC_EBPSAFE(0x006A876D); peep_update_all(); RCT2_CALLPROC_EBPSAFE(0x006D4204); // update vehicles RCT2_CALLPROC_EBPSAFE(0x00672AA4); // update text effects RCT2_CALLPROC_EBPSAFE(0x006ABE4C); // update rides RCT2_CALLPROC_EBPSAFE(0x006674F7); // update park RCT2_CALLPROC_EBPSAFE(0x00684C7A); RCT2_CALLPROC_EBPSAFE(0x006B5A2A); RCT2_CALLPROC_EBPSAFE(0x006B6456); // update ride measurements RCT2_CALLPROC_EBPSAFE(0x0068AFAD); RCT2_CALLPROC_EBPSAFE(0x006BBC6B); RCT2_CALLPROC_EBPSAFE(0x006BD18A); RCT2_CALLPROC_EBPSAFE(0x006BCB91); news_item_update_current(); RCT2_CALLPROC_EBPSAFE(0x0067009A); // Update windows window_dispatch_update_all(); if (RCT2_GLOBAL(0x009AC31B, uint8) != 0) { stringId = STR_UNABLE_TO_LOAD_FILE; _dx = RCT2_GLOBAL(0x009AC31C, uint16); if (RCT2_GLOBAL(0x009AC31B, uint8) != 254) { stringId = RCT2_GLOBAL(0x009AC31C, uint16); _dx = 0xFFFF; } RCT2_GLOBAL(0x009AC31B, uint8) = 0; window_error_open(stringId, _dx); } }
/** * * rct2: 0x006CF1A2 */ void window_track_list_open(ride_list_item item) { rct_window *w; int x, y; void *mem; window_close_construction_windows(); _window_track_list_item = item; if (RCT2_GLOBAL(0x00F635ED, uint8) & 1) window_error_open(STR_WARNING, STR_TOO_MANY_TRACK_DESIGNS_OF_THIS_TYPE); mem = malloc(1285292); if (mem == NULL) return; RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_CACHE, void*) = mem; reset_track_list_cache(); if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) { x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 300; y = max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 200); } else { x = 0; y = 29; } w = window_create( x, y, 600, 400, &window_track_list_events, WC_TRACK_DESIGN_LIST, 0 ); w->widgets = window_track_list_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY) | (1 << WIDX_BACK); window_init_scroll_widgets(w); w->track_list.var_480 = 0xFFFF; w->track_list.var_482 = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 1; w->track_list.var_484 = 0; RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) = 0; window_push_others_right(w); RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 2; }
/** * * 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; }
static void window_title_editor_mousedown(sint32 widgetIndex, rct_window* w, rct_widget* widget) { switch (widgetIndex) { case WIDX_TITLE_EDITOR_PRESETS_TAB: case WIDX_TITLE_EDITOR_SAVES_TAB: case WIDX_TITLE_EDITOR_SCRIPT_TAB: { sint32 newSelectedTab = widgetIndex - WIDX_TITLE_EDITOR_PRESETS_TAB; if (w->selected_tab != newSelectedTab) { w->selected_tab = newSelectedTab; w->selected_list_item = -1; _window_title_editor_highlighted_index = -1; w->scrolls[0].v_top = 0; w->frame_no = 0; window_event_resize_call(w); window_invalidate(w); } break; } case WIDX_TITLE_EDITOR_PRESETS_DROPDOWN: if (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != NULL) { window_error_open(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE); } else { sint32 numItems = (sint32)title_sequence_manager_get_count(); for (sint32 i = 0; i < numItems; i++) { gDropdownItemsFormat[i] = STR_OPTIONS_DROPDOWN_ITEM; gDropdownItemsArgs[i] = (uintptr_t)title_sequence_manager_get_name(i); } widget--; window_dropdown_show_text_custom_width( w->x + widget->left, w->y + widget->top, widget->bottom - widget->top + 1, w->colours[1], DROPDOWN_FLAG_STAY_OPEN, numItems, widget->right - widget->left - 3); dropdown_set_checked((sint32)_selectedTitleSequence, true); } 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: 0x006E3AEC */ void screenshot_check() { int screenshotIndex; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) != 0) { RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8)--; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) == 0) { update_rain_animation(); screenshotIndex = screenshot_dump(); RCT2_GLOBAL(0x013CE952, uint16) = STR_SCR_BMP; RCT2_GLOBAL(0x013CE952 + 2, uint16) = screenshotIndex; RCT2_GLOBAL(0x009A8C29, uint8) |= 1; window_error_open(screenshotIndex == -1 ? STR_SCREENSHOT_FAILED : STR_SCREENSHOT_SAVED_AS, -1); RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; RCT2_CALLPROC_EBPSAFE(0x006843DC); } } }
/** * * 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; } }
/** * * rct2: 0x006CF1A2 */ void window_track_list_open(ride_list_item item) { rct_window *w; int x, y; void *mem; window_close_construction_windows(); _window_track_list_item = item; if (RCT2_GLOBAL(0x00F635ED, uint8) & 1) window_error_open(STR_WARNING, STR_TOO_MANY_TRACK_DESIGNS_OF_THIS_TYPE); mem = malloc(1285292); if (mem == NULL) return; RCT2_GLOBAL(0x00F44105, void*) = mem; RCT2_CALLPROC_EBPSAFE(0x006D1DCE); if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) { x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 300; y = max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 200); } else { x = 0; y = 29; } w = window_create(0, 29, 600, 400, (uint32*)window_track_list_events, WC_TRACK_DESIGN_LIST, 0); w->widgets = window_track_list_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY); window_init_scroll_widgets(w); w->colours[0] = 26; w->colours[1] = 26; w->colours[2] = 26; w->track_list.var_480 = 0xFFFF; w->track_list.var_482 = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER ? 1 : 0; w->track_list.var_484 = 0; RCT2_GLOBAL(0x00F44152, uint8) = 0; window_push_others_right(w); RCT2_GLOBAL(0x00F440AE, uint8) = 2; }