diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index fbb546f6f8..1bc4cb6c32 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4445,6 +4445,9 @@ STR_6133 :{SMALLFONT}{BLACK}Access rides and scenery that have not yet been i STR_6134 :Clear Scenery STR_6135 :Client sent invalid request STR_6136 :Server sent invalid request +STR_6137 :OpenRCT2, a free and open source clone of Roller Coaster Tycoon 2. +STR_6138 :OpenRCT2 is the work of many authors, a full list can be found in "Contributors". For more information, visit http://github.com/OpenRCT2/OpenRCT2 +STR_6139 :All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 0536cbee47..dd15e14505 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -38,6 +38,7 @@ - Improved: The land tool buttons can now be held down to increase/decrease size. - Improved: Dropdowns longer than 32 items overflow into columns. - Improved: Ride Type option in ride window is now a dropdown. +- Improved: "About OpenRCT2" window redesigned, now contains OpenRCT2 info and access to changelog 0.1.0 (2017-07-12) ------------------------------------------------------------------------ diff --git a/src/openrct2/drawing/drawing.h b/src/openrct2/drawing/drawing.h index 3e8629c516..6c5724526a 100644 --- a/src/openrct2/drawing/drawing.h +++ b/src/openrct2/drawing/drawing.h @@ -238,6 +238,12 @@ typedef struct rct_palette { rct_palette_entry entries[256]; } rct_palette; +typedef struct rct_size16 +{ + sint16 width; + sint16 height; +} rct_size16; + #define SPRITE_ID_PALETTE_COLOUR_1(colourId) (IMAGE_TYPE_REMAP | ((colourId) << 19)) #define SPRITE_ID_PALETTE_COLOUR_2(primaryId, secondaryId) (IMAGE_TYPE_REMAP_2_PLUS | IMAGE_TYPE_REMAP | ((primaryId << 19) | (secondaryId << 24))) #define SPRITE_ID_PALETTE_COLOUR_3(primaryId, secondaryId) (IMAGE_TYPE_REMAP_2_PLUS | ((primaryId << 19) | (secondaryId << 24))) @@ -363,6 +369,8 @@ void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, sint32 avai void scrolling_text_initialise_bitmaps(); sint32 scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrollingMode); +rct_size16 FASTCALL gfx_get_sprite_size(uint32 image_id); + #include "NewDrawing.h" #endif diff --git a/src/openrct2/drawing/sprite.cpp b/src/openrct2/drawing/sprite.cpp index fd2e44fedc..46ce0aacef 100644 --- a/src/openrct2/drawing/sprite.cpp +++ b/src/openrct2/drawing/sprite.cpp @@ -706,4 +706,13 @@ extern "C" { return _csgLoaded; } + + rct_size16 FASTCALL gfx_get_sprite_size(uint32 image_id) + { + rct_g1_element *g1_source = gfx_get_g1_element(image_id & 0X7FFFF); + rct_size16 size; + size.width = g1_source->width; + size.height = g1_source->height; + return size; + } } diff --git a/src/openrct2/localisation/string_ids.h b/src/openrct2/localisation/string_ids.h index 635e861802..cbf08f33da 100644 --- a/src/openrct2/localisation/string_ids.h +++ b/src/openrct2/localisation/string_ids.h @@ -3810,6 +3810,10 @@ enum { STR_MULTIPLAYER_CLIENT_INVALID_REQUEST = 6135, STR_MULTIPLAYER_SERVER_INVALID_REQUEST = 6136, + STR_ABOUT_OPENRCT2_DESCRIPTION = 6137, + STR_ABOUT_OPENRCT2_DESCRIPTION_2 = 6138, + STR_ABOUT_OPENRCT2_DESCRIPTION_3 = 6139, + // 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/openrct2/windows/about.c b/src/openrct2/windows/about.c index 6a2abb412b..61fbe77e58 100644 --- a/src/openrct2/windows/about.c +++ b/src/openrct2/windows/about.c @@ -18,30 +18,78 @@ #include "../sprites.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../OpenRCT2.h" + +#define WW 400 +#define WH 330 + +enum +{ + WINDOW_ABOUT_PAGE_OPENRCT2, + WINDOW_ABOUT_PAGE_RCT2, +}; enum WINDOW_ABOUT_WIDGET_IDX { WIDX_BACKGROUND, WIDX_TITLE, WIDX_CLOSE, - WIDX_MUSIC_CREDITS, + WIDX_ABOUT_OPENRCT2, + WIDX_ABOUT_RCT2, + WIDX_PAGE_BACKGROUND, + + WIDX_PAGE_START, + + // About OpenRCT2 + WIDX_CHANGELOG = WIDX_PAGE_START, + + // About RCT2 + WIDX_MUSIC_CREDITS = WIDX_PAGE_START, WIDX_PUBLISHER_CREDITS }; -rct_widget window_about_widgets[] = { - { WWT_FRAME, 0, 0, 399, 0, 329, 0xFFFFFFFF, STR_NONE }, // panel / background - { WWT_CAPTION, 0, 1, 398, 1, 14, STR_ROLLERCOASTER_TYCOON_2, STR_WINDOW_TITLE_TIP }, // title bar - { WWT_CLOSEBOX, 0, 387, 397, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button +#define WIDGETS_MAIN \ + WWT_FRAME, 0, 0, 399, 0, 329, 0xFFFFFFFF, STR_NONE }, /* panel / background */ \ + { WWT_CAPTION, 0, 1, 398, 1, 14, STR_ROLLERCOASTER_TYCOON_2, STR_WINDOW_TITLE_TIP }, /* title bar */ \ + { WWT_CLOSEBOX, 0, 387, 397, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, /* close x button */ \ + { WWT_DROPDOWN_BUTTON, 0, 10, 199, 15, 30, STR_TITLE_SEQUENCE_OPENRCT2, STR_NONE }, /* about OpenRCT2 button */ \ + { WWT_DROPDOWN_BUTTON, 0, 201, 390, 15, 30, STR_TITLE_SEQUENCE_RCT2, STR_NONE }, /* about RCT2 button */ \ + { WWT_IMGBTN, 1, 0, 399, 31, WH - 1, 0xFFFFFFFF, STR_NONE /* page background */ + +static rct_widget window_about_openrct2_widgets[] = { + { WIDGETS_MAIN }, + { WWT_DROPDOWN_BUTTON, 1, 125, 275, 300, 311, STR_CHANGELOG_TITLE, STR_NONE }, // changelog button + { WIDGETS_END } +}; + +static rct_widget window_about_rct2_widgets[] = { + { WIDGETS_MAIN }, { WWT_DROPDOWN_BUTTON, 1, 100, 299, 230, 241, STR_MUSIC_ACKNOWLEDGEMENTS_ELLIPSIS, STR_NONE }, // music credits button { WWT_DROPDOWN_BUTTON, 1, 157, 356, 307, 318, STR_INFOGRAMES_INTERACTIVE_CREDITS, STR_NONE }, // infogrames credits button { WIDGETS_END }, }; -static void window_about_mouseup(rct_window *w, rct_widgetindex widgetIndex); -static void window_about_paint(rct_window *w, rct_drawpixelinfo *dpi); +static rct_widget *window_about_page_widgets[] = { + window_about_openrct2_widgets, + window_about_rct2_widgets, +}; -static rct_window_event_list window_about_events = { +#define DEFAULT_ENABLED_WIDGETS \ + 1ULL << WIDX_CLOSE) | (1ULL << WIDX_ABOUT_OPENRCT2) | (1ULL << WIDX_ABOUT_RCT2 + +static uint64 window_about_page_enabled_widgets[] = { + (DEFAULT_ENABLED_WIDGETS) | (1ULL << WIDX_CHANGELOG), + (DEFAULT_ENABLED_WIDGETS) | (1ULL << WIDX_MUSIC_CREDITS) | (1ULL << WIDX_PUBLISHER_CREDITS), +}; + +static void window_about_openrct2_mouseup(rct_window *w, rct_widgetindex widgetIndex); +static void window_about_openrct2_paint(rct_window *w, rct_drawpixelinfo *dpi); + +static void window_about_rct2_mouseup(rct_window *w, rct_widgetindex widgetIndex); +static void window_about_rct2_paint(rct_window *w, rct_drawpixelinfo *dpi); + +static rct_window_event_list window_about_openrct2_events = { NULL, - window_about_mouseup, + window_about_openrct2_mouseup, NULL, NULL, NULL, @@ -66,10 +114,48 @@ static rct_window_event_list window_about_events = { NULL, NULL, NULL, - window_about_paint, + window_about_openrct2_paint, NULL }; +static rct_window_event_list window_about_rct2_events = { + NULL, + window_about_rct2_mouseup, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + window_about_rct2_paint, + NULL +}; + +static rct_window_event_list *window_about_page_events[] = { + &window_about_openrct2_events, + &window_about_rct2_events, +}; + +static void window_about_set_page(rct_window *w, sint32 page); + /** * * rct2: 0x0066D2AC @@ -84,14 +170,14 @@ void window_about_open() return; window = window_create_centred( - 400, - 330, - &window_about_events, + WW, + WH, + window_about_page_events[WINDOW_ABOUT_PAGE_OPENRCT2], WC_ABOUT, 0 ); - window->widgets = window_about_widgets; - window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_MUSIC_CREDITS) | (1 << WIDX_PUBLISHER_CREDITS); + window->widgets = window_about_page_widgets[WINDOW_ABOUT_PAGE_OPENRCT2]; + window->enabled_widgets = window_about_page_enabled_widgets[WINDOW_ABOUT_PAGE_OPENRCT2]; window_init_scroll_widgets(window); window->colours[0] = COLOUR_LIGHT_BLUE; @@ -99,16 +185,68 @@ void window_about_open() window->colours[2] = COLOUR_LIGHT_BLUE; } -/** - * - * rct2: 0x0066D4D5 - */ -static void window_about_mouseup(rct_window *w, rct_widgetindex widgetIndex) +#pragma region OpenRCT2 + +static void window_about_openrct2_mouseup(rct_window *w, rct_widgetindex widgetIndex) { switch (widgetIndex) { case WIDX_CLOSE: window_close(w); break; + case WIDX_ABOUT_OPENRCT2: + case WIDX_ABOUT_RCT2: + window_about_set_page(w, widgetIndex - WIDX_ABOUT_OPENRCT2); + break; + case WIDX_CHANGELOG: + window_changelog_open(); + break; + } +} + +static void window_about_openrct2_paint(rct_window *w, rct_drawpixelinfo *dpi) +{ + window_draw_widgets(w, dpi); + + sint32 x, y, width; + rct_size16 logoSize; + + x = w->x + (w->width / 2); + y = w->y + w->widgets[WIDX_PAGE_BACKGROUND].top + 5; + width = w->width - 20; + + utf8 buffer[256]; + utf8 *ch = buffer; + + openrct2_write_full_version_info(ch, sizeof(buffer) - (ch - buffer)); + y += gfx_draw_string_centred_wrapped(dpi, &ch, x, y, width, STR_STRING, w->colours[2]) + 11; + y += gfx_draw_string_centred_wrapped(dpi, NULL, x, y, width, STR_ABOUT_OPENRCT2_DESCRIPTION, w->colours[2]) + 2; + + logoSize = gfx_get_sprite_size(SPR_G2_LOGO); + gfx_draw_sprite(dpi, SPR_G2_LOGO, x - (logoSize.width / 2), y, 0); + y += logoSize.height + 20; + + y += gfx_draw_string_centred_wrapped(dpi, NULL, x, y, width, STR_ABOUT_OPENRCT2_DESCRIPTION_2, w->colours[2]) + 15; + gfx_draw_string_centred_wrapped(dpi, NULL, x, y, width, STR_ABOUT_OPENRCT2_DESCRIPTION_3, w->colours[2]); +} + +#pragma endregion OpenRCT2 + +#pragma region RCT2 + +/** + * + * rct2: 0x0066D4D5 + */ +static void window_about_rct2_mouseup(rct_window *w, rct_widgetindex widgetIndex) +{ + switch (widgetIndex) { + case WIDX_CLOSE: + window_close(w); + break; + case WIDX_ABOUT_OPENRCT2: + case WIDX_ABOUT_RCT2: + window_about_set_page(w, widgetIndex - WIDX_ABOUT_OPENRCT2); + break; case WIDX_MUSIC_CREDITS: window_music_credits_open(); break; @@ -122,14 +260,16 @@ static void window_about_mouseup(rct_window *w, rct_widgetindex widgetIndex) * * rct2: 0x0066D321 */ -static void window_about_paint(rct_window *w, rct_drawpixelinfo *dpi) +static void window_about_rct2_paint(rct_window *w, rct_drawpixelinfo *dpi) { - sint32 x, y; + sint32 x, y, yPage; window_draw_widgets(w, dpi); + yPage = w->y + w->widgets[WIDX_PAGE_BACKGROUND].top + 5; + x = w->x + 200; - y = w->y + 17; + y = yPage; // Version gfx_draw_string_centred(dpi, STR_VERSION_X, x, y, COLOUR_BLACK, NULL); @@ -151,25 +291,26 @@ static void window_about_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_centred(dpi, STR_THANKS_TO, x, y, COLOUR_BLACK, NULL); y += 10; gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, x, y, COLOUR_BLACK, NULL); - y += 10; - gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_1, x, y, COLOUR_BLACK, NULL); - y += 10; - gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_2, x, y, COLOUR_BLACK, NULL); - y += 10; - gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_3, x, y, COLOUR_BLACK, NULL); - y += 10; - gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_4, x, y, COLOUR_BLACK, NULL); - y += 10; - gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_5, x, y, COLOUR_BLACK, NULL); - y += 10; - gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_6, x, y, COLOUR_BLACK, NULL); - y += 10; - gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_7, x, y, COLOUR_BLACK, NULL); - + // Images - gfx_draw_sprite(dpi, SPR_CREDITS_CHRIS_SAWYER_SMALL, w->x + 92, w->y + 40, 0); - gfx_draw_sprite(dpi, SPR_CREDITS_INFOGRAMES, w->x + 50, w->y + 247, 0); + gfx_draw_sprite(dpi, SPR_CREDITS_CHRIS_SAWYER_SMALL, w->x + 92, yPage + 24, 0); + gfx_draw_sprite(dpi, SPR_CREDITS_INFOGRAMES, w->x + 50, yPage + 211, 0); // Licence - gfx_draw_string_left(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, NULL, COLOUR_BLACK, w->x + 157, w->y + 257); + gfx_draw_string_left(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, NULL, COLOUR_BLACK, w->x + 157, yPage + 221); +} + +#pragma endregion RCT2 + +static void window_about_set_page(rct_window *w, sint32 page) +{ + w->page = page; + w->frame_no = 0; + w->pressed_widgets = 0; + w->widgets = window_about_page_widgets[page]; + w->enabled_widgets = window_about_page_enabled_widgets[page]; + w->event_handlers = window_about_page_events[page]; + + window_init_scroll_widgets(w); + window_invalidate(w); }