From e90c724a3a959c5b62694ab7cafdabe1d07628dc Mon Sep 17 00:00:00 2001 From: Robert Jordan Date: Sun, 7 Jun 2015 20:31:54 -0400 Subject: [PATCH] Rewrote Themes Added rct1 styles and lights. Themes are now easier to expand Added features tab to themes window --- data/language/english_uk.txt | 4 + resources/g2/17.png | Bin 0 -> 232 bytes resources/g2/18.png | Bin 0 -> 229 bytes resources/g2/19.png | Bin 0 -> 271 bytes resources/g2/20.png | Bin 0 -> 268 bytes resources/g2/21.png | Bin 0 -> 242 bytes resources/g2/22.png | Bin 0 -> 235 bytes resources/g2/23.png | Bin 0 -> 280 bytes resources/g2/24.png | Bin 0 -> 280 bytes resources/g2/25.png | Bin 0 -> 240 bytes resources/g2/26.png | Bin 0 -> 236 bytes resources/g2/27.png | Bin 0 -> 282 bytes resources/g2/28.png | Bin 0 -> 282 bytes src/config.c | 272 ++++++++++++++++++++++------- src/config.h | 21 ++- src/interface/themes.c | 219 ++++++++++++----------- src/interface/themes.h | 34 ++-- src/sprites.h | 13 ++ src/windows/park.c | 46 ++++- src/windows/ride.c | 90 +++++++++- src/windows/ride_list.c | 50 +++++- src/windows/themes.c | 231 +++++++++++++++++++----- src/windows/title_scenarioselect.c | 15 +- 23 files changed, 741 insertions(+), 254 deletions(-) create mode 100644 resources/g2/17.png create mode 100644 resources/g2/18.png create mode 100644 resources/g2/19.png create mode 100644 resources/g2/20.png create mode 100644 resources/g2/21.png create mode 100644 resources/g2/22.png create mode 100644 resources/g2/23.png create mode 100644 resources/g2/24.png create mode 100644 resources/g2/25.png create mode 100644 resources/g2/26.png create mode 100644 resources/g2/27.png create mode 100644 resources/g2/28.png diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index e8ebe8f5e2..88517d6666 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3614,3 +3614,7 @@ STR_5277 :Clear STR_5278 :Editable land rights STR_5279 :Normal map window STR_5280 :{SMALLFONT}{BLACK}Allow editing land ownership settings through the Map window +STR_5281 :{SMALLFONT}{BLACK}Features +STR_5282 :RCT1 Ride Open/Close Lights +STR_5283 :RCT1 Park Open/Close Lights +STR_5284 :RCT1 Scenario Selection Font diff --git a/resources/g2/17.png b/resources/g2/17.png new file mode 100644 index 0000000000000000000000000000000000000000..e81026a20516ac92bf5e71c5ab1bff6a958c3256 GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamUKs7M+SzC{oH>NS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1*%E&ba4!^ z@IN}?E$0CP4%WMCl1nD=U7C1V=0{Yg+Lw4anV%P&FMM0N^;^-Gbd_sCAqzgfiK%m% z672S}Y{&7Fnp0H*gAd-`{~^+Izl&7ZrJ$CXAze{?Axu+FKQun2ylVLh24l{$qi-0G Yd|2~xv-0U(KpPo6UHx3vIVCg!09-Xv-v9sr literal 0 HcmV?d00001 diff --git a/resources/g2/18.png b/resources/g2/18.png new file mode 100644 index 0000000000000000000000000000000000000000..3c09112bcbc8545ec799cc4167897bddf5211a96 GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamUKs7M+SzC{oH>NS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1*%E*ba4!^ z@IN{snu|e^hq>Cge-E*~F%(TEo!`*iCNS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1*+-wba4!^ z@IN|nBX5HN56fjk31$Nx)yDxw9LfO!MjaoeZ*QD5!AyUz(24uUn@s#%p46$uUD?E+ zKJ|~l!BjP?vPHRnd!FlYyx6yimu-c4_@s#f9RZB6FWV%54rB0i L^>bP0l+XkKnrKNS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1*+-tba4!^ z@IN}?pkRXn56jQU8LSaK{@oim=8GgLiU}1PvP-h;PkYAZvFVAzUvZ_NEw2rCZ|L6| zzQN%|&KJ&Y7fdsyqMoI{ZPZQa{V8zs8k5rdx2A0ZOATZys(G8z^qpord)2fdYME=t z>Sw#dJ{B-rGKxFwGgn_6Z@SU)K+8Ty(feF8y90h}2km0aO?&xhj!=FV&{Yhcu6{1- HoD!M<4WV0e literal 0 HcmV?d00001 diff --git a/resources/g2/21.png b/resources/g2/21.png new file mode 100644 index 0000000000000000000000000000000000000000..3ef302396b82c22584173bd33fe81142d7948301 GIT binary patch literal 242 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamUKs7M+SzC{oH>NS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1*$3Vba4!^ z@IN}?B5#8M2kXyb4)+2Md)WhwGKURiB#X7YxN`rz_SVa7;O4xfzv|bfo<(x^xi_*k z-&Wam{yTRZpXSnJS-l^>&nnJLS(MwF{)hXh&o5P@3zKFkU0D*c<*|dBLzPTdoZiN| g4$}o{j_W(-+^*hzILNun31~Nir>mdKI;Vst0LMB{FaQ7m literal 0 HcmV?d00001 diff --git a/resources/g2/22.png b/resources/g2/22.png new file mode 100644 index 0000000000000000000000000000000000000000..13c5deff4f0621eeeba2a995a0811fd296ec374c GIT binary patch literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamUKs7M+SzC{oH>NS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1**yPba4!^ z@IN}?B4>jEkIUwEWs8>ieGeu2t+?GkYxk(%UoNS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1*)0m>Eak- z;eT}EM&1Sk9+u6Ftg6liLd<~%Y{>xuMhwaZ4qjdA`ELYN9i+Y2Tip2miz9qJgUj1u z?){}o-(IfKkS>sP=bt0|pgnre|3;?7+LQu@_cysUCLXbDG%ApsJxRn}@96~1118tM zE?1i2?6a_nRX5ATz~lV+6*W5?UY)!5&gSiQk)!?b8yxp59QBANS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1*)0m>Eak- z;h!vF@!|jfdW(1bY5(`z$TvCWq*(GWOm4`$b^mOC)5k2A>m{{2Km0$xd?`@XI{t+l zGhME;g#Fn4|NsB<9}9XF3Re`d99YTO);P;iuR+V5VTRiTl`gdfY!b&-2|fwgk$Ym+ z0u#UGO*VX!8fNkZahS23V%yCUzM{#%$8b~H47EK{juOwp1=w~odFCx(U}k3MJR-c~ Upy=KgKo>H2y85}Sb4q9e0Qh8Mj{pDw literal 0 HcmV?d00001 diff --git a/resources/g2/25.png b/resources/g2/25.png new file mode 100644 index 0000000000000000000000000000000000000000..55b8ae32970665b4c8f2fd6bf00ea5e608f8c9ad GIT binary patch literal 240 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamUKs7M+SzC{oH>NS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1**yOba4!^ z@IN}?Aa8>KhwIG)&FuYsj|BK03h?z;t_%svc)ZrWGLw1F1clFwR!w~>@byPrhp9x2 z|HZdj`W2Q-rheOf;C?>eNfqH-?LCje|28N fXv>-A`h<})dL!#&-Dk}}n;AS^{an^LB{Ts5ayU=> literal 0 HcmV?d00001 diff --git a/resources/g2/26.png b/resources/g2/26.png new file mode 100644 index 0000000000000000000000000000000000000000..c22e6db1713d739d9309b0f8231a35af09985a61 GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamUKs7M+SzC{oH>NS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1**yNba4!^ z@IN}?Am;%C9_GD{^0g&%_%15$`p=@bC`?yK{fqd)i2|=VZd^Nh*M8gOn2V9(d{Lb~ zN4)~PHfp__{ABNS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1*)0h>Eak- z;h!vF@!|jfdW*97_5bXv_S;G{-#Aeu!Jx(%G^gI~&;Li?|Nh_oUcA|`qd#2PmdKI;Vst0K{NlSO5S3 literal 0 HcmV?d00001 diff --git a/resources/g2/28.png b/resources/g2/28.png new file mode 100644 index 0000000000000000000000000000000000000000..d98274d407999df304af6a496126269731850782 GIT binary patch literal 282 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamUKs7M+SzC{oH>NS%G}c0*}aI zpqfJ<%qXhi)c_QfC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFC9O>H$w1*)0h>Eak- z;h!vF@!|jfdW&i6(|)YKcb@N 0) { lineBuffer[lineLength++] = 0; - themes_read_properties(preset, ¤tColourScheme, lineBuffer); + themes_read_properties(&gConfigThemes.presets[preset], ¤tSection, lineBuffer); } free(lineBuffer); @@ -1164,79 +1216,179 @@ bool themes_open(const utf8string path) return true; } -static bool themes_save(const utf8string path, int preset) +static bool themes_save(const_utf8string path, int preset) { FILE *file; int i, j; + value_union *value; file = fopen(path, "wb"); if (file == NULL) { - log_error("Unable to write to colour scheme file."); + log_error("Unable to write to theme file."); return false; } - - for (i = 0; i < (int)gNumColourSchemeWindows; i++) { - window_colour_scheme* colour_scheme_info = &gColourSchemes[i]; - window_colours* colour_scheme = &gConfigThemes.presets[preset].colour_schemes[i]; + + // Skip the window definition, we'll do that after + for (i = 1; i < countof(_themeSectionDefinitions); i++) { + theme_section_definition *section = &_themeSectionDefinitions[i]; fputc('[', file); - fwrite(colour_scheme_info->section_name, strlen(colour_scheme_info->section_name), 1, file); + fwrite(section->section_name, strlen(section->section_name), 1, file); fputc(']', file); fputc('\n', file); - for (j = 0; j < colour_scheme_info->num_colours; j++) { + for (j = 0; j < section->property_definitions_count; j++) { + theme_property_definition *property = §ion->property_definitions[j]; - fprintf(file, "colour_%d", j); + fwrite(property->property_name, strlen(property->property_name), 1, file); fwrite(" = ", 3, 1, file); - fprintf(file, "%u", colour_scheme->colours[j]); + + value = (value_union*)((size_t)&gConfigThemes.presets[preset] + (size_t)section->offset + (size_t)property->offset); + + if (property->enum_definitions != NULL) + config_write_enum(file, property->type, value, property->enum_definitions); + else + config_save_property_value(file, property->type, value); fputc('\n', file); } fputc('\n', file); } + for (i = 0; i < (int)gNumThemeWindows; i++) { + theme_section_definition *section = &_themeSectionDefinitions[0]; + + fputc('[', file); + fwrite(gThemeWindowDefinitions[i].section_name, strlen(gThemeWindowDefinitions[i].section_name), 1, file); + fputc(']', file); + fputc('\n', file); + + for (j = 0; j < section->property_definitions_count; j++) { + theme_property_definition *property = §ion->property_definitions[j]; + + fwrite(property->property_name, strlen(property->property_name), 1, file); + fwrite(" = ", 3, 1, file); + + value = (value_union*)((size_t)gConfigThemes.presets[preset].windows + (size_t)(sizeof(theme_window) * i) + (size_t)property->offset); + + if (property->enum_definitions != NULL) + config_write_enum(file, property->type, value, property->enum_definitions); + else + config_save_property_value(file, property->type, value); + fputc('\n', file); + } + } + fclose(file); return true; } -static void themes_read_properties(int preset, window_colours **colour_scheme, const_utf8string line) + +static void themes_read_properties(theme_preset *theme, theme_section_definition **currentSection, utf8string line) { - utf8string ch = (utf8string)line; + utf8 *ch = (utf8*)line; utf8_skip_whitespace(&ch); if (*ch == '[') { - utf8string sectionName; + const utf8 *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 = &(gConfigThemes.presets[preset].colour_schemes[i]); - break; - } - } - } + if (config_get_section(ch, §ionName, §ionNameSize)) + *currentSection = themes_get_section_def((utf8string)sectionName, sectionNameSize); } else { - if (*colour_scheme != NULL) { - utf8string propertyName, value; + if (*currentSection != NULL) { + utf8 *propertyName, *value; int propertyNameSize, valueSize; if (config_get_property_name_value(ch, &propertyName, &propertyNameSize, &value, &valueSize)) { - propertyName[propertyNameSize] = '\0'; - themes_set_property(*colour_scheme, propertyName, value); + theme_property_definition *property; + property = themes_get_property_def(*currentSection, propertyName, propertyNameSize); + if (property != NULL) + themes_set_property(theme, *currentSection, property, value, valueSize); } } } } - -static void themes_set_property(window_colours *colour_scheme, utf8string name, utf8string value) +static void themes_set_property(theme_preset *theme, const theme_section_definition *section, const theme_property_definition *property, utf8string value, int valueSize) { - const_utf8string colour_names[] = { "colour_0", "colour_1", "colour_2", "colour_3", "colour_4", "colour_5" }; + value_union *destValue = (value_union*)((size_t)theme + (size_t)section->offset + (size_t)property->offset); - for (int i = 0; i < 6; i++) { - if (strcmp(name, colour_names[i]) == 0) { - colour_scheme->colours[i] = (uint8)strtol(value, NULL, 0); + // Get getting the address from the windows pointer instead + if (section == &_themeSectionDefinitions[0]) + destValue = (value_union*)((size_t)theme->windows + (size_t)section->offset + (size_t)property->offset); + + if (property->enum_definitions != NULL) + if (config_read_enum(destValue, _configValueTypeSize[property->type], value, valueSize, property->enum_definitions)) + return; + + switch (property->type) { + case CONFIG_VALUE_TYPE_BOOLEAN: + if (_strnicmp(value, "false", valueSize) == 0) destValue->value_boolean = false; + else if (_strnicmp(value, "true", valueSize) == 0) destValue->value_boolean = true; + else destValue->value_boolean = strtol(value, NULL, 0) != 0; + break; + case CONFIG_VALUE_TYPE_UINT8: + destValue->value_uint8 = (uint8)strtol(value, NULL, 0); + break; + case CONFIG_VALUE_TYPE_UINT16: + destValue->value_uint16 = (uint16)strtol(value, NULL, 0); + break; + case CONFIG_VALUE_TYPE_UINT32: + destValue->value_uint32 = (uint32)strtol(value, NULL, 0); + break; + case CONFIG_VALUE_TYPE_SINT8: + destValue->value_sint8 = (sint8)strtol(value, NULL, 0); + break; + case CONFIG_VALUE_TYPE_SINT16: + destValue->value_sint16 = (sint16)strtol(value, NULL, 0); + break; + case CONFIG_VALUE_TYPE_SINT32: + destValue->value_sint32 = (sint32)strtol(value, NULL, 0); + break; + case CONFIG_VALUE_TYPE_FLOAT: + destValue->value_float = strtof(value, NULL); + break; + case CONFIG_VALUE_TYPE_DOUBLE: + destValue->value_double = strtod(value, NULL); + break; + case CONFIG_VALUE_TYPE_STRING: + SafeFree(destValue->value_string); + destValue->value_string = malloc(valueSize + 1); + memcpy(destValue->value_string, value, valueSize); + destValue->value_string[valueSize] = 0; + break; + } +} +static theme_section_definition* themes_get_section_def(utf8string name, int size) +{ + int i; + + // Skip the special definition + for (i = 1; i < countof(_themeSectionDefinitions); i++) { + const_utf8string sectionName = _themeSectionDefinitions[i].section_name; + if (sectionName[size] == 0 && _strnicmp(sectionName, name, size) == 0) + return &_themeSectionDefinitions[i]; + } + // Check for window definitions + for (i = 0; i < (int)gNumThemeWindows; i++) { + const_utf8string sectionName = gThemeWindowDefinitions[i].section_name; + if (sectionName[size] == 0 && _strnicmp(sectionName, name, size) == 0) { + _themeSectionDefinitions[0].offset = (size_t)(sizeof(theme_window) * i); + return &_themeSectionDefinitions[0]; } } + + return NULL; +} +static theme_property_definition *themes_get_property_def(theme_section_definition *section, utf8string name, int size) +{ + int i; + + for (i = 0; i < section->property_definitions_count; i++) { + const_utf8string propertyName = section->property_definitions[i].property_name; + if (propertyName[size] == 0 && _strnicmp(propertyName, name, size) == 0) + return §ion->property_definitions[i]; + } + + return NULL; } static void themes_remove_extension(char *path) diff --git a/src/config.h b/src/config.h index 4007453576..ce98146be4 100644 --- a/src/config.h +++ b/src/config.h @@ -176,13 +176,28 @@ typedef struct { uint8 enable_news; } twitch_configuration; -typedef struct { +typedef struct theme_window { uint8 colours[6]; -} window_colours; + // Define any other settings for all windows here + +} theme_window; + +// Define structures for any other settings here typedef struct { - window_colours *colour_schemes; + uint8 rct1_ride_lights; + uint8 rct1_park_lights; + uint8 rct1_scenario_font; +} theme_features; + + +typedef struct theme_preset { char name[256]; + theme_window *windows; + + // Add structures for any other settings here + theme_features features; + } theme_preset; typedef struct { diff --git a/src/interface/themes.c b/src/interface/themes.c index 06f66687ae..dc22390267 100644 --- a/src/interface/themes.c +++ b/src/interface/themes.c @@ -18,141 +18,154 @@ * along with this program. If not, see . *****************************************************************************/ -#include "../config.h" #include "../localisation/string_ids.h" #include "window.h" #include "themes.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_THEMES, { 1, 12, 12, 0, 0, 0 }, 3, 5218, "themes" }, - { 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" }, +#define COLOURS_1(c0) 1, { { (c0), 0, 0, 0, 0, 0 } } +#define COLOURS_2(c0, c1) 2, { { (c0), (c1), 0, 0, 0, 0 } } +#define COLOURS_3(c0, c1, c2) 3, { { (c0), (c1), (c2), 0, 0, 0 } } +#define COLOURS_4(c0, c1, c2, c3) 4, { { (c0), (c1), (c2), (c3), 0, 0 } } +#define COLOURS_5(c0, c1, c2, c3, c4) 5, { { (c0), (c1), (c2), (c3), (c4), 0 } } +#define COLOURS_6(c0, c1, c2, c3, c4, c5) 6, { { (c0), (c1), (c2), (c3), (c4), (c5) } } + +#define TWINDOW(window_class, window_name, window_string_id, theme) { window_class, window_name, window_string_id, theme } + +theme_window_definition gThemeWindowDefinitions[] = { + /* Window Class ini section name stringid window defaults */ + { WC_TOP_TOOLBAR, "top_toolbar", 5245, COLOURS_4(7, 12, 24, 1) }, + { WC_BOTTOM_TOOLBAR, "bottom_toolbar", 5246, COLOURS_4(140, 140, 0, 14) }, + { WC_RIDE, "ride", 5203, COLOURS_3(1, 26, 1) }, + { WC_RIDE_CONSTRUCTION, "ride_construction", 5199, COLOURS_3(24, 24, 24) }, + { WC_RIDE_LIST, "ride_list", 5204, COLOURS_3(1, 26, 26) }, + { WC_SAVE_PROMPT, "save_prompt", 5223, COLOURS_1(154) }, + { WC_CONSTRUCT_RIDE, "new_ride", 5201, COLOURS_3(24, 26, 26) }, + { WC_DEMOLISH_RIDE_PROMPT, "demolish_ride_prompt", 5224, COLOURS_1(154) }, + { WC_SCENERY, "scenery", 5197, COLOURS_3(24, 12, 12) }, + { WC_OPTIONS, "options", 5219, COLOURS_3(7, 7, 7) }, + { WC_FOOTPATH, "footpath", 5198, COLOURS_3(24, 24, 24) }, + { WC_LAND, "land", 5193, COLOURS_3(24, 24, 24) }, + { WC_WATER, "water", 5194, COLOURS_3(24, 24, 24) }, + { WC_PEEP, "guest", 5205, COLOURS_3(1, 15, 15) }, + { WC_GUEST_LIST, "guest_list", 5206, COLOURS_3(1, 15, 15) }, + { WC_STAFF_LIST, "staff_list", 5208, COLOURS_3(1, 4, 4) }, + { WC_FIRE_PROMPT, "staff_fire_prompt", 5225, COLOURS_1(154) }, + { WC_PARK_INFORMATION, "park_information", 5253, COLOURS_3(1, 19, 19) }, + { WC_FINANCES, "finances", 5187, COLOURS_3(1, 19, 19) }, + { WC_TITLE_MENU, "title_menu", 5249, COLOURS_3(140, 140, 140) }, + { WC_TITLE_EXIT, "title_exit", 5250, COLOURS_3(140, 140, 140) }, + { WC_RECENT_NEWS, "recent_news", 5192, COLOURS_3(1, 1, 0) }, + { WC_SCENARIO_SELECT, "scenario_select", 5252, COLOURS_3(1, 26, 26) }, + { WC_TRACK_DESIGN_LIST, "track_design_list", 5202, COLOURS_3(26, 26, 26) }, + { WC_TRACK_DESIGN_PLACE, "track_design_place", 5200, COLOURS_3(24, 24, 24) }, + { WC_NEW_CAMPAIGN, "new_campaign", 5188, COLOURS_3(19, 19, 19) }, + { WC_KEYBOARD_SHORTCUT_LIST, "keyboard_shortcuts", 5220, COLOURS_3(7, 7, 7) }, + { WC_CHANGE_KEYBOARD_SHORTCUT, "change_keyboard_shortcut", 5221, COLOURS_3(7, 7, 7) }, + { WC_MAP, "map", 5190, COLOURS_2(12, 24) }, + { WC_BANNER, "banner", 5209, COLOURS_3(24, 24, 24) }, + { WC_EDITOR_OBJECT_SELECTION, "editor_object_selection", 5210, COLOURS_3(4, 1, 1) }, + { WC_EDITOR_INVENTION_LIST, "editor_invention_list", 5211, COLOURS_3(4, 1, 1) }, + { WC_EDITOR_SCENARIO_OPTIONS, "editor_scenario_options", 5212, COLOURS_3(4, 1, 1) }, + { WC_EDTIOR_OBJECTIVE_OPTIONS, "editor_objection_options", 5213, COLOURS_3(4, 1, 1) }, + { WC_MANAGE_TRACK_DESIGN, "manage_track_design", 5215, COLOURS_3(1, 1, 1) }, + { WC_TRACK_DELETE_PROMPT, "track_delete_prompt", 5226, COLOURS_3(26, 26, 26) }, + { WC_INSTALL_TRACK, "install_track", 5216, COLOURS_3(26, 26, 26) }, + { WC_CLEAR_SCENERY, "clear_scenery", 5195, COLOURS_3(24, 24, 24) }, + { WC_CHEATS, "cheats", 5217, COLOURS_3(1, 19, 19) }, + { WC_RESEARCH, "research", 5189, COLOURS_3(1, 19, 19) }, + { WC_VIEWPORT, "viewport", 5191, COLOURS_3(24, 24, 24) }, + { WC_MAPGEN, "map_generation", 5214, COLOURS_3(12, 24, 24) }, + { WC_LOADSAVE, "loadsave", 5222, COLOURS_3(7, 7, 7) }, + { WC_LOADSAVE_OVERWRITE_PROMPT, "loadsave_overwrite_prompt", 5227, COLOURS_1(154) }, + { WC_TITLE_OPTIONS, "title_options", 5251, COLOURS_3(140, 140, 140) }, + { WC_LAND_RIGHTS, "land_rights", 5196, COLOURS_3(19, 19, 19) }, + { WC_THEMES, "themes", 5218, COLOURS_3(1, 12, 12) }, + { WC_STAFF, "staff", 5207, COLOURS_3(1, 4, 4) }, + { WC_EDITOR_TRACK_BOTTOM_TOOLBAR, "editor_track_bottom_toolbar", 5247, COLOURS_3(135, 135, 135) }, + { WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR, "editor_scenario_bottom_toolbar", 5248, COLOURS_3(150, 150, 141) }, }; +#define COLOURS_RCT1(c0, c1, c2, c3, c4, c5) { { (c0), (c1), (c2), (c3), (c4), (c5) } } -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 +theme_window_preset gThemeWindowsRCT1[] = { + { WC_TOP_TOOLBAR, COLOURS_RCT1(1, 1, 1, 1, 0, 0) }, + { WC_BOTTOM_TOOLBAR, COLOURS_RCT1(129, 129, 0, 18, 0, 0) }, + { WC_RIDE, COLOURS_RCT1(26, 1, 11, 0, 0, 0) }, + { WC_RIDE_LIST, COLOURS_RCT1(26, 1, 1, 0, 0, 0) }, + { WC_CONSTRUCT_RIDE, COLOURS_RCT1(26, 1, 1, 0, 0, 0) }, + { WC_PEEP, COLOURS_RCT1(22, 26, 26, 0, 0, 0) }, + { WC_GUEST_LIST, COLOURS_RCT1(22, 26, 26, 0, 0, 0) }, + { WC_STAFF_LIST, COLOURS_RCT1(12, 4, 4, 0, 0, 0) }, + { WC_FINANCES, COLOURS_RCT1(4, 1, 1, 0, 0, 0) }, + { WC_TITLE_MENU, COLOURS_RCT1(129, 129, 129, 0, 0, 0) }, + { WC_TITLE_EXIT, COLOURS_RCT1(129, 129, 129, 0, 0, 0) }, + { WC_NEW_CAMPAIGN, COLOURS_RCT1(4, 4, 1, 0, 0, 0) }, + { WC_TITLE_OPTIONS, COLOURS_RCT1(129, 129, 129, 0, 0, 0) }, + { WC_STAFF, COLOURS_RCT1(12, 4, 4, 0, 0, 0) }, { 0xFF, { 0, 0, 0, 0, 0, 0 } } // End }; uint16 gCurrentTheme = 0; -uint32 gNumColourSchemeWindows = sizeof(gColourSchemes) / sizeof(window_colour_scheme); +uint32 gNumThemeWindows = sizeof(gThemeWindowDefinitions) / sizeof(theme_window_definition); -window_colour_scheme* colour_scheme_get_by_class(rct_windowclass classification) + +theme_preset* theme_get_preset() { - for (int i = 0; i < sizeof(gColourSchemes); i++) { - if (gColourSchemes[i].classification == classification) { - return &(gColourSchemes[i]); + return &gConfigThemes.presets[gCurrentTheme]; +} + +theme_window_definition* theme_window_definition_get_by_class(rct_windowclass classification) +{ + for (int i = 0; i < (int)gNumThemeWindows; i++) { + if (gThemeWindowDefinitions[i].classification == classification) { + return &gThemeWindowDefinitions[i]; } } return NULL; } -int colour_scheme_get_index_by_class(rct_windowclass classification) +theme_window* theme_window_get_by_class(rct_windowclass classification) { - for (int i = 0; i < sizeof(gColourSchemes); i++) { - if (gColourSchemes[i].classification == classification) { - return i; + for (int i = 0; i < (int)gNumThemeWindows; i++) { + if (gThemeWindowDefinitions[i].classification == classification) { + return &gConfigThemes.presets[gCurrentTheme].windows[i]; } } - return -1; + return NULL; } - void colour_scheme_update(rct_window *window) { - window_colour_scheme* colour_scheme = colour_scheme_get_by_class(window->classification); + theme_window* theme = theme_window_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) { + for (int i = 0; i < 6; i++) { + window->colours[i] = theme->colours[i]; + if (theme->colours[i] & 0x80) { transparent = true; } } - //if (transparent) - window->flags |= WF_TRANSPARENT; - //else - // window->flags &= ~WF_TRANSPARENT; + // Some windows need to be transparent even if the colours aren't. + // There doesn't seem to be any side-effects for all windows being transparent + 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); - + theme_window* theme = theme_window_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) { + for (int i = 0; i < 6; i++) { + window->colours[i] = theme->colours[i]; + if (theme->colours[i] & 0x80) { transparent = true; } } - //if (transparent) - window->flags |= WF_TRANSPARENT; - //else - // window->flags &= ~WF_TRANSPARENT; + // Some windows need to be transparent even if the colours aren't. + // There doesn't seem to be any side-effects for all windows being transparent + window->flags |= WF_TRANSPARENT; } void theme_change_preset(int preset) @@ -170,25 +183,19 @@ void theme_change_preset(int preset) break; } gCurrentTheme = preset; - for (int i = 0; i < (int)gNumColourSchemeWindows; i++) { - for (int j = 0; j < gColourSchemes[i].num_colours; j++) { - gColourSchemes[i].colours[j] = gConfigThemes.presets[preset].colour_schemes[i].colours[j]; - } - } } window_invalidate_all(); } -void theme_create_preset(const char *name) +void theme_create_preset(int duplicate, const char *name) { int preset = gConfigThemes.num_presets; gConfigThemes.num_presets++; gConfigThemes.presets = realloc(gConfigThemes.presets, sizeof(theme_preset) * gConfigThemes.num_presets); strcpy(gConfigThemes.presets[preset].name, name); - gConfigThemes.presets[preset].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows); - for (int i = 0; i < (int)gNumColourSchemeWindows; i++) { - for (int j = 0; j < 6; j++) - gConfigThemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j]; + gConfigThemes.presets[preset].windows = malloc(sizeof(theme_window) * gNumThemeWindows); + for (int i = 0; i < (int)gNumThemeWindows; i++) { + gConfigThemes.presets[preset].windows[i] = gConfigThemes.presets[duplicate].windows[i]; } themes_save_preset(preset); theme_change_preset(preset); @@ -203,6 +210,8 @@ void theme_delete_preset(int preset) strcat(path, ".ini"); platform_file_delete(path); + free(gConfigThemes.presets[preset].windows); + for (int i = preset; i < gConfigThemes.num_presets - 1; i++) { gConfigThemes.presets[i] = gConfigThemes.presets[i + 1]; } diff --git a/src/interface/themes.h b/src/interface/themes.h index be5deb3ffe..4ca788aade 100644 --- a/src/interface/themes.h +++ b/src/interface/themes.h @@ -23,38 +23,42 @@ #include "../common.h" #include "window.h" +#include "../config.h" typedef struct { rct_windowclass classification; - uint8 colours[6]; - uint8 num_colours; - rct_string_id name; char *section_name; -} window_colour_scheme; - + rct_string_id name; + uint8 num_colours; + theme_window window; +} theme_window_definition; typedef struct { rct_windowclass classification; - uint8 colours[6]; -} marked_window_colours; + theme_window window; +} theme_window_preset; -extern window_colour_scheme gColourSchemes[]; - -extern marked_window_colours gColourSchemesRCT1[]; +// The definitions for window themes as well as the RCT2 preset +extern theme_window_definition gThemeWindowDefinitions[]; +// The preset for RCT1 window themes +extern theme_window_preset gThemeWindowsRCT1[]; +// The index of the current theme extern uint16 gCurrentTheme; +// The number of theme-able windows +extern uint32 gNumThemeWindows; -extern uint32 gNumColourSchemeWindows; - -window_colour_scheme* colour_scheme_get_by_class(rct_windowclass classification); -int colour_scheme_get_index_by_class(rct_windowclass classification); +theme_preset* theme_get_preset(); +theme_window_definition* theme_window_definition_get_by_class(rct_windowclass classification); +theme_window* theme_window_get_by_class(rct_windowclass classification); void colour_scheme_update(rct_window *window); void colour_scheme_update_by_class(rct_window *window, rct_windowclass classification); void theme_change_preset(int preset); -void theme_create_preset(const char *name); +void theme_create_preset(int duplicate, const char *name); void theme_delete_preset(int preset); void theme_rename_preset(int preset, const char *newName); + #endif \ No newline at end of file diff --git a/src/sprites.h b/src/sprites.h index b6b168f99a..b30b07c0a6 100644 --- a/src/sprites.h +++ b/src/sprites.h @@ -367,6 +367,19 @@ enum { SPR_G2_BUTTON_LARGE_SCENERY = SPR_G2_BEGIN + 14, SPR_G2_BUTTON_TREES = SPR_G2_BEGIN + 15, SPR_G2_BUTTON_FOOTPATH = SPR_G2_BEGIN + 16, + + SPR_G2_RCT1_CLOSE_BUTTON_0 = SPR_G2_BEGIN + 17, + SPR_G2_RCT1_CLOSE_BUTTON_1 = SPR_G2_BEGIN + 18, + SPR_G2_RCT1_CLOSE_BUTTON_2 = SPR_G2_BEGIN + 19, + SPR_G2_RCT1_CLOSE_BUTTON_3 = SPR_G2_BEGIN + 20, + SPR_G2_RCT1_TEST_BUTTON_0 = SPR_G2_BEGIN + 21, + SPR_G2_RCT1_TEST_BUTTON_1 = SPR_G2_BEGIN + 22, + SPR_G2_RCT1_TEST_BUTTON_2 = SPR_G2_BEGIN + 23, + SPR_G2_RCT1_TEST_BUTTON_3 = SPR_G2_BEGIN + 24, + SPR_G2_RCT1_OPEN_BUTTON_0 = SPR_G2_BEGIN + 25, + SPR_G2_RCT1_OPEN_BUTTON_1 = SPR_G2_BEGIN + 26, + SPR_G2_RCT1_OPEN_BUTTON_2 = SPR_G2_BEGIN + 27, + SPR_G2_RCT1_OPEN_BUTTON_3 = SPR_G2_BEGIN + 28, }; #endif diff --git a/src/windows/park.c b/src/windows/park.c index 273ba3ea9b..1ad99b3be5 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -70,6 +70,8 @@ enum WINDOW_PARK_WIDGET_IDX { //WIDX_BUY_CONSTRUCTION_RIGHTS, WIDX_LOCATE, WIDX_RENAME, + WIDX_CLOSE_LIGHT, + WIDX_OPEN_LIGHT, WIDX__ = 11, WIDX_PRICE, @@ -101,6 +103,8 @@ static rct_widget window_park_entrance_widgets[] = { //{ WWT_FLATBTN, 1, 205, 228, 97, 120, SPR_BUY_CONSTRUCTION_RIGHTS, SPR_BUY_CONSTRUCTION_RIGHTS_TIP }, // buy construction rights { WWT_FLATBTN, 1, 205, 228, 97, 120, SPR_LOCATE, STR_LOCATE_SUBJECT_TIP }, // locate { WWT_FLATBTN, 1, 205, 228, 121, 144, SPR_RENAME, STR_NAME_PARK_TIP }, // rename + { WWT_IMGBTN, 1, 210, 223, 51, 65, SPR_G2_RCT1_CLOSE_BUTTON_0, STR_NONE }, + { WWT_IMGBTN, 1, 210, 223, 66, 79, SPR_G2_RCT1_OPEN_BUTTON_0, STR_NONE }, { WIDGETS_END }, }; @@ -515,7 +519,9 @@ static uint32 window_park_page_enabled_widgets[] = { (1 << WIDX_BUY_LAND_RIGHTS) | //(1 << WIDX_BUY_CONSTRUCTION_RIGHTS) | (1 << WIDX_LOCATE) | - (1 << WIDX_RENAME), + (1 << WIDX_RENAME) | + (1 << WIDX_CLOSE_LIGHT) | + (1 << WIDX_OPEN_LIGHT), (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | @@ -716,6 +722,12 @@ static void window_park_entrance_mouseup() RCT2_GLOBAL(0x013CE962, uint32) = RCT2_GLOBAL(0x013573D8, uint32); window_text_input_open(w, WIDX_RENAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), 0, 32); break; + case WIDX_CLOSE_LIGHT: + park_set_open(0); + break; + case WIDX_OPEN_LIGHT: + park_set_open(1); + break; } } @@ -1036,7 +1048,7 @@ static void window_park_entrance_textinput() */ static void window_park_entrance_invalidate() { - int i; + int i, height; rct_window *w; window_get_register(w); @@ -1051,6 +1063,8 @@ static void window_park_entrance_invalidate() RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id); RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32); window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].image = park_is_open() ? SPR_OPEN : SPR_CLOSED; + window_park_entrance_widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + !park_is_open() * 2 + widget_is_pressed(w, WIDX_CLOSE_LIGHT); + window_park_entrance_widgets[WIDX_OPEN_LIGHT].image = SPR_G2_RCT1_OPEN_BUTTON_0 + park_is_open() * 2 + widget_is_pressed(w, WIDX_OPEN_LIGHT); // Only allow closing of park for guest / rating objective if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) == OBJECTIVE_GUESTS_AND_RATING) @@ -1065,21 +1079,45 @@ static void window_park_entrance_invalidate() window_park_entrance_widgets[WIDX_STATUS].right = w->width - 26; window_park_entrance_widgets[WIDX_STATUS].top = w->height - 13; window_park_entrance_widgets[WIDX_STATUS].bottom = w->height - 3; - for (i = WIDX_OPEN_OR_CLOSE; i <= WIDX_RENAME; i++) { + /*for (i = WIDX_OPEN_OR_CLOSE; i <= WIDX_RENAME; i++) { window_park_entrance_widgets[i].left = w->width - 25; window_park_entrance_widgets[i].right = w->width - 2; + }*/ + + if (theme_get_preset()->features.rct1_park_lights) { + window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].type = WWT_EMPTY; + window_park_entrance_widgets[WIDX_CLOSE_LIGHT].type = WWT_IMGBTN; + window_park_entrance_widgets[WIDX_OPEN_LIGHT].type = WWT_IMGBTN; + height = window_park_entrance_widgets[WIDX_OPEN_LIGHT].bottom + 5 - 24; + } + else { + window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].type = WWT_FLATBTN; + window_park_entrance_widgets[WIDX_CLOSE_LIGHT].type = WWT_EMPTY; + window_park_entrance_widgets[WIDX_OPEN_LIGHT].type = WWT_EMPTY; + height = 49; } // Only allow closing of park and purchase of land when there is money if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) { window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].type = WWT_EMPTY; + window_park_entrance_widgets[WIDX_CLOSE_LIGHT].type = WWT_EMPTY; + window_park_entrance_widgets[WIDX_OPEN_LIGHT].type = WWT_EMPTY; window_park_entrance_widgets[WIDX_BUY_LAND_RIGHTS].type = WWT_EMPTY; //window_park_entrance_widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].type = WWT_EMPTY; } else { - window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].type = WWT_FLATBTN; window_park_entrance_widgets[WIDX_BUY_LAND_RIGHTS].type = WWT_FLATBTN; //window_park_entrance_widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].type = WWT_FLATBTN; } + for (i = WIDX_CLOSE_LIGHT; i <= WIDX_OPEN_LIGHT; i++) { + window_park_entrance_widgets[i].left = w->width - 20; + window_park_entrance_widgets[i].right = w->width - 7; + } + for (i = WIDX_OPEN_OR_CLOSE; i <= WIDX_RENAME; i++, height += 24) { + window_park_entrance_widgets[i].left = w->width - 25; + window_park_entrance_widgets[i].right = w->width - 2; + window_park_entrance_widgets[i].top = height; + window_park_entrance_widgets[i].bottom = height + 23; + } } /** diff --git a/src/windows/ride.c b/src/windows/ride.c index c184097530..11f60470fe 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -81,6 +81,9 @@ enum { WIDX_RENAME, WIDX_LOCATE, WIDX_DEMOLISH, + WIDX_CLOSE_LIGHT, + WIDX_TEST_LIGHT, + WIDX_OPEN_LIGHT, WIDX_VEHICLE_TYPE = 14, WIDX_VEHICLE_TYPE_DROPDOWN, @@ -175,6 +178,8 @@ enum { WIDX_SHOW_GUESTS_QUEUING }; +#define RCT1_LIGHT_OFFSET 4 + // 0x009ADC34 static rct_widget window_ride_main_widgets[] = { { WWT_FRAME, 0, 0, 315, 0, 206, 0x0FFFFFFFF, STR_NONE }, @@ -201,6 +206,9 @@ static rct_widget window_ride_main_widgets[] = { { WWT_FLATBTN, 1, 291, 314, 94, 117, SPR_RENAME, STR_NAME_RIDE_TIP }, { WWT_FLATBTN, 1, 291, 314, 118, 141, SPR_LOCATE, STR_LOCATE_SUBJECT_TIP }, { WWT_FLATBTN, 1, 291, 314, 142, 165, SPR_DEMOLISH, STR_DEMOLISH_RIDE_TIP }, + { WWT_IMGBTN, 1, 296, 309, 48, 61, SPR_G2_RCT1_CLOSE_BUTTON_0, STR_NONE }, + { WWT_IMGBTN, 1, 296, 309, 62, 75, SPR_G2_RCT1_TEST_BUTTON_0, STR_NONE }, + { WWT_IMGBTN, 1, 296, 309, 76, 89, SPR_G2_RCT1_OPEN_BUTTON_0, STR_NONE }, { WIDGETS_END }, }; @@ -481,7 +489,7 @@ static rct_widget *window_ride_page_widgets[] = { }; const uint64 window_ride_page_enabled_widgets[] = { - 0x00000000007DBFF4, + 0x0000000003FDBFF4, 0x00000000001EFFF4, 0x0000019E777DBFF4, 0x000000000001FFF4, @@ -1609,6 +1617,8 @@ static void window_ride_main_mouseup() { short widgetIndex; rct_window *w; + rct_ride *ride; + int status; window_widget_get_registers(w, widgetIndex); @@ -1640,6 +1650,31 @@ static void window_ride_main_mouseup() case WIDX_DEMOLISH: window_ride_demolish_prompt_open(w->number); break; + case WIDX_CLOSE_LIGHT: + case WIDX_TEST_LIGHT: + case WIDX_OPEN_LIGHT: + + ride = GET_RIDE(w->number); + + switch (widgetIndex - WIDX_CLOSE_LIGHT) { + case 0: + status = RIDE_STATUS_CLOSED; + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = 1004; + break; + case 1: + status = RIDE_STATUS_TESTING; + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = 1003; + break; + case 2: + status = RIDE_STATUS_OPEN; + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = 1002; + break; + } + + RCT2_GLOBAL(0x013CE952 + 6, uint16) = ride->name; + RCT2_GLOBAL(0x013CE952 + 8, uint32) = ride->name_arguments; + ride_set_status(w->number, status); + break; } } @@ -1656,7 +1691,10 @@ static void window_ride_main_resize() window_get_register(w); w->flags |= WF_RESIZABLE; - window_set_resize(w, 316, 180, 500, 450); + int minHeight = 180; + if (theme_get_preset()->features.rct1_ride_lights); + minHeight = 200 + RCT1_LIGHT_OFFSET - (ride_type_has_flag(GET_RIDE(w->number)->type, RIDE_TYPE_FLAG_NO_TEST_MODE) ? 14 : 0); + window_set_resize(w, 316, minHeight, 500, 450); viewport = w->viewport; if (viewport != NULL) { @@ -1972,7 +2010,7 @@ static void window_ride_main_invalidate() { rct_window *w; rct_widget *widgets; - int i; + int i, height; window_get_register(w); colour_scheme_update(w); @@ -1996,6 +2034,10 @@ static void window_ride_main_invalidate() RCT2_GLOBAL(0x013CE952 + 2, uint32) = ride->name_arguments; window_ride_main_widgets[WIDX_OPEN].image = SPR_CLOSED + ride->status; + window_ride_main_widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + (ride->status == RIDE_STATUS_CLOSED) * 2 + widget_is_pressed(w, WIDX_CLOSE_LIGHT); + window_ride_main_widgets[WIDX_TEST_LIGHT].image = SPR_G2_RCT1_TEST_BUTTON_0 + (ride->status == RIDE_STATUS_TESTING) * 2 + widget_is_pressed(w, WIDX_TEST_LIGHT); + window_ride_main_widgets[WIDX_OPEN_LIGHT].image = SPR_G2_RCT1_OPEN_BUTTON_0 + (ride->status == RIDE_STATUS_OPEN) * 2 + widget_is_pressed(w, WIDX_OPEN_LIGHT); + window_ride_anchor_border_widgets(w); // Anchor main page specific widgets @@ -2004,15 +2046,49 @@ static void window_ride_main_invalidate() window_ride_main_widgets[WIDX_STATUS].right = w->width - 26; window_ride_main_widgets[WIDX_STATUS].top = w->height - 13; window_ride_main_widgets[WIDX_STATUS].bottom = w->height - 3; - for (i = WIDX_OPEN; i <= WIDX_DEMOLISH; i++) { - window_ride_main_widgets[i].left = w->width - 25; - window_ride_main_widgets[i].right = w->width - 2; - } window_ride_main_widgets[WIDX_VIEW].right = w->width - 60; window_ride_main_widgets[WIDX_VIEW_DROPDOWN].right = w->width - 61; window_ride_main_widgets[WIDX_VIEW_DROPDOWN].left = w->width - 71; window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10); + + if (theme_get_preset()->features.rct1_ride_lights) { + window_ride_main_widgets[WIDX_OPEN].type = WWT_EMPTY; + window_ride_main_widgets[WIDX_CLOSE_LIGHT].type = WWT_IMGBTN; + window_ride_main_widgets[WIDX_TEST_LIGHT].type = (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_NO_TEST_MODE) ? WWT_EMPTY : WWT_IMGBTN); + window_ride_main_widgets[WIDX_OPEN_LIGHT].type = WWT_IMGBTN; + + height = 62; + if (window_ride_main_widgets[WIDX_TEST_LIGHT].type != WWT_EMPTY) { + window_ride_main_widgets[WIDX_TEST_LIGHT].top = height; + window_ride_main_widgets[WIDX_TEST_LIGHT].bottom = height + 13; + height += 14; + } + window_ride_main_widgets[WIDX_OPEN_LIGHT].top = height; + window_ride_main_widgets[WIDX_OPEN_LIGHT].bottom = height + 13; + height += 14 - 24 + RCT1_LIGHT_OFFSET; + + w->min_height = 200 + RCT1_LIGHT_OFFSET - (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_NO_TEST_MODE) ? 14 : 0); + if (w->height < w->min_height) + window_event_resize_call(w); + } + else { + window_ride_main_widgets[WIDX_OPEN].type = WWT_FLATBTN; + window_ride_main_widgets[WIDX_CLOSE_LIGHT].type = WWT_EMPTY; + window_ride_main_widgets[WIDX_TEST_LIGHT].type = WWT_EMPTY; + window_ride_main_widgets[WIDX_OPEN_LIGHT].type = WWT_EMPTY; + height = window_ride_main_widgets[WIDX_OPEN].top; + } + for (i = WIDX_CLOSE_LIGHT; i <= WIDX_OPEN_LIGHT; i++) { + window_ride_main_widgets[i].left = w->width - 20; + window_ride_main_widgets[i].right = w->width - 7; + } + for (i = WIDX_OPEN; i <= WIDX_DEMOLISH; i++, height += 24) { + window_ride_main_widgets[i].left = w->width - 25; + window_ride_main_widgets[i].right = w->width - 2; + window_ride_main_widgets[i].top = height; + window_ride_main_widgets[i].bottom = height + 23; + } } /** diff --git a/src/windows/ride_list.c b/src/windows/ride_list.c index df045542a2..41780614cb 100644 --- a/src/windows/ride_list.c +++ b/src/windows/ride_list.c @@ -48,7 +48,9 @@ enum WINDOW_RIDE_LIST_WIDGET_IDX { WIDX_TAB_1, WIDX_TAB_2, WIDX_TAB_3, - WIDX_LIST + WIDX_LIST, + WIDX_CLOSE_LIGHT, + WIDX_OPEN_LIGHT }; static rct_widget window_ride_list_widgets[] = { @@ -64,6 +66,8 @@ static rct_widget window_ride_list_widgets[] = { { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, STR_LIST_SHOPS_AND_STALLS_TIP }, // tab 2 { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, STR_LIST_KIOSKS_AND_FACILITIES_TIP }, // tab 3 { WWT_SCROLL, 1, 3, 336, 60, 236, 2, 65535 }, // list + { WWT_IMGBTN, 1, 320, 333, 62, 75, SPR_G2_RCT1_CLOSE_BUTTON_0, STR_NONE }, + { WWT_IMGBTN, 1, 320, 333, 76, 89, SPR_G2_RCT1_OPEN_BUTTON_0, STR_NONE }, { WIDGETS_END }, }; @@ -152,7 +156,9 @@ void window_ride_list_open() (1 << WIDX_SORT) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | - (1 << WIDX_TAB_3); + (1 << WIDX_TAB_3) | + (1 << WIDX_CLOSE_LIGHT) | + (1 << WIDX_OPEN_LIGHT); window_init_scroll_widgets(window); window->page = PAGE_RIDES; window->no_list_items = 0; @@ -194,12 +200,19 @@ static void window_ride_list_mouseup() if (w->page != widgetIndex - WIDX_TAB_1) { w->page = widgetIndex - WIDX_TAB_1; w->no_list_items = 0; + w->frame_no = 0; w->selected_list_item = -1; if (w->page != PAGE_RIDES && _window_ride_list_information_type > INFORMATION_TYPE_PROFIT) _window_ride_list_information_type = INFORMATION_TYPE_PROFIT; window_invalidate(w); } break; + case WIDX_CLOSE_LIGHT: + window_ride_list_close_all(w); + break; + case WIDX_OPEN_LIGHT: + window_ride_list_open_all(w); + break; } } @@ -388,6 +401,7 @@ static void window_ride_list_invalidate() { int i; rct_window *w; + rct_ride *ride; window_get_register(w); colour_scheme_update(w); @@ -412,6 +426,38 @@ 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; + w->widgets[WIDX_CLOSE_LIGHT].right = w->width - 7; + w->widgets[WIDX_CLOSE_LIGHT].left = w->width - 20; + w->widgets[WIDX_OPEN_LIGHT].right = w->width - 7; + w->widgets[WIDX_OPEN_LIGHT].left = w->width - 20; + + if (theme_get_preset()->features.rct1_ride_lights) { + w->widgets[WIDX_OPEN_CLOSE_ALL].type = WWT_EMPTY; + w->widgets[WIDX_CLOSE_LIGHT].type = WWT_IMGBTN; + w->widgets[WIDX_OPEN_LIGHT].type = WWT_IMGBTN; + + sint8 allClosed = -1; + sint8 allOpen = -1; + FOR_ALL_RIDES(i, ride) { + if (w->page != gRideClassifications[ride->type]) + continue; + if (ride->status == RIDE_STATUS_OPEN) { + if (allOpen == -1) allOpen = true; + allClosed = false; + } + else { + if (allClosed == -1) allClosed = true; + allOpen = false; + } + } + w->widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + (allClosed == 1) * 2 + widget_is_pressed(w, WIDX_CLOSE_LIGHT); + w->widgets[WIDX_OPEN_LIGHT].image = SPR_G2_RCT1_OPEN_BUTTON_0 + (allOpen == 1) * 2 + widget_is_pressed(w, WIDX_OPEN_LIGHT); + } + else { + w->widgets[WIDX_OPEN_CLOSE_ALL].type = WWT_FLATBTN; + w->widgets[WIDX_CLOSE_LIGHT].type = WWT_EMPTY; + w->widgets[WIDX_OPEN_LIGHT].type = WWT_EMPTY; + } } /** diff --git a/src/windows/themes.c b/src/windows/themes.c index eec0830b90..83c51ed8cf 100644 --- a/src/windows/themes.c +++ b/src/windows/themes.c @@ -43,7 +43,9 @@ enum { WINDOW_THEMES_TAB_RIDES_PEEPS, WINDOW_THEMES_TAB_EDITORS, WINDOW_THEMES_TAB_MISC, - WINDOW_THEMES_TAB_PROMPTS + WINDOW_THEMES_TAB_PROMPTS, + WINDOW_THEMES_TAB_FEATURES, + WINDOW_THEMES_TAB_COUNT } WINDOW_THEMES_TAB; static void window_themes_emptysub() { } @@ -107,6 +109,7 @@ enum WINDOW_STAFF_LIST_WIDGET_IDX { WIDX_THEMES_EDITORS_TAB, WIDX_THEMES_MISC_TAB, WIDX_THEMES_PROMPTS_TAB, + WIDX_THEMES_FEATURES_TAB, WIDX_THEMES_PRESETS, WIDX_THEMES_PRESETS_DROPDOWN, WIDX_THEMES_DUPLICATE_BUTTON, @@ -114,6 +117,9 @@ enum WINDOW_STAFF_LIST_WIDGET_IDX { WIDX_THEMES_RENAME_BUTTON, WIDX_THEMES_COLORBTN_MASK, WIDX_THEMES_LIST, + WIDX_THEMES_RCT1_RIDE_LIGHTS, + WIDX_THEMES_RCT1_PARK_LIGHTS, + WIDX_THEMES_RCT1_SCENARIO_FONT }; static rct_widget window_themes_widgets[] = { @@ -129,6 +135,7 @@ static rct_widget window_themes_widgets[] = { { WWT_TAB, 1, 158, 188, 17, 43, 0x02000144E, 5232 }, // editors tab { WWT_TAB, 1, 189, 219, 17, 43, 0x02000144E, 5233 }, // misc tab { WWT_TAB, 1, 220, 250, 17, 43, 0x02000144E, 5234 }, // prompts tab + { WWT_TAB, 1, 251, 281, 17, 43, 0x02000144E, 5281 }, // features 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, 5257 }, // Duplicate button @@ -136,6 +143,9 @@ static rct_widget window_themes_widgets[] = { { WWT_DROPDOWN_BUTTON, 1, 210, 300, 82, 93, 3348, 5259 }, // Rename button { WWT_COLORBTN, 1, 0, 0, 0, 0, STR_NONE, STR_NONE }, // color button mask { WWT_SCROLL, 1, 3, 316, 60, 103, 2, STR_NONE }, // staff list + { WWT_CHECKBOX, 1, 10, 299, 54, 65, 5282, STR_NONE }, // rct1 ride lights + { WWT_CHECKBOX, 1, 10, 299, 69, 80, 5283, STR_NONE }, // rct1 park lights + { WWT_CHECKBOX, 1, 10, 299, 84, 95, 5284, STR_NONE }, // rct1 scenario font { WIDGETS_END }, }; @@ -147,7 +157,8 @@ static int window_themes_tab_animation_loops[] = { 64, 32, 8, - 14 + 14, + 32 }; static int window_themes_tab_animation_divisor[] = { 4, @@ -157,6 +168,7 @@ static int window_themes_tab_animation_divisor[] = { 4, 2, 2, + 2, 2 }; static int window_themes_tab_sprites[] = { @@ -167,7 +179,8 @@ static int window_themes_tab_sprites[] = { SPR_TAB_RIDE_0, 5205, 5201, - SPR_TAB_STAFF_OPTIONS_0 + SPR_TAB_STAFF_OPTIONS_0, + SPR_TAB_FINANCES_MARKETING_0 }; static rct_windowclass window_themes_tab_1_classes[] = { @@ -254,29 +267,55 @@ void window_themes_init_vars() _selected_tab = WINDOW_THEMES_TAB_SETTINGS; } -static window_colour_scheme* get_colour_scheme_tab() +static theme_window_definition* get_colour_scheme_tab_definition() { switch (_selected_tab) { - case 1: return colour_scheme_get_by_class(window_themes_tab_1_classes[_color_index_1]); - case 2: return colour_scheme_get_by_class(window_themes_tab_2_classes[_color_index_1]); - case 3: return colour_scheme_get_by_class(window_themes_tab_3_classes[_color_index_1]); - case 4: return colour_scheme_get_by_class(window_themes_tab_4_classes[_color_index_1]); - case 5: return colour_scheme_get_by_class(window_themes_tab_5_classes[_color_index_1]); - case 6: return colour_scheme_get_by_class(window_themes_tab_6_classes[_color_index_1]); - case 7: return colour_scheme_get_by_class(window_themes_tab_7_classes[_color_index_1]); + case 1: return theme_window_definition_get_by_class(window_themes_tab_1_classes[_color_index_1]); + case 2: return theme_window_definition_get_by_class(window_themes_tab_2_classes[_color_index_1]); + case 3: return theme_window_definition_get_by_class(window_themes_tab_3_classes[_color_index_1]); + case 4: return theme_window_definition_get_by_class(window_themes_tab_4_classes[_color_index_1]); + case 5: return theme_window_definition_get_by_class(window_themes_tab_5_classes[_color_index_1]); + case 6: return theme_window_definition_get_by_class(window_themes_tab_6_classes[_color_index_1]); + case 7: return theme_window_definition_get_by_class(window_themes_tab_7_classes[_color_index_1]); } return NULL; } -static window_colour_scheme* get_colour_scheme_tab_by_index(int index) +static theme_window_definition* get_colour_scheme_tab_definition_by_index(int index) { switch (_selected_tab) { - case 1: return colour_scheme_get_by_class(window_themes_tab_1_classes[index]); - case 2: return colour_scheme_get_by_class(window_themes_tab_2_classes[index]); - case 3: return colour_scheme_get_by_class(window_themes_tab_3_classes[index]); - case 4: return colour_scheme_get_by_class(window_themes_tab_4_classes[index]); - case 5: return colour_scheme_get_by_class(window_themes_tab_5_classes[index]); - case 6: return colour_scheme_get_by_class(window_themes_tab_6_classes[index]); - case 7: return colour_scheme_get_by_class(window_themes_tab_7_classes[index]); + case 1: return theme_window_definition_get_by_class(window_themes_tab_1_classes[index]); + case 2: return theme_window_definition_get_by_class(window_themes_tab_2_classes[index]); + case 3: return theme_window_definition_get_by_class(window_themes_tab_3_classes[index]); + case 4: return theme_window_definition_get_by_class(window_themes_tab_4_classes[index]); + case 5: return theme_window_definition_get_by_class(window_themes_tab_5_classes[index]); + case 6: return theme_window_definition_get_by_class(window_themes_tab_6_classes[index]); + case 7: return theme_window_definition_get_by_class(window_themes_tab_7_classes[index]); + } + return NULL; +} +static theme_window* get_colour_scheme_tab() +{ + switch (_selected_tab) { + case 1: return theme_window_get_by_class(window_themes_tab_1_classes[_color_index_1]); + case 2: return theme_window_get_by_class(window_themes_tab_2_classes[_color_index_1]); + case 3: return theme_window_get_by_class(window_themes_tab_3_classes[_color_index_1]); + case 4: return theme_window_get_by_class(window_themes_tab_4_classes[_color_index_1]); + case 5: return theme_window_get_by_class(window_themes_tab_5_classes[_color_index_1]); + case 6: return theme_window_get_by_class(window_themes_tab_6_classes[_color_index_1]); + case 7: return theme_window_get_by_class(window_themes_tab_7_classes[_color_index_1]); + } + return NULL; +} +static theme_window* get_colour_scheme_tab_by_index(int index) +{ + switch (_selected_tab) { + case 1: return theme_window_get_by_class(window_themes_tab_1_classes[index]); + case 2: return theme_window_get_by_class(window_themes_tab_2_classes[index]); + case 3: return theme_window_get_by_class(window_themes_tab_3_classes[index]); + case 4: return theme_window_get_by_class(window_themes_tab_4_classes[index]); + case 5: return theme_window_get_by_class(window_themes_tab_5_classes[index]); + case 6: return theme_window_get_by_class(window_themes_tab_6_classes[index]); + case 7: return theme_window_get_by_class(window_themes_tab_7_classes[index]); } return NULL; } @@ -295,24 +334,24 @@ static int get_colour_scheme_tab_count() return 0; } -static int get_colour_scheme_index() { +/*static int get_colour_scheme_index() { switch (_selected_tab) { - case 1: return colour_scheme_get_index_by_class(window_themes_tab_1_classes[_color_index_1]); - case 2: return colour_scheme_get_index_by_class(window_themes_tab_2_classes[_color_index_1]); - case 3: return colour_scheme_get_index_by_class(window_themes_tab_3_classes[_color_index_1]); - case 4: return colour_scheme_get_index_by_class(window_themes_tab_4_classes[_color_index_1]); - case 5: return colour_scheme_get_index_by_class(window_themes_tab_5_classes[_color_index_1]); - case 6: return colour_scheme_get_index_by_class(window_themes_tab_6_classes[_color_index_1]); - case 7: return colour_scheme_get_index_by_class(window_themes_tab_7_classes[_color_index_1]); + case 1: return theme_window_get_index_by_class(window_themes_tab_1_classes[_color_index_1]); + case 2: return theme_window_get_index_by_class(window_themes_tab_2_classes[_color_index_1]); + case 3: return theme_window_get_index_by_class(window_themes_tab_3_classes[_color_index_1]); + case 4: return theme_window_get_index_by_class(window_themes_tab_4_classes[_color_index_1]); + case 5: return theme_window_get_index_by_class(window_themes_tab_5_classes[_color_index_1]); + case 6: return theme_window_get_index_by_class(window_themes_tab_6_classes[_color_index_1]); + case 7: return theme_window_get_index_by_class(window_themes_tab_7_classes[_color_index_1]); } return -1; -} +}*/ static void window_themes_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w) { int sprite_idx; - for (int i = 0; i < 8; i++) { + for (int i = 0; i < WINDOW_THEMES_TAB_COUNT; i++) { sprite_idx = window_themes_tab_sprites[i]; if (_selected_tab == i) sprite_idx += w->frame_no / window_themes_tab_animation_divisor[_selected_tab]; @@ -341,12 +380,16 @@ void window_themes_open() (1 << WIDX_THEMES_EDITORS_TAB) | (1 << WIDX_THEMES_MISC_TAB) | (1 << WIDX_THEMES_PROMPTS_TAB) | + (1 << WIDX_THEMES_FEATURES_TAB) | (1 << WIDX_THEMES_COLORBTN_MASK) | (1 << WIDX_THEMES_PRESETS) | (1 << WIDX_THEMES_PRESETS_DROPDOWN) | (1 << WIDX_THEMES_DUPLICATE_BUTTON) | (1 << WIDX_THEMES_DELETE_BUTTON) | - (1 << WIDX_THEMES_RENAME_BUTTON); + (1 << WIDX_THEMES_RENAME_BUTTON) | + (1 << WIDX_THEMES_RCT1_RIDE_LIGHTS) | + (1 << WIDX_THEMES_RCT1_PARK_LIGHTS) | + (1 << WIDX_THEMES_RCT1_SCENARIO_FONT); window_themes_init_vars(); @@ -429,6 +472,29 @@ static void window_themes_resize() gfx_invalidate_screen(); } } + else if (_selected_tab == WINDOW_THEMES_TAB_FEATURES) { + w->min_width = 320; + w->min_height = 107; + w->max_width = 320; + w->max_height = 107; + + if (w->width < w->min_width) { + w->width = w->min_width; + gfx_invalidate_screen(); + } + if (w->height < w->min_height) { + w->height = w->min_height; + gfx_invalidate_screen(); + } + if (w->width > w->max_width) { + w->width = w->max_width; + gfx_invalidate_screen(); + } + if (w->height > w->max_height) { + w->height = w->max_height; + gfx_invalidate_screen(); + } + } else { w->min_width = 320; w->min_height = 270; @@ -468,6 +534,7 @@ static void window_themes_mousedown(int widgetIndex, rct_window* w, rct_widget* case WIDX_THEMES_EDITORS_TAB: case WIDX_THEMES_MISC_TAB: case WIDX_THEMES_PROMPTS_TAB: + case WIDX_THEMES_FEATURES_TAB: newSelectedTab = widgetIndex - WIDX_THEMES_SETTINGS_TAB; if (_selected_tab == newSelectedTab) break; @@ -498,6 +565,36 @@ static void window_themes_mousedown(int widgetIndex, rct_window* w, rct_widget* gDropdownItemsChecked = 1 << gCurrentTheme; break; + case WIDX_THEMES_RCT1_RIDE_LIGHTS: + if (gCurrentTheme >= 2) { + theme_get_preset()->features.rct1_ride_lights ^= 1; + themes_save_preset(gCurrentTheme); + window_invalidate_all(); + } + else { + window_error_open(5241, STR_NONE); + } + break; + case WIDX_THEMES_RCT1_PARK_LIGHTS: + if (gCurrentTheme >= 2) { + theme_get_preset()->features.rct1_park_lights ^= 1; + themes_save_preset(gCurrentTheme); + window_invalidate_all(); + } + else { + window_error_open(5241, STR_NONE); + } + break; + case WIDX_THEMES_RCT1_SCENARIO_FONT: + if (gCurrentTheme >= 2) { + theme_get_preset()->features.rct1_scenario_font ^= 1; + themes_save_preset(gCurrentTheme); + window_invalidate_all(); + } + else { + window_error_open(5241, STR_NONE); + } + break; } } @@ -511,7 +608,6 @@ static void window_themes_dropdown() case WIDX_THEMES_LIST: if (dropdownIndex != -1) { get_colour_scheme_tab()->colours[_color_index_2] = dropdownIndex | get_colour_scheme_tab()->colours[_color_index_2] & 0x80; - gConfigThemes.presets[gCurrentTheme].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; @@ -545,7 +641,7 @@ void window_themes_scrollgetsize() { window_get_register(w); - if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) + if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS || _selected_tab == WINDOW_THEMES_TAB_FEATURES) return; int scrollHeight = get_colour_scheme_tab_count() * _row_height; @@ -580,7 +676,7 @@ void window_themes_scrollmousedown() { 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 (_color_index_2 < get_colour_scheme_tab_definition()->num_colours) { if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 && y2 >= _button_offset_y && y2 < _button_offset_y + 11) { if (gCurrentTheme >= 2) { window_themes_widgets[WIDX_THEMES_COLORBTN_MASK].left = _button_offset_x + _color_index_2 * 12 + window_themes_widgets[WIDX_THEMES_LIST].left; @@ -598,12 +694,9 @@ void window_themes_scrollmousedown() { if (gCurrentTheme >= 2) { if (get_colour_scheme_tab()->colours[_color_index_2] & 0x80) { get_colour_scheme_tab()->colours[_color_index_2] &= 0x7F; - - gConfigThemes.presets[gCurrentTheme].colour_schemes[get_colour_scheme_index()].colours[_color_index_2] &= 0x7F; } else { get_colour_scheme_tab()->colours[_color_index_2] |= 0x80; - gConfigThemes.presets[gCurrentTheme].colour_schemes[get_colour_scheme_index()].colours[_color_index_2] |= 0x80; } themes_save_preset(gCurrentTheme); window_invalidate_all(); @@ -661,7 +754,7 @@ static void window_themes_textinput() } if (!nameTaken) { if (widgetIndex == WIDX_THEMES_DUPLICATE_BUTTON) { - theme_create_preset(text); + theme_create_preset(gCurrentTheme, text); } else { theme_rename_preset(gCurrentTheme, text); @@ -689,7 +782,7 @@ void window_themes_invalidate() window_get_register(w); colour_scheme_update(w); - int pressed_widgets = w->pressed_widgets & 0xFFFFF00F; + int pressed_widgets = w->pressed_widgets & 0xFFFFE00F; uint8 widgetIndex = _selected_tab + 4; w->pressed_widgets = pressed_widgets | (1 << widgetIndex); @@ -709,11 +802,53 @@ void window_themes_invalidate() window_themes_widgets[WIDX_THEMES_LIST].right = w->width - 4; window_themes_widgets[WIDX_THEMES_LIST].bottom = w->height - 0x0F; + + window_themes_widgets[WIDX_THEMES_LIST].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_DELETE_BUTTON].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RENAME_BUTTON].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_PRESETS].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WWT_EMPTY; + if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) { window_themes_widgets[WIDX_THEMES_LIST].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WWT_DROPDOWN_BUTTON; + window_themes_widgets[WIDX_THEMES_DELETE_BUTTON].type = WWT_DROPDOWN_BUTTON; + window_themes_widgets[WIDX_THEMES_RENAME_BUTTON].type = WWT_DROPDOWN_BUTTON; + window_themes_widgets[WIDX_THEMES_PRESETS].type = WWT_DROPDOWN; + window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WWT_DROPDOWN_BUTTON; + } + else if (_selected_tab == WINDOW_THEMES_TAB_FEATURES) { + window_themes_widgets[WIDX_THEMES_LIST].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WWT_CHECKBOX; + window_themes_widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WWT_CHECKBOX; + window_themes_widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WWT_CHECKBOX; + window_themes_widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_DELETE_BUTTON].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RENAME_BUTTON].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_PRESETS].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WWT_EMPTY; + + widget_set_checkbox_value(w, WIDX_THEMES_RCT1_RIDE_LIGHTS, theme_get_preset()->features.rct1_ride_lights); + widget_set_checkbox_value(w, WIDX_THEMES_RCT1_PARK_LIGHTS, theme_get_preset()->features.rct1_park_lights); + widget_set_checkbox_value(w, WIDX_THEMES_RCT1_SCENARIO_FONT, theme_get_preset()->features.rct1_scenario_font); } else { window_themes_widgets[WIDX_THEMES_LIST].type = WWT_SCROLL; + window_themes_widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_DELETE_BUTTON].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_RENAME_BUTTON].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_PRESETS].type = WWT_EMPTY; + window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WWT_EMPTY; } } @@ -727,12 +862,7 @@ void window_themes_paint() { window_draw_widgets(w, dpi); window_themes_draw_tab_images(dpi, w); - if (_selected_tab != WINDOW_THEMES_TAB_SETTINGS) { - - 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 { + if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) { RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&gConfigThemes.presets[gCurrentTheme].name; gfx_draw_string_left(dpi, 5238, NULL, w->colours[1], w->x + 10, w->y + window_themes_widgets[WIDX_THEMES_PRESETS].top + 1); gfx_draw_string_left_clipped( @@ -745,6 +875,13 @@ void window_themes_paint() { w->x + window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].left - window_themes_widgets[WIDX_THEMES_PRESETS].left - 4 ); } + else if (_selected_tab == WINDOW_THEMES_TAB_FEATURES) { + + } + else { + 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); + } } /** @@ -759,7 +896,7 @@ void window_themes_scrollpaint() window_paint_get_registers(w, dpi); - if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) + if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS || _selected_tab == WINDOW_THEMES_TAB_FEATURES) return; if ((w->colours[1] & 0x80) == 0) @@ -788,9 +925,9 @@ void window_themes_scrollpaint() } } - for (int j = 0; j < get_colour_scheme_tab_by_index(i)->num_colours; j++) { + for (int j = 0; j < get_colour_scheme_tab_definition_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); + gfx_draw_string_left(dpi, get_colour_scheme_tab_definition_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) { diff --git a/src/windows/title_scenarioselect.c b/src/windows/title_scenarioselect.c index 57ec8a4ef1..8fdf3fc80c 100644 --- a/src/windows/title_scenarioselect.c +++ b/src/windows/title_scenarioselect.c @@ -289,11 +289,8 @@ static void window_scenarioselect_paint() window_paint_get_registers(w, dpi); 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; - // Will reimplement this later - format = 1193; + + format = (theme_get_preset()->features.rct1_scenario_font) ? 5138 : 1193; // Text for each tab for (i = 0; i < 5; i++) { @@ -358,12 +355,8 @@ static void window_scenarioselect_scrollpaint() colour = (colour << 24) | (colour << 16) | (colour << 8) | colour; 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; - // Will reimplement this later - highlighted_format = 1193; - unhighlighted_format = 1191; + highlighted_format = (theme_get_preset()->features.rct1_scenario_font) ? 5139 : 1193; + unhighlighted_format = (theme_get_preset()->features.rct1_scenario_font) ? 5139 : 1191; y = 0; for (i = 0; i < gScenarioListCount; i++) {