Merge pull request #1190 from trigger-death/themes-rename

Renamed Colour Schemes to Themes
This commit is contained in:
Ted John 2015-06-01 21:35:23 +01:00
commit cea0f77c03
60 changed files with 991 additions and 993 deletions

View File

@ -3486,7 +3486,7 @@ STR_5149 :{SMALLFONT}{BLACK}Open the cheats window
STR_5150 :Enable debugging tools
STR_5151 :,
STR_5152 :.
STR_5153 :Colour schemes...
STR_5153 :Edit Themes...
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
@ -3551,7 +3551,7 @@ STR_5214 :Map Generation
STR_5215 :Track Design Manager
STR_5216 :Track Design Manager List
STR_5217 :Cheats
STR_5218 :Colour Schemes
STR_5218 :Themes
STR_5219 :Options
STR_5220 :Keyboard Shortcuts
STR_5221 :Change Keyboard Shortcut
@ -3571,13 +3571,13 @@ STR_5234 :{SMALLFONT}{BLACK}Prompts
STR_5235 :{SMALLFONT}{BLACK}Settings
STR_5236 :Window:
STR_5237 :Palette:
STR_5238 :Colour Schemes:
STR_5238 :Current Theme:
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_5240 :Enter a name for the theme
STR_5241 :Can't change this theme
STR_5242 :Theme name already exists
STR_5243 :Invalid characters used
STR_5244 :Colour schemes
STR_5244 :Themes
STR_5245 :Top Toolbar
STR_5246 :Bottom Toolbar
STR_5247 :Track Editor Bottom Toolbar
@ -3589,3 +3589,7 @@ STR_5252 :Title Scenario Selection
STR_5253 :Park Information
STR_5254 :Add nausea
STR_5255 :{MEDIUMFONT}{BLACK}All peeps become nauseous
STR_5256 :Create a new theme to make changes to
STR_5257 :{SMALLFONT}{BLACK}Create a new theme based on the current one
STR_5258 :{SMALLFONT}{BLACK}Delete the current theme
STR_5259 :{SMALLFONT}{BLACK}Rename the current theme

View File

@ -37,7 +37,7 @@
<ClCompile Include="..\src\game.c" />
<ClCompile Include="..\src\hook.c" />
<ClCompile Include="..\src\input.c" />
<ClCompile Include="..\src\interface\colour_schemes.c">
<ClCompile Include="..\src\interface\themes.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
</ClCompile>
@ -145,7 +145,7 @@
<ClCompile Include="..\src\windows\track_place.c" />
<ClCompile Include="..\src\windows\viewport.c" />
<ClCompile Include="..\src\windows\water.c" />
<ClCompile Include="..\src\windows\colour_schemes.c">
<ClCompile Include="..\src\windows\themes.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
</ClCompile>
@ -175,7 +175,7 @@
<ClInclude Include="..\src\game.h" />
<ClInclude Include="..\src\hook.h" />
<ClInclude Include="..\src\input.h" />
<ClInclude Include="..\src\interface\colour_schemes.h">
<ClInclude Include="..\src\interface\themes.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
</ClInclude>

View File

@ -450,12 +450,12 @@
<ClCompile Include="..\src\network\http.cpp">
<Filter>Source\Network</Filter>
</ClCompile>
<ClCompile Include="..\src\windows\colour_schemes.c">
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\interface\colour_schemes.c">
<ClCompile Include="..\src\interface\themes.c">
<Filter>Source\Interface</Filter>
</ClCompile>
<ClCompile Include="..\src\windows\themes.c">
<Filter>Source\Windows</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\management\award.h">
@ -668,7 +668,7 @@
<ClInclude Include="..\src\network\twitch.h">
<Filter>Source\Network</Filter>
</ClInclude>
<ClInclude Include="..\src\interface\colour_schemes.h">
<ClInclude Include="..\src\interface\themes.h">
<Filter>Source\Interface</Filter>
</ClInclude>
</ItemGroup>

View File

@ -23,7 +23,7 @@
#include "localisation/language.h"
#include "localisation/localisation.h"
#include "util/util.h"
#include "interface/colour_schemes.h"
#include "interface/themes.h"
// Magic number for original game cfg file
static const int MagicNumber = 0x0003113A;
@ -182,7 +182,7 @@ config_property_definition _interfaceDefinitions[] = {
{ 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, 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 },
{ offsetof(interface_configuration, current_theme_preset), "current_theme", CONFIG_VALUE_TYPE_STRING, { .value_string = "*RCT2" }, NULL },
};
config_property_definition _soundDefinitions[] = {
@ -224,7 +224,7 @@ interface_configuration gConfigInterface;
sound_configuration gConfigSound;
cheat_configuration gConfigCheat;
twitch_configuration gConfigTwitch;
colour_schemes_configuration gConfigColourSchemes;
themes_configuration gConfigThemes;
bool config_open(const utf8string path);
bool config_save(const utf8string path);
@ -999,37 +999,37 @@ bool config_shortcut_keys_save()
#pragma endregion
#pragma region Colour Schemes
#pragma region Themes
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);
static void themes_remove_extension(char *path);
static bool themes_open(const utf8string path);
static bool themes_save(const utf8string path, int preset);
static void themes_read_properties(int preset, window_colours **current_window_colours, const_utf8string line);
static void themes_set_property(window_colours *colour_scheme, utf8string name, utf8string value);
void colour_schemes_set_default()
void themes_set_default()
{
utf8 path[MAX_PATH];
platform_get_user_directory(path, "colour schemes");
platform_get_user_directory(path, "themes");
platform_ensure_directory_exists(path);
gConfigColourSchemes.num_presets = 2;
gConfigColourSchemes.presets = malloc(sizeof(colour_scheme_preset) * gConfigColourSchemes.num_presets);
gConfigThemes.num_presets = 2;
gConfigThemes.presets = malloc(sizeof(theme_preset) * gConfigThemes.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);
strcpy(gConfigThemes.presets[0].name, language_get_string(2741));
gConfigThemes.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];
gConfigThemes.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);
strcpy(gConfigThemes.presets[1].name, language_get_string(2740));
gConfigThemes.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++) {
@ -1039,61 +1039,61 @@ void colour_schemes_set_default()
}
}
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]);
gConfigThemes.presets[1].colour_schemes[i].colours[j] = (changed_colour != 0xFF ? gColourSchemesRCT1[changed_colour].colours[j] : gColourSchemes[i].colours[j]);
}
}
}
void colour_schemes_load_presets()
void themes_load_presets()
{
utf8 path[MAX_PATH];
file_info file;
int fileEnumHandle, i;
platform_get_user_directory(path, "colour schemes");
platform_get_user_directory(path, "themes");
strcat(path, "*.ini");
fileEnumHandle = platform_enumerate_files_begin(path);
while (platform_enumerate_files_next(fileEnumHandle, &file)) {
platform_get_user_directory(path, "colour schemes");
platform_get_user_directory(path, "themes");
strcat(path, file.path);
colour_schemes_open(path);
themes_open(path);
}
platform_enumerate_files_end(fileEnumHandle);
if (strcmp(gConfigInterface.current_colour_scheme_preset, "*RCT2") == 0) {
colour_scheme_change_preset(0);
if (strcmp(gConfigInterface.current_theme_preset, "*RCT2") == 0) {
theme_change_preset(0);
}
else if (strcmp(gConfigInterface.current_colour_scheme_preset, "*RCT1") == 0) {
colour_scheme_change_preset(1);
else if (strcmp(gConfigInterface.current_theme_preset, "*RCT1") == 0) {
theme_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);
for (i = 2; i < gConfigThemes.num_presets; i++) {
if (strcmp(gConfigInterface.current_theme_preset, gConfigThemes.presets[i].name) == 0) {
theme_change_preset(i);
break;
}
}
if (i == gConfigColourSchemes.num_presets) {
colour_scheme_change_preset(0);
if (i == gConfigThemes.num_presets) {
theme_change_preset(0);
}
}
}
bool colour_schemes_save_preset(int preset)
bool themes_save_preset(int preset)
{
utf8 path[MAX_PATH];
platform_get_user_directory(path, "colour schemes");
strcat(path, gConfigColourSchemes.presets[preset].name);
platform_get_user_directory(path, "themes");
strcat(path, gConfigThemes.presets[preset].name);
strcat(path, ".ini");
if (colour_schemes_save(path, preset)) {
if (themes_save(path, preset)) {
return true;
}
return false;
}
bool colour_schemes_open(const utf8string path)
bool themes_open(const utf8string path)
{
FILE *file;
uint8 *lineBuffer;
@ -1108,21 +1108,21 @@ bool colour_schemes_open(const utf8string path)
// 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) {
for (preset = 2; preset < gConfigThemes.num_presets; preset++) {
if (strcmp(path, gConfigThemes.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);
if (preset == gConfigThemes.num_presets) {
gConfigThemes.num_presets++;
gConfigThemes.presets = realloc(gConfigThemes.presets, sizeof(theme_preset) * gConfigThemes.num_presets);
strcpy(gConfigThemes.presets[preset].name, path_get_filename(path));
themes_remove_extension(gConfigThemes.presets[preset].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++)
gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
gConfigThemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
}
}
@ -1139,7 +1139,7 @@ bool colour_schemes_open(const utf8string path)
while ((c = fgetc(file)) != EOF) {
if (c == '\n' || c == '\r') {
lineBuffer[lineLength++] = 0;
colour_schemes_read_properties(preset, &currentColourScheme, (const_utf8string)lineBuffer);
themes_read_properties(preset, &currentColourScheme, (const_utf8string)lineBuffer);
lineLength = 0;
}
else {
@ -1154,7 +1154,7 @@ bool colour_schemes_open(const utf8string path)
if (lineLength > 0) {
lineBuffer[lineLength++] = 0;
colour_schemes_read_properties(preset, &currentColourScheme, lineBuffer);
themes_read_properties(preset, &currentColourScheme, lineBuffer);
}
free(lineBuffer);
@ -1162,7 +1162,7 @@ bool colour_schemes_open(const utf8string path)
return true;
}
static bool colour_schemes_save(const utf8string path, int preset)
static bool themes_save(const utf8string path, int preset)
{
FILE *file;
int i, j;
@ -1175,7 +1175,7 @@ static bool colour_schemes_save(const utf8string path, int preset)
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];
window_colours* colour_scheme = &gConfigThemes.presets[preset].colour_schemes[i];
fputc('[', file);
fwrite(colour_scheme_info->section_name, strlen(colour_scheme_info->section_name), 1, file);
@ -1196,7 +1196,7 @@ static bool colour_schemes_save(const utf8string path, int preset)
return true;
}
static void colour_schemes_read_properties(int preset, window_colours **colour_scheme, const_utf8string line)
static void themes_read_properties(int preset, window_colours **colour_scheme, const_utf8string line)
{
utf8string ch = (utf8string)line;
utf8_skip_whitespace(&ch);
@ -1208,7 +1208,7 @@ static void colour_schemes_read_properties(int preset, window_colours **colour_s
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]);
*colour_scheme = &(gConfigThemes.presets[preset].colour_schemes[i]);
break;
}
}
@ -1220,13 +1220,13 @@ static void colour_schemes_read_properties(int preset, window_colours **colour_s
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);
themes_set_property(*colour_scheme, propertyName, value);
}
}
}
}
static void colour_schemes_set_property(window_colours *colour_scheme, utf8string name, utf8string value)
static void themes_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" };
@ -1237,7 +1237,7 @@ static void colour_schemes_set_property(window_colours *colour_scheme, utf8strin
}
}
static void colour_schemes_remove_extension(char *path)
static void themes_remove_extension(char *path)
{
char *ch;

View File

@ -147,7 +147,7 @@ typedef struct {
uint8 toolbar_show_cheats;
uint8 allow_subtype_switching;
uint8 console_small_font;
utf8string current_colour_scheme_preset;
utf8string current_theme_preset;
} interface_configuration;
typedef struct {
@ -181,12 +181,12 @@ typedef struct {
typedef struct {
window_colours *colour_schemes;
char name[256];
} colour_scheme_preset;
} theme_preset;
typedef struct {
colour_scheme_preset *presets;
theme_preset *presets;
uint16 num_presets;
} colour_schemes_configuration;
} themes_configuration;
typedef struct {
uint8 key;
@ -198,7 +198,7 @@ extern interface_configuration gConfigInterface;
extern sound_configuration gConfigSound;
extern cheat_configuration gConfigCheat;
extern twitch_configuration gConfigTwitch;
extern colour_schemes_configuration gConfigColourSchemes;
extern themes_configuration gConfigThemes;
extern uint16 gShortcutKeys[SHORTCUT_COUNT];
@ -214,8 +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);
void themes_set_default();
void themes_load_presets();
bool themes_save_preset(int preset);
#endif

View File

@ -780,8 +780,8 @@ static int cc_open(const char **argv, int argc) {
window_editor_inventions_list_open();
} else if (strcmp(argv[0], "options") == 0) {
window_options_open();
} else if (strcmp(argv[0], "colour_schemes") == 0) {
window_colour_schemes_open();
} else if (strcmp(argv[0], "themes") == 0) {
window_themes_open();
}
else {
console_writeline_error("Invalid window.");
@ -831,7 +831,7 @@ char* console_window_table[] = {
"object_selection",
"inventions_list",
"options",
"colour_schemes"
"themes"
};
console_command console_command_table[] = {

View File

@ -21,7 +21,7 @@
#include "../config.h"
#include "../localisation/string_ids.h"
#include "window.h"
#include "colour_schemes.h"
#include "themes.h"
window_colour_scheme gColourSchemes[] = {
{ WC_TOP_TOOLBAR, { 7, 12, 24, 1, 0, 0 }, 4, 5245, "top_toolbar" },
@ -70,7 +70,7 @@ window_colour_scheme gColourSchemes[] = {
{ 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_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" },
@ -97,7 +97,7 @@ marked_window_colours gColourSchemesRCT1[sizeof(gColourSchemes)] = {
{ 0xFF, { 0, 0, 0, 0, 0, 0 } } // End
};
uint16 gCurrentColourSchemePreset = 0;
uint16 gCurrentTheme = 0;
uint32 gNumColourSchemeWindows = sizeof(gColourSchemes) / sizeof(window_colour_scheme);
window_colour_scheme* colour_scheme_get_by_class(rct_windowclass classification)
@ -155,78 +155,78 @@ void colour_scheme_update_by_class(rct_window *window, rct_windowclass classific
// window->flags &= ~WF_TRANSPARENT;
}
void colour_scheme_change_preset(int preset)
void theme_change_preset(int preset)
{
if (preset >= 0 && preset < gConfigColourSchemes.num_presets) {
if (preset >= 0 && preset < gConfigThemes.num_presets) {
switch (preset) {
case 0:
gConfigInterface.current_colour_scheme_preset = "*RCT2";
gConfigInterface.current_theme_preset = "*RCT2";
break;
case 1:
gConfigInterface.current_colour_scheme_preset = "*RCT1";
gConfigInterface.current_theme_preset = "*RCT1";
break;
default:
gConfigInterface.current_colour_scheme_preset = gConfigColourSchemes.presets[preset].name;
gConfigInterface.current_theme_preset = gConfigThemes.presets[preset].name;
break;
}
gCurrentColourSchemePreset = preset;
gCurrentTheme = 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];
gColourSchemes[i].colours[j] = gConfigThemes.presets[preset].colour_schemes[i].colours[j];
}
}
}
window_invalidate_all();
}
void colour_scheme_create_preset(const char *name)
void theme_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);
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++)
gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
gConfigThemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
}
colour_schemes_save_preset(preset);
colour_scheme_change_preset(preset);
themes_save_preset(preset);
theme_change_preset(preset);
}
void colour_scheme_delete_preset(int preset)
void theme_delete_preset(int preset)
{
if (preset >= 2) {
utf8 path[MAX_PATH];
platform_get_user_directory(path, "colour schemes");
strcat(path, gConfigColourSchemes.presets[preset].name);
platform_get_user_directory(path, "themes");
strcat(path, gConfigThemes.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];
for (int i = preset; i < gConfigThemes.num_presets - 1; i++) {
gConfigThemes.presets[i] = gConfigThemes.presets[i + 1];
}
gConfigColourSchemes.num_presets--;
colour_scheme_change_preset(0);
gConfigThemes.num_presets--;
theme_change_preset(0);
}
}
void colour_scheme_rename_preset(int preset, const char *newName)
void theme_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);
platform_get_user_directory(src, "themes");
platform_get_user_directory(dest, "themes");
strcat(src, gConfigThemes.presets[preset].name);
strcat(dest, newName);
strcat(src, ".ini");
strcat(dest, ".ini");
platform_file_move(src, dest);
strcpy(gConfigColourSchemes.presets[gCurrentColourSchemePreset].name, newName);
strcpy(gConfigThemes.presets[gCurrentTheme].name, newName);
if (preset == gCurrentColourSchemePreset) {
gConfigInterface.current_colour_scheme_preset = gConfigColourSchemes.presets[gCurrentColourSchemePreset].name;
if (preset == gCurrentTheme) {
gConfigInterface.current_theme_preset = gConfigThemes.presets[gCurrentTheme].name;
}
}
}

View File

@ -42,7 +42,7 @@ extern window_colour_scheme gColourSchemes[];
extern marked_window_colours gColourSchemesRCT1[];
extern uint16 gCurrentColourSchemePreset;
extern uint16 gCurrentTheme;
extern uint32 gNumColourSchemeWindows;
@ -52,9 +52,9 @@ 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);
void theme_change_preset(int preset);
void theme_create_preset(const char *name);
void theme_delete_preset(int preset);
void theme_rename_preset(int preset, const char *newName);
#endif

View File

@ -405,7 +405,7 @@ enum {
WC_LOADSAVE_OVERWRITE_PROMPT = 116,
WC_TITLE_OPTIONS = 117,
WC_LAND_RIGHTS = 118,
WC_COLOUR_SCHEMES = 119,
WC_THEMES = 119,
// Only used for colour schemes
WC_STAFF = 220,
@ -566,7 +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_themes_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();

View File

@ -146,8 +146,8 @@ bool openrct2_initialise()
language_open(gConfigGeneral.language);
http_init();
colour_schemes_set_default();
colour_schemes_load_presets();
themes_set_default();
themes_load_presets();
if (!rct2_init())
return false;

View File

@ -23,7 +23,7 @@
#include "../sprites.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_ABOUT_WIDGET_IDX {
WIDX_BACKGROUND,

View File

@ -31,7 +31,7 @@
#include "error.h"
#include "dropdown.h"
#include "../drawing/drawing.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define WW 113
#define WH 96

View File

@ -33,7 +33,7 @@
#include "../world/footpath.h"
#include "../world/park.h"
#include "../world/sprite.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
//#define WW 200
//#define WH 128

View File

@ -25,7 +25,7 @@
#include "../sprites.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_CLEAR_SCENERY_WIDGET_IDX {
WIDX_BACKGROUND,

View File

@ -1,800 +0,0 @@
/*****************************************************************************
* 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 <http://www.gnu.org/licenses/>.
*****************************************************************************/
#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;
}
}

View File

@ -27,7 +27,7 @@
#include "../peep/staff.h"
#include "../sprites.h"
#include "../world/sprite.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define WW 200
#define WH 100

View File

@ -33,7 +33,7 @@
#include "../util/util.h"
#include "../world/scenery.h"
#include "error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WIDX_PREVIOUS_IMAGE, // 1

View File

@ -27,7 +27,7 @@
#include "../management/research.h"
#include "../object.h"
#include "../world/scenery.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#pragma region Widgets

View File

@ -29,7 +29,7 @@
#include "../ride/track.h"
#include "../scenario.h"
#include "error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WINDOW_OBJECT_SELECTION_PAGE_RIDE_VEHICLES_ATTRACTIONS,

View File

@ -28,7 +28,7 @@
#include "../world/park.h"
#include "dropdown.h"
#include "error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define DISABLE_SIX_FLAGS_CHECKBOX

View File

@ -26,7 +26,7 @@
#include "../sprites.h"
#include "error.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#pragma region Widgets

View File

@ -33,7 +33,7 @@
#include "../scenario.h"
#include "../sprites.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WINDOW_FINANCES_PAGE_SUMMARY,

View File

@ -30,7 +30,7 @@
#include "../world/footpath.h"
#include "../world/map.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
PATH_CONSTRUCTION_MODE_LAND,

View File

@ -31,7 +31,7 @@
#include "../world/climate.h"
#include "../world/park.h"
#include "../world/sprite.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_GAME_BOTTOM_TOOLBAR_WIDGET_IDX {
WIDX_LEFT_OUTSET,

View File

@ -37,7 +37,7 @@
#include "../input.h"
#include "dropdown.h"
#include "error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_GUEST_PAGE {
WINDOW_GUEST_OVERVIEW,

View File

@ -29,7 +29,7 @@
#include "../sprites.h"
#include "../world/sprite.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
PAGE_INDIVIDUAL,

View File

@ -28,7 +28,7 @@
#include "../ride/track.h"
#include "../sprites.h"
#include "error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WIDX_BACKGROUND,

View File

@ -26,7 +26,7 @@
#include "../sprites.h"
#include "../world/map.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_LAND_WIDGET_IDX {
WIDX_BACKGROUND,

View File

@ -27,7 +27,7 @@
#include "../sprites.h"
#include "../world/map.h"
#include "../game.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
const int MAX_LAND_RIGHTS_SIZE = 64;

View File

@ -28,7 +28,7 @@
#include "../scenario.h"
#include "../title.h"
#include "../windows/error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#pragma region Widgets

View File

@ -26,7 +26,7 @@
#include "../interface/window.h"
#include "../sprites.h"
#include "../world/scenery.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_MAP_WIDGET_IDX {

View File

@ -28,7 +28,7 @@
#include "../world/mapgen.h"
#include "../world/scenery.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WINDOW_MAPGEN_PAGE_BASE,

View File

@ -27,7 +27,7 @@
#include "../management/marketing.h"
#include "../ride/ride.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define SELECTED_RIDE_UNDEFINED ((uint16)0xFFFF)

View File

@ -30,7 +30,7 @@
#include "../ride/track.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define _window_new_ride_current_tab RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8)

View File

@ -27,7 +27,7 @@
#include "../sprites.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_NEWS_WIDGET_IDX {
WIDX_BACKGROUND,

View File

@ -39,7 +39,7 @@
#include "../sprites.h"
#include "dropdown.h"
#include "error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WINDOW_OPTIONS_PAGE_DISPLAY,
@ -72,9 +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_THEMES,
WIDX_THEMES_DROPDOWN,
WIDX_THEMES_BUTTON,
WIDX_LANGUAGE,
WIDX_LANGUAGE_DROPDOWN,
@ -301,9 +301,9 @@ 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_THEMES) |
(1ULL << WIDX_THEMES_DROPDOWN) |
(1ULL << WIDX_THEMES_BUTTON) |
(1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX) |
(1ULL << WIDX_AUTOSAVE) |
(1ULL << WIDX_AUTOSAVE_DROPDOWN) |
@ -417,8 +417,8 @@ static void window_options_mouseup()
config_save_default();
window_invalidate(w);
break;
case WIDX_COLOUR_SCHEMES_BUTTON:
window_colour_schemes_open();
case WIDX_THEMES_BUTTON:
window_themes_open();
window_invalidate(w);
break;
case WIDX_FOLLOWER_PEEP_NAMES_CHECKBOX:
@ -597,17 +597,17 @@ 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;
case WIDX_THEMES_DROPDOWN:
num_items = gConfigThemes.num_presets;
for (i = 0; i < num_items; i++) {
gDropdownItemsFormat[i] = 2777;
gDropdownItemsArgs[i] = (uint64)&gConfigColourSchemes.presets[i].name;
gDropdownItemsArgs[i] = (uint64)&gConfigThemes.presets[i].name;
}
window_options_show_dropdown(w, widget, num_items);
gDropdownItemsChecked = 1 << gCurrentColourSchemePreset;
gDropdownItemsChecked = 1 << gCurrentTheme;
break;
case WIDX_LANGUAGE_DROPDOWN:
for (i = 1; i < LANGUAGE_COUNT; i++) {
@ -768,9 +768,9 @@ static void window_options_dropdown()
gfx_invalidate_screen();
}
break;
case WIDX_COLOUR_SCHEMES_DROPDOWN:
case WIDX_THEMES_DROPDOWN:
if (dropdownIndex != -1) {
colour_scheme_change_preset(dropdownIndex);
theme_change_preset(dropdownIndex);
}
config_save_default();
break;
@ -842,9 +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;
window_options_widgets[WIDX_THEMES].type = WWT_DROPDOWN;
window_options_widgets[WIDX_THEMES_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
window_options_widgets[WIDX_THEMES_BUTTON].type = WWT_DROPDOWN_BUTTON;
break;
case WINDOW_OPTIONS_PAGE_CULTURE:
// currency: pounds, dollars, etc. (10 total)
@ -992,15 +992,16 @@ static void window_options_paint()
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(
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_options_widgets[WIDX_THEMES].top + 1);
gfx_draw_string_left_clipped(
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
w->x + window_options_widgets[WIDX_THEMES].left + 1,
w->y + window_options_widgets[WIDX_THEMES].top,
window_options_widgets[WIDX_THEMES_DROPDOWN].left - window_options_widgets[WIDX_THEMES].left - 4
);
break;
case WINDOW_OPTIONS_PAGE_CULTURE:

View File

@ -38,7 +38,7 @@
#include "../world/sprite.h"
#include "../management/finance.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_PARK_PAGE {
WINDOW_PARK_PAGE_ENTRANCE,

View File

@ -30,7 +30,7 @@
#include "../sprites.h"
#include "../world/scenery.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WINDOW_RESEARCH_PAGE_DEVELOPMENT,

View File

@ -36,7 +36,7 @@
#include "../world/sprite.h"
#include "../audio/audio.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define var_496(w) RCT2_GLOBAL((int)w + 0x496, uint16)

View File

@ -24,7 +24,7 @@
#include "../game.h"
#include "../ride/track.h"
#include "../drawing/drawing.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
/* move to ride.c */
void sub_6b2fa9(rct_windownumber number){

View File

@ -28,7 +28,7 @@
#include "../interface/widget.h"
#include "../interface/window.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
PAGE_RIDES,

View File

@ -28,7 +28,7 @@
#include "../openrct2.h"
#include "../sprites.h"
#include "../tutorial.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_SAVE_PROMPT_WIDGET_IDX {
WIDX_BACKGROUND,

View File

@ -32,7 +32,7 @@
#include "../world/scenery.h"
#include "../world/sprite.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define WINDOW_SCENERY_WIDTH 634
#define WINDOW_SCENERY_HEIGHT 142

View File

@ -23,7 +23,7 @@
#include "../interface/window.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define WW 250
#define WH 60

View File

@ -24,7 +24,7 @@
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include "../platform/platform.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define WW 340
#define WH 240

View File

@ -32,7 +32,7 @@
#include "error.h"
#include "dropdown.h"
#include "../drawing/drawing.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define WW 113
#define WH 96

View File

@ -34,7 +34,7 @@
#include "../input.h"
#include "dropdown.h"
#include "error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define WW 190
#define WH 180

View File

@ -27,7 +27,7 @@
#include "../peep/staff.h"
#include "../sprites.h"
#include "../world/sprite.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define WW 200
#define WH 100

View File

@ -31,7 +31,7 @@
#include "../peep/staff.h"
#include "../world/sprite.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WINDOW_STAFF_LIST_TAB_HANDYMEN,

793
src/windows/themes.c Normal file
View File

@ -0,0 +1,793 @@
/*****************************************************************************
* 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 <http://www.gnu.org/licenses/>.
*****************************************************************************/
#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/themes.h"
#include "error.h"
enum {
WINDOW_THEMES_TAB_SETTINGS,
WINDOW_THEMES_TAB_MAIN_UI,
WINDOW_THEMES_TAB_PARK,
WINDOW_THEMES_TAB_TOOLS,
WINDOW_THEMES_TAB_RIDES_PEEPS,
WINDOW_THEMES_TAB_EDITORS,
WINDOW_THEMES_TAB_MISC,
WINDOW_THEMES_TAB_PROMPTS
} WINDOW_THEMES_TAB;
static void window_themes_emptysub() { }
static void window_themes_close();
static void window_themes_mouseup();
static void window_themes_resize();
static void window_themes_mousedown(int widgetIndex, rct_window*w, rct_widget* widget);
static void window_themes_dropdown();
static void window_themes_update(rct_window *w);
static void window_themes_scrollgetsize();
static void window_themes_scrollmousedown();
static void window_themes_scrollmouseover();
static void window_themes_textinput();
static void window_themes_tooltip();
static void window_themes_invalidate();
static void window_themes_paint();
static void window_themes_scrollpaint();
static void window_themes_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w);
static void* window_themes_events[] = {
window_themes_close,
window_themes_mouseup,
window_themes_resize,
window_themes_mousedown,
window_themes_dropdown,
window_themes_emptysub,
window_themes_update,
window_themes_emptysub,
window_themes_emptysub,
window_themes_emptysub,
window_themes_emptysub,
window_themes_emptysub,
window_themes_emptysub,
window_themes_emptysub,
window_themes_emptysub,
window_themes_scrollgetsize,
window_themes_scrollmousedown,
window_themes_emptysub,
window_themes_scrollmouseover,
window_themes_textinput,
window_themes_emptysub,
window_themes_emptysub,
window_themes_tooltip,
window_themes_emptysub,
window_themes_emptysub,
window_themes_invalidate,
window_themes_paint,
window_themes_scrollpaint,
};
enum WINDOW_STAFF_LIST_WIDGET_IDX {
WIDX_THEMES_BACKGROUND,
WIDX_THEMES_TITLE,
WIDX_THEMES_CLOSE,
WIDX_THEMES_TAB_CONTENT_PANEL,
WIDX_THEMES_SETTINGS_TAB,
WIDX_THEMES_MAIN_UI_TAB,
WIDX_THEMES_PARK_TAB,
WIDX_THEMES_TOOLS_TAB,
WIDX_THEMES_RIDE_PEEPS_TAB,
WIDX_THEMES_EDITORS_TAB,
WIDX_THEMES_MISC_TAB,
WIDX_THEMES_PROMPTS_TAB,
WIDX_THEMES_PRESETS,
WIDX_THEMES_PRESETS_DROPDOWN,
WIDX_THEMES_DUPLICATE_BUTTON,
WIDX_THEMES_DELETE_BUTTON,
WIDX_THEMES_RENAME_BUTTON,
WIDX_THEMES_COLORBTN_MASK,
WIDX_THEMES_LIST,
};
static rct_widget window_themes_widgets[] = {
{ WWT_FRAME, 0, 0, 319, 0, 106, 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, 106, 0x0FFFFFFFF, STR_NONE }, // tab content panel
{ WWT_TAB, 1, 3, 33, 17, 43, 0x02000144E, 5235 }, // settings tab
{ WWT_TAB, 1, 34, 64, 17, 43, 0x02000144E, 5228 }, // main ui tab
{ WWT_TAB, 1, 65, 95, 17, 43, 0x02000144E, 5229 }, // park tab
{ WWT_TAB, 1, 96, 126, 17, 43, 0x02000144E, 5230 }, // tools tab
{ WWT_TAB, 1, 127, 157, 17, 43, 0x02000144E, 5232 }, // rides and peeps tab
{ 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_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
{ WWT_DROPDOWN_BUTTON, 1, 110, 200, 82, 93, 3349, 5258 }, // Delete button
{ 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
{ WIDGETS_END },
};
static int window_themes_tab_animation_loops[] = {
32,
32,
1,
1,
64,
32,
8,
14
};
static int window_themes_tab_animation_divisor[] = {
4,
4,
1,
1,
4,
2,
2,
2
};
static int window_themes_tab_sprites[] = {
5221,
SPR_TAB_KIOSKS_AND_FACILITIES_0,
5200,
SPR_G2_TAB_LAND,
SPR_TAB_RIDE_0,
5205,
5201,
SPR_TAB_STAFF_OPTIONS_0
};
static rct_windowclass window_themes_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_themes_tab_2_classes[] = {
WC_PARK_INFORMATION,
WC_FINANCES,
WC_NEW_CAMPAIGN,
WC_RESEARCH,
WC_MAP,
WC_VIEWPORT,
WC_RECENT_NEWS
};
static rct_windowclass window_themes_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_themes_tab_4_classes[] = {
WC_RIDE,
WC_RIDE_LIST,
WC_PEEP,
WC_GUEST_LIST,
WC_STAFF,
WC_STAFF_LIST,
WC_BANNER
};
static rct_windowclass window_themes_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_themes_tab_6_classes[] = {
WC_CHEATS,
WC_THEMES,
WC_OPTIONS,
WC_KEYBOARD_SHORTCUT_LIST,
WC_CHANGE_KEYBOARD_SHORTCUT,
WC_LOADSAVE
};
static rct_windowclass window_themes_tab_7_classes[] = {
WC_SAVE_PROMPT,
WC_DEMOLISH_RIDE_PROMPT,
WC_FIRE_PROMPT,
WC_TRACK_DELETE_PROMPT,
WC_LOADSAVE_OVERWRITE_PROMPT
};
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_themes_init_vars()
{
_selected_tab = WINDOW_THEMES_TAB_SETTINGS;
}
static window_colour_scheme* get_colour_scheme_tab()
{
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]);
}
return NULL;
}
static window_colour_scheme* get_colour_scheme_tab_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]);
}
return NULL;
}
static int get_colour_scheme_tab_count()
{
switch (_selected_tab) {
case 1: return sizeof(window_themes_tab_1_classes);
case 2: return sizeof(window_themes_tab_2_classes);
case 3: return sizeof(window_themes_tab_3_classes);
case 4: return sizeof(window_themes_tab_4_classes);
case 5: return sizeof(window_themes_tab_5_classes);
case 6: return sizeof(window_themes_tab_6_classes);
case 7: return sizeof(window_themes_tab_7_classes);
}
return 0;
}
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]);
}
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++) {
sprite_idx = window_themes_tab_sprites[i];
if (_selected_tab == i)
sprite_idx += w->frame_no / window_themes_tab_animation_divisor[_selected_tab];
gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_THEMES_SETTINGS_TAB + i].left, w->y + w->widgets[WIDX_THEMES_SETTINGS_TAB + i].top, 0);
}
}
void window_themes_open()
{
rct_window* window;
// Check if window is already open
window = window_bring_to_front_by_class(WC_THEMES);
if (window != NULL)
return;
window = window_create_auto_pos(320, 107, (uint32*)window_themes_events, WC_THEMES, 0x0400);
window->widgets = window_themes_widgets;
window->enabled_widgets =
(1 << WIDX_THEMES_CLOSE) |
(1 << WIDX_THEMES_SETTINGS_TAB) |
(1 << WIDX_THEMES_MAIN_UI_TAB) |
(1 << WIDX_THEMES_PARK_TAB) |
(1 << WIDX_THEMES_TOOLS_TAB) |
(1 << WIDX_THEMES_RIDE_PEEPS_TAB) |
(1 << WIDX_THEMES_EDITORS_TAB) |
(1 << WIDX_THEMES_MISC_TAB) |
(1 << WIDX_THEMES_PROMPTS_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);
window_themes_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 = 107;
window->max_width = 320;
window->max_height = 107;
window->flags |= WF_RESIZABLE;
}
void window_themes_close() {
rct_window *w;
window_get_register(w);
}
static void window_themes_mouseup()
{
short widgetIndex;
rct_window *w;
window_widget_get_registers(w, widgetIndex);
switch (widgetIndex) {
case WIDX_THEMES_CLOSE:
window_close(w);
break;
case WIDX_THEMES_DUPLICATE_BUTTON:
window_text_input_open(w, widgetIndex, 5239, 5240, 1170, (uint32)&gConfigThemes.presets[gCurrentTheme].name, 64);
break;
case WIDX_THEMES_DELETE_BUTTON:
if (gCurrentTheme >= 2) {
theme_delete_preset(gCurrentTheme);
}
else {
window_error_open(5241, STR_NONE);
}
break;
case WIDX_THEMES_RENAME_BUTTON:
if (gCurrentTheme >= 2) {
window_text_input_open(w, widgetIndex, 3348, 5240, 1170, (uint32)&gConfigThemes.presets[gCurrentTheme].name, 64);
}
else {
window_error_open(5241, STR_NONE);
}
break;
}
}
static void window_themes_resize()
{
rct_window *w;
window_get_register(w);
if (_selected_tab == WINDOW_THEMES_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_themes_mousedown(int widgetIndex, rct_window* w, rct_widget* widget)
{
short newSelectedTab;
int num_items, i;
switch (widgetIndex) {
case WIDX_THEMES_SETTINGS_TAB:
case WIDX_THEMES_MAIN_UI_TAB:
case WIDX_THEMES_PARK_TAB:
case WIDX_THEMES_TOOLS_TAB:
case WIDX_THEMES_RIDE_PEEPS_TAB:
case WIDX_THEMES_EDITORS_TAB:
case WIDX_THEMES_MISC_TAB:
case WIDX_THEMES_PROMPTS_TAB:
newSelectedTab = widgetIndex - WIDX_THEMES_SETTINGS_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_THEMES_PRESETS_DROPDOWN:
num_items = gConfigThemes.num_presets;
widget--;
for (i = 0; i < num_items; i++) {
gDropdownItemsFormat[i] = 2777;
gDropdownItemsArgs[i] = (uint64)&gConfigThemes.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 << gCurrentTheme;
break;
}
}
static void window_themes_dropdown()
{
rct_window* w;
short widgetIndex, dropdownIndex;
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
switch (widgetIndex) {
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;
if (gCurrentTheme >= 2)
themes_save_preset(gCurrentTheme);
}
break;
case WIDX_THEMES_PRESETS_DROPDOWN:
if (dropdownIndex != -1) {
theme_change_preset(dropdownIndex);
}
config_save_default();
break;
}
}
void window_themes_update(rct_window *w)
{
w->frame_no++;
if (w->frame_no >= window_themes_tab_animation_loops[_selected_tab])
w->frame_no = 0;
widget_invalidate(w, WIDX_THEMES_SETTINGS_TAB + _selected_tab);
}
void window_themes_scrollgetsize() {
rct_window *w;
window_get_register(w);
int scrollHeight = get_colour_scheme_tab_count() * _row_height;
int i = scrollHeight - window_themes_widgets[WIDX_THEMES_LIST].bottom + window_themes_widgets[WIDX_THEMES_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_themes_scrollmousedown() {
short x, y, scrollIndex;
rct_window *w;
window_scrollmouse_get_registers(w, scrollIndex, x, y);
if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS)
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) {
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;
window_themes_widgets[WIDX_THEMES_COLORBTN_MASK].top = _color_index_1 * _row_height + _button_offset_y - w->scrolls[0].v_top + window_themes_widgets[WIDX_THEMES_LIST].top;
window_themes_widgets[WIDX_THEMES_COLORBTN_MASK].right = window_themes_widgets[WIDX_THEMES_COLORBTN_MASK].left + 12;
window_themes_widgets[WIDX_THEMES_COLORBTN_MASK].bottom = window_themes_widgets[WIDX_THEMES_COLORBTN_MASK].top + 12;
window_dropdown_show_colour(w, &(window_themes_widgets[WIDX_THEMES_COLORBTN_MASK]), w->colours[1], get_colour_scheme_tab()->colours[_color_index_2]);
widget_invalidate(w, WIDX_THEMES_LIST);
}
else {
window_error_open(5241, 5256);
}
}
else if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 - 1 && y2 >= _check_offset_y && y2 < _check_offset_y + 11) {
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();
}
else {
window_error_open(5241, 5256);
}
}
}
}
}
void window_themes_scrollmouseover() {
short x, y, scrollIndex;
rct_window *w;
window_scrollmouse_get_registers(w, scrollIndex, x, y);
//if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS)
// 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_themes_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_THEMES_DUPLICATE_BUTTON:
case WIDX_THEMES_RENAME_BUTTON:
if (valid_characters(text)) {
bool nameTaken = false;
for (int i = 0; i < gConfigThemes.num_presets; i++) {
if (strcmp(gConfigThemes.presets[i].name, text) == 0) {
window_error_open(5242, STR_NONE);
nameTaken = true;
break;
}
}
if (!nameTaken) {
if (widgetIndex == WIDX_THEMES_DUPLICATE_BUTTON) {
theme_create_preset(text);
}
else {
theme_rename_preset(gCurrentTheme, text);
}
config_save_default();
window_invalidate(w);
}
}
else {
window_error_open(5243, STR_NONE);
}
break;
}
}
void window_themes_tooltip()
{
RCT2_GLOBAL(0x013CE952, uint16) = STR_LIST;
}
void window_themes_invalidate()
{
rct_window *w;
window_get_register(w);
colour_scheme_update(w);
int pressed_widgets = w->pressed_widgets & 0xFFFFF00F;
uint8 widgetIndex = _selected_tab + 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_themes_widgets[WIDX_THEMES_BACKGROUND].right = w->width - 1;
window_themes_widgets[WIDX_THEMES_BACKGROUND].bottom = w->height - 1;
window_themes_widgets[WIDX_THEMES_TAB_CONTENT_PANEL].right = w->width - 1;
window_themes_widgets[WIDX_THEMES_TAB_CONTENT_PANEL].bottom = w->height - 1;
window_themes_widgets[WIDX_THEMES_TITLE].right = w->width - 2;
window_themes_widgets[WIDX_THEMES_CLOSE].left = w->width - 2 - 0x0B;
window_themes_widgets[WIDX_THEMES_CLOSE].right = w->width - 2 - 0x0B + 0x0A;
window_themes_widgets[WIDX_THEMES_LIST].right = w->width - 4;
window_themes_widgets[WIDX_THEMES_LIST].bottom = w->height - 0x0F;
if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) {
window_themes_widgets[WIDX_THEMES_LIST].type = WWT_EMPTY;
}
else {
window_themes_widgets[WIDX_THEMES_LIST].type = WWT_SCROLL;
}
}
void window_themes_paint() {
rct_window *w;
rct_drawpixelinfo *dpi;
window_paint_get_registers(w, dpi);
// Widgets
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 {
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(
dpi,
1170,
(void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS,
w->colours[1],
w->x + window_themes_widgets[WIDX_THEMES_PRESETS].left + 1,
w->y + window_themes_widgets[WIDX_THEMES_PRESETS].top,
w->x + window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].left - window_themes_widgets[WIDX_THEMES_PRESETS].left - 4
);
}
}
/**
*
* rct2: 0x006BD785
*/
void window_themes_scrollpaint()
{
int y;
rct_window *w;
rct_drawpixelinfo *dpi;
window_paint_get_registers(w, dpi);
if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS)
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;
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_themes_widgets[WIDX_THEMES_LIST].right, y + _row_height - 2, colour + 1);
gfx_fill_rect(dpi, 0, y + _row_height - 1, window_themes_widgets[WIDX_THEMES_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_themes_widgets[WIDX_THEMES_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_themes_widgets[WIDX_THEMES_LIST].right, y + _row_height - 1, colour);
}
}
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;
}
}

View File

@ -25,7 +25,7 @@
#include "../localisation/localisation.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
static rct_widget window_title_exit_widgets[] = {
{ WWT_IMGBTN, 2, 0, 39, 0, 63, SPR_MENU_EXIT, STR_EXIT },

View File

@ -28,7 +28,7 @@
#include "../sprites.h"
#include "../tutorial.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WIDX_START_NEW_GAME,

View File

@ -24,7 +24,7 @@
#include "../localisation/localisation.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
static rct_widget window_title_options_widgets[] = {
{ WWT_DROPDOWN_BUTTON, 2, 0, 79, 0, 11, STR_OPTIONS, STR_NONE },

View File

@ -27,7 +27,7 @@
#include "../sprites.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WIDX_BACKGROUND,

View File

@ -34,7 +34,7 @@
#include "../world/scenery.h"
#include "../world/banner.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WIDX_PAUSE,

View File

@ -28,7 +28,7 @@
#include "../ride/track.h"
#include "../sprites.h"
#include "error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum {
WIDX_BACKGROUND,

View File

@ -24,7 +24,7 @@
#include "../localisation/localisation.h"
#include "../ride/track.h"
#include "error.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#pragma region Widgets

View File

@ -29,7 +29,7 @@
#include "../sprites.h"
#include "../ride/track.h"
#include "../ride/track_data.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define TRACK_MINI_PREVIEW_WIDTH 168
#define TRACK_MINI_PREVIEW_HEIGHT 78

View File

@ -28,7 +28,7 @@
#include "../interface/widget.h"
#include "../interface/window.h"
#include "dropdown.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
#define INITIAL_WIDTH 500
#define INITIAL_HEIGHT 350

View File

@ -25,7 +25,7 @@
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../world/map.h"
#include "../interface/colour_schemes.h"
#include "../interface/themes.h"
enum WINDOW_WATER_WIDGET_IDX {
WIDX_BACKGROUND,