1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-21 23:03:04 +01:00

Issues with Dropdown text

This commit is contained in:
Robert Jordan
2015-05-29 16:42:57 -04:00
parent dc1e38180e
commit dbc1df308f
7 changed files with 356 additions and 103 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 :RCT1 colour scheme
STR_5153 :Custom
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
@@ -3571,3 +3571,4 @@ STR_5234 :{SMALLFONT}{BLACK}Prompts
STR_5235 :{SMALLFONT}{BLACK}Settings
STR_5236 :Window:
STR_5237 :Palette:
STR_5238 :Presets:

View File

@@ -20,7 +20,10 @@
#include "addresses.h"
#include "config.h"
#include "localisation/language.h"
#include "localisation/localisation.h"
#include "util/util.h"
#include "interface/colour_schemes.h"
// Magic number for original game cfg file
static const int MagicNumber = 0x0003113A;
@@ -171,6 +174,7 @@ config_property_definition _generalDefinitions[] = {
{ offsetof(general_configuration, test_unfinished_tracks), "test_unfinished_tracks", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
{ offsetof(general_configuration, no_test_crashes), "no_test_crashes", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
{ offsetof(general_configuration, date_format), "date_format", CONFIG_VALUE_TYPE_UINT8, DATE_FORMAT_DMY, _dateFormatEnum },
{ offsetof(general_configuration, current_colour_scheme_preset), "colour_scheme_preset", CONFIG_VALUE_TYPE_STRING, { .value_string = "*RCT2" }, NULL },
};
config_property_definition _interfaceDefinitions[] = {
@@ -380,23 +384,6 @@ bool config_save(const utf8string path)
fputc('\n', file);
}
fputc('[', file);
fwrite("colour_schemes", "colour_schemes", 1, file);
fputc(']', file);
fputc('\n', file);
for (i = 0; i < gNumColourSchemeWindows; i++) {
window_colour_scheme colour_scheme = gColourSchemes[i];
for (j = 0; j < colour_scheme.num_colours; j++) {
fwrite(colour_scheme.ini_name, strlen(colour_scheme.ini_name), 1, file);
fprintf(file, "_%d", j);
fwrite(" = ", 3, 1, file);
fprintf(file, "%u", colour_scheme.colours[j]);
fputc('\n', file);
}
fputc('\n', file);
}
fclose(file);
return true;
}
@@ -1016,31 +1003,233 @@ bool config_shortcut_keys_save()
#pragma region Colour Schemes
static bool colour_schemes_open(const utf8string path);
static bool colour_schemes_save(const utf8string path);
static void colour_schemes_read_properties(int preset, window_colour_scheme **colour_scheme, const_utf8string line);
static void colour_schemes_set_property(window_colour_scheme **colour_scheme, const_utf8string line);
void colour_schemes_remove_extension(char *path)
{
char *ch;
for (ch = path; *ch != 0; ch++) {
if (*ch == '.') {
*ch = '\0';
break;
}
}
}
void colour_schemes_set_default()
{
gConfigColourSchemes.num_presets = 2;
gConfigColourSchemes.presets = malloc(sizeof(colour_scheme_preset*) * gConfigColourSchemes.num_presets);
gConfigColourSchemes.presets = malloc(sizeof(colour_schemes_setting*) * gConfigColourSchemes.num_presets);
// Set RCT2 colour scheme
strcpy(gConfigColourSchemes.presets[0].name, language_get_string(2741));
gConfigColourSchemes.presets[0].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
for (int j = 0; j < gNumColourSchemeWindows; j++) {
for (int k = 0; k < 6; k++)
gConfigColourSchemes.presets[0].colour_schemes[j].colours[k] = gColourSchemes[j].colours[k];
for (int i = 0; i < gNumColourSchemeWindows; i++) {
for (int j = 0; j < 6; j++)
gConfigColourSchemes.presets[0].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
}
// Set RCT1 colour scheme
strcpy(gConfigColourSchemes.presets[1].name, language_get_string(2740));
gConfigColourSchemes.presets[1].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
for (int i = 0; i < gNumColourSchemeWindows; i++) {
uint8 changed_colour = 0xFF;
for (int k = 0; gColourSchemesRCT1[k].classification != 0xFF; k++) {
if (gColourSchemesRCT1[k].classification == gColourSchemes[k].classification) {
changed_colour = (uint8)k;
break;
}
}
for (int j = 0; j < 6; j++) {
gConfigColourSchemes.presets[1].colour_schemes[i].colours[j] = (changed_colour != 0xFF ? gColourSchemesRCT1[changed_colour].colours[j] : gColourSchemes[i].colours[j]);
}
}
}
bool colour_schemes_open_default()
void colour_schemes_load_presets()
{
utf8 path[MAX_PATH];
file_info file;
int fileEnumHandle;
platform_get_user_directory(path, "colour schemes");
strcpy(path, "*.ini");
fileEnumHandle = platform_enumerate_files_begin(path);
while (platform_enumerate_files_next(fileEnumHandle, &file)) {
colour_schemes_open(file.path);
}
platform_enumerate_files_end(fileEnumHandle);
}
bool colour_schemes_save_default()
bool colour_schemes_save_preset(int preset)
{
utf8 path[MAX_PATH];
platform_get_user_directory(path, "colour schemes");
strcat(path, "custom.ini");
if (config_save(path)) {
return true;
}
return false;
}
bool colour_schemes_open(const utf8string path)
{
FILE *file;
uint8 *lineBuffer;
size_t lineBufferCapacity;
size_t lineLength;
int c, preset;
window_colour_scheme *currentColourScheme;
file = fopen(path, "rb");
if (file == NULL)
return false;
// Check if the colour scheme is already loaded
// No nead to read the first two presets as they're hardcoded in
for (preset = 2; preset < gConfigColourSchemes.num_presets; preset++) {
if (strcmp(path, gConfigColourSchemes.presets[preset].name) == 0) {
break;
}
}
// Otherwise allocate one
if (preset == gConfigColourSchemes.num_presets) {
gConfigColourSchemes.num_presets++;
gConfigColourSchemes.presets = realloc(gConfigColourSchemes.presets, sizeof(colour_scheme_preset*) * gConfigColourSchemes.num_presets);
strcpy(gConfigColourSchemes.presets[preset].name, path_get_filename(path));
gConfigColourSchemes.presets[preset].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
for (int i = 0; i < gNumColourSchemeWindows; i++) {
for (int j = 0; j < 6; j++)
gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
}
}
currentColourScheme = NULL;
lineBufferCapacity = 64;
lineBuffer = malloc(lineBufferCapacity);
lineLength = 0;
// Skim UTF-8 byte order mark
fread(lineBuffer, 3, 1, file);
if (!(lineBuffer[0] == 0xEF && lineBuffer[1] == 0xBB && lineBuffer[2] == 0xBF))
fseek(file, 0, SEEK_SET);
while ((c = fgetc(file)) != EOF) {
if (c == '\n' || c == '\r') {
lineBuffer[lineLength++] = 0;
colour_schemes_read_properties(preset, &currentColourScheme, (const_utf8string)lineBuffer);
lineLength = 0;
}
else {
lineBuffer[lineLength++] = c;
}
if (lineLength >= lineBufferCapacity) {
lineBufferCapacity *= 2;
lineBuffer = realloc(lineBuffer, lineBufferCapacity);
}
}
if (lineLength > 0) {
lineBuffer[lineLength++] = 0;
colour_schemes_read_properties(preset, &currentColourScheme, lineBuffer);
}
free(lineBuffer);
fclose(file);
return true;
}
static bool colour_schemes_save(const utf8string path)
{
FILE *file;
int i, j, preset;
value_union *value;
file = fopen(path, "wb");
if (file == NULL) {
log_error("Unable to write to colour scheme file.");
return false;
}
for (preset = 2; preset < gConfigColourSchemes.num_presets; preset++) {
if (strcmp(path, gConfigColourSchemes.presets[preset].name) == 0) {
break;
}
}
if (preset == gConfigColourSchemes.num_presets) {
log_error("Unable to write colour scheme, no preset with that name found.");
return false;
}
for (i = 0; i < gNumColourSchemeWindows; i++) {
window_colour_scheme* colour_scheme = &(gColourSchemes[i]);
fputc('[', file);
fwrite(colour_scheme->section_name, strlen(colour_scheme->section_name), 1, file);
fputc(']', file);
fputc('\n', file);
for (j = 0; j < colour_scheme->num_colours; j++) {
fprintf(file, "colour_%d", j);
fwrite(" = ", 3, 1, file);
fprintf(file, "%u", colour_scheme->colours[j]);
fputc('\n', file);
}
fputc('\n', file);
}
fclose(file);
return true;
}
static void colour_schemes_read_properties(int preset, window_colour_scheme **colour_scheme, const_utf8string line)
{
utf8string ch = (utf8string)line;
utf8_skip_whitespace(&ch);
if (*ch == '[') {
const_utf8string sectionName;
int sectionNameSize;
if (config_get_section(ch, &sectionName, &sectionNameSize)) {
for (int i = 0; i < gNumColourSchemeWindows; i++) {
if (strcmp(sectionName, gColourSchemes[i].section_name)) {
*colour_scheme = &(gConfigColourSchemes.presets[preset].colour_schemes[i]);
break;
}
}
}
}
else {
if (*colour_scheme != NULL) {
const_utf8string propertyName, *value;
int propertyNameSize, valueSize;
if (config_get_property_name_value(ch, &propertyName, &propertyNameSize, &value, &valueSize)) {
colour_schemes_set_property(colour_scheme, propertyName, value);
}
}
}
}
static void colour_schemes_set_property(window_colour_scheme *colour_scheme, const_utf8string name, const_utf8string value)
{
const_utf8string colour_names[] = { "colour_0", "colour_1", "colour_2", "colour_3", "colour_4", "colour_5" };
for (int i = 0; i < 6; i++) {
if (strcmp(name, colour_names[i]) == 0) {
colour_scheme->colours[i] = (uint8)strtol(value, NULL, 0);
}
}
}
#pragma endregion

View File

@@ -24,7 +24,6 @@
#include "common.h"
#include "localisation/currency.h"
#include "platform/platform.h"
#include "interface/colour_schemes.h"
enum {
CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES = (1 << 0),
@@ -140,6 +139,7 @@ typedef struct {
uint8 test_unfinished_tracks;
uint8 no_test_crashes;
uint8 date_format;
utf8string current_colour_scheme_preset;
} general_configuration;
typedef struct {
@@ -176,12 +176,16 @@ typedef struct {
} twitch_configuration;
typedef struct {
window_colours *colour_schemes;
char *name;
} colour_schemes_setting;
uint8 colours[6];
} window_colours;
typedef struct {
colour_schemes_setting *presets;
window_colours *colour_schemes;
char name[256];
} colour_scheme_preset;
typedef struct {
colour_scheme_preset *presets;
uint16 num_presets;
} colour_schemes_configuration;
@@ -212,7 +216,7 @@ bool config_shortcut_keys_save();
bool config_find_or_browse_install_directory();
void colour_schemes_set_default();
bool colour_schemes_open_default();
bool colour_schemes_save_default();
void colour_schemes_load_presets();
bool colour_schemes_save_preset(int preset);
#endif

View File

@@ -76,60 +76,28 @@ window_colour_scheme gColourSchemes[] = {
{ WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR, { 150, 150, 141, 0, 0, 0 }, 3, 5181, "editor_scenario_bottom_toolbar" },
};
marked_window_colours gColourSchemesRCT1[sizeof(gColourSchemes)] = {
{ WC_TOP_TOOLBAR, { 1, 1, 1, 1, 0, 0 } }, // WC_TOP_TOOLBAR
{ WC_BOTTOM_TOOLBAR, { 129, 129, 0, 18, 0, 0 } }, // WC_BOTTOM_TOOLBAR
{ WC_RIDE, { 26, 1, 11, 0, 0, 0 } }, // WC_RIDE
{ 0, 0, 0, 0, 0, 0 }, // WC_RIDE_CONSTRUCTION
{ WC_RIDE_LIST, { 0, 0, 0, 0, 0, 0 } }, // WC_RIDE_LIST
{ 0, 0, 0, 0, 0, 0 }, // WC_SAVE_PROMPT
{ 0, 0, 0, 0, 0, 0 }, // WC_CONSTRUCT_RIDE
{ 0, 0, 0, 0, 0, 0 }, // WC_DEMOLISH_RIDE_PROMPT
{ 0, 0, 0, 0, 0, 0 }, // WC_SCENERY
{ 0, 0, 0, 0, 0, 0 }, // WC_OPTIONS
{ 0, 0, 0, 0, 0, 0 }, // WC_FOOTPATH
{ 0, 0, 0, 0, 0, 0 }, // WC_LAND
{ 0, 0, 0, 0, 0, 0 }, // WC_WATER
{ 0, 0, 0, 0, 0, 0 }, // WC_PEEP
{ 0, 0, 0, 0, 0, 0 }, // WC_GUEST_LIST
{ 0, 0, 0, 0, 0, 0 }, // WC_STAFF_LIST
{ 0, 0, 0, 0, 0, 0 }, // WC_FIRE_PROMPT
{ 0, 0, 0, 0, 0, 0 }, // WC_PARK_INFORMATION
{ 0, 0, 0, 0, 0, 0 }, // WC_FINANCES
{ 0, 0, 0, 0, 0, 0 }, // WC_TITLE_MENU
{ 0, 0, 0, 0, 0, 0 }, // WC_TITLE_EXIT
{ 0, 0, 0, 0, 0, 0 }, // WC_RECENT_NEWS
{ 0, 0, 0, 0, 0, 0 }, // WC_SCENARIO_SELECT
{ 0, 0, 0, 0, 0, 0 }, // WC_TRACK_DESIGN_LIST
{ 0, 0, 0, 0, 0, 0 }, // WC_TRACK_DESIGN_PLACE
{ 0, 0, 0, 0, 0, 0 }, // WC_NEW_CAMPAIGN
{ 0, 0, 0, 0, 0, 0 }, // WC_KEYBOARD_SHORTCUT_LIST
{ 0, 0, 0, 0, 0, 0 }, // WC_CHANGE_KEYBOARD_SHORTCUT
{ 0, 0, 0, 0, 0, 0 }, // WC_MAP
{ 0, 0, 0, 0, 0, 0 }, // WC_BANNER
{ 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_OBJECT_SELECTION
{ 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_INVENTION_LIST
{ 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_SCENARIO_OPTIONS
{ 0, 0, 0, 0, 0, 0 }, // WC_EDTIOR_OBJECTIVE_OPTIONS
{ 0, 0, 0, 0, 0, 0 }, // WC_MANAGE_TRACK_DESIGN
{ 0, 0, 0, 0, 0, 0 }, // WC_TRACK_DELETE_PROMPT
{ 0, 0, 0, 0, 0, 0 }, // WC_INSTALL_TRACK
{ 0, 0, 0, 0, 0, 0 }, // WC_CLEAR_SCENERY
{ 0, 0, 0, 0, 0, 0 }, // WC_CHEATS
{ 0, 0, 0, 0, 0, 0 }, // WC_RESEARCH
{ 0, 0, 0, 0, 0, 0 }, // WC_VIEWPORT
{ 0, 0, 0, 0, 0, 0 }, // WC_MAPGEN
{ 0, 0, 0, 0, 0, 0 }, // WC_LOADSAVE
{ 0, 0, 0, 0, 0, 0 }, // WC_LOADSAVE_OVERWRITE_PROMPT
{ 0, 0, 0, 0, 0, 0 }, // WC_TITLE_OPTIONS
{ 0, 0, 0, 0, 0, 0 }, // WC_LAND_RIGHTS
{ 0, 0, 0, 0, 0, 0 }, // WC_COLOUR_SCHEMES
{ 0, 0, 0, 0, 0, 0 }, // WC_STAFF
{ 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_TRACK_BOTTOM_TOOLBAR
{ 0, 0, 0, 0, 0, 0 }, // WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR
{ WC_RIDE_LIST, { 26, 1, 1, 0, 0, 0 } }, // WC_RIDE_LIST
{ WC_CONSTRUCT_RIDE, { 26, 1, 1, 0, 0, 0 } }, // WC_CONSTRUCT_RIDE
{ WC_PEEP, { 22, 26, 26, 0, 0, 0 } }, // WC_PEEP
{ WC_GUEST_LIST, { 22, 26, 26, 0, 0, 0 } }, // WC_GUEST_LIST
{ WC_STAFF_LIST, { 12, 4, 4, 0, 0, 0 } }, // WC_STAFF_LIST
{ WC_FINANCES, { 4, 1, 1, 0, 0, 0 } }, // WC_FINANCES
{ WC_TITLE_MENU, { 129, 129, 129, 0, 0, 0 } }, // WC_TITLE_MENU
{ WC_TITLE_EXIT, { 129, 129, 129, 0, 0, 0 } }, // WC_TITLE_EXIT
{ WC_NEW_CAMPAIGN, { 4, 4, 1, 0, 0, 0 } }, // WC_NEW_CAMPAIGN
{ WC_TITLE_OPTIONS, { 129, 129, 129, 0, 0, 0 } }, // WC_TITLE_OPTIONS
{ WC_STAFF, { 12, 4, 4, 0, 0, 0 } }, // WC_STAFF
{ 0xFF, { 0, 0, 0, 0, 0, 0 } } // End
};
uint16 gCurrentColourSchemePreset = 0;
uint32 gNumColourSchemeWindows = sizeof(gColourSchemes) / sizeof(window_colour_scheme);
window_colour_scheme* colour_scheme_get_by_class(rct_windowclass classification)
@@ -154,10 +122,10 @@ void colour_scheme_update(rct_window *window)
transparent = true;
}
}
//if (transparent)
if (transparent)
window->flags |= WF_TRANSPARENT;
//else
// window->flags &= ~WF_TRANSPARENT;
else
window->flags &= ~WF_TRANSPARENT;
}
void colour_scheme_update_by_class(rct_window *window, rct_windowclass classification)
@@ -171,8 +139,47 @@ void colour_scheme_update_by_class(rct_window *window, rct_windowclass classific
transparent = true;
}
}
//if (transparent)
if (transparent)
window->flags |= WF_TRANSPARENT;
//else
// window->flags &= ~WF_TRANSPARENT;
else
window->flags &= ~WF_TRANSPARENT;
}
void colour_scheme_change_preset(int preset)
{
if (preset >= 0 && preset < gConfigColourSchemes.num_presets) {
switch (preset) {
case 0:
gConfigGeneral.current_colour_scheme_preset = "*RCT2";
break;
case 1:
gConfigGeneral.current_colour_scheme_preset = "*RCT1";
break;
default:
gConfigGeneral.current_colour_scheme_preset = gConfigColourSchemes.presets[preset].name;
break;
}
gCurrentColourSchemePreset = preset;
for (int i = 0; i < gNumColourSchemeWindows; i++) {
for (int j = 0; j < gColourSchemes[i].num_colours; j++) {
gColourSchemes[i].colours[j] = gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j];
}
}
}
window_invalidate_all();
}
bool colour_scheme_create_preset(const char *name)
{
int preset = gConfigColourSchemes.num_presets;
gConfigColourSchemes.num_presets++;
gConfigColourSchemes.presets = realloc(gConfigColourSchemes.presets, sizeof(colour_scheme_preset*) * gConfigColourSchemes.num_presets);
strcpy(gConfigColourSchemes.presets[preset].name, name);
gConfigColourSchemes.presets[preset].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
for (int i = 0; i < gNumColourSchemeWindows; i++) {
for (int j = 0; j < 6; j++)
gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
}
colour_schemes_save_preset(preset);
colour_scheme_change_preset(gConfigColourSchemes.num_presets - 1);
}

View File

@@ -29,12 +29,9 @@ typedef struct {
uint8 colours[6];
uint8 num_colours;
rct_string_id name;
char *ini_name;
char *section_name;
} window_colour_scheme;
typedef struct {
uint8 colours[6];
} window_colours;
typedef struct {
rct_windowclass classification;
@@ -43,7 +40,9 @@ typedef struct {
extern window_colour_scheme gColourSchemes[];
extern window_colours gColourSchemesRCT1[];
extern marked_window_colours gColourSchemesRCT1[];
extern uint16 gCurrentColourSchemePreset;
extern uint32 gNumColourSchemeWindows;
@@ -52,4 +51,7 @@ window_colour_scheme* colour_scheme_get_by_class(rct_windowclass classification)
void colour_scheme_update(rct_window *window);
void colour_scheme_update_by_class(rct_window *window, rct_windowclass classification);
void colour_scheme_change_preset(int preset);
bool colour_scheme_create_preset(const char *name);
#endif

View File

@@ -150,6 +150,9 @@ void openrct2_launch()
Mixer_Init(NULL);
colour_schemes_set_default();
colour_schemes_load_presets();
switch (gOpenRCT2StartupAction) {
case STARTUP_ACTION_INTRO:
RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 8;

View File

@@ -107,7 +107,6 @@ enum WINDOW_STAFF_LIST_WIDGET_IDX {
WIDX_COLOUR_SCHEMES_SETTINGS_TAB,
WIDX_COLOUR_SCHEMES_PRESETS,
WIDX_COLOUR_SCHEMES_PRESETS_DROPDOWN,
WIDX_COLOUR_SCHEMES_RCT1_STYLES_CHECKBOX,
WIDX_COLOUR_SCHEMES_COLORBTN_MASK,
WIDX_COLOUR_SCHEMES_LIST,
};
@@ -125,10 +124,9 @@ static rct_widget window_colour_schemes_widgets[] = {
{ WWT_TAB, 1, 158, 188, 17, 43, 0x02000144E, 5233 }, // misc tab
{ WWT_TAB, 1, 189, 219, 17, 43, 0x02000144E, 5234 }, // prompts tab
{ WWT_TAB, 1, 220, 250, 17, 43, 0x02000144E, 5235 }, // settings tab
{ WWT_COLORBTN, 1, 0, 0, 0, 0, STR_NONE, STR_NONE }, // color button mask
{ WWT_DROPDOWN, 1, 155, 299, 60, 71, STR_NONE, STR_NONE }, // Preset colour schemes
{ WWT_DROPDOWN, 1, 125, 299, 60, 71, STR_NONE, STR_NONE }, // Preset colour schemes
{ WWT_DROPDOWN_BUTTON, 1, 288, 298, 61, 70, 876, STR_NONE },
{ WWT_CHECKBOX, 1, 10, 229, 68, 79, STR_SOUND, STR_NONE }, // RCT1 menu styles
{ WWT_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 },
};
@@ -325,7 +323,9 @@ void window_colour_schemes_open()
(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_COLORBTN_MASK) |
(1 << WIDX_COLOUR_SCHEMES_PRESETS) |
(1 << WIDX_COLOUR_SCHEMES_PRESETS_DROPDOWN);
window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_LIST].type = WWT_SCROLL;
@@ -383,6 +383,7 @@ static void window_colour_schemes_resize()
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:
@@ -401,6 +402,30 @@ static void window_colour_schemes_mousedown(int widgetIndex, rct_window* w, rct_
w->frame_no = 0;
window_invalidate(w);
break;
case WIDX_COLOUR_SCHEMES_PRESETS_DROPDOWN:
num_items = gConfigColourSchemes.num_presets;
for (i = 0; i < num_items; i++) {
//gDropdownItemsFormat[i] = 2777;
//gDropdownItemsArgs[i] = 1170 | ((uint64)(intptr_t)gConfigColourSchemes.presets[i].name << 16);
//gDropdownItemsFormat[i] = 1170;
//gDropdownItemsArgs[i] = ((uint64)&gConfigColourSchemes.presets[i].name) << 32;
gDropdownItemsFormat[i] = 1170;
gDropdownItemsArgs[i] = &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;
}
}
@@ -410,12 +435,22 @@ static void window_colour_schemes_dropdown()
short widgetIndex, dropdownIndex;
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
if (widgetIndex == WIDX_COLOUR_SCHEMES_LIST && dropdownIndex != -1) {
get_colour_scheme_tab()->colours[_color_index_2] = dropdownIndex | get_colour_scheme_tab()->colours[_color_index_2] & 0x80;
window_invalidate_all();
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;
window_invalidate_all();
_color_index_1 = -1;
_color_index_2 = -1;
}
break;
case WIDX_COLOUR_SCHEMES_PRESETS_DROPDOWN:
if (dropdownIndex != -1) {
colour_scheme_change_preset(dropdownIndex);
}
break;
}
_color_index_1 = -1;
_color_index_2 = -1;
}
void window_colour_schemes_update(rct_window *w)
@@ -563,6 +598,18 @@ void window_colour_schemes_paint() {
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) = &gConfigColourSchemes.presets[gCurrentColourSchemePreset].name;
gfx_draw_string_left(dpi, 5238, NULL, 12, 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,
12,
w->x + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_PRESETS].left + 1,
w->y + window_colour_schemes_widgets[WIDX_COLOUR_SCHEMES_PRESETS].top
);
}
}
/**