diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 89e2f667f7..72276980e0 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3509,4 +3509,65 @@ STR_5172 :Will turn on tracking information for guests named after Twitch cha STR_5173 :Pull Twitch chat as news STR_5174 :Will use Twitch chat messages preceded by !news for in game notifications STR_5175 :Input the name of your Twitch channel -STR_5176 :Enable Twitch integration \ No newline at end of file +STR_5176 :Enable Twitch integration +STR_5177 :Colour schemes +STR_5178 :Top Toolbar +STR_5179 :Bottom Toolbar +STR_5180 :Track Editor Bottom Toolbar +STR_5181 :Scenario Editor Bottom Toolbar +STR_5182 :Title Menu Buttons +STR_5183 :Title Exit Button +STR_5184 :Title Options Button +STR_5185 :Title Scenario Selection +STR_5186 :Park Information +STR_5187 :Finances +STR_5188 :New Campaign +STR_5189 :Research +STR_5190 :Map +STR_5191 :Viewport +STR_5192 :Recent News +STR_5193 :Land +STR_5194 :Water +STR_5195 :Clear Scenery +STR_5196 :Land Rights +STR_5197 :Scenery +STR_5198 :Footpath +STR_5199 :Ride Construction +STR_5200 :Track Design Place +STR_5201 :New Ride +STR_5202 :Track Design Selection +STR_5203 :Ride +STR_5204 :Ride List +STR_5205 :Guest +STR_5206 :Guest List +STR_5207 :Staff +STR_5208 :Staff List +STR_5209 :Banner +STR_5210 :Object Selection +STR_5211 :Invention List +STR_5212 :Scenario Options +STR_5213 :Objective Options +STR_5214 :Map Generation +STR_5215 :Track Design Manager +STR_5216 :Track Design Manager List +STR_5217 :Cheats +STR_5218 :Colour Schemes +STR_5219 :Options +STR_5220 :Keyboard Shortcuts +STR_5221 :Change Keyboard Shortcut +STR_5222 :Load/Save +STR_5223 :Save Prompt +STR_5224 :Demolish Ride Prompt +STR_5225 :Fire Staff Prompt +STR_5226 :Track Delete Prompt +STR_5227 :Save Overwrite Prompt +STR_5228 :{SMALLFONT}{BLACK}Main UI +STR_5229 :{SMALLFONT}{BLACK}Park +STR_5230 :{SMALLFONT}{BLACK}Tools +STR_5231 :{SMALLFONT}{BLACK}Rides and Peeps +STR_5232 :{SMALLFONT}{BLACK}Editors +STR_5233 :{SMALLFONT}{BLACK}Miscellaneous +STR_5234 :{SMALLFONT}{BLACK}Prompts +STR_5235 :{SMALLFONT}{BLACK}Settings +STR_5236 :Window: +STR_5237 :Palette: diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 0156e72513..80ede23ea6 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -37,7 +37,10 @@ - + + + + @@ -172,7 +175,10 @@ - + + + + diff --git a/resources/g2/6.png b/resources/g2/6.png new file mode 100644 index 0000000000..a441a6c73d Binary files /dev/null and b/resources/g2/6.png differ diff --git a/src/config.c b/src/config.c index d111a03ecf..da24545f56 100644 --- a/src/config.c +++ b/src/config.c @@ -221,6 +221,7 @@ interface_configuration gConfigInterface; sound_configuration gConfigSound; cheat_configuration gConfigCheat; twitch_configuration gConfigTwitch; +colour_schemes_configuration gConfigColourSchemes; bool config_open(const utf8string path); bool config_save(const utf8string path); @@ -379,6 +380,23 @@ bool config_save(const utf8string path) fputc('\n', file); } + fputc('[', file); + fwrite("colour_schemes", "colour_schemes", 1, file); + fputc(']', file); + fputc('\n', file); + for (i = 0; i < gNumColourSchemeWindows; i++) { + window_colour_scheme colour_scheme = gColourSchemes[i]; + for (j = 0; j < colour_scheme.num_colours; j++) { + + fwrite(colour_scheme.ini_name, strlen(colour_scheme.ini_name), 1, file); + fprintf(file, "_%d", j); + fwrite(" = ", 3, 1, file); + fprintf(file, "%u", colour_scheme.colours[j]); + fputc('\n', file); + } + fputc('\n', file); + } + fclose(file); return true; } @@ -993,3 +1011,36 @@ bool config_shortcut_keys_save() } #pragma endregion + + +#pragma region Colour Schemes + + +void colour_schemes_set_default() +{ + gConfigColourSchemes.num_presets = 2; + + gConfigColourSchemes.presets = malloc(sizeof(colour_schemes_setting*) * gConfigColourSchemes.num_presets); + + gConfigColourSchemes.presets[0].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows); + + for (int j = 0; j < gNumColourSchemeWindows; j++) { + for (int k = 0; k < 6; k++) + gConfigColourSchemes.presets[0].colour_schemes[j].colours[k] = gColourSchemes[j].colours[k]; + } + +} + +bool colour_schemes_open_default() +{ + + +} + +bool colour_schemes_save_default() +{ + + +} + +#pragma endregion \ No newline at end of file diff --git a/src/config.h b/src/config.h index 9d17b59eec..8f0a8db0cc 100644 --- a/src/config.h +++ b/src/config.h @@ -24,6 +24,7 @@ #include "common.h" #include "localisation/currency.h" #include "platform/platform.h" +#include "interface/colour_schemes.h" enum { CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES = (1 << 0), @@ -175,7 +176,13 @@ typedef struct { } twitch_configuration; typedef struct { - uint8 window_palettes[][6]; + window_colours *colour_schemes; + char *name; +} colour_schemes_setting; + +typedef struct { + colour_schemes_setting *presets; + uint16 num_presets; } colour_schemes_configuration; typedef struct { @@ -204,4 +211,8 @@ bool config_shortcut_keys_save(); bool config_find_or_browse_install_directory(); +void colour_schemes_set_default(); +bool colour_schemes_open_default(); +bool colour_schemes_save_default(); + #endif diff --git a/src/interface/colour_schemes.c b/src/interface/colour_schemes.c index d0b25da6fd..af3dc2c077 100644 --- a/src/interface/colour_schemes.c +++ b/src/interface/colour_schemes.c @@ -19,13 +19,160 @@ *****************************************************************************/ #include "../config.h" +#include "../localisation/string_ids.h" #include "window.h" #include "colour_schemes.h" - -window_colour_scheme gColorSchemes[] = { - { WC_TOP_TOOLBAR, { 7, 12, 24, 1, 0, 0 }, 4 }, - { WC_BOTTOM_TOOLBAR, { 140, 140, 0, 0, 0, 0 }, 3 }, - - +window_colour_scheme gColourSchemes[] = { + { WC_TOP_TOOLBAR, { 7, 12, 24, 1, 0, 0 }, 4, 5178, "top_toolbar" }, + { WC_BOTTOM_TOOLBAR, { 140, 140, 0, 14, 0, 0 }, 4, 5179, "bottom_toolbar" }, + { WC_RIDE, { 1, 26, 11, 0, 0, 0 }, 3, 5203, "ride" }, + { WC_RIDE_CONSTRUCTION, { 24, 24, 24, 0, 0, 0 }, 3, 5199, "ride_construction" }, + { WC_RIDE_LIST, { 1, 26, 26, 0, 0, 0 }, 3, 5204, "ride_list" }, + { WC_SAVE_PROMPT, { 154, 0, 0, 0, 0, 0 }, 1, 5223, "save_prompt" }, + { WC_CONSTRUCT_RIDE, { 24, 26, 26, 0, 0, 0 }, 3, 5201, "new_ride" }, + { WC_DEMOLISH_RIDE_PROMPT, { 154, 0, 0, 0, 0, 0 }, 1, 5224, "demolish_ride_prompt" }, + { WC_SCENERY, { 24, 12, 12, 0, 0, 0 }, 3, 5197, "scenery" }, + { WC_OPTIONS, { 7, 7, 7, 0, 0, 0 }, 3, 5219, "options" }, + { WC_FOOTPATH, { 24, 24, 24, 0, 0, 0 }, 3, 5198, "footpath" }, + { WC_LAND, { 24, 24, 24, 0, 0, 0 }, 3, 5193, "land" }, + { WC_WATER, { 24, 24, 24, 0, 0, 0 }, 3, 5194, "water" }, + { WC_PEEP, { 1, 15, 15, 0, 0, 0 }, 3, 5205, "guest" }, + { WC_GUEST_LIST, { 1, 15, 15, 0, 0, 0 }, 3, 5206, "guest_list" }, + { WC_STAFF_LIST, { 1, 4, 4, 0, 0, 0 }, 3, 5208, "staff_list" }, + { WC_FIRE_PROMPT, { 154, 0, 0, 0, 0, 0 }, 1, 5225, "staff_fire_prompt" }, + { WC_PARK_INFORMATION, { 1, 19, 19, 0, 0, 0 }, 3, 5186, "park_information" }, + { WC_FINANCES, { 1, 19, 19, 0, 0, 0 }, 3, 5187, "finances" }, + { WC_TITLE_MENU, { 140, 140, 140, 0, 0, 0 }, 3, 5182, "title_menu" }, + { WC_TITLE_EXIT, { 140, 140, 140, 0, 0, 0 }, 3, 5183, "title_exit" }, + { WC_RECENT_NEWS, { 1, 1, 0, 0, 0, 0 }, 3, 5192, "recent_news" }, + { WC_SCENARIO_SELECT, { 1, 26, 26, 0, 0, 0 }, 3, 5185, "scenario_select" }, + { WC_TRACK_DESIGN_LIST, { 26, 26, 26, 0, 0, 0 }, 3, 5202, "track_design_list" }, + { WC_TRACK_DESIGN_PLACE, { 24, 24, 24, 0, 0, 0 }, 3, 5200, "track_design_place" }, + { WC_NEW_CAMPAIGN, { 19, 19, 19, 0, 0, 0 }, 3, 5188, "new_campaign" }, + { WC_KEYBOARD_SHORTCUT_LIST, { 7, 7, 7, 0, 0, 0 }, 3, 5220, "keyboard_shortcuts" }, + { WC_CHANGE_KEYBOARD_SHORTCUT, { 7, 7, 7, 0, 0, 0 }, 3, 5221, "change_keyboard_shortcut" }, + { WC_MAP, { 12, 24, 0, 0, 0, 0 }, 2, 5190, "map" }, + { WC_BANNER, { 24, 24, 24, 0, 0, 0 }, 3, 5209, "banner" }, + { WC_EDITOR_OBJECT_SELECTION, { 4, 1, 1, 0, 0, 0 }, 3, 5210, "editor_object_selection" }, + { WC_EDITOR_INVENTION_LIST, { 4, 1, 1, 0, 0, 0 }, 3, 5211, "editor_invention_list" }, + { WC_EDITOR_SCENARIO_OPTIONS, { 4, 1, 1, 0, 0, 0 }, 3, 5212, "editor_scenario_options" }, + { WC_EDTIOR_OBJECTIVE_OPTIONS, { 4, 1, 1, 0, 0, 0 }, 3, 5213, "editor_objection_options" }, + { WC_MANAGE_TRACK_DESIGN, { 1, 1, 1, 0, 0, 0 }, 3, 5215, "manage_track_design" }, + { WC_TRACK_DELETE_PROMPT, { 26, 26, 26, 0, 0, 0 }, 3, 5226, "track_delete_prompt" }, + { WC_INSTALL_TRACK, { 26, 26, 26, 0, 0, 0 }, 3, 5216, "install_track" }, + { WC_CLEAR_SCENERY, { 24, 24, 24, 0, 0, 0 }, 3, 5195, "clear_scenery" }, + { WC_CHEATS, { 1, 19, 19, 0, 0, 0 }, 3, 5217, "cheats" }, + { WC_RESEARCH, { 1, 19, 19, 0, 0, 0 }, 3, 5189, "research" }, + { WC_VIEWPORT, { 24, 24, 24, 0, 0, 0 }, 3, 5191, "viewport" }, + { WC_MAPGEN, { 12, 24, 24, 0, 0, 0 }, 3, 5214, "map_generation" }, + { WC_LOADSAVE, { 7, 7, 7, 0, 0, 0 }, 3, 5222, "loadsave" }, + { WC_LOADSAVE_OVERWRITE_PROMPT, { 154, 0, 0, 0, 0, 0 }, 1, 5227, "loadsave_overwrite_prompt" }, + { WC_TITLE_OPTIONS, { 140, 140, 140, 0, 0, 0 }, 3, 5184, "title_options" }, + { WC_LAND_RIGHTS, { 19, 19, 19, 0, 0, 0 }, 3, 5196, "land_rights" }, + { WC_COLOUR_SCHEMES, { 1, 12, 12, 0, 0, 0 }, 3, 5218, "colour_schemes" }, + { WC_STAFF, { 1, 4, 4, 0, 0, 0 }, 3, 5207, "staff" }, + { WC_EDITOR_TRACK_BOTTOM_TOOLBAR, { 135, 135, 135, 0, 0, 0 }, 3, 5180, "editor_track_bottom_toolbar" }, + { WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR, { 150, 150, 141, 0, 0, 0 }, 3, 5181, "editor_scenario_bottom_toolbar" }, }; + +marked_window_colours gColourSchemesRCT1[sizeof(gColourSchemes)] = { + { WC_TOP_TOOLBAR, { 1, 1, 1, 1, 0, 0 } }, // WC_TOP_TOOLBAR + { WC_BOTTOM_TOOLBAR, { 129, 129, 0, 18, 0, 0 } }, // WC_BOTTOM_TOOLBAR + { WC_RIDE, { 26, 1, 11, 0, 0, 0 } }, // WC_RIDE + { 0, 0, 0, 0, 0, 0 }, // WC_RIDE_CONSTRUCTION + { WC_RIDE_LIST, { 0, 0, 0, 0, 0, 0 } }, // WC_RIDE_LIST + { 0, 0, 0, 0, 0, 0 }, // WC_SAVE_PROMPT + { 0, 0, 0, 0, 0, 0 }, // WC_CONSTRUCT_RIDE + { 0, 0, 0, 0, 0, 0 }, // WC_DEMOLISH_RIDE_PROMPT + { 0, 0, 0, 0, 0, 0 }, // WC_SCENERY + { 0, 0, 0, 0, 0, 0 }, // WC_OPTIONS + { 0, 0, 0, 0, 0, 0 }, // WC_FOOTPATH + { 0, 0, 0, 0, 0, 0 }, // WC_LAND + { 0, 0, 0, 0, 0, 0 }, // WC_WATER + { 0, 0, 0, 0, 0, 0 }, // WC_PEEP + { 0, 0, 0, 0, 0, 0 }, // WC_GUEST_LIST + { 0, 0, 0, 0, 0, 0 }, // WC_STAFF_LIST + { 0, 0, 0, 0, 0, 0 }, // WC_FIRE_PROMPT + { 0, 0, 0, 0, 0, 0 }, // WC_PARK_INFORMATION + { 0, 0, 0, 0, 0, 0 }, // WC_FINANCES + { 0, 0, 0, 0, 0, 0 }, // WC_TITLE_MENU + { 0, 0, 0, 0, 0, 0 }, // WC_TITLE_EXIT + { 0, 0, 0, 0, 0, 0 }, // WC_RECENT_NEWS + { 0, 0, 0, 0, 0, 0 }, // WC_SCENARIO_SELECT + { 0, 0, 0, 0, 0, 0 }, // WC_TRACK_DESIGN_LIST + { 0, 0, 0, 0, 0, 0 }, // WC_TRACK_DESIGN_PLACE + { 0, 0, 0, 0, 0, 0 }, // WC_NEW_CAMPAIGN + { 0, 0, 0, 0, 0, 0 }, // WC_KEYBOARD_SHORTCUT_LIST + { 0, 0, 0, 0, 0, 0 }, // WC_CHANGE_KEYBOARD_SHORTCUT + { 0, 0, 0, 0, 0, 0 }, // WC_MAP + { 0, 0, 0, 0, 0, 0 }, // WC_BANNER + { 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_OBJECT_SELECTION + { 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_INVENTION_LIST + { 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_SCENARIO_OPTIONS + { 0, 0, 0, 0, 0, 0 }, // WC_EDTIOR_OBJECTIVE_OPTIONS + { 0, 0, 0, 0, 0, 0 }, // WC_MANAGE_TRACK_DESIGN + { 0, 0, 0, 0, 0, 0 }, // WC_TRACK_DELETE_PROMPT + { 0, 0, 0, 0, 0, 0 }, // WC_INSTALL_TRACK + { 0, 0, 0, 0, 0, 0 }, // WC_CLEAR_SCENERY + { 0, 0, 0, 0, 0, 0 }, // WC_CHEATS + { 0, 0, 0, 0, 0, 0 }, // WC_RESEARCH + { 0, 0, 0, 0, 0, 0 }, // WC_VIEWPORT + { 0, 0, 0, 0, 0, 0 }, // WC_MAPGEN + { 0, 0, 0, 0, 0, 0 }, // WC_LOADSAVE + { 0, 0, 0, 0, 0, 0 }, // WC_LOADSAVE_OVERWRITE_PROMPT + { 0, 0, 0, 0, 0, 0 }, // WC_TITLE_OPTIONS + { 0, 0, 0, 0, 0, 0 }, // WC_LAND_RIGHTS + { 0, 0, 0, 0, 0, 0 }, // WC_COLOUR_SCHEMES + { 0, 0, 0, 0, 0, 0 }, // WC_STAFF + { 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_TRACK_BOTTOM_TOOLBAR + { 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR +}; + + +uint32 gNumColourSchemeWindows = sizeof(gColourSchemes) / sizeof(window_colour_scheme); + +window_colour_scheme* colour_scheme_get_by_class(rct_windowclass classification) +{ + for (int i = 0; i < sizeof(gColourSchemes); i++) { + if (gColourSchemes[i].classification == classification) { + return &(gColourSchemes[i]); + } + } + return NULL; +} + + +void colour_scheme_update(rct_window *window) +{ + window_colour_scheme* colour_scheme = colour_scheme_get_by_class(window->classification); + + bool transparent = false; + for (int i = 0; i < colour_scheme->num_colours; i++) { + window->colours[i] = colour_scheme->colours[i]; + if (colour_scheme->colours[i] & 0x80) { + transparent = true; + } + } + //if (transparent) + window->flags |= WF_TRANSPARENT; + //else + // window->flags &= ~WF_TRANSPARENT; +} + +void colour_scheme_update_by_class(rct_window *window, rct_windowclass classification) +{ + window_colour_scheme* colour_scheme = colour_scheme_get_by_class(classification); + + bool transparent = false; + for (int i = 0; i < colour_scheme->num_colours; i++) { + window->colours[i] = colour_scheme->colours[i]; + if (colour_scheme->colours[i] & 0x80) { + transparent = true; + } + } + //if (transparent) + window->flags |= WF_TRANSPARENT; + //else + // window->flags &= ~WF_TRANSPARENT; +} diff --git a/src/interface/colour_schemes.h b/src/interface/colour_schemes.h index d29a6f101d..0630d08642 100644 --- a/src/interface/colour_schemes.h +++ b/src/interface/colour_schemes.h @@ -28,11 +28,28 @@ typedef struct { rct_windowclass classification; uint8 colours[6]; uint8 num_colours; + rct_string_id name; + char *ini_name; } window_colour_scheme; -extern window_colour_scheme gColorSchemes[] = { - {WC_} -} +typedef struct { + uint8 colours[6]; +} window_colours; +typedef struct { + rct_windowclass classification; + uint8 colours[6]; +} marked_window_colours; + +extern window_colour_scheme gColourSchemes[]; + +extern window_colours gColourSchemesRCT1[]; + +extern uint32 gNumColourSchemeWindows; + +window_colour_scheme* colour_scheme_get_by_class(rct_windowclass classification); + +void colour_scheme_update(rct_window *window); +void colour_scheme_update_by_class(rct_window *window, rct_windowclass classification); #endif \ No newline at end of file diff --git a/src/interface/console.c b/src/interface/console.c index 3cf75636bb..2ae81a966a 100644 --- a/src/interface/console.c +++ b/src/interface/console.c @@ -780,8 +780,8 @@ static int cc_open(const char **argv, int argc) { window_editor_inventions_list_open(); } else if (strcmp(argv[0], "options") == 0) { window_options_open(); - } else if (strcmp(argv[0], "window_palettes") == 0) { - window_window_palettes_open(); + } else if (strcmp(argv[0], "colour_schemes") == 0) { + window_colour_schemes_open(); } else { console_writeline_error("Invalid window."); @@ -831,7 +831,7 @@ char* console_window_table[] = { "object_selection", "inventions_list", "options", - "window_palettes" + "colour_schemes" }; console_command console_command_table[] = { diff --git a/src/interface/widget.c b/src/interface/widget.c index a85df3d4d1..d25187eb58 100644 --- a/src/interface/widget.c +++ b/src/interface/widget.c @@ -200,7 +200,7 @@ static void widget_frame_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetI // Draw the resize sprite at the bottom right corner l = w->x + widget->right - 18; t = w->y + widget->bottom - 18; - gfx_draw_sprite(dpi, SPR_RESIZE | 0x20000000 | (colour << 19), l, t, 0); + gfx_draw_sprite(dpi, SPR_RESIZE | 0x20000000 | ((colour & 0x7F) << 19), l, t, 0); } /** @@ -237,7 +237,7 @@ static void widget_resize_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget // Draw the resize sprite at the bottom right corner l = w->x + widget->right - 18; t = w->y + widget->bottom - 18; - gfx_draw_sprite(dpi, SPR_RESIZE | 0x20000000 | (colour << 19), l, t, 0); + gfx_draw_sprite(dpi, SPR_RESIZE | 0x20000000 | ((colour & 0x7F) << 19), l, t, 0); } /** @@ -316,7 +316,7 @@ static void widget_tab_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetInd b = w->y + widget->bottom; // Get the colour and image - colour = w->colours[widget->colour]; + colour = w->colours[widget->colour] & 0x7F; image = widget->image + 2; // Draw coloured image @@ -835,6 +835,7 @@ static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour) { + colour &= 0x7F; // Trough gfx_fill_rect(dpi, l + 10, t, r - 10, b, *((char*)(0x0141FC4B + (colour * 8)))); gfx_fill_rect(dpi, l + 10, t, r - 10, b, 0x1000000 | *((char*)(0x0141FC47 + (colour * 8)))); @@ -860,6 +861,7 @@ static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, i static void widget_vscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour) { + colour &= 0x7F; // Trough gfx_fill_rect(dpi, l, t + 10, r, b - 10, *((char*)(0x0141FC4B + (colour * 8)))); gfx_fill_rect(dpi, l, t + 10, r, b - 10, 0x1000000 | *((char*)(0x0141FC47 + (colour * 8)))); @@ -907,7 +909,7 @@ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetI b = w->y + widget->bottom; // Get the colour - colour = w->colours[widget->colour]; + colour = w->colours[widget->colour] & 0x7F; if (widget->type == WWT_4 || widget->type == WWT_COLORBTN || widget->type == WWT_TRNBTN || widget->type == WWT_TAB) if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) diff --git a/src/interface/window.h b/src/interface/window.h index bf9007b382..93bbfce7d4 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -406,6 +406,11 @@ enum { WC_TITLE_OPTIONS = 117, WC_LAND_RIGHTS = 118, WC_COLOUR_SCHEMES = 119, + + // Only used for colour schemes + WC_STAFF = 1020, + WC_EDITOR_TRACK_BOTTOM_TOOLBAR = 1021, + WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR = 1022, } WINDOW_CLASS; enum PROMPT_MODE { @@ -561,7 +566,7 @@ void window_music_credits_open(); void window_publisher_credits_open(); void window_track_manage_open(); void window_viewport_open(); -void window_window_palettes_open(); +void window_colour_schemes_open(); void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, rct_string_id existing_text, uint32 existing_args, int maxLength); 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); rct_window *window_mapgen_open(); diff --git a/src/sprites.h b/src/sprites.h index 562ce8b901..263b4a7964 100644 --- a/src/sprites.h +++ b/src/sprites.h @@ -352,7 +352,8 @@ SPR_G2_TITLE = SPR_G2_BEGIN + 1, SPR_G2_FASTFORWARD = SPR_G2_BEGIN + 2, SPR_G2_SPEED_ARROW = SPR_G2_BEGIN + 3, SPR_G2_HYPER_ARROW = SPR_G2_BEGIN + 4, -SPR_G2_TAB_TWITCH = SPR_G2_BEGIN + 5 +SPR_G2_TAB_TWITCH = SPR_G2_BEGIN + 5, +SPR_G2_TAB_LAND = SPR_G2_BEGIN + 6 }; #endif diff --git a/src/windows/about.c b/src/windows/about.c index f6c82139d0..b56d26188e 100644 --- a/src/windows/about.c +++ b/src/windows/about.c @@ -23,6 +23,7 @@ #include "../sprites.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../interface/colour_schemes.h" enum WINDOW_ABOUT_WIDGET_IDX { WIDX_BACKGROUND, diff --git a/src/windows/banner.c b/src/windows/banner.c index 76626d71cf..7739b1dec5 100644 --- a/src/windows/banner.c +++ b/src/windows/banner.c @@ -31,6 +31,7 @@ #include "error.h" #include "dropdown.h" #include "../drawing/drawing.h" +#include "../interface/colour_schemes.h" #define WW 113 #define WH 96 @@ -130,9 +131,6 @@ void window_banner_open(rct_windownumber number) w->number = number; window_init_scroll_widgets(w); - w->colours[0] = 24; - w->colours[1] = 24; - w->colours[2] = 24; int view_x = gBanners[w->number].x << 5; int view_y = gBanners[w->number].y << 5; @@ -338,6 +336,7 @@ static void window_banner_invalidate() rct_window* w; window_get_register(w); + colour_scheme_update(w); rct_banner* banner = &gBanners[w->number]; rct_widget* colour_btn = &window_banner_widgets[WIDX_MAIN_COLOR]; diff --git a/src/windows/cheats.c b/src/windows/cheats.c index decf02ebbc..f12e7eea0e 100644 --- a/src/windows/cheats.c +++ b/src/windows/cheats.c @@ -33,6 +33,7 @@ #include "../world/footpath.h" #include "../world/park.h" #include "../world/sprite.h" +#include "../interface/colour_schemes.h" //#define WW 200 //#define WH 128 @@ -521,9 +522,6 @@ void window_cheats_open() window->enabled_widgets = window_cheats_page_enabled_widgets[0]; window_init_scroll_widgets(window); window->page = WINDOW_CHEATS_PAGE_MONEY; - window->colours[0] = 1; - window->colours[1] = 19; - window->colours[2] = 19; } static void window_cheats_money_mouseup() @@ -702,6 +700,7 @@ static void window_cheats_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); strcpy((char*)0x009BC677, "Cheats"); diff --git a/src/windows/clear_scenery.c b/src/windows/clear_scenery.c index 549ef3b6b7..4aee7d9012 100644 --- a/src/windows/clear_scenery.c +++ b/src/windows/clear_scenery.c @@ -25,6 +25,7 @@ #include "../sprites.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../interface/colour_schemes.h" enum WINDOW_CLEAR_SCENERY_WIDGET_IDX { WIDX_BACKGROUND, @@ -106,9 +107,6 @@ void window_clear_scenery_open() window_push_others_below(window); RCT2_GLOBAL(0x00F1AD62, uint32) = MONEY32_UNDEFINED; - window->colours[0] = 24; - window->colours[1] = 24; - window->colours[2] = 24; } /** @@ -219,6 +217,7 @@ static void window_clear_scenery_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); // Set the preview image button to be pressed down w->pressed_widgets |= (1 << WIDX_PREVIEW); diff --git a/src/windows/colour_schemes.c b/src/windows/colour_schemes.c index b8ee454ec5..442388fd7b 100644 --- a/src/windows/colour_schemes.c +++ b/src/windows/colour_schemes.c @@ -30,11 +30,19 @@ #include "../peep/peep.h" #include "../peep/staff.h" #include "../world/sprite.h" +#include "../sprites.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { - WINDOW_COLOUR_SCHEMES_TAB_WINDOWS, - WINDOW_COLOUR_SCHEMES_TAB_PRESETS, + WINDOW_COLOUR_SCHEMES_TAB_MAIN_UI, + WINDOW_COLOUR_SCHEMES_TAB_PARK, + WINDOW_COLOUR_SCHEMES_TAB_TOOLS, + WINDOW_COLOUR_SCHEMES_TAB_RIDES_PEEPS, + WINDOW_COLOUR_SCHEMES_TAB_EDITORS, + WINDOW_COLOUR_SCHEMES_TAB_MISC, + WINDOW_COLOUR_SCHEMES_TAB_PROMPTS, + WINDOW_COLOUR_SCHEMES_TAB_SETTINGS } WINDOW_COLOUR_SCHEMES_TAB; static void window_colour_schemes_emptysub() { } @@ -51,6 +59,7 @@ static void window_colour_schemes_tooltip(); static void window_colour_schemes_invalidate(); static void window_colour_schemes_paint(); static void window_colour_schemes_scrollpaint(); +static void window_colour_schemes_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w); static void* window_colour_schemes_events[] = { window_colour_schemes_close, @@ -88,41 +97,211 @@ enum WINDOW_STAFF_LIST_WIDGET_IDX { WIDX_COLOUR_SCHEMES_TITLE, WIDX_COLOUR_SCHEMES_CLOSE, WIDX_COLOUR_SCHEMES_TAB_CONTENT_PANEL, - WIDX_COLOUR_SCHEMES_WINDOWS_TAB, - WIDX_COLOUR_SCHEMES_PRESETS_TAB, + WIDX_COLOUR_SCHEMES_MAIN_UI_TAB, + WIDX_COLOUR_SCHEMES_PARK_TAB, + WIDX_COLOUR_SCHEMES_TOOLS_TAB, + WIDX_COLOUR_SCHEMES_RIDE_PEEPS_TAB, + WIDX_COLOUR_SCHEMES_EDITORS_TAB, + WIDX_COLOUR_SCHEMES_MISC_TAB, + WIDX_COLOUR_SCHEMES_PROMPTS_TAB, + WIDX_COLOUR_SCHEMES_SETTINGS_TAB, + WIDX_COLOUR_SCHEMES_PRESETS, + WIDX_COLOUR_SCHEMES_PRESETS_DROPDOWN, + WIDX_COLOUR_SCHEMES_RCT1_STYLES_CHECKBOX, WIDX_COLOUR_SCHEMES_COLORBTN_MASK, WIDX_COLOUR_SCHEMES_LIST, }; static rct_widget window_colour_schemes_widgets[] = { - { WWT_FRAME, 0, 0, 319, 0, 269, 0x0FFFFFFFF, STR_NONE }, // panel / background - { WWT_CAPTION, 0, 1, 318, 1, 14, STR_STAFF, STR_WINDOW_TITLE_TIP }, // title bar - { WWT_CLOSEBOX, 0, 307, 317, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close button - { WWT_RESIZE, 1, 0, 319, 43, 269, 0x0FFFFFFFF, STR_NONE }, // tab content panel - { WWT_TAB, 1, 3, 33, 17, 43, 0x02000144E, STR_NONE }, // windows tab - { WWT_TAB, 1, 34, 64, 17, 43, 0x02000144E, STR_NONE }, // presets tab - { WWT_COLORBTN, 1, 0, 0, 0, 0, STR_NONE, STR_NONE }, // color button mask - { WWT_SCROLL, 1, 3, 316, 72, 266, 3, STR_NONE }, // staff list + { WWT_FRAME, 0, 0, 319, 0, 269, 0x0FFFFFFFF, STR_NONE }, // panel / background + { WWT_CAPTION, 0, 1, 318, 1, 14, 5177, STR_WINDOW_TITLE_TIP }, // title bar + { WWT_CLOSEBOX, 0, 307, 317, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close button + { WWT_RESIZE, 1, 0, 319, 43, 269, 0x0FFFFFFFF, STR_NONE }, // tab content panel + { WWT_TAB, 1, 3, 33, 17, 43, 0x02000144E, 5228 }, // main ui tab + { WWT_TAB, 1, 34, 64, 17, 43, 0x02000144E, 5229 }, // park tab + { WWT_TAB, 1, 65, 95, 17, 43, 0x02000144E, 5230 }, // tools tab + { WWT_TAB, 1, 96, 126, 17, 43, 0x02000144E, 5231 }, // rides and peeps tab + { WWT_TAB, 1, 127, 157, 17, 43, 0x02000144E, 5232 }, // editors tab + { WWT_TAB, 1, 158, 188, 17, 43, 0x02000144E, 5233 }, // misc tab + { WWT_TAB, 1, 189, 219, 17, 43, 0x02000144E, 5234 }, // prompts tab + { WWT_TAB, 1, 220, 250, 17, 43, 0x02000144E, 5235 }, // settings tab + { WWT_COLORBTN, 1, 0, 0, 0, 0, STR_NONE, STR_NONE }, // color button mask + { WWT_DROPDOWN, 1, 155, 299, 60, 71, STR_NONE, STR_NONE }, // Preset colour schemes + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 61, 70, 876, STR_NONE }, + { WWT_CHECKBOX, 1, 10, 229, 68, 79, STR_SOUND, STR_NONE }, // RCT1 menu styles + { WWT_SCROLL, 1, 3, 316, 60, 266, 2, STR_NONE }, // staff list { WIDGETS_END }, }; +static int window_colour_schemes_tab_animation_loops[] = { + 32, + 1, + 1, + 64, + 32, + 8, + 14, + 28 +}; +static int window_colour_schemes_tab_animation_divisor[] = { + 4, + 1, + 1, + 4, + 2, + 2, + 2, + 4 +}; +static int window_colour_schemes_tab_sprites[] = { + SPR_TAB_KIOSKS_AND_FACILITIES_0, + 5200, + SPR_G2_TAB_LAND, + SPR_TAB_RIDE_0, + 5205, + 5201, + SPR_TAB_STAFF_OPTIONS_0, + SPR_TAB_STATS_0 +}; -static uint8 _window_colors[16][6]; +static rct_windowclass window_colour_schemes_tab_1_classes[] = { + WC_TOP_TOOLBAR, + WC_BOTTOM_TOOLBAR, + WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR, + WC_EDITOR_TRACK_BOTTOM_TOOLBAR, + WC_TITLE_MENU, + WC_TITLE_EXIT, + WC_TITLE_OPTIONS, + WC_SCENARIO_SELECT +}; + +static rct_windowclass window_colour_schemes_tab_2_classes[] = { + WC_PARK_INFORMATION, + WC_FINANCES, + WC_NEW_CAMPAIGN, + WC_RESEARCH, + WC_MAP, + WC_VIEWPORT, + WC_RECENT_NEWS +}; + +static rct_windowclass window_colour_schemes_tab_3_classes[] = { + WC_LAND, + WC_WATER, + WC_CLEAR_SCENERY, + WC_LAND_RIGHTS, + WC_SCENERY, + WC_FOOTPATH, + WC_RIDE_CONSTRUCTION, + WC_TRACK_DESIGN_PLACE, + WC_CONSTRUCT_RIDE, + WC_TRACK_DESIGN_LIST +}; + +static rct_windowclass window_colour_schemes_tab_4_classes[] = { + WC_RIDE, + WC_RIDE_LIST, + WC_PEEP, + WC_GUEST_LIST, + WC_STAFF, + WC_STAFF_LIST, + WC_BANNER +}; + +static rct_windowclass window_colour_schemes_tab_5_classes[] = { + WC_EDITOR_OBJECT_SELECTION, + WC_EDITOR_INVENTION_LIST, + WC_EDITOR_SCENARIO_OPTIONS, + WC_EDTIOR_OBJECTIVE_OPTIONS, + WC_MAPGEN, + WC_MANAGE_TRACK_DESIGN, + WC_INSTALL_TRACK +}; + +static rct_windowclass window_colour_schemes_tab_6_classes[] = { + WC_CHEATS, + WC_COLOUR_SCHEMES, + WC_OPTIONS, + WC_KEYBOARD_SHORTCUT_LIST, + WC_CHANGE_KEYBOARD_SHORTCUT, + WC_LOADSAVE +}; + +static rct_windowclass window_colour_schemes_tab_7_classes[] = { + WC_SAVE_PROMPT, + WC_DEMOLISH_RIDE_PROMPT, + WC_FIRE_PROMPT, + WC_TRACK_DELETE_PROMPT, + WC_LOADSAVE_OVERWRITE_PROMPT +}; + +// Info, Research, Wrench, Entrance, Slide, Gears, Point Finger +// Info, Entrance, Construction, Slide, Wrench, Gear, Todo +static uint8 _selected_tab = 0; static sint16 _color_index_1 = -1; static sint8 _color_index_2 = -1; -static uint8 _selected_tab = 0; -static const uint8 _row_height = 16; -static const uint8 _button_offset_x = 110; -static const uint8 _button_offset_y = 2; +static const uint8 _row_height = 32; +static const uint8 _button_offset_x = 220; +static const uint8 _button_offset_y = 3; +static const uint8 _check_offset_y = 3 + 12 + 2; -static uint16 _window_staff_list_selected_type_count = 0; -// TODO: These are still referenced in non-decompiled code -//static int _window_staff_list_highlighted_index; -//static int _window_staff_list_selected_tab; void window_colour_schemes_init_vars() { - _selected_tab = WINDOW_COLOUR_SCHEMES_TAB_WINDOWS; + _selected_tab = WINDOW_COLOUR_SCHEMES_TAB_MAIN_UI; +} + +static window_colour_scheme* get_colour_scheme_tab() +{ + switch (_selected_tab) { + case 0: return colour_scheme_get_by_class(window_colour_schemes_tab_1_classes[_color_index_1]); + case 1: return colour_scheme_get_by_class(window_colour_schemes_tab_2_classes[_color_index_1]); + case 2: return colour_scheme_get_by_class(window_colour_schemes_tab_3_classes[_color_index_1]); + case 3: return colour_scheme_get_by_class(window_colour_schemes_tab_4_classes[_color_index_1]); + case 4: return colour_scheme_get_by_class(window_colour_schemes_tab_5_classes[_color_index_1]); + case 5: return colour_scheme_get_by_class(window_colour_schemes_tab_6_classes[_color_index_1]); + case 6: return colour_scheme_get_by_class(window_colour_schemes_tab_7_classes[_color_index_1]); + } + return NULL; +} +static window_colour_scheme* get_colour_scheme_tab_by_index(int index) +{ + switch (_selected_tab) { + case 0: return colour_scheme_get_by_class(window_colour_schemes_tab_1_classes[index]); + case 1: return colour_scheme_get_by_class(window_colour_schemes_tab_2_classes[index]); + case 2: return colour_scheme_get_by_class(window_colour_schemes_tab_3_classes[index]); + case 3: return colour_scheme_get_by_class(window_colour_schemes_tab_4_classes[index]); + case 4: return colour_scheme_get_by_class(window_colour_schemes_tab_5_classes[index]); + case 5: return colour_scheme_get_by_class(window_colour_schemes_tab_6_classes[index]); + case 6: return colour_scheme_get_by_class(window_colour_schemes_tab_7_classes[index]); + } + return NULL; +} + +static int get_colour_scheme_tab_count() +{ + switch (_selected_tab) { + case 0: return sizeof(window_colour_schemes_tab_1_classes); + case 1: return sizeof(window_colour_schemes_tab_2_classes); + case 2: return sizeof(window_colour_schemes_tab_3_classes); + case 3: return sizeof(window_colour_schemes_tab_4_classes); + case 4: return sizeof(window_colour_schemes_tab_5_classes); + case 5: return sizeof(window_colour_schemes_tab_6_classes); + case 6: return sizeof(window_colour_schemes_tab_7_classes); + } + return 0; +} + +static void window_colour_schemes_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w) +{ + int sprite_idx; + + for (int i = 0; i < 8; i++) { + sprite_idx = window_colour_schemes_tab_sprites[i]; + if (_selected_tab == i) + sprite_idx += w->frame_no / window_colour_schemes_tab_animation_divisor[_selected_tab]; + gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_COLOUR_SCHEMES_MAIN_UI_TAB + i].left, w->y + w->widgets[WIDX_COLOUR_SCHEMES_MAIN_UI_TAB + i].top, 0); + } } void window_colour_schemes_open() @@ -138,17 +317,27 @@ void window_colour_schemes_open() window->widgets = window_colour_schemes_widgets; window->enabled_widgets = (1 << WIDX_COLOUR_SCHEMES_CLOSE) | - (1 << WIDX_COLOUR_SCHEMES_WINDOWS_TAB) | - (1 << WIDX_COLOUR_SCHEMES_PRESETS_TAB) | + (1 << WIDX_COLOUR_SCHEMES_MAIN_UI_TAB) | + (1 << WIDX_COLOUR_SCHEMES_PARK_TAB) | + (1 << WIDX_COLOUR_SCHEMES_TOOLS_TAB) | + (1 << WIDX_COLOUR_SCHEMES_RIDE_PEEPS_TAB) | + (1 << WIDX_COLOUR_SCHEMES_EDITORS_TAB) | + (1 << WIDX_COLOUR_SCHEMES_MISC_TAB) | + (1 << WIDX_COLOUR_SCHEMES_PROMPTS_TAB) | + (1 << WIDX_COLOUR_SCHEMES_SETTINGS_TAB) | (1 << WIDX_COLOUR_SCHEMES_COLORBTN_MASK); + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].type = WWT_SCROLL; + + window_colour_schemes_init_vars(); + window_init_scroll_widgets(window); window->list_information_type = 0; _color_index_1 = -1; _color_index_2 = -1; window->min_width = 320; window->min_height = 270; - window->max_width = 500; + window->max_width = 320; window->max_height = 450; window->flags |= WF_RESIZABLE; } @@ -196,18 +385,23 @@ static void window_colour_schemes_mousedown(int widgetIndex, rct_window* w, rct_ short newSelectedTab; switch (widgetIndex) { - case WIDX_COLOUR_SCHEMES_WINDOWS_TAB: - case WIDX_COLOUR_SCHEMES_PRESETS_TAB: - newSelectedTab = widgetIndex - WIDX_COLOUR_SCHEMES_WINDOWS_TAB; + case WIDX_COLOUR_SCHEMES_MAIN_UI_TAB: + case WIDX_COLOUR_SCHEMES_PARK_TAB: + case WIDX_COLOUR_SCHEMES_TOOLS_TAB: + case WIDX_COLOUR_SCHEMES_RIDE_PEEPS_TAB: + case WIDX_COLOUR_SCHEMES_EDITORS_TAB: + case WIDX_COLOUR_SCHEMES_MISC_TAB: + case WIDX_COLOUR_SCHEMES_PROMPTS_TAB: + case WIDX_COLOUR_SCHEMES_SETTINGS_TAB: + newSelectedTab = widgetIndex - WIDX_COLOUR_SCHEMES_MAIN_UI_TAB; if (_selected_tab == newSelectedTab) break; _selected_tab = (uint8)newSelectedTab; - window_invalidate(w); w->scrolls[0].v_top = 0; + w->frame_no = 0; + window_invalidate(w); break; } - - } static void window_colour_schemes_dropdown() @@ -217,7 +411,7 @@ static void window_colour_schemes_dropdown() window_dropdown_get_registers(w, widgetIndex, dropdownIndex); if (widgetIndex == WIDX_COLOUR_SCHEMES_LIST && dropdownIndex != -1) { - _window_colors[_color_index_1][_color_index_2] = dropdownIndex; + get_colour_scheme_tab()->colours[_color_index_2] = dropdownIndex | get_colour_scheme_tab()->colours[_color_index_2] & 0x80; window_invalidate_all(); } _color_index_1 = -1; @@ -226,16 +420,12 @@ static void window_colour_schemes_dropdown() void window_colour_schemes_update(rct_window *w) { - /*int spriteIndex; - rct_peep *peep; + w->frame_no++; + if (w->frame_no >= window_colour_schemes_tab_animation_loops[_selected_tab]) + w->frame_no = 0; + + widget_invalidate(w, WIDX_COLOUR_SCHEMES_MAIN_UI_TAB + _selected_tab); - w->list_information_type++; - if (w->list_information_type >= 24) { - w->list_information_type = 0; - } - else { - widget_invalidate(w, WIDX_COLOUR_SCHEMES_WINDOWS_TAB + _selected_tab); - }*/ } void window_colour_schemes_scrollgetsize() { @@ -245,18 +435,7 @@ void window_colour_schemes_scrollgetsize() { window_get_register(w); - uint16 staffCount = 15; - - _window_staff_list_selected_type_count = staffCount; - - if (RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short) != -1) { - RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short) = -1; - window_invalidate(w); - } - - int rowHeight = 15; - - int scrollHeight = staffCount * rowHeight; + int scrollHeight = get_colour_scheme_tab_count() * _row_height; int i = scrollHeight - window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].bottom + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].top + 21; if (i < 0) i = 0; @@ -286,33 +465,32 @@ void window_colour_schemes_scrollmousedown() { rct_drawpixelinfo *dpi; window_scrollmouse_get_registers(w, scrollIndex, x, y); - - int rowHeight = 15; + + if (_selected_tab == 7) + return; + selectedTab = _selected_tab; - if (y / rowHeight < 15) { - if (x >= 110 && x < 110 + 12 * 6) { - _color_index_1 = y / rowHeight; - _color_index_2 = ((x - 110) / 12); - window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].left = 110 + _color_index_2 * 12 + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].left; - window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].top = _color_index_1 * rowHeight - scrollIndex + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].top; - window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].right = window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].left + 11; - window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].bottom = window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].top + 11; - window_dropdown_show_colour(w, &(window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK]), w->colours[1], _window_colors[_color_index_1][_color_index_2]); + if (y / _row_height < get_colour_scheme_tab_count()) { + int y2 = y % _row_height; + _color_index_1 = y / _row_height; + _color_index_2 = ((x - _button_offset_x) / 12); + if (_color_index_2 < get_colour_scheme_tab()->num_colours) { + if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 && y2 >= _button_offset_y && y2 < _button_offset_y + 11) { + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].left = _button_offset_x + _color_index_2 * 12 + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].left; + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].top = _color_index_1 * _row_height + _button_offset_y - w->scrolls[0].v_top + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].top; + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].right = window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].left + 11; + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].bottom = window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK].top + 11; + window_dropdown_show_colour(w, &(window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_COLORBTN_MASK]), w->colours[1], get_colour_scheme_tab()->colours[_color_index_2]); + } + else if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 - 1 && y2 >= _check_offset_y && y2 < _check_offset_y + 11) { + if (get_colour_scheme_tab()->colours[_color_index_2] & 0x80) + get_colour_scheme_tab()->colours[_color_index_2] &= 0x7F; + else + get_colour_scheme_tab()->colours[_color_index_2] |= 0x80; + window_invalidate_all(); + } } } - - /*for (int i = y / rowHeight; i >= 0; i--) { - if (i == 0) { - if (x >= 110 && x < 110 + 12 * 6) { - _color_index_1 = i; - _color_index_2 = ((x - 110) / 12); - window_dropdown_show_colour(w, &(w->widgets[WIDX_COLOUR_SCHEMES_LIST]), w->colours[1], _window_colors[_color_index_1][_color_index_2]); - } - break; - } - - i--; - }*/ } void window_colour_schemes_scrollmouseover() { @@ -322,11 +500,8 @@ void window_colour_schemes_scrollmouseover() { window_scrollmouse_get_registers(w, scrollIndex, x, y); - /*i = y / 10; - if (i != RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short)) { - RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short) = i; - window_invalidate(w); - }*/ + //if (_selected_tab == 7) + // return; } void window_colour_schemes_tooltip() @@ -339,21 +514,9 @@ void window_colour_schemes_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); - if (!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 1; - w->colours[1] = 4; - w->colours[2] = 4; - } - else - { - w->colours[0] = 12; - w->colours[1] = 4; - w->colours[2] = 4; - } - - int pressed_widgets = w->pressed_widgets & 0xFFFFFFCF; + int pressed_widgets = w->pressed_widgets & 0xFFFFF00F; uint8 tabIndex = _selected_tab; uint8 widgetIndex = tabIndex + 4; @@ -374,6 +537,13 @@ void window_colour_schemes_invalidate() window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_CLOSE].right = w->width - 2 - 0x0B + 0x0A; window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].right = w->width - 4; window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].bottom = w->height - 0x0F; + + if (_selected_tab == 7) { + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].type = WWT_EMPTY; + } + else { + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].type = WWT_SCROLL; + } } void window_colour_schemes_paint() { @@ -386,21 +556,13 @@ void window_colour_schemes_paint() { // Widgets window_draw_widgets(w, dpi); + window_colour_schemes_draw_tab_images(dpi, w); - selectedTab = RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8); - - // Handymen tab image - /*i = (selectedTab == 0 ? w->list_information_type & 0x0FFFFFFFC : 0); - i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982710, int), int)[0] + 1; - i |= 0x20000000; - i |= RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) << 19; - gfx_draw_sprite( - dpi, - i, - (window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_WINDOWS_TAB].left + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_WINDOWS_TAB].right) / 2 + w->x, - window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_WINDOWS_TAB].bottom - 6 + w->y, 0 - );*/ + if (_selected_tab < 7) { + gfx_draw_string_left(dpi, 5236, w, w->colours[1], w->x + 6, 58 - 12 + w->y + 1); + gfx_draw_string_left(dpi, 5237, w, w->colours[1], w->x + 220, 58 - 12 + w->y + 1); + } } /** @@ -416,24 +578,56 @@ void window_colour_schemes_scrollpaint() window_paint_get_registers(w, dpi); - gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ((char*)0x0141FC48)[w->colours[1] * 8]); - int rowHeight = 15; + if (_selected_tab == 7) + return; + + if ((w->colours[1] & 0x80) == 0) + //gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ((char*)0x0141FC48)[w->colours[1] * 8]); + gfx_clear(dpi, ((char*)0x0141FC48)[w->colours[1] * 8] * 0x1010101); y = 0; selectedTab = _selected_tab; - for (int i = 0; i < 15; i++) { + for (int i = 0; i < get_colour_scheme_tab_count(); i++) { if (y > dpi->y + dpi->height) { break; } - if (y + rowHeight >= dpi->y) { - for (int j = 0; j < 6; j++) { - uint32 image = (_window_colors[i][j] << 19) + 0x600013C3; - if (i == _color_index_1 && j == _color_index_2) { - image = (_window_colors[i][j] << 19) + 0x600013C4; + if (y + _row_height >= dpi->y) { + if (i + 1 < get_colour_scheme_tab_count()) { + int colour = w->colours[1]; + if (colour & 0x80) { + colour = RCT2_ADDRESS(0x009DEDF4, uint8)[colour]; + + colour = colour | 0x2000000; + gfx_fill_rect(dpi, 0, y + _row_height - 2, window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].right, y + _row_height - 2, colour + 1); + gfx_fill_rect(dpi, 0, y + _row_height - 1, window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].right, y + _row_height - 1, colour + 2); } - gfx_draw_sprite(dpi, image, 110 + 12 * j, y - 1, 0); + else { + colour = RCT2_ADDRESS(0x0141FC47, uint8)[w->colours[1] * 8]; + gfx_fill_rect(dpi, 0, y + _row_height - 2, window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].right, y + _row_height - 2, colour); + colour = RCT2_ADDRESS(0x0141FC4B, uint8)[w->colours[1] * 8]; + gfx_fill_rect(dpi, 0, y + _row_height - 1, window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].right, y + _row_height - 1, colour); + } + } + //gfx_fill_rect_inset(dpi, 0, y + _row_height - 2, window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].right + 1, y + _row_height - 1, w->colours[1], 0x20); + + for (int j = 0; j < get_colour_scheme_tab_by_index(i)->num_colours; j++) { + + gfx_draw_string_left(dpi, get_colour_scheme_tab_by_index(i)->name, NULL, w->colours[1], 2, y + 4); + + uint32 image = ((get_colour_scheme_tab_by_index(i)->colours[j] & 0x7F) << 19) + 0x600013C3; + if (i == _color_index_1 && j == _color_index_2) { + image = ((get_colour_scheme_tab_by_index(i)->colours[j] & 0x7F) << 19) + 0x600013C4; + } + gfx_draw_sprite(dpi, image, _button_offset_x + 12 * j, y + _button_offset_y, 0); + + gfx_fill_rect_inset(dpi, _button_offset_x + 12 * j, y + _check_offset_y, _button_offset_x + 12 * j + 9, y + _check_offset_y + 10, w->colours[1], 0xE0); + if (get_colour_scheme_tab_by_index(i)->colours[j] & 0x80) { + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = -1; + gfx_draw_string(dpi, (char*)0x009DED72, w->colours[1] & 0x7F, _button_offset_x + 12 * j, y + _check_offset_y); + } + } } - y += rowHeight; + y += _row_height; } } diff --git a/src/windows/demolish_ride_prompt.c b/src/windows/demolish_ride_prompt.c index dca45ce62f..2f7350b9d2 100644 --- a/src/windows/demolish_ride_prompt.c +++ b/src/windows/demolish_ride_prompt.c @@ -27,6 +27,7 @@ #include "../peep/staff.h" #include "../sprites.h" #include "../world/sprite.h" +#include "../interface/colour_schemes.h" #define WW 200 #define WH 100 @@ -51,6 +52,7 @@ static rct_widget window_ride_demolish_widgets[] = { static void window_ride_demolish_emptysub(){} static void window_ride_demolish_mouseup(); +static void window_ride_demolish_invalidate(); static void window_ride_demolish_paint(); //0x0098E2E4 @@ -80,7 +82,7 @@ static void* window_ride_demolish_events[] = { window_ride_demolish_emptysub, window_ride_demolish_emptysub, window_ride_demolish_emptysub, - window_ride_demolish_emptysub, + window_ride_demolish_invalidate, window_ride_demolish_paint, window_ride_demolish_emptysub }; @@ -99,7 +101,6 @@ void window_ride_demolish_prompt_open(int rideIndex){ window_init_scroll_widgets(w); w->flags |= WF_TRANSPARENT; w->number = rideIndex; - w->colours[0] = 154; } @@ -124,6 +125,14 @@ static void window_ride_demolish_mouseup(){ } } +static void window_ride_demolish_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + /** * * rct2: 0x006B48E5 diff --git a/src/windows/editor_bottom_toolbar.c b/src/windows/editor_bottom_toolbar.c index 2c2f41d2f1..316a5c18c8 100644 --- a/src/windows/editor_bottom_toolbar.c +++ b/src/windows/editor_bottom_toolbar.c @@ -33,6 +33,7 @@ #include "../util/util.h" #include "../world/scenery.h" #include "error.h" +#include "../interface/colour_schemes.h" enum { WIDX_PREVIOUS_IMAGE, // 1 @@ -140,15 +141,6 @@ void window_editor_bottom_toolbar_open() (1 << WIDX_NEXT_IMAGE); window_init_scroll_widgets(window); - window->colours[0] = 150; - window->colours[1] = 150; - window->colours[2] = 141; - - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) { - window->colours[0] = 135; - window->colours[1] = 135; - window->colours[2] = 135; - } } /** @@ -391,6 +383,8 @@ void window_editor_bottom_toolbar_invalidate() { window_get_register(w); + colour_scheme_update_by_class(w, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) ? WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR : WC_EDITOR_TRACK_BOTTOM_TOOLBAR); + sint16 screenWidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left = screenWidth - 200; window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right = screenWidth - 1; diff --git a/src/windows/editor_inventions_list.c b/src/windows/editor_inventions_list.c index 560bf27fe7..1cca4c85a3 100644 --- a/src/windows/editor_inventions_list.c +++ b/src/windows/editor_inventions_list.c @@ -27,6 +27,7 @@ #include "../management/research.h" #include "../object.h" #include "../world/scenery.h" +#include "../interface/colour_schemes.h" #pragma region Widgets @@ -434,9 +435,6 @@ void window_editor_inventions_list_open() w->selected_tab = 0; WindowHighlightedItem(w) = NULL; _editorInventionsListDraggedItem = NULL; - w->colours[0] = 4; - w->colours[1] = 1; - w->colours[2] = 1; } /** @@ -627,6 +625,7 @@ static void window_editor_inventions_list_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); w->pressed_widgets |= 1 << WIDX_PREVIEW; w->pressed_widgets |= 1 << WIDX_TAB_1; diff --git a/src/windows/editor_object_selection.c b/src/windows/editor_object_selection.c index 6ab2fadda4..3b1996f295 100644 --- a/src/windows/editor_object_selection.c +++ b/src/windows/editor_object_selection.c @@ -29,6 +29,7 @@ #include "../ride/track.h" #include "../scenario.h" #include "error.h" +#include "../interface/colour_schemes.h" enum { WINDOW_OBJECT_SELECTION_PAGE_RIDE_VEHICLES_ATTRACTIONS, @@ -231,9 +232,6 @@ void window_editor_object_selection_open() window->selected_tab = 0; window->selected_list_item = -1; window->var_494 = 0xFFFFFFFF; - window->colours[0] = 4; - window->colours[1] = 1; - window->colours[2] = 1; } /** @@ -372,7 +370,9 @@ static void window_editor_object_selection_scroll_mousedown() if (!window_editor_object_selection_select_object(1, installed_entry)) return; - window_close(w); + // 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(); @@ -475,6 +475,7 @@ static void window_editor_object_selection_invalidate() rct_widget *widget; window_get_register(w); + colour_scheme_update(w); // Set pressed widgets w->pressed_widgets |= 1 << WIDX_PREVIEW; diff --git a/src/windows/editor_objective_options.c b/src/windows/editor_objective_options.c index fac111c1ae..db1f406cf1 100644 --- a/src/windows/editor_objective_options.c +++ b/src/windows/editor_objective_options.c @@ -28,6 +28,7 @@ #include "../world/park.h" #include "dropdown.h" #include "error.h" +#include "../interface/colour_schemes.h" #define DISABLE_SIX_FLAGS_CHECKBOX @@ -271,9 +272,6 @@ void window_editor_objective_options_open() w->no_list_items = 0; w->selected_list_item = -1; RCT2_CALLPROC_X(0x00672609, 0, 0, 0, 0, (int)w, 0, 0); - w->colours[0] = 4; - w->colours[1] = 1; - w->colours[2] = 1; } static void window_editor_objective_options_set_pressed_tab(rct_window *w) @@ -834,6 +832,7 @@ static void window_editor_objective_options_main_invalidate() rct_stex_entry *stex; window_get_register(w); + colour_scheme_update(w); stex = g_stexEntries[0]; if (stex == (rct_stex_entry*)0xFFFFFFFF) @@ -1208,6 +1207,7 @@ static void window_editor_objective_options_rides_invalidate() rct_widget *widgets; window_get_register(w); + colour_scheme_update(w); widgets = window_editor_objective_options_widgets[w->page]; if (w->widgets != widgets) { diff --git a/src/windows/editor_scenario_options.c b/src/windows/editor_scenario_options.c index 9dbb05174f..87c239a200 100644 --- a/src/windows/editor_scenario_options.c +++ b/src/windows/editor_scenario_options.c @@ -26,6 +26,7 @@ #include "../sprites.h" #include "error.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" #pragma region Widgets @@ -352,9 +353,6 @@ void window_editor_scenario_options_open() window_init_scroll_widgets(w); w->var_4AE = 0; w->page = 0; - w->colours[0] = 4; - w->colours[1] = 1; - w->colours[2] = 1; } static void window_editor_scenario_options_set_pressed_tab(rct_window *w) @@ -580,6 +578,7 @@ static void window_editor_scenario_options_financial_invalidate() int i; window_get_register(w); + colour_scheme_update(w); widgets = window_editor_scenario_options_widgets[w->page]; if (w->widgets != widgets) { @@ -820,6 +819,7 @@ static void window_editor_scenario_options_guests_invalidate() rct_widget *widgets; window_get_register(w); + colour_scheme_update(w); widgets = window_editor_scenario_options_widgets[w->page]; if (w->widgets != widgets) { @@ -1110,6 +1110,7 @@ static void window_editor_scenario_options_park_invalidate() uint64 pressedWidgets; window_get_register(w); + colour_scheme_update(w); widgets = window_editor_scenario_options_widgets[w->page]; if (w->widgets != widgets) { diff --git a/src/windows/finances.c b/src/windows/finances.c index f4c2d25b25..f16db8ee67 100644 --- a/src/windows/finances.c +++ b/src/windows/finances.c @@ -33,6 +33,7 @@ #include "../scenario.h" #include "../sprites.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { WINDOW_FINANCES_PAGE_SUMMARY, @@ -640,7 +641,7 @@ static void window_finances_summary_invalidate() rct_window *w; window_get_register(w); - window_finances_set_colours(); + colour_scheme_update(w); if (w->widgets != window_finances_page_widgets[WINDOW_FINANCES_PAGE_SUMMARY]) { w->widgets = window_finances_page_widgets[WINDOW_FINANCES_PAGE_SUMMARY]; @@ -814,7 +815,7 @@ static void window_finances_financial_graph_invalidate() rct_window *w; window_get_register(w); - window_finances_set_colours(); + colour_scheme_update(w); if (w->widgets != window_finances_page_widgets[WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH]) { w->widgets = window_finances_page_widgets[WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH]; @@ -937,7 +938,7 @@ static void window_finances_park_value_graph_invalidate() rct_window *w; window_get_register(w); - window_finances_set_colours(); + colour_scheme_update(w); if (w->widgets != window_finances_page_widgets[WINDOW_FINANCES_PAGE_VALUE_GRAPH]) { w->widgets = window_finances_page_widgets[WINDOW_FINANCES_PAGE_VALUE_GRAPH]; @@ -1056,7 +1057,7 @@ static void window_finances_profit_graph_invalidate() rct_window *w; window_get_register(w); - window_finances_set_colours(); + colour_scheme_update(w); if (w->widgets != window_finances_page_widgets[WINDOW_FINANCES_PAGE_PROFIT_GRAPH]) { w->widgets = window_finances_page_widgets[WINDOW_FINANCES_PAGE_PROFIT_GRAPH]; @@ -1179,7 +1180,7 @@ static void window_finances_marketing_invalidate() int i; window_get_register(w); - window_finances_set_colours(); + colour_scheme_update(w); if (w->widgets != window_finances_page_widgets[WINDOW_FINANCES_PAGE_MARKETING]) { w->widgets = window_finances_page_widgets[WINDOW_FINANCES_PAGE_MARKETING]; @@ -1429,7 +1430,7 @@ static void window_finances_research_invalidate() rct_window *w; window_get_register(w); - window_finances_set_colours(); + colour_scheme_update(w); if (w->widgets != window_finances_page_widgets[WINDOW_FINANCES_PAGE_RESEARCH]) { w->widgets = window_finances_page_widgets[WINDOW_FINANCES_PAGE_RESEARCH]; @@ -1561,23 +1562,4 @@ static void window_finances_draw_tab_images(rct_drawpixelinfo *dpi, rct_window * window_finances_draw_tab_image(dpi, w, WINDOW_FINANCES_PAGE_RESEARCH, SPR_TAB_FINANCES_RESEARCH_0); } -static void window_finances_set_colours() -{ - rct_window *w; - window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 1; - w->colours[1] = 19; - w->colours[2] = 19; - } - else - { - w->colours[0] = 4; - w->colours[1] = 1; - w->colours[2] = 1; - } -} - #pragma endregion diff --git a/src/windows/footpath.c b/src/windows/footpath.c index 64e9e9fa3a..e4d719283b 100644 --- a/src/windows/footpath.c +++ b/src/windows/footpath.c @@ -30,6 +30,7 @@ #include "../world/footpath.h" #include "../world/map.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { PATH_CONSTRUCTION_MODE_LAND, @@ -202,9 +203,6 @@ void window_footpath_open() window_init_scroll_widgets(window); window_push_others_right(window); show_gridlines(); - window->colours[0] = 24; - window->colours[1] = 24; - window->colours[2] = 24; tool_cancel(); RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_LAND; @@ -520,6 +518,7 @@ static void window_footpath_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); // Press / unpress footpath and queue type buttons w->pressed_widgets &= ~(1 << WIDX_FOOTPATH_TYPE); diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c index c4f781b8fb..869871f3bf 100644 --- a/src/windows/game_bottom_toolbar.c +++ b/src/windows/game_bottom_toolbar.c @@ -31,6 +31,7 @@ #include "../world/climate.h" #include "../world/park.h" #include "../world/sprite.h" +#include "../interface/colour_schemes.h" enum WINDOW_GAME_BOTTOM_TOOLBAR_WIDGET_IDX { WIDX_LEFT_OUTSET, @@ -268,19 +269,7 @@ static void window_game_bottom_toolbar_invalidate() rct_news_item *newsItem; window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 140; - w->colours[1] = 140; - w->colours[2] = 0; - } - else - { - w->colours[0] = 129; - w->colours[1] = 129; - w->colours[2] = 0; - } + colour_scheme_update(w); // Anchor the middle and right panel to the right x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); @@ -444,12 +433,10 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r ); // Draw park rating - int park_rating_bar_colour=!gConfigInterface.rct1_colour_scheme ? 14 : 18; - window_game_bottom_toolbar_draw_park_rating( dpi, w, - park_rating_bar_colour, + w->colours[3], w->x + window_game_bottom_toolbar_widgets[WIDX_PARK_RATING].left + 11, w->y + window_game_bottom_toolbar_widgets[WIDX_PARK_RATING].top, max(10, ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16) / 4) * 263) / 256) diff --git a/src/windows/guest.c b/src/windows/guest.c index e7f32b44ab..58f840a96a 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -37,6 +37,7 @@ #include "../input.h" #include "dropdown.h" #include "error.h" +#include "../interface/colour_schemes.h" enum WINDOW_GUEST_PAGE { WINDOW_GUEST_OVERVIEW, @@ -1028,7 +1029,7 @@ void window_guest_overview_paint(){ void window_guest_overview_invalidate(){ rct_window* w; window_get_register(w); - window_guest_set_colours(); + colour_scheme_update(w); if (window_guest_page_widgets[w->page] != w->widgets){ w->widgets = window_guest_page_widgets[w->page]; @@ -1333,7 +1334,7 @@ void window_guest_stats_update(){ void window_guest_stats_invalidate(){ rct_window* w; window_get_register(w); - window_guest_set_colours(); + colour_scheme_update(w); if (w->widgets != window_guest_page_widgets[w->page]) { w->widgets = window_guest_page_widgets[w->page]; @@ -1665,7 +1666,7 @@ void window_guest_rides_scroll_mouse_over(){ void window_guest_rides_invalidate(){ rct_window* w; window_get_register(w); - window_guest_set_colours(); + colour_scheme_update(w); if (window_guest_page_widgets[w->page] != w->widgets){ w->widgets = window_guest_page_widgets[w->page]; @@ -1789,7 +1790,7 @@ void window_guest_finance_update(){ void window_guest_finance_invalidate(){ rct_window* w; window_get_register(w); - window_guest_set_colours(); + colour_scheme_update(w); if (window_guest_page_widgets[w->page] != w->widgets){ w->widgets = window_guest_page_widgets[w->page]; @@ -1929,7 +1930,7 @@ void window_guest_thoughts_update(){ void window_guest_thoughts_invalidate(){ rct_window* w; window_get_register(w); - window_guest_set_colours(); + colour_scheme_update(w); if (window_guest_page_widgets[w->page] != w->widgets){ w->widgets = window_guest_page_widgets[w->page]; @@ -2032,7 +2033,7 @@ void window_guest_inventory_update(){ void window_guest_inventory_invalidate(){ rct_window* w; window_get_register(w); - window_guest_set_colours(); + colour_scheme_update(w); if (window_guest_page_widgets[w->page] != w->widgets){ w->widgets = window_guest_page_widgets[w->page]; @@ -2192,22 +2193,3 @@ void window_guest_inventory_paint(){ gfx_draw_string_left(dpi, 2293, (void*)0, 0, x, y); } } - -void window_guest_set_colours() -{ - rct_window* w; - window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 1; - w->colours[1] = 15; - w->colours[2] = 15; - } - else - { - w->colours[0] = 22; - w->colours[1] = 26; - w->colours[2] = 26; - } -} diff --git a/src/windows/guest_list.c b/src/windows/guest_list.c index ab844b1047..76ffe41e6f 100644 --- a/src/windows/guest_list.c +++ b/src/windows/guest_list.c @@ -29,6 +29,7 @@ #include "../sprites.h" #include "../world/sprite.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { PAGE_INDIVIDUAL, @@ -569,19 +570,7 @@ static void window_guest_list_invalidate() rct_window *w; window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 1; - w->colours[1] = 15; - w->colours[2] = 15; - } - else - { - w->colours[0] = 22; - w->colours[1] = 26; - w->colours[2] = 26; - } + colour_scheme_update(w); w->pressed_widgets &= ~(1 << WIDX_TAB_1); w->pressed_widgets &= ~(1 << WIDX_TAB_2); diff --git a/src/windows/install_track.c b/src/windows/install_track.c index 922ed382f7..d2e465a7c9 100644 --- a/src/windows/install_track.c +++ b/src/windows/install_track.c @@ -28,6 +28,7 @@ #include "../ride/track.h" #include "../sprites.h" #include "error.h" +#include "../interface/colour_schemes.h" enum { WIDX_BACKGROUND, @@ -130,9 +131,6 @@ void window_install_track_open(const char* path) 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->colours[0] = 26; - w->colours[1] = 26; - w->colours[2] = 26; w->track_list.var_482 = 0; w->track_list.var_484 = 0; window_push_others_right(w); @@ -270,6 +268,7 @@ static void window_install_track_invalidate() { rct_window *w; window_get_register(w); + colour_scheme_update(w); w->pressed_widgets |= 1 << WIDX_TRACK_PREVIEW; if (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) == 0) diff --git a/src/windows/land.c b/src/windows/land.c index c15628eda2..c7b2d29367 100644 --- a/src/windows/land.c +++ b/src/windows/land.c @@ -26,6 +26,7 @@ #include "../sprites.h" #include "../world/map.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum WINDOW_LAND_WIDGET_IDX { WIDX_BACKGROUND, @@ -148,9 +149,6 @@ void window_land_open() _selectedWallTexture = 0; RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = MONEY32_UNDEFINED; RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = MONEY32_UNDEFINED; - window->colours[0] = 24; - window->colours[1] = 24; - window->colours[2] = 24; } /** @@ -365,6 +363,7 @@ static void window_land_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); w->pressed_widgets = (1 << WIDX_PREVIEW); if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) != 255) diff --git a/src/windows/land_rights.c b/src/windows/land_rights.c index 5cc8961628..0f3d83e5de 100644 --- a/src/windows/land_rights.c +++ b/src/windows/land_rights.c @@ -27,6 +27,7 @@ #include "../sprites.h" #include "../world/map.h" #include "../game.h" +#include "../interface/colour_schemes.h" const int MAX_LAND_RIGHTS_SIZE = 64; @@ -115,9 +116,6 @@ void window_land_rights_open() RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, uint32) = MONEY32_UNDEFINED; RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, uint32) = MONEY32_UNDEFINED; - window->colours[0] = 19; - window->colours[1] = 19; - window->colours[2] = 19; show_land_rights(); } @@ -231,6 +229,7 @@ static void window_land_rights_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); // Set the preview image button to be pressed down w->pressed_widgets |= (1 << WIDX_PREVIEW) | (1 << (LandRightsMode ? WIDX_BUY_LAND_RIGHTS : WIDX_BUY_CONSTRUCTION_RIGHTS)); diff --git a/src/windows/loadsave.c b/src/windows/loadsave.c index ca43a637bd..4c4afade91 100644 --- a/src/windows/loadsave.c +++ b/src/windows/loadsave.c @@ -28,6 +28,7 @@ #include "../scenario.h" #include "../title.h" #include "../windows/error.h" +#include "../interface/colour_schemes.h" #pragma region Widgets @@ -65,6 +66,7 @@ static void window_loadsave_scrollmousedown(); static void window_loadsave_scrollmouseover(); static void window_loadsave_textinput(); static void window_loadsave_tooltip(); +static void window_loadsave_invalidate(); static void window_loadsave_paint(); static void window_loadsave_scrollpaint(); @@ -94,7 +96,7 @@ static void* window_loadsave_events[] = { window_loadsave_tooltip, window_loadsave_emptysub, window_loadsave_emptysub, - window_loadsave_emptysub, + window_loadsave_invalidate, window_loadsave_paint, window_loadsave_scrollpaint }; @@ -424,6 +426,14 @@ static void window_loadsave_tooltip() RCT2_GLOBAL(0x013CE952, uint16) = STR_LIST; } +static void window_loadsave_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + static void window_loadsave_paint() { rct_window *w; @@ -686,6 +696,7 @@ static rct_widget window_overwrite_prompt_widgets[] = { static void window_overwrite_prompt_emptysub(){} static void window_overwrite_prompt_mouseup(); +static void window_overwrite_prompt_invalidate(); static void window_overwrite_prompt_paint(); static void* window_overwrite_prompt_events[] = { @@ -714,7 +725,7 @@ static void* window_overwrite_prompt_events[] = { window_overwrite_prompt_emptysub, window_overwrite_prompt_emptysub, window_overwrite_prompt_emptysub, - window_overwrite_prompt_emptysub, + window_overwrite_prompt_invalidate, window_overwrite_prompt_paint, window_overwrite_prompt_emptysub }; @@ -761,6 +772,14 @@ static void window_overwrite_prompt_mouseup() } } +static void window_overwrite_prompt_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + static void window_overwrite_prompt_paint() { rct_window *w; diff --git a/src/windows/map.c b/src/windows/map.c index d5eef11cad..75099de662 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -26,6 +26,7 @@ #include "../interface/window.h" #include "../sprites.h" #include "../world/scenery.h" +#include "../interface/colour_schemes.h" enum WINDOW_MAP_WIDGET_IDX { @@ -187,9 +188,6 @@ void window_map_open() window_map_init_map(); RCT2_GLOBAL(0x00F64F05, uint8) = 0; window_map_center_on_view_point(); - - w->colours[0] = 12; - w->colours[1] = 24; } /** @@ -513,6 +511,7 @@ static void window_map_invalidate() int i, height; window_get_register(w); + colour_scheme_update(w); // set the pressed widgets pressed_widgets = (uint32)w->pressed_widgets; diff --git a/src/windows/mapgen.c b/src/windows/mapgen.c index 0728125fc9..f9e95de268 100644 --- a/src/windows/mapgen.c +++ b/src/windows/mapgen.c @@ -28,6 +28,7 @@ #include "../world/mapgen.h" #include "../world/scenery.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { WINDOW_MAPGEN_PAGE_BASE, @@ -429,9 +430,6 @@ rct_window *window_mapgen_open() ); w->number = 0; w->frame_no = 0; - w->colours[0] = 12; - w->colours[1] = 24; - w->colours[2] = 24; } w->page = WINDOW_MAPGEN_PAGE_BASE; @@ -602,6 +600,7 @@ static void window_mapgen_base_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); if (w->widgets != window_mapgen_page_widgets[WINDOW_MAPGEN_PAGE_BASE]) { w->widgets = window_mapgen_page_widgets[WINDOW_MAPGEN_PAGE_BASE]; @@ -705,6 +704,7 @@ static void window_mapgen_random_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); if (w->widgets != window_mapgen_page_widgets[WINDOW_MAPGEN_PAGE_RANDOM]) { w->widgets = window_mapgen_page_widgets[WINDOW_MAPGEN_PAGE_RANDOM]; @@ -922,6 +922,7 @@ static void window_mapgen_simplex_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); if (w->widgets != window_mapgen_page_widgets[WINDOW_MAPGEN_PAGE_SIMPLEX]) { w->widgets = window_mapgen_page_widgets[WINDOW_MAPGEN_PAGE_SIMPLEX]; diff --git a/src/windows/new_campaign.c b/src/windows/new_campaign.c index 9f0cb40006..094253fa33 100644 --- a/src/windows/new_campaign.c +++ b/src/windows/new_campaign.c @@ -27,6 +27,7 @@ #include "../management/marketing.h" #include "../ride/ride.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" #define SELECTED_RIDE_UNDEFINED ((uint16)0xFFFF) @@ -345,19 +346,7 @@ static void window_new_campaign_invalidate() rct_window *w; window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 19; - w->colours[1] = 19; - w->colours[2] = 19; - } - else - { - w->colours[0] = 4; - w->colours[1] = 4; - w->colours[2] = 1; - } + colour_scheme_update(w); window_new_campaign_widgets[WIDX_RIDE_LABEL].type = WWT_EMPTY; window_new_campaign_widgets[WIDX_RIDE_DROPDOWN].type = WWT_EMPTY; diff --git a/src/windows/new_ride.c b/src/windows/new_ride.c index 082be03649..e583dfc830 100644 --- a/src/windows/new_ride.c +++ b/src/windows/new_ride.c @@ -30,6 +30,7 @@ #include "../ride/track.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../interface/colour_schemes.h" #define _window_new_ride_current_tab RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) @@ -727,19 +728,7 @@ static void window_new_ride_invalidate() rct_window *w; window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 24; - w->colours[1] = 26; - w->colours[2] = 26; - } - else - { - w->colours[0] = 26; - w->colours[1] = 1; - w->colours[2] = 1; - } + colour_scheme_update(w); window_new_ride_set_pressed_tab(w); diff --git a/src/windows/news.c b/src/windows/news.c index 1d5935bf58..9c3fff2310 100644 --- a/src/windows/news.c +++ b/src/windows/news.c @@ -27,6 +27,7 @@ #include "../sprites.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../interface/colour_schemes.h" enum WINDOW_NEWS_WIDGET_IDX { WIDX_BACKGROUND, @@ -49,6 +50,7 @@ static void window_news_update(rct_window *w); static void window_news_scrollgetsize(); static void window_news_scrollmousedown(); static void window_news_tooltip(); +static void window_news_invalidate(); static void window_news_paint(); static void window_news_scrollpaint(); @@ -78,7 +80,7 @@ static void* window_news_events[] = { window_news_tooltip, window_news_emptysub, window_news_emptysub, - window_news_emptysub, + window_news_invalidate, window_news_paint, window_news_scrollpaint }; @@ -104,9 +106,6 @@ void window_news_open() window->widgets = window_news_widgets; window->enabled_widgets = (1 << WIDX_CLOSE); window_init_scroll_widgets(window); - window->colours[0] = 1; - window->colours[1] = 1; - window->colours[2] = 0; window->news.var_480 = -1; } @@ -118,6 +117,7 @@ void window_news_open() widget = &window_news_widgets[WIDX_SCROLL]; window->scrolls[0].v_top = max(0, height - (widget->bottom - widget->top - 1)); widget_scroll_update_thumbs(window, WIDX_SCROLL); + } /** @@ -282,6 +282,14 @@ static void window_news_paint() window_draw_widgets(w, dpi); } +static void window_news_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + /** * * rct2: 0x0066E4EE diff --git a/src/windows/options.c b/src/windows/options.c index 6ab2568dbf..d1d365f5a9 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -39,6 +39,7 @@ #include "../sprites.h" #include "dropdown.h" #include "error.h" +#include "../interface/colour_schemes.h" enum { WINDOW_OPTIONS_PAGE_DISPLAY, @@ -71,6 +72,7 @@ enum WINDOW_OPTIONS_WIDGET_IDX { WIDX_CONSTRUCTION_MARKER, WIDX_CONSTRUCTION_MARKER_DROPDOWN, WIDX_HARDWARE_DISPLAY_CHECKBOX, + WIDX_COLOUR_SCHEMES, WIDX_LANGUAGE, WIDX_LANGUAGE_DROPDOWN, @@ -132,41 +134,42 @@ static rct_widget window_options_widgets[] = { { WWT_TAB, 1, 158, 188, 17, 43, 0x2000144E, STR_NONE }, // Display tab - { WWT_DROPDOWN, 0, 155, 299, 53, 64, 840, STR_NONE }, // resolution - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 54, 63, 876, STR_NONE }, - { WWT_DROPDOWN, 0, 155, 299, 68, 79, 871, STR_NONE }, // fullscreen - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 69, 78, 876, STR_NONE }, - { WWT_CHECKBOX, 0, 10, 299, 84, 95, STR_TILE_SMOOTHING, STR_TILE_SMOOTHING_TIP }, - { WWT_CHECKBOX, 0, 10, 299, 99, 110, STR_GRIDLINES, STR_GRIDLINES_TIP }, - { WWT_DROPDOWN, 0, 155, 299, 113, 124, STR_NONE, STR_NONE }, // construction marker - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 114, 123, 876, STR_NONE }, - { WWT_CHECKBOX, 0, 10, 290, 129, 140, 5154, STR_NONE }, + { WWT_DROPDOWN, 1, 155, 299, 53, 64, 840, STR_NONE }, // resolution + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 54, 63, 876, STR_NONE }, + { WWT_DROPDOWN, 1, 155, 299, 68, 79, 871, STR_NONE }, // fullscreen + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 69, 78, 876, STR_NONE }, + { WWT_CHECKBOX, 1, 10, 299, 84, 95, STR_TILE_SMOOTHING, STR_TILE_SMOOTHING_TIP }, + { WWT_CHECKBOX, 1, 10, 299, 99, 110, STR_GRIDLINES, STR_GRIDLINES_TIP }, + { WWT_DROPDOWN, 1, 155, 299, 113, 124, STR_NONE, STR_NONE }, // construction marker + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 114, 123, 876, STR_NONE }, + { WWT_CHECKBOX, 1, 10, 290, 129, 140, 5154, STR_NONE }, + { WWT_DROPDOWN_BUTTON, 1, 26, 185, 144, 155, 5218, STR_NONE }, // Culture / units tab - { WWT_DROPDOWN, 0, 155, 299, 53, 64, STR_NONE, STR_NONE }, // language - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 54, 63, 876, STR_NONE }, - { WWT_DROPDOWN, 0, 155, 299, 68, 79, 871, STR_NONE }, // currency - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 69, 78, 876, STR_NONE }, // - { WWT_DROPDOWN, 0, 155, 299, 83, 94, 872, STR_NONE }, // distance - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 84, 93, 876, STR_NONE }, - { WWT_DROPDOWN, 0, 155, 299, 98, 110, 875, STR_NONE }, // temperature - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 99, 108, 876, STR_NONE }, //jjj - { WWT_DROPDOWN, 0, 155, 299, 113, 124, 868, STR_NONE }, // height labels - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 114, 123, 876, STR_NONE }, - { WWT_DROPDOWN, 0, 155, 299, 128, 139, STR_NONE, STR_NONE }, // date format - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 129, 138, 876, STR_NONE }, + { WWT_DROPDOWN, 1, 155, 299, 53, 64, STR_NONE, STR_NONE }, // language + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 54, 63, 876, STR_NONE }, + { WWT_DROPDOWN, 1, 155, 299, 68, 79, 871, STR_NONE }, // currency + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 69, 78, 876, STR_NONE }, // + { WWT_DROPDOWN, 1, 155, 299, 83, 94, 872, STR_NONE }, // distance + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 84, 93, 876, STR_NONE }, + { WWT_DROPDOWN, 1, 155, 299, 98, 110, 875, STR_NONE }, // temperature + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 99, 108, 876, STR_NONE }, //jjj + { WWT_DROPDOWN, 1, 155, 299, 113, 124, 868, STR_NONE }, // height labels + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 114, 123, 876, STR_NONE }, + { WWT_DROPDOWN, 1, 155, 299, 128, 139, STR_NONE, STR_NONE }, // date format + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 129, 138, 876, STR_NONE }, // Audio tab - { WWT_DROPDOWN, 0, 10, 299, 53, 64, 865, STR_NONE }, // sound - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 54, 63, 876, STR_NONE }, - { WWT_CHECKBOX, 0, 10, 229, 68, 79, STR_SOUND, STR_NONE }, // enable / disable sound - { WWT_CHECKBOX, 0, 10, 229, 83, 94, STR_MUSIC, STR_NONE }, // enable / disable music - { WWT_DROPDOWN, 0, 155, 299, 98, 109, STR_NONE, STR_NONE }, // title music - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 99, 108, 876, STR_NONE }, + { WWT_DROPDOWN, 1, 10, 299, 53, 64, 865, STR_NONE }, // sound + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 54, 63, 876, STR_NONE }, + { WWT_CHECKBOX, 1, 10, 229, 68, 79, STR_SOUND, STR_NONE }, // enable / disable sound + { WWT_CHECKBOX, 1, 10, 229, 83, 94, STR_MUSIC, STR_NONE }, // enable / disable music + { WWT_DROPDOWN, 1, 155, 299, 98, 109, STR_NONE, STR_NONE }, // title music + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 99, 108, 876, STR_NONE }, // Controls tab { WWT_CHECKBOX, 2, 10, 299, 53, 64, STR_SCREEN_EDGE_SCROLLING, STR_SCREEN_EDGE_SCROLLING_TIP }, - { WWT_DROPDOWN_BUTTON, 0, 26, 185, 68, 78, STR_HOTKEY, STR_HOTKEY_TIP }, + { WWT_DROPDOWN_BUTTON, 1, 26, 185, 68, 78, STR_HOTKEY, STR_HOTKEY_TIP }, { WWT_CHECKBOX, 2, 10, 299, 82, 93, 5120, STR_NONE }, { WWT_CHECKBOX, 2, 10, 299, 97, 108, 5121, STR_NONE }, { WWT_CHECKBOX, 2, 10, 299, 112, 123, 5147, STR_NONE }, @@ -175,8 +178,8 @@ static rct_widget window_options_widgets[] = { // Misc { WWT_CHECKBOX, 2, 10, 299, 53, 64, STR_REAL_NAME, STR_REAL_NAME_TIP }, { WWT_CHECKBOX, 2, 10, 299, 68, 79, STR_SAVE_PLUGIN_DATA, STR_SAVE_PLUGIN_DATA_TIP }, - { WWT_DROPDOWN, 0, 155, 299, 83, 94, STR_NONE, STR_NONE }, - { WWT_DROPDOWN_BUTTON, 0, 288, 298, 84, 93, 876, STR_NONE }, + { WWT_DROPDOWN, 1, 155, 299, 83, 94, STR_NONE, STR_NONE }, + { WWT_DROPDOWN_BUTTON, 1, 288, 298, 84, 93, 876, STR_NONE }, { WWT_CHECKBOX, 2, 10, 299, 98, 109, 5122, STR_NONE }, // allow subtype { WWT_CHECKBOX, 2, 10, 299, 113, 124, 5150, STR_NONE }, // enabled debugging tools { WWT_CHECKBOX, 2, 10, 299, 128, 139, 5155, 5156 }, // test unfinished tracks @@ -296,6 +299,7 @@ void window_options_open() (1ULL << WIDX_TILE_SMOOTHING_CHECKBOX) | (1ULL << WIDX_GRIDLINES_CHECKBOX) | (1ULL << WIDX_HARDWARE_DISPLAY_CHECKBOX) | + (1ULL << WIDX_COLOUR_SCHEMES) | (1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX) | (1ULL << WIDX_AUTOSAVE) | (1ULL << WIDX_AUTOSAVE_DROPDOWN) | @@ -314,9 +318,6 @@ void window_options_open() w->page = WINDOW_OPTIONS_PAGE_DISPLAY; window_init_scroll_widgets(w); - w->colours[0] = 7; - w->colours[1] = 7; - w->colours[2] = 7; } /** @@ -418,6 +419,10 @@ static void window_options_mouseup() config_save_default(); window_invalidate(w); break; + case WIDX_COLOUR_SCHEMES: + window_colour_schemes_open(); + window_invalidate(w); + break; case WIDX_FOLLOWER_PEEP_NAMES_CHECKBOX: gConfigTwitch.enable_follower_peep_names ^= 1; config_save_default(); @@ -767,6 +772,7 @@ static void window_options_invalidate() sint32 currentSoundDevice; window_get_register(w); + colour_scheme_update(w); window_options_set_pressed_tab(w); for (i = WIDX_RESOLUTION; i < WINDOW_OPTIONS_WIDGETS_SIZE; i++) { @@ -820,6 +826,7 @@ static void window_options_invalidate() window_options_widgets[WIDX_CONSTRUCTION_MARKER].type = WWT_DROPDOWN; window_options_widgets[WIDX_CONSTRUCTION_MARKER_DROPDOWN].type = WWT_DROPDOWN_BUTTON; window_options_widgets[WIDX_HARDWARE_DISPLAY_CHECKBOX].type = WWT_CHECKBOX; + window_options_widgets[WIDX_COLOUR_SCHEMES].type = WWT_DROPDOWN_BUTTON; break; case WINDOW_OPTIONS_PAGE_CULTURE: // currency: pounds, dollars, etc. (10 total) diff --git a/src/windows/park.c b/src/windows/park.c index b1d9b4a917..2169520c78 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -38,6 +38,7 @@ #include "../world/sprite.h" #include "../management/finance.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum WINDOW_PARK_PAGE { WINDOW_PARK_PAGE_ENTRANCE, @@ -615,9 +616,6 @@ rct_window *window_park_open() w->var_48C = -1; w->var_492 = 0; window_park_set_disabled_tabs(w); - w->colours[0] = 1; - w->colours[1] = 19; - w->colours[2] = 19; return w; } @@ -973,6 +971,7 @@ static void window_park_entrance_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); w->widgets = window_park_page_widgets[w->page]; window_init_scroll_widgets(w); @@ -1223,6 +1222,7 @@ static void window_park_rating_invalidate() rct_widget *widgets; window_get_register(w); + colour_scheme_update(w); widgets = window_park_page_widgets[w->page]; if (w->widgets != widgets) { @@ -1356,6 +1356,7 @@ static void window_park_guests_invalidate() rct_widget *widgets; window_get_register(w); + colour_scheme_update(w); widgets = window_park_page_widgets[w->page]; if (w->widgets != widgets) { @@ -1491,6 +1492,7 @@ static void window_park_price_invalidate() rct_widget *widgets; window_get_register(w); + colour_scheme_update(w); widgets = window_park_page_widgets[w->page]; if (w->widgets != widgets) { @@ -1613,6 +1615,7 @@ static void window_park_stats_invalidate() rct_widget *widgets; window_get_register(w); + colour_scheme_update(w); widgets = window_park_page_widgets[w->page]; if (w->widgets != widgets) { @@ -1799,6 +1802,7 @@ static void window_park_objective_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); window_park_set_pressed_tab(w); window_park_prepare_window_title_text(); @@ -1944,6 +1948,7 @@ static void window_park_awards_invalidate() rct_widget *widgets; window_get_register(w); + colour_scheme_update(w); widgets = window_park_page_widgets[w->page]; if (w->widgets != widgets) { diff --git a/src/windows/research.c b/src/windows/research.c index e75ac0256f..25831d6c65 100644 --- a/src/windows/research.c +++ b/src/windows/research.c @@ -30,6 +30,7 @@ #include "../sprites.h" #include "../world/scenery.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { WINDOW_RESEARCH_PAGE_DEVELOPMENT, @@ -235,9 +236,6 @@ void window_research_open() w->page = 0; w->frame_no = 0; w->disabled_widgets = 0; - w->colours[0] = 1; - w->colours[1] = 19; - w->colours[2] = 19; research_update_uncompleted_types(); } @@ -304,6 +302,7 @@ static void window_research_development_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); if (w->widgets != window_research_page_widgets[WINDOW_RESEARCH_PAGE_DEVELOPMENT]) { w->widgets = window_research_page_widgets[WINDOW_RESEARCH_PAGE_DEVELOPMENT]; @@ -521,6 +520,7 @@ static void window_research_funding_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); if (w->widgets != window_research_page_widgets[WINDOW_RESEARCH_PAGE_FUNDING]) { w->widgets = window_research_page_widgets[WINDOW_RESEARCH_PAGE_FUNDING]; diff --git a/src/windows/ride.c b/src/windows/ride.c index 794fb63314..2adc2ab40d 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -36,6 +36,7 @@ #include "../world/sprite.h" #include "../audio/audio.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" #define var_496(w) RCT2_GLOBAL((int)w + 0x496, uint16) @@ -1974,8 +1975,7 @@ static void window_ride_main_invalidate() int i; window_get_register(w); - - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -2426,7 +2426,7 @@ static void window_ride_vehicle_invalidate() int carsPerTrain; window_get_register(w); - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -2990,7 +2990,7 @@ static void window_ride_operating_invalidate() rct_string_id format, caption, tooltip; window_get_register(w); - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -3398,7 +3398,7 @@ static void window_ride_maintenance_invalidate() rct_widget *widgets; window_get_register(w); - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -3917,7 +3917,7 @@ static void window_ride_colour_invalidate() int vehicleColourSchemeType; window_get_register(w); - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -4411,7 +4411,7 @@ static void window_ride_music_invalidate() int isMusicActivated; window_get_register(w); - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -4704,7 +4704,7 @@ static void window_ride_measurements_invalidate() rct_widget *widgets; window_get_register(w); - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -5155,7 +5155,7 @@ static void window_ride_graphs_invalidate() int x, y; window_get_register(w); - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -5501,7 +5501,7 @@ static void window_ride_income_invalidate() int primaryItem, secondaryItem; window_get_register(w); - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -5783,7 +5783,7 @@ static void window_ride_customer_invalidate() rct_widget *widgets; window_get_register(w); - window_ride_set_colours(); + colour_scheme_update(w); widgets = window_ride_page_widgets[w->page]; if (w->widgets != widgets) { @@ -5922,23 +5922,4 @@ static void window_ride_customer_paint() gfx_draw_string_left(dpi, stringId, &age, 0, x, y); } -static void window_ride_set_colours() -{ - rct_window *w; - window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 1; - w->colours[1] = 26; - w->colours[2] = 11; - } - else - { - w->colours[0] = 26; - w->colours[1] = 1; - w->colours[2] = 11; - } -} - #pragma endregion diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index 9a07407735..615d696ef0 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -24,6 +24,7 @@ #include "../game.h" #include "../ride/track.h" #include "../drawing/drawing.h" +#include "../interface/colour_schemes.h" /* move to ride.c */ void sub_6b2fa9(rct_windownumber number){ @@ -142,9 +143,7 @@ rct_window *window_construction_open() window_init_scroll_widgets(w); - w->colours[0] = 24; - w->colours[1] = 24; - w->colours[2] = 24; + colour_scheme_update(w); w->number = ride_id; @@ -200,6 +199,7 @@ rct_window *window_construction_open() RCT2_GLOBAL(0x00F440B1, uint8) = 0; RCT2_GLOBAL(0x00F44159, uint8) = 0; RCT2_GLOBAL(0x00F4415C, uint8) = 0; + colour_scheme_update(w); return w; } diff --git a/src/windows/ride_list.c b/src/windows/ride_list.c index f327357a61..3ebbaf96df 100644 --- a/src/windows/ride_list.c +++ b/src/windows/ride_list.c @@ -28,6 +28,7 @@ #include "../interface/widget.h" #include "../interface/window.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { PAGE_RIDES, @@ -399,6 +400,7 @@ static void window_ride_list_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); window_ride_list_widgets[WIDX_CURRENT_INFORMATION_TYPE].image = STR_STATUS + _window_ride_list_information_type; @@ -420,19 +422,6 @@ static void window_ride_list_invalidate() w->widgets[WIDX_LIST].bottom = w->height - 4; w->widgets[WIDX_OPEN_CLOSE_ALL].right = w->width - 2; w->widgets[WIDX_OPEN_CLOSE_ALL].left = w->width - 25; - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 1; - w->colours[1] = 26; - w->colours[2] = 26; - } - else - { - w->colours[0] = 26; - w->colours[1] = 1; - w->colours[2] = 1; - } } /** diff --git a/src/windows/save_prompt.c b/src/windows/save_prompt.c index 4760d4c758..7ee23be8db 100644 --- a/src/windows/save_prompt.c +++ b/src/windows/save_prompt.c @@ -28,6 +28,7 @@ #include "../openrct2.h" #include "../sprites.h" #include "../tutorial.h" +#include "../interface/colour_schemes.h" enum WINDOW_SAVE_PROMPT_WIDGET_IDX { WIDX_BACKGROUND, @@ -70,6 +71,7 @@ static rct_widget window_quit_prompt_widgets[] = { static void window_save_prompt_emptysub() { } static void window_save_prompt_close(); static void window_save_prompt_mouseup(); +static void window_save_prompt_invalidate(); static void window_save_prompt_paint(); static void* window_save_prompt_events[] = { @@ -98,7 +100,7 @@ static void* window_save_prompt_events[] = { window_save_prompt_emptysub, window_save_prompt_emptysub, window_save_prompt_emptysub, - window_save_prompt_emptysub, + window_save_prompt_invalidate, window_save_prompt_paint, window_save_prompt_emptysub }; @@ -161,7 +163,6 @@ void window_save_prompt_open() window->widgets = widgets; window->enabled_widgets = enabled_widgets; window_init_scroll_widgets(window); - window->colours[0] = 154; // Pause the game RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) |= 2; @@ -200,7 +201,6 @@ void window_save_prompt_open() return; } } - } /** @@ -274,6 +274,14 @@ static void window_save_prompt_mouseup() } } +static void window_save_prompt_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + static void window_save_prompt_paint() { rct_window *w; diff --git a/src/windows/scenery.c b/src/windows/scenery.c index af207ce653..5fc443bb7e 100644 --- a/src/windows/scenery.c +++ b/src/windows/scenery.c @@ -32,6 +32,7 @@ #include "../world/scenery.h" #include "../world/sprite.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" #define WINDOW_SCENERY_WIDTH 634 #define WINDOW_SCENERY_HEIGHT 142 @@ -473,9 +474,6 @@ void window_scenery_open() window->max_width = WINDOW_SCENERY_WIDTH; window->min_height = WINDOW_SCENERY_HEIGHT; window->max_height = WINDOW_SCENERY_HEIGHT; - window->colours[0] = 0x18; - window->colours[1] = 0x0C; - window->colours[2] = 0x0C; } /** @@ -887,6 +885,7 @@ void window_scenery_invalidate() rct_window* w; window_get_register(w); + colour_scheme_update(w); uint16 tabIndex = window_scenery_active_tab_index; uint32 titleStringId = 1813; diff --git a/src/windows/shortcut_key_change.c b/src/windows/shortcut_key_change.c index 19558c3c05..994f1f706a 100644 --- a/src/windows/shortcut_key_change.c +++ b/src/windows/shortcut_key_change.c @@ -23,6 +23,7 @@ #include "../interface/window.h" #include "../interface/widget.h" #include "../localisation/localisation.h" +#include "../interface/colour_schemes.h" #define WW 250 #define WH 60 @@ -43,6 +44,7 @@ static rct_widget window_shortcut_change_widgets[] = { static void window_shortcut_change_emptysub(){} static void window_shortcut_change_mouseup(); +static void window_shortcut_change_invalidate(); static void window_shortcut_change_paint(); //0x9A3F7C @@ -72,7 +74,7 @@ static void* window_shortcut_change_events[] = { window_shortcut_change_emptysub, window_shortcut_change_emptysub, window_shortcut_change_emptysub, - window_shortcut_change_emptysub, + window_shortcut_change_invalidate, window_shortcut_change_paint, window_shortcut_change_emptysub }; @@ -87,9 +89,6 @@ void window_shortcut_change_open(int selected_key){ 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; } /** @@ -108,6 +107,14 @@ static void window_shortcut_change_mouseup(){ } } +static void window_shortcut_change_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + /** * * rct2: 0x006E3A9F diff --git a/src/windows/shortcut_keys.c b/src/windows/shortcut_keys.c index 2fb9c028c9..55f42fb5c4 100644 --- a/src/windows/shortcut_keys.c +++ b/src/windows/shortcut_keys.c @@ -24,6 +24,7 @@ #include "../interface/widget.h" #include "../localisation/localisation.h" #include "../platform/platform.h" +#include "../interface/colour_schemes.h" #define WW 340 #define WH 240 @@ -48,6 +49,7 @@ static rct_widget window_shortcut_widgets[] = { void window_shortcut_emptysub() { } static void window_shortcut_mouseup(); +static void window_shortcut_invalidate(); static void window_shortcut_paint(); static void window_shortcut_tooltip(); static void window_shortcut_scrollgetsize(); @@ -81,7 +83,7 @@ static void* window_shortcut_events[] = { window_shortcut_tooltip, window_shortcut_emptysub, window_shortcut_emptysub, - window_shortcut_emptysub, + window_shortcut_invalidate, window_shortcut_paint, window_shortcut_scrollpaint }; @@ -104,9 +106,6 @@ void window_shortcut_keys_open() w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RESET); window_init_scroll_widgets(w); - w->colours[0] = 7; - w->colours[1] = 7; - w->colours[2] = 7; w->no_list_items = 32; w->selected_list_item = -1; } @@ -134,6 +133,14 @@ static void window_shortcut_mouseup() } } +static void window_shortcut_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + /** * * rct2: 0x006E38E0 diff --git a/src/windows/sign.c b/src/windows/sign.c index f26eabdc92..abc052324a 100644 --- a/src/windows/sign.c +++ b/src/windows/sign.c @@ -32,6 +32,7 @@ #include "error.h" #include "dropdown.h" #include "../drawing/drawing.h" +#include "../interface/colour_schemes.h" #define WW 113 #define WH 96 @@ -163,9 +164,6 @@ void window_sign_open(rct_windownumber number) w->number = number; window_init_scroll_widgets(w); - w->colours[0] = 24; - w->colours[1] = 24; - w->colours[2] = 24; int view_x = gBanners[w->number].x << 5; int view_y = gBanners[w->number].y << 5; @@ -387,6 +385,7 @@ static void window_sign_invalidate() rct_window* w; window_get_register(w); + colour_scheme_update(w); rct_widget* main_colour_btn = &window_sign_widgets[WIDX_MAIN_COLOR]; rct_widget* text_colour_btn = &window_sign_widgets[WIDX_TEXT_COLOR]; @@ -645,6 +644,7 @@ static void window_sign_small_invalidate() rct_window* w; window_get_register(w); + colour_scheme_update(w); rct_widget* main_colour_btn = &window_sign_widgets[WIDX_MAIN_COLOR]; rct_widget* text_colour_btn = &window_sign_widgets[WIDX_TEXT_COLOR]; diff --git a/src/windows/staff.c b/src/windows/staff.c index 084a666d09..239833b297 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -34,6 +34,7 @@ #include "../input.h" #include "dropdown.h" #include "error.h" +#include "../interface/colour_schemes.h" #define WW 190 #define WH 180 @@ -723,8 +724,7 @@ void window_staff_unknown_05(){ void window_staff_stats_invalidate(){ rct_window* w; window_get_register(w); - - window_staff_set_colours(); + colour_scheme_update_by_class(w, WC_STAFF); if (window_staff_page_widgets[w->page] != w->widgets){ w->widgets = window_staff_page_widgets[w->page]; @@ -757,8 +757,7 @@ void window_staff_stats_invalidate(){ void window_staff_options_invalidate(){ rct_window* w; window_get_register(w); - - window_staff_set_colours(); + colour_scheme_update_by_class(w, WC_STAFF); if (window_staff_page_widgets[w->page] != w->widgets){ w->widgets = window_staff_page_widgets[w->page]; @@ -831,8 +830,7 @@ void window_staff_options_invalidate(){ void window_staff_overview_invalidate(){ rct_window* w; window_get_register(w); - - window_staff_set_colours(); + colour_scheme_update_by_class(w, WC_STAFF); if (window_staff_page_widgets[w->page] != w->widgets){ w->widgets = window_staff_page_widgets[w->page]; @@ -1388,22 +1386,3 @@ void window_staff_options_dropdown() game_do_command(peep->x, (costume << 8) | 1, peep->y, w->number, GAME_COMMAND_SET_STAFF_ORDER, (int)peep, 0); } - -void window_staff_set_colours() -{ - rct_window* w; - window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 1; - w->colours[1] = 4; - w->colours[2] = 4; - } - else - { - w->colours[0] = 12; - w->colours[1] = 4; - w->colours[2] = 4; - } -} diff --git a/src/windows/staff_fire_prompt.c b/src/windows/staff_fire_prompt.c index ce6ca7909c..31ec1a77d1 100644 --- a/src/windows/staff_fire_prompt.c +++ b/src/windows/staff_fire_prompt.c @@ -27,6 +27,7 @@ #include "../peep/staff.h" #include "../sprites.h" #include "../world/sprite.h" +#include "../interface/colour_schemes.h" #define WW 200 #define WH 100 @@ -51,6 +52,7 @@ static rct_widget window_staff_fire_widgets[] = { static void window_staff_fire_emptysub(){} static void window_staff_fire_mouseup(); +static void window_staff_fire_invalidate(); static void window_staff_fire_paint(); //0x9A3F7C @@ -80,7 +82,7 @@ static void* window_staff_fire_events[] = { window_staff_fire_emptysub, window_staff_fire_emptysub, window_staff_fire_emptysub, - window_staff_fire_emptysub, + window_staff_fire_invalidate, window_staff_fire_paint, window_staff_fire_emptysub }; @@ -99,7 +101,6 @@ void window_staff_fire_prompt_open(rct_peep* peep){ w->flags |= WF_TRANSPARENT; w->number = peep->sprite_index; - w->colours[0] = 0x9A; } @@ -125,6 +126,14 @@ static void window_staff_fire_mouseup(){ } } +static void window_staff_fire_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + /** * * rct2: 0x006C0AF2 diff --git a/src/windows/staff_list.c b/src/windows/staff_list.c index 6f12c78ca3..e1d6b6023f 100644 --- a/src/windows/staff_list.c +++ b/src/windows/staff_list.c @@ -31,6 +31,7 @@ #include "../peep/staff.h" #include "../world/sprite.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { WINDOW_STAFF_LIST_TAB_HANDYMEN, @@ -455,19 +456,7 @@ void window_staff_list_invalidate() rct_window *w; window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 1; - w->colours[1] = 4; - w->colours[2] = 4; - } - else - { - w->colours[0] = 12; - w->colours[1] = 4; - w->colours[2] = 4; - } + colour_scheme_update(w); int pressed_widgets = w->pressed_widgets & 0xFFFFFF0F; uint8 tabIndex = RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8); diff --git a/src/windows/title_exit.c b/src/windows/title_exit.c index 31b3b608af..61273eaa53 100644 --- a/src/windows/title_exit.c +++ b/src/windows/title_exit.c @@ -25,6 +25,7 @@ #include "../localisation/localisation.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../interface/colour_schemes.h" static rct_widget window_title_exit_widgets[] = { { WWT_IMGBTN, 2, 0, 39, 0, 63, SPR_MENU_EXIT, STR_EXIT }, @@ -125,17 +126,5 @@ static void window_title_exit_invalidate() { rct_window *w; window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 140; - w->colours[1] = 140; - w->colours[2] = 140; - } - else - { - w->colours[0] = 129; - w->colours[1] = 129; - w->colours[2] = 129; - } + colour_scheme_update(w); } diff --git a/src/windows/title_menu.c b/src/windows/title_menu.c index 646cb57a35..33a60ed1e2 100644 --- a/src/windows/title_menu.c +++ b/src/windows/title_menu.c @@ -28,6 +28,7 @@ #include "../sprites.h" #include "../tutorial.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { WIDX_START_NEW_GAME, @@ -194,17 +195,5 @@ static void window_title_menu_invalidate() { rct_window *w; window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 140; - w->colours[1] = 140; - w->colours[2] = 140; - } - else - { - w->colours[0] = 129; - w->colours[1] = 129; - w->colours[2] = 129; - } + colour_scheme_update(w); } diff --git a/src/windows/title_options.c b/src/windows/title_options.c index e1de3bd3df..db02786a90 100644 --- a/src/windows/title_options.c +++ b/src/windows/title_options.c @@ -24,6 +24,7 @@ #include "../localisation/localisation.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../interface/colour_schemes.h" static rct_widget window_title_options_widgets[] = { { WWT_DROPDOWN_BUTTON, 2, 0, 79, 0, 11, STR_OPTIONS, STR_NONE }, @@ -114,17 +115,5 @@ static void window_title_options_invalidate() { rct_window *w; window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 140; - w->colours[1] = 140; - w->colours[2] = 140; - } - else - { - w->colours[0] = 129; - w->colours[1] = 129; - w->colours[2] = 129; - } + colour_scheme_update(w); } diff --git a/src/windows/title_scenarioselect.c b/src/windows/title_scenarioselect.c index 7c8a9000d2..5644f08abf 100644 --- a/src/windows/title_scenarioselect.c +++ b/src/windows/title_scenarioselect.c @@ -27,6 +27,7 @@ #include "../sprites.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../interface/colour_schemes.h" enum { WIDX_BACKGROUND, @@ -123,9 +124,6 @@ void window_scenarioselect_open() window->enabled_widgets = 0x04 | 0x10 | 0x20 | 0x40 | 0x80 | 0x100; window_init_scroll_widgets(window); - window->colours[0] = 1; - window->colours[1] = 26; - window->colours[2] = 26; window->viewport_focus_coordinates.var_480 = -1; window->var_494 = 0; @@ -284,6 +282,7 @@ static void window_scenarioselect_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); w->pressed_widgets &= ~(0x10 | 0x20 | 0x40 | 0x80 | 0x100); w->pressed_widgets |= 1LL << (w->selected_tab + 4); diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index e7c49d44d7..2e6e4174be 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -34,6 +34,7 @@ #include "../world/scenery.h" #include "../world/banner.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" enum { WIDX_PAUSE, @@ -487,21 +488,7 @@ static void window_top_toolbar_invalidate() rct_widget *widget; window_get_register(w); - - if(!gConfigInterface.rct1_colour_scheme) - { - w->colours[0] = 7; - w->colours[1] = 12; - w->colours[2] = 24; - w->colours[3] = 1; - } - else - { - w->colours[0] = 1; - w->colours[1] = 1; - w->colours[2] = 1; - w->colours[3] = 1; - } + colour_scheme_update(w); // Enable / disable buttons window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_TRNBTN; diff --git a/src/windows/track_list.c b/src/windows/track_list.c index f36aa355ea..a44fc6b2dd 100644 --- a/src/windows/track_list.c +++ b/src/windows/track_list.c @@ -28,6 +28,7 @@ #include "../ride/track.h" #include "../sprites.h" #include "error.h" +#include "../interface/colour_schemes.h" enum { WIDX_BACKGROUND, @@ -128,9 +129,6 @@ void window_track_list_open(ride_list_item item) 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 ? 0 : 1; w->track_list.var_484 = 0; @@ -346,6 +344,7 @@ static void window_track_list_invalidate() rct_string_id stringId; window_get_register(w); + colour_scheme_update(w); entry = GET_RIDE_ENTRY(_window_track_list_item.entry_index); diff --git a/src/windows/track_manage.c b/src/windows/track_manage.c index 5da91f3f94..023251c5c3 100644 --- a/src/windows/track_manage.c +++ b/src/windows/track_manage.c @@ -24,6 +24,7 @@ #include "../localisation/localisation.h" #include "../ride/track.h" #include "error.h" +#include "../interface/colour_schemes.h" #pragma region Widgets @@ -65,11 +66,13 @@ static void window_track_manage_emptysub() { } static void window_track_manage_close(); static void window_track_manage_mouseup(); static void window_track_manage_textinput(); +static void window_track_manage_invalidate(); static void window_track_manage_paint(); static void window_track_delete_prompt_emptysub() { } static void window_track_delete_prompt_mouseup(); +static void window_track_delete_prompt_invalidate(); static void window_track_delete_prompt_paint(); // 0x009940EC @@ -99,7 +102,7 @@ static void* window_track_manage_events[] = { window_track_manage_emptysub, window_track_manage_emptysub, window_track_manage_emptysub, - window_track_manage_emptysub, + window_track_manage_invalidate, window_track_manage_paint, window_track_manage_emptysub }; @@ -131,7 +134,7 @@ static void* window_track_delete_prompt_events[] = { window_track_delete_prompt_emptysub, window_track_delete_prompt_emptysub, window_track_delete_prompt_emptysub, - window_track_delete_prompt_emptysub, + window_track_delete_prompt_invalidate, window_track_delete_prompt_paint, window_track_delete_prompt_emptysub }; @@ -164,9 +167,6 @@ void window_track_manage_open() (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) @@ -244,6 +244,14 @@ static void window_track_manage_textinput() } } +static void window_track_manage_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + /** * * rct2: 0x006D3523 @@ -284,9 +292,6 @@ static void window_track_delete_prompt_open() (1 << WIDX_DELETE); window_init_scroll_widgets(w); w->flags |= WF_TRANSPARENT; - w->colours[0] = 26; - w->colours[1] = 26; - w->colours[2] = 26; } /** @@ -315,6 +320,14 @@ static void window_track_delete_prompt_mouseup() } } +static void window_track_delete_prompt_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + /** * * rct2: 0x006D37EE diff --git a/src/windows/track_place.c b/src/windows/track_place.c index 6ac32ddad2..348e310fd7 100644 --- a/src/windows/track_place.c +++ b/src/windows/track_place.c @@ -29,6 +29,7 @@ #include "../sprites.h" #include "../ride/track.h" #include "../ride/track_data.h" +#include "../interface/colour_schemes.h" #define TRACK_MINI_PREVIEW_WIDTH 168 #define TRACK_MINI_PREVIEW_HEIGHT 78 @@ -63,6 +64,7 @@ static void window_track_place_toolupdate(); static void window_track_place_tooldown(); static void window_track_place_toolabort(); static void window_track_place_unknown14(); +static void window_track_place_invalidate(); static void window_track_place_paint(); static void* window_track_place_events[] = { @@ -91,7 +93,7 @@ static void* window_track_place_events[] = { window_track_place_emptysub, window_track_place_emptysub, window_track_place_emptysub, - window_track_place_emptysub, + window_track_place_invalidate, window_track_place_paint, window_track_place_emptysub }; @@ -378,9 +380,6 @@ void window_track_place_open() w->widgets = window_track_place_widgets; w->enabled_widgets = 4 | 8 | 0x10 | 0x20; window_init_scroll_widgets(w); - w->colours[0] = 24; - w->colours[1] = 24; - w->colours[2] = 24; tool_set(w, 6, 12); RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6; window_push_others_right(w); @@ -588,6 +587,14 @@ static void window_track_place_unknown14() window_track_place_draw_mini_preview(); } +static void window_track_place_invalidate() +{ + rct_window *w; + + window_get_register(w); + colour_scheme_update(w); +} + /** * * rct2: 0x006CFD9D diff --git a/src/windows/viewport.c b/src/windows/viewport.c index 0caaa347fe..c476272bf0 100644 --- a/src/windows/viewport.c +++ b/src/windows/viewport.c @@ -28,6 +28,7 @@ #include "../interface/widget.h" #include "../interface/window.h" #include "dropdown.h" +#include "../interface/colour_schemes.h" #define INITIAL_WIDTH 500 #define INITIAL_HEIGHT 350 @@ -118,9 +119,6 @@ void window_viewport_open() (1 << WIDX_ZOOM_OUT) | (1 << WIDX_LOCATE); w->number = _viewportNumber++; - w->colours[0] = 24; - w->colours[1] = 24; - w->colours[2] = 24; rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32); @@ -218,6 +216,7 @@ static void window_viewport_invalidate() int i; window_get_register(w); + colour_scheme_update(w); viewportWidget = &window_viewport_widgets[WIDX_VIEWPORT]; viewport = w->viewport; diff --git a/src/windows/water.c b/src/windows/water.c index dc0034a5d2..6f371e09f2 100644 --- a/src/windows/water.c +++ b/src/windows/water.c @@ -25,6 +25,7 @@ #include "../localisation/localisation.h" #include "../sprites.h" #include "../world/map.h" +#include "../interface/colour_schemes.h" enum WINDOW_WATER_WIDGET_IDX { WIDX_BACKGROUND, @@ -107,9 +108,6 @@ void window_water_open() RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, uint32) = MONEY32_UNDEFINED; RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, uint32) = MONEY32_UNDEFINED; - window->colours[0] = 24; - window->colours[1] = 24; - window->colours[2] = 24; } /** @@ -220,6 +218,7 @@ static void window_water_invalidate() rct_window *w; window_get_register(w); + colour_scheme_update(w); // Set the preview image button to be pressed down w->pressed_widgets |= (1 << WIDX_PREVIEW);