mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Clean up and improve UI of track install window
Clean up and improve UI of track install window Cleanup window def Clean up and improve track install window Name track_list.var_484 Format widget definitions Use get_friendly_track_type_name() Guard against NULL
This commit is contained in:
@@ -3383,7 +3383,7 @@ STR_3372 :{BLACK}= Cash Machine
|
|||||||
STR_3373 :{BLACK}= Toilet
|
STR_3373 :{BLACK}= Toilet
|
||||||
STR_3374 :Warning: Too many objects selected!
|
STR_3374 :Warning: Too many objects selected!
|
||||||
STR_3375 :Not all objects in this scenery group could be selected
|
STR_3375 :Not all objects in this scenery group could be selected
|
||||||
STR_3376 :Install new track design...
|
STR_3376 :Install new
|
||||||
STR_3377 :{SMALLFONT}{BLACK}Install a new track design file
|
STR_3377 :{SMALLFONT}{BLACK}Install a new track design file
|
||||||
STR_3378 :Install
|
STR_3378 :Install
|
||||||
STR_3379 :Cancel
|
STR_3379 :Cancel
|
||||||
@@ -4450,6 +4450,8 @@ STR_6138 :OpenRCT2 is the work of many authors, a full list can be found in {
|
|||||||
STR_6139 :All product and company names belong to their respective holders. Use of them does not imply any affiliation with or endorsement by them.
|
STR_6139 :All product and company names belong to their respective holders. Use of them does not imply any affiliation with or endorsement by them.
|
||||||
STR_6140 :Changelog...
|
STR_6140 :Changelog...
|
||||||
STR_6141 :RCT1 Bottom Toolbar
|
STR_6141 :RCT1 Bottom Toolbar
|
||||||
|
STR_6142 :{WINDOW_COLOUR_2}Track name: {BLACK}{STRING}
|
||||||
|
STR_6143 :{WINDOW_COLOUR_2}Ride type: {BLACK}{STRINGID}
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# Scenarios #
|
# Scenarios #
|
||||||
|
|||||||
@@ -225,8 +225,7 @@ typedef struct scenery_variables {
|
|||||||
} scenery_variables;
|
} scenery_variables;
|
||||||
|
|
||||||
typedef struct track_list_variables {
|
typedef struct track_list_variables {
|
||||||
uint16 var_480;
|
bool track_list_being_updated;
|
||||||
uint16 var_484;
|
|
||||||
bool reload_track_designs;
|
bool reload_track_designs;
|
||||||
} track_list_variables;
|
} track_list_variables;
|
||||||
|
|
||||||
|
|||||||
@@ -3788,6 +3788,9 @@ enum {
|
|||||||
|
|
||||||
STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR = 6141,
|
STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR = 6141,
|
||||||
|
|
||||||
|
STR_TRACK_DESIGN_NAME = 6142,
|
||||||
|
STR_TRACK_DESIGN_TYPE = 6143,
|
||||||
|
|
||||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||||
STR_COUNT = 32768
|
STR_COUNT = 32768
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,15 +42,21 @@ enum {
|
|||||||
WIDX_CANCEL
|
WIDX_CANCEL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define WW 380
|
||||||
|
#define WH 400
|
||||||
|
#define WW_LESS_PADDING (WW - 4)
|
||||||
|
#define PREVIEW_BUTTONS_LEFT (WW - 25)
|
||||||
|
#define ACTION_BUTTONS_LEFT (WW - 100)
|
||||||
|
|
||||||
static rct_widget window_install_track_widgets[] = {
|
static rct_widget window_install_track_widgets[] = {
|
||||||
{ WWT_FRAME, 0, 0, 401, 0, 399, 0xFFFFFFFF, STR_NONE },
|
{ WWT_FRAME, 0, 0, WW - 1, 0, WH-1, STR_NONE, STR_NONE },
|
||||||
{ WWT_CAPTION, 0, 1, 400, 1, 14, STR_TRACK_DESIGN_INSTALL_WINDOW_TITLE, STR_WINDOW_TITLE_TIP },
|
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_TRACK_DESIGN_INSTALL_WINDOW_TITLE, STR_WINDOW_TITLE_TIP },
|
||||||
{ WWT_CLOSEBOX, 0, 389, 399, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP },
|
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP },
|
||||||
{ WWT_FLATBTN, 0, 15, 386, 18, 236, 0xFFFFFFFF, STR_NONE },
|
{ WWT_FLATBTN, 0, 4, WW - 5, 18, 236, STR_NONE, STR_NONE },
|
||||||
{ WWT_FLATBTN, 0, 376, 399, 374, 397, SPR_ROTATE_ARROW, STR_ROTATE_90_TIP },
|
{ WWT_FLATBTN, 0, PREVIEW_BUTTONS_LEFT, WW_LESS_PADDING, 374, 397, SPR_ROTATE_ARROW, STR_ROTATE_90_TIP },
|
||||||
{ WWT_FLATBTN, 0, 376, 399, 350, 373, SPR_SCENERY, STR_TOGGLE_SCENERY_TIP },
|
{ WWT_FLATBTN, 0, PREVIEW_BUTTONS_LEFT, WW_LESS_PADDING, 350, 373, SPR_SCENERY, STR_TOGGLE_SCENERY_TIP },
|
||||||
{ WWT_DROPDOWN_BUTTON, 0, 303, 397, 241, 252, STR_INSTALL_NEW_TRACK_DESIGN_INSTALL, STR_NONE },
|
{ WWT_DROPDOWN_BUTTON, 0, ACTION_BUTTONS_LEFT, WW_LESS_PADDING, 241, 252, STR_INSTALL_NEW_TRACK_DESIGN_INSTALL, STR_NONE },
|
||||||
{ WWT_DROPDOWN_BUTTON, 0, 303, 397, 256, 267, STR_INSTALL_NEW_TRACK_DESIGN_CANCEL, STR_NONE },
|
{ WWT_DROPDOWN_BUTTON, 0, ACTION_BUTTONS_LEFT, WW_LESS_PADDING, 256, 267, STR_INSTALL_NEW_TRACK_DESIGN_CANCEL, STR_NONE },
|
||||||
{ WIDGETS_END },
|
{ WIDGETS_END },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -132,11 +138,11 @@ void window_install_track_open(const utf8 *path)
|
|||||||
sint32 x = screenWidth / 2 - 201;
|
sint32 x = screenWidth / 2 - 201;
|
||||||
sint32 y = Math::Max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200);
|
sint32 y = Math::Max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200);
|
||||||
|
|
||||||
rct_window *w = window_create(x, y, 402, 400, &window_install_track_events, WC_INSTALL_TRACK, 0);
|
rct_window *w = window_create(x, y, WW, WH, &window_install_track_events, WC_INSTALL_TRACK, 0);
|
||||||
w->widgets = window_install_track_widgets;
|
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);
|
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY) | (1 << WIDX_INSTALL) | (1 << WIDX_CANCEL);
|
||||||
window_init_scroll_widgets(w);
|
window_init_scroll_widgets(w);
|
||||||
w->track_list.var_484 = 0;
|
w->track_list.track_list_being_updated = false;
|
||||||
window_push_others_right(w);
|
window_push_others_right(w);
|
||||||
|
|
||||||
_trackPath = _strdup(path);
|
_trackPath = _strdup(path);
|
||||||
@@ -247,14 +253,34 @@ static void window_install_track_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Track design name
|
|
||||||
gfx_draw_string_centred_clipped(dpi, STR_TRACK_PREVIEW_NAME_FORMAT, &_trackName, COLOUR_BLACK, x, y, 368);
|
|
||||||
|
|
||||||
// Information
|
// Information
|
||||||
x = w->x + widget->left + 1;
|
x = w->x + widget->left + 1;
|
||||||
y = w->y + widget->bottom + 2;
|
y = w->y + widget->bottom + 4;
|
||||||
// 0x006D3CF1 -- 0x006d3d71 missing
|
// 0x006D3CF1 -- 0x006d3d71 missing
|
||||||
|
|
||||||
|
// Track design name & type
|
||||||
|
gfx_draw_string_left(dpi, STR_TRACK_DESIGN_NAME, &_trackName, COLOUR_BLACK, x-1, y);
|
||||||
|
y += 10;
|
||||||
|
|
||||||
|
rct_ride_name rideName;
|
||||||
|
rct_string_id friendlyTrackName;
|
||||||
|
|
||||||
|
void * objectEntry = object_manager_load_object(&td6->vehicle_object);
|
||||||
|
if (objectEntry != NULL)
|
||||||
|
{
|
||||||
|
sint32 groupIndex = object_manager_get_loaded_object_entry_index(objectEntry);
|
||||||
|
rideName = get_ride_naming(td6->type, get_ride_entry(groupIndex));
|
||||||
|
friendlyTrackName = rideName.name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Fall back on the technical track name if the vehicle object cannot be loaded
|
||||||
|
friendlyTrackName = RideNaming[td6->type].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx_draw_string_left(dpi, STR_TRACK_DESIGN_TYPE, &friendlyTrackName, COLOUR_BLACK, x, y);
|
||||||
|
y += 14;
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
fixed32_2dp rating = td6->excitement * 10;
|
fixed32_2dp rating = td6->excitement * 10;
|
||||||
gfx_draw_string_left(dpi, STR_TRACK_LIST_EXCITEMENT_RATING, &rating, COLOUR_BLACK, x, y);
|
gfx_draw_string_left(dpi, STR_TRACK_LIST_EXCITEMENT_RATING, &rating, COLOUR_BLACK, x, y);
|
||||||
|
|||||||
@@ -144,8 +144,7 @@ static void _window_track_list_open(ride_list_item item)
|
|||||||
w->widgets = window_track_list_widgets;
|
w->widgets = window_track_list_widgets;
|
||||||
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY) | (1 << WIDX_BACK);
|
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY) | (1 << WIDX_BACK);
|
||||||
window_init_scroll_widgets(w);
|
window_init_scroll_widgets(w);
|
||||||
w->track_list.var_480 = 0xFFFF;
|
w->track_list.track_list_being_updated = false;
|
||||||
w->track_list.var_484 = 0;
|
|
||||||
w->track_list.reload_track_designs = false;
|
w->track_list.reload_track_designs = false;
|
||||||
w->selected_list_item = 0;
|
w->selected_list_item = 0;
|
||||||
if (_trackDesignsCount != 0 && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) {
|
if (_trackDesignsCount != 0 && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) {
|
||||||
@@ -198,8 +197,6 @@ static void window_track_list_close(rct_window *w)
|
|||||||
*/
|
*/
|
||||||
static void window_track_list_select(rct_window *w, sint32 index)
|
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
|
// Displays a message if the ride can't load, fix #4080
|
||||||
if (_loadedTrackDesign == nullptr) {
|
if (_loadedTrackDesign == nullptr) {
|
||||||
window_error_open(STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_TRACK_LOAD_FAILED_ERROR);
|
window_error_open(STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_TRACK_LOAD_FAILED_ERROR);
|
||||||
@@ -298,7 +295,7 @@ static void window_track_list_scrollgetsize(rct_window *w, sint32 scrollIndex, s
|
|||||||
*/
|
*/
|
||||||
static void window_track_list_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
static void window_track_list_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
||||||
{
|
{
|
||||||
if (!(w->track_list.var_484 & 1)) {
|
if (!w->track_list.track_list_being_updated) {
|
||||||
sint32 i = window_track_list_get_list_item_index_from_position(x, y);
|
sint32 i = window_track_list_get_list_item_index_from_position(x, y);
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
window_track_list_select(w, i);
|
window_track_list_select(w, i);
|
||||||
@@ -312,7 +309,7 @@ static void window_track_list_scrollmousedown(rct_window *w, sint32 scrollIndex,
|
|||||||
*/
|
*/
|
||||||
static void window_track_list_scrollmouseover(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
static void window_track_list_scrollmouseover(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
||||||
{
|
{
|
||||||
if (!(w->track_list.var_484 & 1)) {
|
if (!w->track_list.track_list_being_updated) {
|
||||||
sint32 i = window_track_list_get_list_item_index_from_position(x, y);
|
sint32 i = window_track_list_get_list_item_index_from_position(x, y);
|
||||||
if (i != -1 && w->selected_list_item != i) {
|
if (i != -1 && w->selected_list_item != i) {
|
||||||
w->selected_list_item = i;
|
w->selected_list_item = i;
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ static void _window_track_manage_open(track_design_file_ref *tdFileRef)
|
|||||||
|
|
||||||
rct_window *trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST);
|
rct_window *trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST);
|
||||||
if (trackDesignListWindow != nullptr) {
|
if (trackDesignListWindow != nullptr) {
|
||||||
trackDesignListWindow->track_list.var_484 |= 1;
|
trackDesignListWindow->track_list.track_list_being_updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_trackDesignFileReference = tdFileRef;
|
_trackDesignFileReference = tdFileRef;
|
||||||
@@ -178,7 +178,7 @@ static void window_track_manage_close(rct_window *w)
|
|||||||
{
|
{
|
||||||
rct_window *trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST);
|
rct_window *trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST);
|
||||||
if (trackDesignListWindow != nullptr) {
|
if (trackDesignListWindow != nullptr) {
|
||||||
trackDesignListWindow->track_list.var_484 &= ~1;
|
trackDesignListWindow->track_list.track_list_being_updated = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user