diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 1a0fe5c80d..a1993df8a2 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3801,3 +3801,4 @@ STR_5464 :General STR_5465 :Climate STR_5466 :Staff STR_5467 :ALT + +STR_5468 :Show recent messages button on toolbar diff --git a/resources/g2/58.png b/resources/g2/58.png new file mode 100644 index 0000000000..38dab8711a Binary files /dev/null and b/resources/g2/58.png differ diff --git a/src/config.c b/src/config.c index d596175a65..55ad3ecbde 100644 --- a/src/config.c +++ b/src/config.c @@ -190,7 +190,8 @@ config_property_definition _interfaceDefinitions[] = { { offsetof(interface_configuration, toolbar_show_finances), "toolbar_show_finances", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, toolbar_show_research), "toolbar_show_research", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, { offsetof(interface_configuration, toolbar_show_cheats), "toolbar_show_cheats", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, - { offsetof(interface_configuration, select_by_track_type), "select_by_track_type", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, + { offsetof(interface_configuration, toolbar_show_news), "toolbar_show_news", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, + { offsetof(interface_configuration, select_by_track_type), "select_by_track_type", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, console_small_font), "console_small_font", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, current_theme_preset), "current_theme", CONFIG_VALUE_TYPE_STRING, { .value_string = "*RCT2" }, NULL }, { offsetof(interface_configuration, current_title_sequence_preset), "current_title_sequence", CONFIG_VALUE_TYPE_STRING, { .value_string = "*OPENRCT2" },NULL }, diff --git a/src/config.h b/src/config.h index aa7fdfa6c3..6190edfa4c 100644 --- a/src/config.h +++ b/src/config.h @@ -163,6 +163,7 @@ typedef struct { uint8 toolbar_show_finances; uint8 toolbar_show_research; uint8 toolbar_show_cheats; + uint8 toolbar_show_news; uint8 select_by_track_type; uint8 console_small_font; utf8string current_theme_preset; diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 8f6afbe503..7bdd8aba14 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -1796,6 +1796,7 @@ enum { STR_CHEAT_STAFF_GROUP = 5466, STR_ALT_PLUS = 5467, + STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR = 5468, // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 diff --git a/src/sprites.h b/src/sprites.h index 337fef7c8e..f0935e0748 100644 --- a/src/sprites.h +++ b/src/sprites.h @@ -387,6 +387,8 @@ enum { SPR_G2_TITLE_SKIP = SPR_G2_BEGIN + 32, SPR_G2_SANDBOX = SPR_G2_BEGIN + 33, + + SPR_G2_TAB_NEWS = SPR_G2_BEGIN + 58, }; #endif diff --git a/src/windows/options.c b/src/windows/options.c index 3d0e982d70..eb7a968a48 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -117,6 +117,7 @@ enum WINDOW_OPTIONS_WIDGET_IDX { WIDX_TOOLBAR_SHOW_FINANCES, WIDX_TOOLBAR_SHOW_RESEARCH, WIDX_TOOLBAR_SHOW_CHEATS, + WIDX_TOOLBAR_SHOW_NEWS, // Misc WIDX_REAL_NAME_CHECKBOX = WIDX_PAGE_START, @@ -206,12 +207,13 @@ static rct_widget window_options_audio_widgets[] = { static rct_widget window_options_controls_widgets[] = { MAIN_OPTIONS_WIDGETS, - { WWT_CHECKBOX, 2, 10, 299, 54, 65, STR_SCREEN_EDGE_SCROLLING, STR_SCREEN_EDGE_SCROLLING_TIP }, - { WWT_CHECKBOX, 2, 10, 299, 69, 80, STR_INVERT_RIGHT_MOUSE_DRAG,STR_NONE }, - { WWT_DROPDOWN_BUTTON, 1, 26, 185, 84, 95, STR_HOTKEY, STR_HOTKEY_TIP }, - { WWT_CHECKBOX, 2, 10, 299, 99, 110, 5120, STR_NONE }, - { WWT_CHECKBOX, 2, 10, 299, 114, 125, 5121, STR_NONE }, - { WWT_CHECKBOX, 2, 10, 299, 129, 140, 5147, STR_NONE }, + { WWT_CHECKBOX, 2, 10, 299, 54, 65, STR_SCREEN_EDGE_SCROLLING, STR_SCREEN_EDGE_SCROLLING_TIP }, + { WWT_CHECKBOX, 2, 10, 299, 69, 80, STR_INVERT_RIGHT_MOUSE_DRAG, STR_NONE }, + { WWT_DROPDOWN_BUTTON, 1, 26, 185, 84, 95, STR_HOTKEY, STR_HOTKEY_TIP }, + { WWT_CHECKBOX, 2, 10, 299, 99, 110, 5120, STR_NONE }, + { WWT_CHECKBOX, 2, 10, 299, 114, 125, 5121, STR_NONE }, + { WWT_CHECKBOX, 2, 10, 299, 129, 140, 5147, STR_NONE }, + { WWT_CHECKBOX, 2, 10, 299, 144, 155, STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR, STR_NONE }, { WIDGETS_END }, }; @@ -363,7 +365,8 @@ static uint32 window_options_page_enabled_widgets[] = { (1 << WIDX_HOTKEY_DROPDOWN) | (1 << WIDX_TOOLBAR_SHOW_FINANCES) | (1 << WIDX_TOOLBAR_SHOW_RESEARCH) | - (1 << WIDX_TOOLBAR_SHOW_CHEATS), + (1 << WIDX_TOOLBAR_SHOW_CHEATS) | + (1 << WIDX_TOOLBAR_SHOW_NEWS), MAIN_OPTIONS_ENABLED_WIDGETS | (1 << WIDX_REAL_NAME_CHECKBOX) | @@ -526,6 +529,12 @@ static void window_options_mouseup(rct_window *w, int widgetIndex) window_invalidate(w); window_invalidate_by_class(WC_TOP_TOOLBAR); break; + case WIDX_TOOLBAR_SHOW_NEWS: + gConfigInterface.toolbar_show_news ^= 1; + config_save_default(); + window_invalidate(w); + window_invalidate_by_class(WC_TOP_TOOLBAR); + break; case WIDX_INVERT_DRAG: gConfigGeneral.invert_viewport_drag ^= 1; config_save_default(); @@ -1157,12 +1166,14 @@ static void window_options_invalidate(rct_window *w) widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_FINANCES, gConfigInterface.toolbar_show_finances); widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_RESEARCH, gConfigInterface.toolbar_show_research); widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_CHEATS, gConfigInterface.toolbar_show_cheats); + widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_NEWS, gConfigInterface.toolbar_show_news); window_options_controls_widgets[WIDX_SCREEN_EDGE_SCROLLING].type = WWT_CHECKBOX; window_options_controls_widgets[WIDX_HOTKEY_DROPDOWN].type = WWT_DROPDOWN_BUTTON; window_options_controls_widgets[WIDX_TOOLBAR_SHOW_FINANCES].type = WWT_CHECKBOX; window_options_controls_widgets[WIDX_TOOLBAR_SHOW_RESEARCH].type = WWT_CHECKBOX; window_options_controls_widgets[WIDX_TOOLBAR_SHOW_CHEATS].type = WWT_CHECKBOX; + window_options_controls_widgets[WIDX_TOOLBAR_SHOW_NEWS].type = WWT_CHECKBOX; break; case WINDOW_OPTIONS_PAGE_MISC: diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index 5694318419..d021941a90 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -64,6 +64,7 @@ enum { WIDX_DEBUG, WIDX_FINANCES, WIDX_RESEARCH, + WIDX_NEWS, WIDX_SEPARATOR, }; @@ -130,6 +131,7 @@ static const int left_aligned_widgets_order[] = { // from right to left static const int right_aligned_widgets_order[] = { + WIDX_NEWS, WIDX_GUESTS, WIDX_STAFF, WIDX_PARK, @@ -144,7 +146,7 @@ static const int right_aligned_widgets_order[] = { WIDX_SCENERY, WIDX_WATER, WIDX_LAND, - WIDX_CLEAR_SCENERY, + WIDX_CLEAR_SCENERY }; #pragma endregion @@ -174,6 +176,7 @@ static rct_widget window_top_toolbar_widgets[] = { { WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_DEBUG_TIP }, // Debug { WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 3235 }, // Finances { WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 2275 }, // Research + { WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 2522 }, // News { WWT_EMPTY, 0, 0, 10-1, 0, 0, 0xFFFFFFFF, STR_NONE }, // Artificial widget separator { WIDGETS_END }, @@ -319,6 +322,9 @@ static void window_top_toolbar_mouseup(rct_window *w, int widgetIndex) case WIDX_RESEARCH: window_research_open(); break; + case WIDX_NEWS: + window_news_open(); + break; } } @@ -589,6 +595,7 @@ static void window_top_toolbar_invalidate(rct_window *w) window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_TRNBTN; window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_TRNBTN; window_top_toolbar_widgets[WIDX_DEBUG].type = gConfigGeneral.debugging_tools ? WWT_TRNBTN : WWT_EMPTY; + window_top_toolbar_widgets[WIDX_NEWS].type = WWT_TRNBTN; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) { window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_EMPTY; @@ -599,6 +606,7 @@ static void window_top_toolbar_invalidate(rct_window *w) window_top_toolbar_widgets[WIDX_FINANCES].type = WWT_EMPTY; window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_EMPTY; window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY; + window_top_toolbar_widgets[WIDX_NEWS].type = WWT_EMPTY; if (g_editor_step != EDITOR_STEP_LANDSCAPE_EDITOR) { window_top_toolbar_widgets[WIDX_MAP].type = WWT_EMPTY; @@ -629,10 +637,13 @@ static void window_top_toolbar_invalidate(rct_window *w) if (!gConfigInterface.toolbar_show_cheats) window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY; + + if (!gConfigInterface.toolbar_show_news) + window_top_toolbar_widgets[WIDX_NEWS].type = WWT_EMPTY; } enabledWidgets = 0; - for (i = WIDX_PAUSE; i <= WIDX_RESEARCH; i++) + for (i = WIDX_PAUSE; i <= WIDX_NEWS; i++) if (window_top_toolbar_widgets[i].type != WWT_EMPTY) enabledWidgets |= (1 << i); w->enabled_widgets = enabledWidgets; @@ -785,6 +796,16 @@ static void window_top_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi) imgId = SPR_FINANCE; gfx_draw_sprite(dpi, imgId, x, y, 0); } + + // Draw news button + if (window_top_toolbar_widgets[WIDX_NEWS].type != WWT_EMPTY) { + x = w->x + window_top_toolbar_widgets[WIDX_NEWS].left + 3; + y = w->y + window_top_toolbar_widgets[WIDX_NEWS].top + 0; + if (widget_is_pressed(w, WIDX_NEWS)) + y++; + imgId = SPR_G2_TAB_NEWS; + gfx_draw_sprite(dpi, imgId, x, y, 0); + } } /* rct2: 0x006E3158 */