diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt
index 740ba44286..ac1fe63f1b 100644
--- a/data/language/english_uk.txt
+++ b/data/language/english_uk.txt
@@ -3486,7 +3486,7 @@ STR_5149 :{SMALLFONT}{BLACK}Open the cheats window
STR_5150 :Enable debugging tools
STR_5151 :,
STR_5152 :.
-STR_5153 :RCT1 colour scheme
+STR_5153 :Colour schemes...
STR_5154 :Hardware display
STR_5155 :Allow testing of unfinished tracks
STR_5156 :{SMALLFONT}{BLACK}Allows testing of most ride types even when the track is unfinished, does not apply to block sectioned modes
@@ -3519,4 +3519,71 @@ STR_5182 :{INT32}
STR_5183 :Base height
STR_5184 :Enter base height between {COMMA16} and {COMMA16}
STR_5185 :Water level
-STR_5186 :Enter water level between {COMMA16} and {COMMA16}
\ No newline at end of file
+STR_5186 :Enter water level between {COMMA16} and {COMMA16}
+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:
+STR_5238 :Colour Schemes:
+STR_5239 :Duplicate
+STR_5240 :Enter a name for the colour scheme
+STR_5241 :Can't change this preset
+STR_5242 :Preset name already exists
+STR_5243 :Invalid characters used
+STR_5244 :Colour schemes
+STR_5245 :Top Toolbar
+STR_5246 :Bottom Toolbar
+STR_5247 :Track Editor Bottom Toolbar
+STR_5248 :Scenario Editor Bottom Toolbar
+STR_5249 :Title Menu Buttons
+STR_5250 :Title Exit Button
+STR_5251 :Title Options Button
+STR_5252 :Title Scenario Selection
+STR_5253 :Park Information
\ No newline at end of file
diff --git a/projects/libs/libs.vcxproj b/projects/libs/libs.vcxproj
index 31b60a3810..78a6c82be8 100644
--- a/projects/libs/libs.vcxproj
+++ b/projects/libs/libs.vcxproj
@@ -84,7 +84,8 @@
libcurl.lib;Ws2_32.lib;%(AdditionalDependencies)
- $(ProjectDir)..\..\VSgetLibs.bat
+
+
diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj
index c6e6b7be9a..80ede23ea6 100644
--- a/projects/openrct2.vcxproj
+++ b/projects/openrct2.vcxproj
@@ -37,6 +37,10 @@
+
+
+
+
@@ -141,6 +145,10 @@
+
+
+
+
@@ -167,6 +175,10 @@
+
+
+
+
diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters
index 14ac58a7a3..a62688e2ec 100644
--- a/projects/openrct2.vcxproj.filters
+++ b/projects/openrct2.vcxproj.filters
@@ -450,6 +450,12 @@
Source\Network
+
+ Source\Windows
+
+
+ Source\Interface
+
@@ -662,5 +668,8 @@
Source\Network
+
+ Source\Interface
+
\ No newline at end of file
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..0202917af0 100644
--- a/src/config.c
+++ b/src/config.c
@@ -20,7 +20,10 @@
#include "addresses.h"
#include "config.h"
+#include "localisation/language.h"
#include "localisation/localisation.h"
+#include "util/util.h"
+#include "interface/colour_schemes.h"
// Magic number for original game cfg file
static const int MagicNumber = 0x0003113A;
@@ -178,8 +181,8 @@ config_property_definition _interfaceDefinitions[] = {
{ offsetof(interface_configuration, toolbar_show_research), "toolbar_show_research", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(interface_configuration, toolbar_show_cheats), "toolbar_show_cheats", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
{ offsetof(interface_configuration, allow_subtype_switching), "allow_subtype_switching", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
- { offsetof(interface_configuration, rct1_colour_scheme), "rct1_colour_scheme", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
{ offsetof(interface_configuration, console_small_font), "console_small_font", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
+ { offsetof(interface_configuration, current_colour_scheme_preset), "colour_scheme_preset", CONFIG_VALUE_TYPE_STRING, { .value_string = "*RCT2" }, NULL },
};
config_property_definition _soundDefinitions[] = {
@@ -221,6 +224,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);
@@ -445,7 +449,7 @@ bool config_get_section(const utf8string line, const utf8 **sectionName, int *se
return true;
}
-bool config_get_property_name_value(const utf8string line, const utf8 **propertyName, int *propertyNameSize, const utf8 **value, int *valueSize)
+bool config_get_property_name_value(const utf8string line, utf8 **propertyName, int *propertyNameSize, utf8 **value, int *valueSize)
{
utf8 *ch;
int c, lastC;
@@ -578,7 +582,7 @@ static void config_read_properties(config_section_definition **currentSection, c
*currentSection = config_get_section_def(sectionName, sectionNameSize);
} else {
if (*currentSection != NULL) {
- const utf8 *propertyName, *value;
+ utf8 *propertyName, *value;
int propertyNameSize, valueSize;
if (config_get_property_name_value(ch, &propertyName, &propertyNameSize, &value, &valueSize)) {
config_property_definition *property;
@@ -993,3 +997,256 @@ bool config_shortcut_keys_save()
}
#pragma endregion
+
+
+#pragma region Colour Schemes
+
+static void colour_schemes_remove_extension(char *path);
+static bool colour_schemes_open(const utf8string path);
+static bool colour_schemes_save(const utf8string path, int preset);
+static void colour_schemes_read_properties(int preset, window_colours **current_window_colours, const_utf8string line);
+static void colour_schemes_set_property(window_colours *colour_scheme, utf8string name, utf8string value);
+
+
+void colour_schemes_set_default()
+{
+
+ utf8 path[MAX_PATH];
+
+ platform_get_user_directory(path, "colour schemes");
+ platform_ensure_directory_exists(path);
+
+ gConfigColourSchemes.num_presets = 2;
+ gConfigColourSchemes.presets = malloc(sizeof(colour_scheme_preset) * gConfigColourSchemes.num_presets);
+
+ // Set RCT2 colour scheme
+ strcpy(gConfigColourSchemes.presets[0].name, language_get_string(2741));
+ gConfigColourSchemes.presets[0].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
+ for (int i = 0; i < (int)gNumColourSchemeWindows; i++) {
+ for (int j = 0; j < 6; j++)
+ gConfigColourSchemes.presets[0].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
+ }
+
+ // Set RCT1 colour scheme
+ strcpy(gConfigColourSchemes.presets[1].name, language_get_string(2740));
+ gConfigColourSchemes.presets[1].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
+ for (int i = 0; i < (int)gNumColourSchemeWindows; i++) {
+ uint8 changed_colour = 0xFF;
+ for (int k = 0; gColourSchemesRCT1[k].classification != 0xFF; k++) {
+ if (gColourSchemesRCT1[k].classification == gColourSchemes[i].classification) {
+ changed_colour = (uint8)k;
+ break;
+ }
+ }
+ for (int j = 0; j < 6; j++) {
+ gConfigColourSchemes.presets[1].colour_schemes[i].colours[j] = (changed_colour != 0xFF ? gColourSchemesRCT1[changed_colour].colours[j] : gColourSchemes[i].colours[j]);
+ }
+ }
+}
+
+void colour_schemes_load_presets()
+{
+ utf8 path[MAX_PATH];
+ file_info file;
+ int fileEnumHandle, i;
+
+ platform_get_user_directory(path, "colour schemes");
+ strcat(path, "*.ini");
+ fileEnumHandle = platform_enumerate_files_begin(path);
+ while (platform_enumerate_files_next(fileEnumHandle, &file)) {
+ platform_get_user_directory(path, "colour schemes");
+ strcat(path, file.path);
+ colour_schemes_open(path);
+ }
+ platform_enumerate_files_end(fileEnumHandle);
+
+ if (strcmp(gConfigInterface.current_colour_scheme_preset, "*RCT2") == 0) {
+ colour_scheme_change_preset(0);
+ }
+ else if (strcmp(gConfigInterface.current_colour_scheme_preset, "*RCT1") == 0) {
+ colour_scheme_change_preset(1);
+ }
+ else {
+ for (i = 2; i < gConfigColourSchemes.num_presets; i++) {
+ if (strcmp(gConfigInterface.current_colour_scheme_preset, gConfigColourSchemes.presets[i].name) == 0) {
+ colour_scheme_change_preset(i);
+ break;
+ }
+ }
+ if (i == gConfigColourSchemes.num_presets) {
+ colour_scheme_change_preset(0);
+ }
+ }
+}
+
+bool colour_schemes_save_preset(int preset)
+{
+ utf8 path[MAX_PATH];
+
+ platform_get_user_directory(path, "colour schemes");
+ strcat(path, gConfigColourSchemes.presets[preset].name);
+ strcat(path, ".ini");
+ if (colour_schemes_save(path, preset)) {
+ return true;
+ }
+
+ return false;
+}
+
+bool colour_schemes_open(const utf8string path)
+{
+ FILE *file;
+ uint8 *lineBuffer;
+ size_t lineBufferCapacity;
+ size_t lineLength;
+ int c, preset;
+ window_colours *currentColourScheme;
+
+ file = fopen(path, "rb");
+ if (file == NULL)
+ return false;
+
+ // Check if the colour scheme is already loaded
+ // No nead to read the first two presets as they're hardcoded in
+ for (preset = 2; preset < gConfigColourSchemes.num_presets; preset++) {
+ if (strcmp(path, gConfigColourSchemes.presets[preset].name) == 0) {
+ break;
+ }
+ }
+ // Otherwise allocate one
+ if (preset == gConfigColourSchemes.num_presets) {
+ gConfigColourSchemes.num_presets++;
+ gConfigColourSchemes.presets = realloc(gConfigColourSchemes.presets, sizeof(colour_scheme_preset) * gConfigColourSchemes.num_presets);
+ strcpy(gConfigColourSchemes.presets[preset].name, path_get_filename(path));
+ colour_schemes_remove_extension(gConfigColourSchemes.presets[preset].name);
+ gConfigColourSchemes.presets[preset].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
+ for (int i = 0; i < (int)gNumColourSchemeWindows; i++) {
+ for (int j = 0; j < 6; j++)
+ gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
+ }
+ }
+
+ currentColourScheme = NULL;
+ lineBufferCapacity = 64;
+ lineBuffer = malloc(lineBufferCapacity);
+ lineLength = 0;
+
+ // Skim UTF-8 byte order mark
+ fread(lineBuffer, 3, 1, file);
+ if (!(lineBuffer[0] == 0xEF && lineBuffer[1] == 0xBB && lineBuffer[2] == 0xBF))
+ fseek(file, 0, SEEK_SET);
+
+ while ((c = fgetc(file)) != EOF) {
+ if (c == '\n' || c == '\r') {
+ lineBuffer[lineLength++] = 0;
+ colour_schemes_read_properties(preset, ¤tColourScheme, (const_utf8string)lineBuffer);
+ lineLength = 0;
+ }
+ else {
+ lineBuffer[lineLength++] = c;
+ }
+
+ if (lineLength >= lineBufferCapacity) {
+ lineBufferCapacity *= 2;
+ lineBuffer = realloc(lineBuffer, lineBufferCapacity);
+ }
+ }
+
+ if (lineLength > 0) {
+ lineBuffer[lineLength++] = 0;
+ colour_schemes_read_properties(preset, ¤tColourScheme, lineBuffer);
+ }
+
+ free(lineBuffer);
+ fclose(file);
+ return true;
+}
+
+static bool colour_schemes_save(const utf8string path, int preset)
+{
+ FILE *file;
+ int i, j;
+
+ file = fopen(path, "wb");
+ if (file == NULL) {
+ log_error("Unable to write to colour scheme file.");
+ return false;
+ }
+
+ for (i = 0; i < (int)gNumColourSchemeWindows; i++) {
+ window_colour_scheme* colour_scheme_info = &gColourSchemes[i];
+ window_colours* colour_scheme = &gConfigColourSchemes.presets[preset].colour_schemes[i];
+
+ fputc('[', file);
+ fwrite(colour_scheme_info->section_name, strlen(colour_scheme_info->section_name), 1, file);
+ fputc(']', file);
+ fputc('\n', file);
+
+ for (j = 0; j < colour_scheme_info->num_colours; j++) {
+
+ fprintf(file, "colour_%d", j);
+ fwrite(" = ", 3, 1, file);
+ fprintf(file, "%u", colour_scheme->colours[j]);
+ fputc('\n', file);
+ }
+ fputc('\n', file);
+ }
+
+ fclose(file);
+ return true;
+}
+
+static void colour_schemes_read_properties(int preset, window_colours **colour_scheme, const_utf8string line)
+{
+ utf8string ch = (utf8string)line;
+ utf8_skip_whitespace(&ch);
+
+ if (*ch == '[') {
+ utf8string sectionName;
+ int sectionNameSize;
+ if (config_get_section(ch, §ionName, §ionNameSize)) {
+ sectionName[strlen(sectionName) - 1] = '\0';
+ for (int i = 0; i < (int)gNumColourSchemeWindows; i++) {
+ if (strcmp(sectionName, gColourSchemes[i].section_name) == 0) {
+ *colour_scheme = &(gConfigColourSchemes.presets[preset].colour_schemes[i]);
+ break;
+ }
+ }
+ }
+ }
+ else {
+ if (*colour_scheme != NULL) {
+ utf8string propertyName, value;
+ int propertyNameSize, valueSize;
+ if (config_get_property_name_value(ch, &propertyName, &propertyNameSize, &value, &valueSize)) {
+ propertyName[propertyNameSize] = '\0';
+ colour_schemes_set_property(*colour_scheme, propertyName, value);
+ }
+ }
+ }
+}
+
+static void colour_schemes_set_property(window_colours *colour_scheme, utf8string name, utf8string value)
+{
+ const_utf8string colour_names[] = { "colour_0", "colour_1", "colour_2", "colour_3", "colour_4", "colour_5" };
+
+ for (int i = 0; i < 6; i++) {
+ if (strcmp(name, colour_names[i]) == 0) {
+ colour_scheme->colours[i] = (uint8)strtol(value, NULL, 0);
+ }
+ }
+}
+
+static void colour_schemes_remove_extension(char *path)
+{
+ char *ch;
+
+ for (ch = path; *ch != 0; ch++) {
+ if (*ch == '.') {
+ *ch = '\0';
+ break;
+ }
+ }
+}
+
+#pragma endregion
\ No newline at end of file
diff --git a/src/config.h b/src/config.h
index bdd3c363e9..f0b9354f22 100644
--- a/src/config.h
+++ b/src/config.h
@@ -146,8 +146,8 @@ typedef struct {
uint8 toolbar_show_research;
uint8 toolbar_show_cheats;
uint8 allow_subtype_switching;
- uint8 rct1_colour_scheme;
uint8 console_small_font;
+ utf8string current_colour_scheme_preset;
} interface_configuration;
typedef struct {
@@ -174,6 +174,20 @@ typedef struct {
uint8 enable_news;
} twitch_configuration;
+typedef struct {
+ uint8 colours[6];
+} window_colours;
+
+typedef struct {
+ window_colours *colour_schemes;
+ char name[256];
+} colour_scheme_preset;
+
+typedef struct {
+ colour_scheme_preset *presets;
+ uint16 num_presets;
+} colour_schemes_configuration;
+
typedef struct {
uint8 key;
uint8 modifier;
@@ -184,6 +198,7 @@ extern interface_configuration gConfigInterface;
extern sound_configuration gConfigSound;
extern cheat_configuration gConfigCheat;
extern twitch_configuration gConfigTwitch;
+extern colour_schemes_configuration gConfigColourSchemes;
extern uint16 gShortcutKeys[SHORTCUT_COUNT];
@@ -199,4 +214,8 @@ bool config_shortcut_keys_save();
bool config_find_or_browse_install_directory();
+void colour_schemes_set_default();
+void colour_schemes_load_presets();
+bool colour_schemes_save_preset(int preset);
+
#endif
diff --git a/src/interface/colour_schemes.c b/src/interface/colour_schemes.c
new file mode 100644
index 0000000000..ab6ccb56f1
--- /dev/null
+++ b/src/interface/colour_schemes.c
@@ -0,0 +1,232 @@
+/*****************************************************************************
+* Copyright (c) 2014 Ted John, Peter Hill
+* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+*
+* This file is part of OpenRCT2.
+*
+* OpenRCT2 is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*****************************************************************************/
+
+#include "../config.h"
+#include "../localisation/string_ids.h"
+#include "window.h"
+#include "colour_schemes.h"
+
+window_colour_scheme gColourSchemes[] = {
+ { WC_TOP_TOOLBAR, { 7, 12, 24, 1, 0, 0 }, 4, 5245, "top_toolbar" },
+ { WC_BOTTOM_TOOLBAR, { 140, 140, 0, 14, 0, 0 }, 4, 5246, "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, 5253, "park_information" },
+ { WC_FINANCES, { 1, 19, 19, 0, 0, 0 }, 3, 5187, "finances" },
+ { WC_TITLE_MENU, { 140, 140, 140, 0, 0, 0 }, 3, 5249, "title_menu" },
+ { WC_TITLE_EXIT, { 140, 140, 140, 0, 0, 0 }, 3, 5250, "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, 5252, "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, 5251, "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, 5247, "editor_track_bottom_toolbar" },
+ { WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR, { 150, 150, 141, 0, 0, 0 }, 3, 5248, "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
+ { WC_RIDE_LIST, { 26, 1, 1, 0, 0, 0 } }, // WC_RIDE_LIST
+ { WC_CONSTRUCT_RIDE, { 26, 1, 1, 0, 0, 0 } }, // WC_CONSTRUCT_RIDE
+ { WC_PEEP, { 22, 26, 26, 0, 0, 0 } }, // WC_PEEP
+ { WC_GUEST_LIST, { 22, 26, 26, 0, 0, 0 } }, // WC_GUEST_LIST
+ { WC_STAFF_LIST, { 12, 4, 4, 0, 0, 0 } }, // WC_STAFF_LIST
+ { WC_FINANCES, { 4, 1, 1, 0, 0, 0 } }, // WC_FINANCES
+ { WC_TITLE_MENU, { 129, 129, 129, 0, 0, 0 } }, // WC_TITLE_MENU
+ { WC_TITLE_EXIT, { 129, 129, 129, 0, 0, 0 } }, // WC_TITLE_EXIT
+ { WC_NEW_CAMPAIGN, { 4, 4, 1, 0, 0, 0 } }, // WC_NEW_CAMPAIGN
+ { WC_TITLE_OPTIONS, { 129, 129, 129, 0, 0, 0 } }, // WC_TITLE_OPTIONS
+ { WC_STAFF, { 12, 4, 4, 0, 0, 0 } }, // WC_STAFF
+
+
+ { 0xFF, { 0, 0, 0, 0, 0, 0 } } // End
+};
+
+uint16 gCurrentColourSchemePreset = 0;
+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;
+}
+
+int colour_scheme_get_index_by_class(rct_windowclass classification)
+{
+ for (int i = 0; i < sizeof(gColourSchemes); i++) {
+ if (gColourSchemes[i].classification == classification) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+
+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;
+}
+
+void colour_scheme_change_preset(int preset)
+{
+ if (preset >= 0 && preset < gConfigColourSchemes.num_presets) {
+ switch (preset) {
+ case 0:
+ gConfigInterface.current_colour_scheme_preset = "*RCT2";
+ break;
+ case 1:
+ gConfigInterface.current_colour_scheme_preset = "*RCT1";
+ break;
+ default:
+ gConfigInterface.current_colour_scheme_preset = gConfigColourSchemes.presets[preset].name;
+ break;
+ }
+ gCurrentColourSchemePreset = preset;
+ for (int i = 0; i < (int)gNumColourSchemeWindows; i++) {
+ for (int j = 0; j < gColourSchemes[i].num_colours; j++) {
+ gColourSchemes[i].colours[j] = gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j];
+ }
+ }
+ }
+ window_invalidate_all();
+}
+
+void colour_scheme_create_preset(const char *name)
+{
+ int preset = gConfigColourSchemes.num_presets;
+ gConfigColourSchemes.num_presets++;
+ gConfigColourSchemes.presets = realloc(gConfigColourSchemes.presets, sizeof(colour_scheme_preset) * gConfigColourSchemes.num_presets);
+ strcpy(gConfigColourSchemes.presets[preset].name, name);
+ gConfigColourSchemes.presets[preset].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
+ for (int i = 0; i < (int)gNumColourSchemeWindows; i++) {
+ for (int j = 0; j < 6; j++)
+ gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
+ }
+ colour_schemes_save_preset(preset);
+ colour_scheme_change_preset(preset);
+}
+
+void colour_scheme_delete_preset(int preset)
+{
+ if (preset >= 2) {
+ utf8 path[MAX_PATH];
+ platform_get_user_directory(path, "colour schemes");
+ strcat(path, gConfigColourSchemes.presets[preset].name);
+ strcat(path, ".ini");
+ platform_file_delete(path);
+
+ for (int i = preset; i < gConfigColourSchemes.num_presets - 1; i++) {
+ gConfigColourSchemes.presets[i] = gConfigColourSchemes.presets[i + 1];
+ }
+ gConfigColourSchemes.num_presets--;
+ colour_scheme_change_preset(0);
+ }
+}
+
+void colour_scheme_rename_preset(int preset, const char *newName)
+{
+ if (preset >= 2) {
+ utf8 src[MAX_PATH], dest[MAX_PATH];
+ platform_get_user_directory(src, "colour schemes");
+ platform_get_user_directory(dest, "colour schemes");
+ strcat(src, gConfigColourSchemes.presets[preset].name);
+ strcat(dest, newName);
+ strcat(src, ".ini");
+ strcat(dest, ".ini");
+ platform_file_move(src, dest);
+
+ strcpy(gConfigColourSchemes.presets[gCurrentColourSchemePreset].name, newName);
+
+ if (preset == gCurrentColourSchemePreset) {
+ gConfigInterface.current_colour_scheme_preset = gConfigColourSchemes.presets[gCurrentColourSchemePreset].name;
+ }
+ }
+}
diff --git a/src/interface/colour_schemes.h b/src/interface/colour_schemes.h
new file mode 100644
index 0000000000..f88e1a7c77
--- /dev/null
+++ b/src/interface/colour_schemes.h
@@ -0,0 +1,60 @@
+/*****************************************************************************
+* Copyright (c) 2014 Ted John, Peter Hill, Duncan Frost
+* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+*
+* This file is part of OpenRCT2.
+*
+* OpenRCT2 is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*****************************************************************************/
+
+#ifndef _COLOUR_SCHEMES_H_
+#define _COLOUR_SCHEMES_H_
+
+#include "../common.h"
+#include "window.h"
+
+typedef struct {
+ rct_windowclass classification;
+ uint8 colours[6];
+ uint8 num_colours;
+ rct_string_id name;
+ char *section_name;
+} window_colour_scheme;
+
+
+typedef struct {
+ rct_windowclass classification;
+ uint8 colours[6];
+} marked_window_colours;
+
+extern window_colour_scheme gColourSchemes[];
+
+extern marked_window_colours gColourSchemesRCT1[];
+
+extern uint16 gCurrentColourSchemePreset;
+
+extern uint32 gNumColourSchemeWindows;
+
+window_colour_scheme* colour_scheme_get_by_class(rct_windowclass classification);
+int colour_scheme_get_index_by_class(rct_windowclass classification);
+
+void colour_scheme_update(rct_window *window);
+void colour_scheme_update_by_class(rct_window *window, rct_windowclass classification);
+
+void colour_scheme_change_preset(int preset);
+void colour_scheme_create_preset(const char *name);
+void colour_scheme_delete_preset(int preset);
+void colour_scheme_rename_preset(int preset, const char *newName);
+
+#endif
\ No newline at end of file
diff --git a/src/interface/console.c b/src/interface/console.c
index 4dafd92d12..2ae81a966a 100644
--- a/src/interface/console.c
+++ b/src/interface/console.c
@@ -780,7 +780,10 @@ 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 {
+ } else if (strcmp(argv[0], "colour_schemes") == 0) {
+ window_colour_schemes_open();
+ }
+ else {
console_writeline_error("Invalid window.");
}
}
@@ -827,7 +830,8 @@ char* console_variable_table[] = {
char* console_window_table[] = {
"object_selection",
"inventions_list",
- "options"
+ "options",
+ "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 2a6969a9c0..0434f225c5 100644
--- a/src/interface/window.h
+++ b/src/interface/window.h
@@ -404,7 +404,13 @@ enum {
WC_LOADSAVE = 115,
WC_LOADSAVE_OVERWRITE_PROMPT = 116,
WC_TITLE_OPTIONS = 117,
- WC_LAND_RIGHTS = 118
+ WC_LAND_RIGHTS = 118,
+ WC_COLOUR_SCHEMES = 119,
+
+ // Only used for colour schemes
+ WC_STAFF = 220,
+ WC_EDITOR_TRACK_BOTTOM_TOOLBAR = 221,
+ WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR = 222,
} WINDOW_CLASS;
enum PROMPT_MODE {
@@ -560,6 +566,7 @@ void window_music_credits_open();
void window_publisher_credits_open();
void window_track_manage_open();
void window_viewport_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/openrct2.c b/src/openrct2.c
index 301ff317a4..a66731d302 100644
--- a/src/openrct2.c
+++ b/src/openrct2.c
@@ -145,6 +145,10 @@ bool openrct2_initialise()
}
language_open(gConfigGeneral.language);
http_init();
+
+ colour_schemes_set_default();
+ colour_schemes_load_presets();
+
if (!rct2_init())
return false;
@@ -160,29 +164,29 @@ bool openrct2_initialise()
void openrct2_launch()
{
if (openrct2_initialise()) {
- switch (gOpenRCT2StartupAction) {
- case STARTUP_ACTION_INTRO:
- RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 8;
- break;
- case STARTUP_ACTION_TITLE:
- RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 0;
- RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TITLE_DEMO;
- break;
- case STARTUP_ACTION_OPEN:
- assert(gOpenRCT2StartupActionPath != NULL);
- rct2_open_file(gOpenRCT2StartupActionPath);
+ switch (gOpenRCT2StartupAction) {
+ case STARTUP_ACTION_INTRO:
+ RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 8;
+ break;
+ case STARTUP_ACTION_TITLE:
+ RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 0;
+ RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TITLE_DEMO;
+ break;
+ case STARTUP_ACTION_OPEN:
+ assert(gOpenRCT2StartupActionPath != NULL);
+ rct2_open_file(gOpenRCT2StartupActionPath);
- RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 0;
- RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING;
- break;
- case STARTUP_ACTION_EDIT:
- if (strlen(gOpenRCT2StartupActionPath) == 0) {
- editor_load();
- } else {
- editor_load_landscape(gOpenRCT2StartupActionPath);
- }
- break;
+ RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 0;
+ RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING;
+ break;
+ case STARTUP_ACTION_EDIT:
+ if (strlen(gOpenRCT2StartupActionPath) == 0) {
+ editor_load();
+ } else {
+ editor_load_landscape(gOpenRCT2StartupActionPath);
}
+ break;
+ }
openrct2_loop();
}
openrct2_dispose();
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 febc389481..c1daee3ddb 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 8b681a24be..e17286aa5b 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
new file mode 100644
index 0000000000..ebb3158702
--- /dev/null
+++ b/src/windows/colour_schemes.c
@@ -0,0 +1,800 @@
+/*****************************************************************************
+* Copyright (c) 2014 Maciek Baron, Dániel Tar
+* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+*
+* This file is part of OpenRCT2.
+*
+* OpenRCT2 is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*****************************************************************************/
+
+#include "../addresses.h"
+#include "../config.h"
+#include "../game.h"
+#include "../drawing/drawing.h"
+#include "../input.h"
+#include "../interface/viewport.h"
+#include "../interface/widget.h"
+#include "../interface/window.h"
+#include "../localisation/localisation.h"
+#include "../peep/peep.h"
+#include "../peep/staff.h"
+#include "../world/sprite.h"
+#include "../sprites.h"
+#include "dropdown.h"
+#include "../interface/colour_schemes.h"
+#include "error.h"
+
+enum {
+ 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() { }
+static void window_colour_schemes_close();
+static void window_colour_schemes_mouseup();
+static void window_colour_schemes_resize();
+static void window_colour_schemes_mousedown(int widgetIndex, rct_window*w, rct_widget* widget);
+static void window_colour_schemes_dropdown();
+static void window_colour_schemes_update(rct_window *w);
+static void window_colour_schemes_scrollgetsize();
+static void window_colour_schemes_scrollmousedown();
+static void window_colour_schemes_scrollmouseover();
+static void window_colour_schemes_textinput();
+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,
+ window_colour_schemes_mouseup,
+ window_colour_schemes_resize,
+ window_colour_schemes_mousedown,
+ window_colour_schemes_dropdown,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_update,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_scrollgetsize,
+ window_colour_schemes_scrollmousedown,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_scrollmouseover,
+ window_colour_schemes_textinput,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_tooltip,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_emptysub,
+ window_colour_schemes_invalidate,
+ window_colour_schemes_paint,
+ window_colour_schemes_scrollpaint,
+};
+
+enum WINDOW_STAFF_LIST_WIDGET_IDX {
+ WIDX_COLOUR_SCHEMES_BACKGROUND,
+ WIDX_COLOUR_SCHEMES_TITLE,
+ WIDX_COLOUR_SCHEMES_CLOSE,
+ WIDX_COLOUR_SCHEMES_TAB_CONTENT_PANEL,
+ 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_DUPLICATE_BUTTON,
+ WIDX_COLOUR_SCHEMES_DELETE_BUTTON,
+ WIDX_COLOUR_SCHEMES_RENAME_BUTTON,
+ 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, 5244, 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_DROPDOWN, 1, 125, 299, 60, 71, STR_NONE, STR_NONE }, // Preset colour schemes
+ { WWT_DROPDOWN_BUTTON, 1, 288, 298, 61, 70, 876, STR_NONE },
+ { WWT_DROPDOWN_BUTTON, 1, 10, 100, 82, 93, 5239, STR_NONE }, // Duplicate button
+ { WWT_DROPDOWN_BUTTON, 1, 110, 200, 82, 93, 3349, STR_NONE }, // Delete button
+ { WWT_DROPDOWN_BUTTON, 1, 210, 300, 82, 93, 3348, STR_NONE }, // Rename button
+ { WWT_COLORBTN, 1, 0, 0, 0, 0, STR_NONE, STR_NONE }, // color button mask
+ { 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,
+ 32
+};
+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,
+ 5221
+};
+
+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 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;
+
+
+void window_colour_schemes_init_vars()
+{
+ _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 int get_colour_scheme_index() {
+ switch (_selected_tab) {
+ case 0: return colour_scheme_get_index_by_class(window_colour_schemes_tab_1_classes[_color_index_1]);
+ case 1: return colour_scheme_get_index_by_class(window_colour_schemes_tab_2_classes[_color_index_1]);
+ case 2: return colour_scheme_get_index_by_class(window_colour_schemes_tab_3_classes[_color_index_1]);
+ case 3: return colour_scheme_get_index_by_class(window_colour_schemes_tab_4_classes[_color_index_1]);
+ case 4: return colour_scheme_get_index_by_class(window_colour_schemes_tab_5_classes[_color_index_1]);
+ case 5: return colour_scheme_get_index_by_class(window_colour_schemes_tab_6_classes[_color_index_1]);
+ case 6: return colour_scheme_get_index_by_class(window_colour_schemes_tab_7_classes[_color_index_1]);
+ }
+ return -1;
+}
+
+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()
+{
+ rct_window* window;
+
+ // Check if window is already open
+ window = window_bring_to_front_by_class(WC_COLOUR_SCHEMES);
+ if (window != NULL)
+ return;
+
+ window = window_create_auto_pos(320, 270, (uint32*)window_colour_schemes_events, WC_COLOUR_SCHEMES, 0x0400);
+ window->widgets = window_colour_schemes_widgets;
+ window->enabled_widgets =
+ (1 << WIDX_COLOUR_SCHEMES_CLOSE) |
+ (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) |
+ (1 << WIDX_COLOUR_SCHEMES_PRESETS) |
+ (1 << WIDX_COLOUR_SCHEMES_PRESETS_DROPDOWN) |
+ (1 << WIDX_COLOUR_SCHEMES_DUPLICATE_BUTTON) |
+ (1 << WIDX_COLOUR_SCHEMES_DELETE_BUTTON) |
+ (1 << WIDX_COLOUR_SCHEMES_RENAME_BUTTON);
+
+ 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 = 320;
+ window->max_height = 450;
+ window->flags |= WF_RESIZABLE;
+}
+
+void window_colour_schemes_close() {
+ rct_window *w;
+
+ window_get_register(w);
+}
+
+static void window_colour_schemes_mouseup()
+{
+ short widgetIndex;
+ rct_window *w;
+
+ window_widget_get_registers(w, widgetIndex);
+
+ switch (widgetIndex) {
+ case WIDX_COLOUR_SCHEMES_CLOSE:
+ window_close(w);
+ break;
+ case WIDX_COLOUR_SCHEMES_DUPLICATE_BUTTON:
+ window_text_input_open(w, widgetIndex, 5239, 5240, 1170, (uint32)&gConfigColourSchemes.presets[gCurrentColourSchemePreset].name, 64);
+ break;
+ case WIDX_COLOUR_SCHEMES_DELETE_BUTTON:
+ if (gCurrentColourSchemePreset >= 2) {
+ colour_scheme_delete_preset(gCurrentColourSchemePreset);
+ }
+ else {
+ window_error_open(5241, STR_NONE);
+ }
+ break;
+ case WIDX_COLOUR_SCHEMES_RENAME_BUTTON:
+ if (gCurrentColourSchemePreset >= 2) {
+ window_text_input_open(w, widgetIndex, 3348, 5240, 1170, (uint32)&gConfigColourSchemes.presets[gCurrentColourSchemePreset].name, 64);
+ }
+ else {
+ window_error_open(5241, STR_NONE);
+ }
+ break;
+ }
+}
+
+static void window_colour_schemes_resize()
+{
+ rct_window *w;
+
+ window_get_register(w);
+
+ if (_selected_tab == WINDOW_COLOUR_SCHEMES_TAB_SETTINGS) {
+ window_set_resize(w, 320, 107, 320, 107);
+ gfx_invalidate_screen();
+ }
+ else {
+ w->min_width = 320;
+ w->min_height = 270;
+ w->max_width = 320;
+ w->max_height = 450;
+
+ if (w->width < w->min_width) {
+ w->width = w->min_width;
+ window_invalidate(w);
+ }
+ if (w->height < w->min_height) {
+ w->height = w->min_height;
+ window_invalidate(w);
+ }
+ if (w->width > w->max_width) {
+ w->width = w->max_width;
+ window_invalidate(w);
+ }
+ if (w->height > w->max_height) {
+ w->height = w->max_height;
+ window_invalidate(w);
+ }
+ }
+}
+
+static void window_colour_schemes_mousedown(int widgetIndex, rct_window* w, rct_widget* widget)
+{
+ short newSelectedTab;
+ int num_items, i;
+
+ switch (widgetIndex) {
+ 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:
+ /*if (widgetIndex == WIDX_COLOUR_SCHEMES_SETTINGS_TAB) {
+ window_set_resize(w, 320, 100, 320, 100);
+ w->flags &= ~WF_RESIZABLE;
+ }
+ else if (_selected_tab == WINDOW_COLOUR_SCHEMES_TAB_SETTINGS) {
+ w->flags |= WF_RESIZABLE;
+ window_set_resize(w, 320, 270, 320, 450);
+ }*/
+ newSelectedTab = widgetIndex - WIDX_COLOUR_SCHEMES_MAIN_UI_TAB;
+ if (_selected_tab == newSelectedTab)
+ break;
+ _selected_tab = (uint8)newSelectedTab;
+ w->scrolls[0].v_top = 0;
+ w->frame_no = 0;
+ window_event_resize_call(w);
+ window_invalidate(w);
+ break;
+ case WIDX_COLOUR_SCHEMES_PRESETS_DROPDOWN:
+ num_items = gConfigColourSchemes.num_presets;
+
+ widget--;
+ for (i = 0; i < num_items; i++) {
+ gDropdownItemsFormat[i] = 2777;
+ gDropdownItemsArgs[i] = (uint64)&gConfigColourSchemes.presets[i].name;
+ }
+
+ window_dropdown_show_text_custom_width(
+ w->x + widget->left,
+ w->y + widget->top,
+ widget->bottom - widget->top + 1,
+ w->colours[1],
+ DROPDOWN_FLAG_STAY_OPEN,
+ num_items,
+ widget->right - widget->left - 3
+ );
+
+ gDropdownItemsChecked = 1 << gCurrentColourSchemePreset;
+ break;
+ }
+}
+
+static void window_colour_schemes_dropdown()
+{
+ rct_window* w;
+ short widgetIndex, dropdownIndex;
+ window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
+
+ switch (widgetIndex) {
+ case WIDX_COLOUR_SCHEMES_LIST:
+ if (dropdownIndex != -1) {
+ get_colour_scheme_tab()->colours[_color_index_2] = dropdownIndex | get_colour_scheme_tab()->colours[_color_index_2] & 0x80;
+ gConfigColourSchemes.presets[gCurrentColourSchemePreset].colour_schemes[get_colour_scheme_index()].colours[_color_index_2] = dropdownIndex | get_colour_scheme_tab()->colours[_color_index_2] & 0x80;
+ window_invalidate_all();
+ _color_index_1 = -1;
+ _color_index_2 = -1;
+
+ if (gCurrentColourSchemePreset >= 2)
+ colour_schemes_save_preset(gCurrentColourSchemePreset);
+ }
+ break;
+ case WIDX_COLOUR_SCHEMES_PRESETS_DROPDOWN:
+ if (dropdownIndex != -1) {
+ colour_scheme_change_preset(dropdownIndex);
+ }
+ config_save_default();
+ break;
+ }
+
+}
+
+void window_colour_schemes_update(rct_window *w)
+{
+ 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);
+
+}
+
+void window_colour_schemes_scrollgetsize() {
+ rct_window *w;
+
+ window_get_register(w);
+
+ 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;
+ if (i < w->scrolls[0].v_top) {
+ w->scrolls[0].v_top = i;
+ window_invalidate(w);
+ }
+
+ #ifdef _MSC_VER
+ __asm mov ecx, 420
+ #else
+ __asm__("mov ecx, 420 ");
+ #endif
+
+ #ifdef _MSC_VER
+ __asm mov edx, scrollHeight
+ #else
+ __asm__("mov edx, %[scrollHeight] " : [scrollHeight] "+m" (scrollHeight));
+ #endif
+}
+
+void window_colour_schemes_scrollmousedown() {
+ short x, y, scrollIndex;
+ rct_window *w;
+
+ window_scrollmouse_get_registers(w, scrollIndex, x, y);
+
+ if (_selected_tab == 7)
+ return;
+
+ 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;
+
+ gConfigColourSchemes.presets[gCurrentColourSchemePreset].colour_schemes[get_colour_scheme_index()].colours[_color_index_2] &= 0x7F;
+ }
+ else {
+ get_colour_scheme_tab()->colours[_color_index_2] |= 0x80;
+ gConfigColourSchemes.presets[gCurrentColourSchemePreset].colour_schemes[get_colour_scheme_index()].colours[_color_index_2] |= 0x80;
+ }
+ if (gCurrentColourSchemePreset >= 2)
+ colour_schemes_save_preset(gCurrentColourSchemePreset);
+ window_invalidate_all();
+ }
+ }
+ }
+}
+
+void window_colour_schemes_scrollmouseover() {
+ short x, y, scrollIndex;
+ rct_window *w;
+
+ window_scrollmouse_get_registers(w, scrollIndex, x, y);
+
+ //if (_selected_tab == 7)
+ // return;
+}
+
+static bool valid_characters(const char *name)
+{
+ for (int i = 0; name[i] != '\0'; i++) {
+ if (name[i] == '\\' || name[i] == '/' || name[i] == ':' || name[i] == '?' || name[i] == '*' || name[i] == '<' || name[i] == '>' || name[i] == '|')
+ return false;
+ }
+ return true;
+}
+
+static void window_colour_schemes_textinput()
+{
+ rct_window *w;
+ short widgetIndex;
+ uint8 result;
+ char *text;
+
+ window_textinput_get_registers(w, widgetIndex, result, text);
+
+ if (!result || text[0] == 0)
+ return;
+
+ switch (widgetIndex) {
+ case WIDX_COLOUR_SCHEMES_DUPLICATE_BUTTON:
+ case WIDX_COLOUR_SCHEMES_RENAME_BUTTON:
+ if (valid_characters(text)) {
+ bool nameTaken = false;
+ for (int i = 0; i < gConfigColourSchemes.num_presets; i++) {
+ if (strcmp(gConfigColourSchemes.presets[i].name, text) == 0) {
+ window_error_open(5242, STR_NONE);
+ nameTaken = true;
+ break;
+ }
+ }
+ if (!nameTaken) {
+ if (widgetIndex == WIDX_COLOUR_SCHEMES_DUPLICATE_BUTTON) {
+ colour_scheme_create_preset(text);
+ }
+ else {
+ colour_scheme_rename_preset(gCurrentColourSchemePreset, text);
+ }
+ config_save_default();
+ window_invalidate(w);
+ }
+ }
+ else {
+ window_error_open(5243, STR_NONE);
+ }
+ break;
+ }
+}
+
+void window_colour_schemes_tooltip()
+{
+ RCT2_GLOBAL(0x013CE952, uint16) = STR_LIST;
+}
+
+void window_colour_schemes_invalidate()
+{
+ rct_window *w;
+
+ window_get_register(w);
+ colour_scheme_update(w);
+
+ int pressed_widgets = w->pressed_widgets & 0xFFFFF00F;
+ uint8 tabIndex = _selected_tab;
+ uint8 widgetIndex = tabIndex + 4;
+
+ w->pressed_widgets = pressed_widgets | (1 << widgetIndex);
+
+ if (window_find_by_class(WC_DROPDOWN) == NULL) {
+ _color_index_1 = -1;
+ _color_index_2 = -1;
+ }
+
+
+ window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_BACKGROUND].right = w->width - 1;
+ window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_BACKGROUND].bottom = w->height - 1;
+ window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_TAB_CONTENT_PANEL].right = w->width - 1;
+ window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_TAB_CONTENT_PANEL].bottom = w->height - 1;
+ window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_TITLE].right = w->width - 2;
+ window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_CLOSE].left = w->width - 2 - 0x0B;
+ 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() {
+ rct_window *w;
+ rct_drawpixelinfo *dpi;
+
+ window_paint_get_registers(w, dpi);
+
+ // Widgets
+ window_draw_widgets(w, dpi);
+ window_colour_schemes_draw_tab_images(dpi, w);
+
+ 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);
+ }
+ else {
+ RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&gConfigColourSchemes.presets[gCurrentColourSchemePreset].name;
+ gfx_draw_string_left(dpi, 5238, NULL, w->colours[1], w->x + 10, w->y + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_PRESETS].top + 1);
+ gfx_draw_string_left(
+ dpi,
+ 1170,
+ (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS,
+ w->colours[1],
+ w->x + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_PRESETS].left + 1,
+ w->y + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_PRESETS].top
+ );
+ }
+}
+
+/**
+*
+* rct2: 0x006BD785
+*/
+void window_colour_schemes_scrollpaint()
+{
+ int y;
+ uint8 selectedTab;
+ rct_window *w;
+ rct_drawpixelinfo *dpi;
+
+ window_paint_get_registers(w, dpi);
+
+ 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 < get_colour_scheme_tab_count(); i++) {
+ if (y > dpi->y + dpi->height) {
+ break;
+ }
+ 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);
+ }
+ 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 += _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 fa50c57605..a7a1c71066 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 33727efa7e..7da22bd3af 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,
@@ -253,19 +254,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);
@@ -429,12 +418,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 d5c0550956..651588b603 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];
@@ -1658,7 +1659,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];
@@ -1782,7 +1783,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];
@@ -1922,7 +1923,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];
@@ -2025,7 +2026,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];
@@ -2185,22 +2186,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 4fe22575a0..7bc2dd1d7e 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,
@@ -561,19 +562,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 9fa360876d..f66b8bb8d9 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 ec4d5332cc..69be2f881e 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;
}
/**
@@ -511,6 +509,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 87337e740b..aed304a256 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,
@@ -440,9 +441,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;
@@ -665,6 +663,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];
@@ -768,6 +767,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];
@@ -985,6 +985,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 4d2fb19bc9..1cc1aaa236 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)
@@ -717,19 +718,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 003bb5b7c0..fd93b4edc8 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);
+
}
/**
@@ -278,6 +278,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 c983ff82c1..9829af7465 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,9 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
WIDX_CONSTRUCTION_MARKER,
WIDX_CONSTRUCTION_MARKER_DROPDOWN,
WIDX_HARDWARE_DISPLAY_CHECKBOX,
+ WIDX_COLOUR_SCHEMES,
+ WIDX_COLOUR_SCHEMES_DROPDOWN,
+ WIDX_COLOUR_SCHEMES_BUTTON,
WIDX_LANGUAGE,
WIDX_LANGUAGE_DROPDOWN,
@@ -97,7 +101,6 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
WIDX_TOOLBAR_SHOW_FINANCES,
WIDX_TOOLBAR_SHOW_RESEARCH,
WIDX_TOOLBAR_SHOW_CHEATS,
- WIDX_RCT1_COLOUR_SCHEME,
WIDX_REAL_NAME_CHECKBOX,
WIDX_SAVE_PLUGIN_DATA_CHECKBOX,
@@ -132,57 +135,59 @@ 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, 1, 155, 299, 143, 154, STR_NONE, STR_NONE }, // colour schemes
+ { WWT_DROPDOWN_BUTTON, 1, 288, 298, 144, 153, 876, STR_NONE },
+ { WWT_DROPDOWN_BUTTON, 1, 26, 185, 159, 170, 5153, STR_NONE }, // colour schemes button
// 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 },
- { WWT_CHECKBOX, 2, 10, 299, 127, 138, 5153, STR_NONE }, // rct1 colour scheme
// 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
//Twitch tab
- { WWT_DROPDOWN_BUTTON, 2, 10, 299, 53, 64, STR_TWITCH_NAME, STR_NONE }, // Twitch channel name
+ { WWT_DROPDOWN_BUTTON, 2, 10, 299, 53, 64, STR_TWITCH_NAME, STR_NONE }, // Twitch channel name
{ WWT_CHECKBOX, 2, 10, 299, 68, 79, STR_TWITCH_PEEP_FOLLOWERS, STR_TWITCH_PEEP_FOLLOWERS_TIP }, // Twitch name peeps by follows
{ WWT_CHECKBOX, 2, 10, 299, 83, 94, STR_TWITCH_FOLLOWERS_TRACK, STR_TWITCH_FOLLOWERS_TRACK_TIP}, // Twitch information on for follows
{ WWT_CHECKBOX, 2, 10, 299, 98, 109, STR_TWITCH_PEEP_CHAT, STR_TWITCH_PEEP_CHAT_TIP }, // Twitch name peeps by chat
@@ -296,13 +301,15 @@ void window_options_open()
(1ULL << WIDX_TILE_SMOOTHING_CHECKBOX) |
(1ULL << WIDX_GRIDLINES_CHECKBOX) |
(1ULL << WIDX_HARDWARE_DISPLAY_CHECKBOX) |
+ (1ULL << WIDX_COLOUR_SCHEMES) |
+ (1ULL << WIDX_COLOUR_SCHEMES_DROPDOWN) |
+ (1ULL << WIDX_COLOUR_SCHEMES_BUTTON) |
(1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX) |
(1ULL << WIDX_AUTOSAVE) |
(1ULL << WIDX_AUTOSAVE_DROPDOWN) |
(1ULL << WIDX_ALLOW_SUBTYPE_SWITCHING) |
(1ULL << WIDX_DEBUGGING_TOOLS) |
(1ULL << WIDX_TEST_UNFINISHED_TRACKS) |
- (1ULL << WIDX_RCT1_COLOUR_SCHEME) |
(1ULL << WIDX_DATE_FORMAT) |
(1ULL << WIDX_DATE_FORMAT_DROPDOWN) |
(1ULL << WIDX_CHANNEL_BUTTON) |
@@ -314,9 +321,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;
}
/**
@@ -371,11 +375,6 @@ static void window_options_mouseup()
window_invalidate(w);
window_invalidate_by_class(WC_TOP_TOOLBAR);
break;
- case WIDX_RCT1_COLOUR_SCHEME:
- gConfigInterface.rct1_colour_scheme ^= 1;
- config_save_default();
- window_invalidate_all();
- break;
case WIDX_ALLOW_SUBTYPE_SWITCHING:
gConfigInterface.allow_subtype_switching ^= 1;
config_save_default();
@@ -418,6 +417,10 @@ static void window_options_mouseup()
config_save_default();
window_invalidate(w);
break;
+ case WIDX_COLOUR_SCHEMES_BUTTON:
+ window_colour_schemes_open();
+ window_invalidate(w);
+ break;
case WIDX_FOLLOWER_PEEP_NAMES_CHECKBOX:
gConfigTwitch.enable_follower_peep_names ^= 1;
config_save_default();
@@ -594,6 +597,18 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
gDropdownItemsChecked = 1 << gConfigGeneral.construction_marker_colour;
break;
+ case WIDX_COLOUR_SCHEMES_DROPDOWN:
+ num_items = gConfigColourSchemes.num_presets;
+
+ for (i = 0; i < num_items; i++) {
+ gDropdownItemsFormat[i] = 2777;
+ gDropdownItemsArgs[i] = (uint64)&gConfigColourSchemes.presets[i].name;
+ }
+
+ window_options_show_dropdown(w, widget, num_items);
+
+ gDropdownItemsChecked = 1 << gCurrentColourSchemePreset;
+ break;
case WIDX_LANGUAGE_DROPDOWN:
for (i = 1; i < LANGUAGE_COUNT; i++) {
gDropdownItemsFormat[i - 1] = 2777;
@@ -753,6 +768,12 @@ static void window_options_dropdown()
gfx_invalidate_screen();
}
break;
+ case WIDX_COLOUR_SCHEMES_DROPDOWN:
+ if (dropdownIndex != -1) {
+ colour_scheme_change_preset(dropdownIndex);
+ }
+ config_save_default();
+ break;
}
}
@@ -767,6 +788,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 +842,9 @@ 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;
+ window_options_widgets[WIDX_COLOUR_SCHEMES_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
+ window_options_widgets[WIDX_COLOUR_SCHEMES_BUTTON].type = WWT_DROPDOWN_BUTTON;
break;
case WINDOW_OPTIONS_PAGE_CULTURE:
// currency: pounds, dollars, etc. (10 total)
@@ -879,14 +904,12 @@ static void window_options_invalidate()
widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_FINANCES, gConfigInterface.toolbar_show_finances);
widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_RESEARCH, gConfigInterface.toolbar_show_research);
widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_CHEATS, gConfigInterface.toolbar_show_cheats);
- widget_set_checkbox_value(w, WIDX_RCT1_COLOUR_SCHEME, gConfigInterface.rct1_colour_scheme);
window_options_widgets[WIDX_SCREEN_EDGE_SCROLLING].type = WWT_CHECKBOX;
window_options_widgets[WIDX_HOTKEY_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
window_options_widgets[WIDX_TOOLBAR_SHOW_FINANCES].type = WWT_CHECKBOX;
window_options_widgets[WIDX_TOOLBAR_SHOW_RESEARCH].type = WWT_CHECKBOX;
window_options_widgets[WIDX_TOOLBAR_SHOW_CHEATS].type = WWT_CHECKBOX;
- window_options_widgets[WIDX_RCT1_COLOUR_SCHEME].type = WWT_CHECKBOX;
break;
case WINDOW_OPTIONS_PAGE_MISC:
widget_set_checkbox_value(w, WIDX_ALLOW_SUBTYPE_SWITCHING, gConfigInterface.allow_subtype_switching);
@@ -969,6 +992,17 @@ static void window_options_paint()
gfx_draw_string_left(dpi, STR_DISPLAY_RESOLUTION, w, 0, w->x + 10, w->y + window_options_widgets[WIDX_RESOLUTION].top + 1);
gfx_draw_string_left(dpi, STR_FULLSCREEN_MODE, w, 12, w->x + 10, w->y + window_options_widgets[WIDX_FULLSCREEN].top + 1);
gfx_draw_string_left(dpi, STR_CONSTRUCTION_MARKER, w, 0, w->x + 10, w->y + window_options_widgets[WIDX_CONSTRUCTION_MARKER].top + 1);
+
+ RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&gConfigColourSchemes.presets[gCurrentColourSchemePreset].name;
+ gfx_draw_string_left(dpi, 5238, NULL, w->colours[1], w->x + 10, w->y + window_options_widgets[WIDX_COLOUR_SCHEMES].top + 1);
+ gfx_draw_string_left(
+ dpi,
+ 1170,
+ (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS,
+ w->colours[1],
+ w->x + window_options_widgets[WIDX_COLOUR_SCHEMES].left + 1,
+ w->y + window_options_widgets[WIDX_COLOUR_SCHEMES].top
+ );
break;
case WINDOW_OPTIONS_PAGE_CULTURE:
gfx_draw_string_left(dpi, 2776, w, 12, w->x + 10, w->y + window_options_widgets[WIDX_LANGUAGE].top + 1);
diff --git a/src/windows/park.c b/src/windows/park.c
index 9a9ea8a061..97baae4c9b 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;
}
@@ -974,6 +972,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);
@@ -1224,6 +1223,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) {
@@ -1357,6 +1357,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) {
@@ -1492,6 +1493,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) {
@@ -1614,6 +1616,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) {
@@ -1800,6 +1803,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();
@@ -1945,6 +1949,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 6f93696dce..69a42ee60f 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) {
@@ -3920,7 +3920,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) {
@@ -4414,7 +4414,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) {
@@ -4707,7 +4707,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) {
@@ -5143,7 +5143,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) {
@@ -5489,7 +5489,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) {
@@ -5771,7 +5771,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) {
@@ -5910,23 +5910,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 c7c068366e..eccece57cc 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,
@@ -389,6 +390,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;
@@ -410,19 +412,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..f865bbe3b5 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, (rct_windowclass)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, (rct_windowclass)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, (rct_windowclass)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 c9bce60061..86cad33ca4 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,
@@ -104,19 +105,19 @@ enum WINDOW_STAFF_LIST_WIDGET_IDX {
};
static rct_widget window_staff_list_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_STAFF_HANDYMEN_TAB_TIP }, // handymen tab
- { WWT_TAB, 1, 34, 64, 17, 43, 0x02000144E, STR_STAFF_MECHANICS_TAB_TIP }, // mechanics tab
- { WWT_TAB, 1, 65, 95, 17, 43, 0x02000144E, STR_STAFF_SECURITY_TAB_TIP }, // security guards tab
- { WWT_TAB, 1, 96, 126, 17, 43, 0x02000144E, STR_STAFF_ENTERTAINERS_TAB_TIP }, // entertainers tab
- { WWT_SCROLL, 1, 3, 316, 72, 266, 3, STR_NONE }, // staff list
- { WWT_COLORBTN, 1, 130, 141, 58, 69, STR_NONE, STR_UNIFORM_COLOUR_TIP }, // uniform color picker
- { WWT_DROPDOWN_BUTTON, 0, 165, 309, 17, 29, STR_NONE, STR_HIRE_STAFF_TIP }, // hire button
- { WWT_FLATBTN, 1, 267, 290, 46, 69, 5175, STR_SHOW_PATROL_AREA_TIP }, // show staff patrol area tool
- { WWT_FLATBTN, 1, 291, 314, 46, 69, 5192, STR_SHOW_STAFF_ON_MAP_TIP }, // show staff on map button
+ { 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_STAFF_HANDYMEN_TAB_TIP }, // handymen tab
+ { WWT_TAB, 1, 34, 64, 17, 43, 0x02000144E, STR_STAFF_MECHANICS_TAB_TIP }, // mechanics tab
+ { WWT_TAB, 1, 65, 95, 17, 43, 0x02000144E, STR_STAFF_SECURITY_TAB_TIP }, // security guards tab
+ { WWT_TAB, 1, 96, 126, 17, 43, 0x02000144E, STR_STAFF_ENTERTAINERS_TAB_TIP }, // entertainers tab
+ { WWT_SCROLL, 1, 3, 316, 72, 266, 3, STR_NONE }, // staff list
+ { WWT_COLORBTN, 1, 130, 141, 58, 69, STR_NONE, STR_UNIFORM_COLOUR_TIP }, // uniform color picker
+ { WWT_DROPDOWN_BUTTON, 0, 165, 309, 17, 29, STR_NONE, STR_HIRE_STAFF_TIP }, // hire button
+ { WWT_FLATBTN, 1, 267, 290, 46, 69, 5175, STR_SHOW_PATROL_AREA_TIP }, // show staff patrol area tool
+ { WWT_FLATBTN, 1, 291, 314, 46, 69, 5192, STR_SHOW_STAFF_ON_MAP_TIP }, // show staff on map button
{ WIDGETS_END },
};
@@ -447,19 +448,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 90f94b4c04..93dfd5e7bc 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;
@@ -274,6 +272,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);
@@ -292,7 +291,9 @@ static void window_scenarioselect_paint()
window_draw_widgets(w, dpi);
// Use small text for the tabs when the RCT1 colour scheme is selected.
- format = (gConfigInterface.rct1_colour_scheme) ? 5138 : 1193;
+ //format = (gConfigInterface.rct1_colour_scheme) ? 5138 : 1193;
+ // Will reimplement this later
+ format = 1193;
// Text for each tab
for (i = 0; i < 5; i++) {
@@ -358,8 +359,11 @@ static void window_scenarioselect_scrollpaint()
gfx_clear(dpi, colour);
// Use white text for the scenario names when the RCT1 colour scheme is selected
- highlighted_format = gConfigInterface.rct1_colour_scheme ? 5139 : 1193;
- unhighlighted_format = gConfigInterface.rct1_colour_scheme ? 5139 : 1191;
+ //highlighted_format = gConfigInterface.rct1_colour_scheme ? 5139 : 1193;
+ //unhighlighted_format = gConfigInterface.rct1_colour_scheme ? 5139 : 1191;
+ // Will reimplement this later
+ highlighted_format = 1193;
+ unhighlighted_format = 1191;
y = 0;
for (i = 0; i < gScenarioListCount; i++) {
diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c
index 739a9a6316..522309108e 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,
@@ -494,21 +495,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 f7868c1f75..91019a49f9 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 099617f42c..4e0ebe457c 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 f3a446c11b..2d3e98d96c 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);