mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
improve reading and saving of configuration
This commit is contained in:
@@ -222,9 +222,6 @@
|
|||||||
<ClCompile Include="..\src\util\util.c">
|
<ClCompile Include="..\src\util\util.c">
|
||||||
<Filter>Source\Util</Filter>
|
<Filter>Source\Util</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\src\config.c">
|
|
||||||
<Filter>Source</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\editor.c">
|
<ClCompile Include="..\src\editor.c">
|
||||||
<Filter>Source</Filter>
|
<Filter>Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -333,14 +330,12 @@
|
|||||||
<ClCompile Include="..\src\world\fountain.c">
|
<ClCompile Include="..\src\world\fountain.c">
|
||||||
<Filter>Source\World</Filter>
|
<Filter>Source\World</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
|
||||||
<ClCompile Include="..\src\world\banner.c">
|
<ClCompile Include="..\src\world\banner.c">
|
||||||
<Filter>Source\World</Filter>
|
<Filter>Source\World</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\src\windows\staff_fire_prompt.c">
|
<ClCompile Include="..\src\windows\staff_fire_prompt.c">
|
||||||
<Filter>Source\Windows</Filter>
|
<Filter>Source\Windows</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
|
||||||
<ClCompile Include="..\src\windows\viewport.c">
|
<ClCompile Include="..\src\windows\viewport.c">
|
||||||
<Filter>Source\Windows</Filter>
|
<Filter>Source\Windows</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -362,11 +357,11 @@
|
|||||||
<ClCompile Include="..\src\ride\station.c">
|
<ClCompile Include="..\src\ride\station.c">
|
||||||
<Filter>Source\Ride</Filter>
|
<Filter>Source\Ride</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\lib\libspeex\resample.c;..\lib\lodepng\lodepng.c" />
|
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
||||||
<ClCompile Include="..\src\windows\ride_construction.c">
|
<ClCompile Include="..\src\windows\ride_construction.c">
|
||||||
<Filter>Source\Windows</Filter>
|
<Filter>Source\Windows</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\lib\libspeex\resample.c;..\lib\lodepng\lodepng.c" />
|
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
||||||
<ClCompile Include="..\src\interface\keyboard_shortcut.c">
|
<ClCompile Include="..\src\interface\keyboard_shortcut.c">
|
||||||
<Filter>Source\Interface</Filter>
|
<Filter>Source\Interface</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -427,6 +422,9 @@
|
|||||||
<ClCompile Include="..\src\windows\loadsave.c">
|
<ClCompile Include="..\src\windows\loadsave.c">
|
||||||
<Filter>Source\Windows</Filter>
|
<Filter>Source\Windows</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\config.c">
|
||||||
|
<Filter>Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\src\management\award.h">
|
<ClInclude Include="..\src\management\award.h">
|
||||||
|
|||||||
@@ -1545,7 +1545,7 @@ void stop_completed_sounds()
|
|||||||
void start_title_music()
|
void start_title_music()
|
||||||
{
|
{
|
||||||
int musicPathId;
|
int musicPathId;
|
||||||
switch (gGeneral_config.title_music) {
|
switch (gConfigSound.title_music) {
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -1751,7 +1751,7 @@ void audio_init2(int device)
|
|||||||
rct_dsdevice dsdevice = RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_DEVICES, rct_dsdevice*)[device];
|
rct_dsdevice dsdevice = RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_DEVICES, rct_dsdevice*)[device];
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_GUID, GUID) = dsdevice.guid;
|
RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_GUID, GUID) = dsdevice.guid;
|
||||||
RCT2_GLOBAL(0x009AAC5C, uint8) = 1;
|
RCT2_GLOBAL(0x009AAC5C, uint8) = 1;
|
||||||
config_save();
|
config_save_default();
|
||||||
RCT2_GLOBAL(0x014241BC, uint32) = 1;
|
RCT2_GLOBAL(0x014241BC, uint32) = 1;
|
||||||
int successtimer = audio_create_timer();
|
int successtimer = audio_create_timer();
|
||||||
RCT2_GLOBAL(0x014241BC, uint32) = 0;
|
RCT2_GLOBAL(0x014241BC, uint32) = 0;
|
||||||
@@ -1763,9 +1763,9 @@ void audio_init2(int device)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 1 << 4)) {
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 1 << 4)) {
|
||||||
gSound_config.forced_software_buffering = RCT2_GLOBAL(0x001425B74, uint32) != RCT2_GLOBAL(0x001425B78, uint32) || RCT2_GLOBAL(0x001425B74, uint32) != RCT2_GLOBAL(0x001425B7C, uint32);
|
gConfigSound.forced_software_buffering = RCT2_GLOBAL(0x001425B74, uint32) != RCT2_GLOBAL(0x001425B78, uint32) || RCT2_GLOBAL(0x001425B74, uint32) != RCT2_GLOBAL(0x001425B7C, uint32);
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= 1 << 4;
|
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= 1 << 4;
|
||||||
config_save();
|
config_save_default();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,4 +24,6 @@
|
|||||||
#include "diagnostic.h"
|
#include "diagnostic.h"
|
||||||
#include "rct2.h"
|
#include "rct2.h"
|
||||||
|
|
||||||
|
#define SafeFree(x) if ((x) != NULL) { free(x); (x) = NULL; }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
1329
src/config.c
1329
src/config.c
File diff suppressed because it is too large
Load Diff
74
src/config.h
74
src/config.h
@@ -96,30 +96,11 @@ enum{
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern uint16 gShortcutKeys[SHORTCUT_COUNT];
|
|
||||||
|
|
||||||
void config_reset_shortcut_keys();
|
|
||||||
void config_load();
|
|
||||||
void config_save();
|
|
||||||
int config_find_or_browse_install_directory();
|
|
||||||
|
|
||||||
|
|
||||||
// New config format
|
|
||||||
#define MAX_CONFIG_LENGTH 256
|
|
||||||
|
|
||||||
typedef struct sound_configuration {
|
|
||||||
|
|
||||||
sint8 sound_quality;
|
|
||||||
sint8 forced_software_buffering;
|
|
||||||
} sound_configuration_t;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct general_configuration {
|
typedef struct general_configuration {
|
||||||
uint8 play_intro;
|
uint8 play_intro;
|
||||||
uint8 confirmation_prompt;
|
uint8 confirmation_prompt;
|
||||||
uint8 screenshot_format;
|
uint8 screenshot_format;
|
||||||
char game_path[MAX_PATH];
|
utf8string game_path;
|
||||||
sint8 measurement_format;
|
sint8 measurement_format;
|
||||||
sint8 temperature_format;
|
sint8 temperature_format;
|
||||||
sint8 currency_format;
|
sint8 currency_format;
|
||||||
@@ -132,44 +113,35 @@ typedef struct general_configuration {
|
|||||||
|
|
||||||
//new
|
//new
|
||||||
uint8 fullscreen_mode;
|
uint8 fullscreen_mode;
|
||||||
sint16 fullscreen_width;
|
sint32 fullscreen_width;
|
||||||
sint16 fullscreen_height;
|
sint32 fullscreen_height;
|
||||||
sint16 window_width;
|
sint32 window_width;
|
||||||
sint16 window_height;
|
sint32 window_height;
|
||||||
uint16 language;
|
uint16 language;
|
||||||
uint8 window_snap_proximity;
|
uint8 window_snap_proximity;
|
||||||
|
} general_configuration;
|
||||||
|
|
||||||
|
typedef struct sound_configuration {
|
||||||
|
sint8 forced_software_buffering;
|
||||||
|
sint8 sound_quality;
|
||||||
uint8 title_music;
|
uint8 title_music;
|
||||||
} general_configuration_t;
|
} sound_configuration;
|
||||||
|
|
||||||
static const struct { const char *key; int value; } _currencyLookupTable[] = {
|
typedef struct shortcut_entry {
|
||||||
{ "GBP", CURRENCY_POUNDS },
|
|
||||||
{ "USD", CURRENCY_DOLLARS },
|
|
||||||
{ "FRF", CURRENCY_FRANC },
|
|
||||||
{ "DEM", CURRENCY_DEUTSCHMARK },
|
|
||||||
{ "YEN", CURRENCY_YEN },
|
|
||||||
{ "ESP", CURRENCY_PESETA },
|
|
||||||
{ "ITL", CURRENCY_LIRA },
|
|
||||||
{ "NLG", CURRENCY_GUILDERS },
|
|
||||||
{ "NOK", CURRENCY_KRONA },
|
|
||||||
{ "SEK", CURRENCY_KRONA },
|
|
||||||
{ "DEK", CURRENCY_KRONA },
|
|
||||||
{ "EUR", CURRENCY_EUROS },
|
|
||||||
|
|
||||||
{ "\xA3", CURRENCY_POUNDS },
|
|
||||||
{ "\x24", CURRENCY_DOLLARS },
|
|
||||||
{ "\xA5", CURRENCY_YEN },
|
|
||||||
{ "\xB5", CURRENCY_EUROS }
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct shortcut_entry{
|
|
||||||
uint8 key;
|
uint8 key;
|
||||||
uint8 modifier;
|
uint8 modifier;
|
||||||
}shortcut_entry;
|
} shortcut_entry;
|
||||||
|
|
||||||
//typedef struct hotkey_configuration{
|
extern general_configuration gConfigGeneral;
|
||||||
|
extern sound_configuration gConfigSound;
|
||||||
|
|
||||||
//};
|
extern uint16 gShortcutKeys[SHORTCUT_COUNT];
|
||||||
extern general_configuration_t gGeneral_config;
|
|
||||||
extern sound_configuration_t gSound_config;
|
void config_set_defaults();
|
||||||
|
bool config_open_default();
|
||||||
|
bool config_save_default();
|
||||||
|
|
||||||
|
void config_reset_shortcut_keys();
|
||||||
|
bool config_find_or_browse_install_directory();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ void game_update()
|
|||||||
if (RCT2_GLOBAL(0x009AAC73, uint8) != 255) {
|
if (RCT2_GLOBAL(0x009AAC73, uint8) != 255) {
|
||||||
RCT2_GLOBAL(0x009AAC73, uint8)++;
|
RCT2_GLOBAL(0x009AAC73, uint8)++;
|
||||||
if (RCT2_GLOBAL(0x009AAC73, uint8) == 255)
|
if (RCT2_GLOBAL(0x009AAC73, uint8) == 255)
|
||||||
config_save();
|
config_save_default();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ char save_game()
|
|||||||
// Ensure path has .SV6 extension
|
// Ensure path has .SV6 extension
|
||||||
path_set_extension(path, ".SV6");
|
path_set_extension(path, ".SV6");
|
||||||
|
|
||||||
if (scenario_save(path, gGeneral_config.save_plugin_data ? 1 : 0)) {
|
if (scenario_save(path, gConfigGeneral.save_plugin_data ? 1 : 0)) {
|
||||||
game_do_command(0, 1047, 0, -1, GAME_COMMAND_0, 0, 0);
|
game_do_command(0, 1047, 0, -1, GAME_COMMAND_0, 0, 0);
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ static void input_window_position_continue(rct_window *w, int wdx, int wdy, int
|
|||||||
{
|
{
|
||||||
int snapProximity;
|
int snapProximity;
|
||||||
|
|
||||||
snapProximity = w->flags & WF_NO_SNAPPING ? 0 : gGeneral_config.window_snap_proximity;
|
snapProximity = w->flags & WF_NO_SNAPPING ? 0 : gConfigGeneral.window_snap_proximity;
|
||||||
window_move_and_snap(w, x - wdx, y - wdy, snapProximity);
|
window_move_and_snap(w, x - wdx, y - wdy, snapProximity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void keyboard_shortcut_set(int key)
|
|||||||
gShortcutKeys[RCT2_GLOBAL(0x009DE511, uint8)] = key;
|
gShortcutKeys[RCT2_GLOBAL(0x009DE511, uint8)] = key;
|
||||||
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
|
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
|
||||||
window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST);
|
window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST);
|
||||||
config_save();
|
config_save_default();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void screenshot_check()
|
|||||||
|
|
||||||
if (screenshotIndex != -1) {
|
if (screenshotIndex != -1) {
|
||||||
char *lang_3165 = (char*)0x009BC677;
|
char *lang_3165 = (char*)0x009BC677;
|
||||||
sprintf(lang_3165, "SCR%d%s", screenshotIndex, _screenshot_format_extension[gGeneral_config.screenshot_format]);
|
sprintf(lang_3165, "SCR%d%s", screenshotIndex, _screenshot_format_extension[gConfigGeneral.screenshot_format]);
|
||||||
|
|
||||||
RCT2_GLOBAL(0x013CE952, uint16) = 3165;
|
RCT2_GLOBAL(0x013CE952, uint16) = 3165;
|
||||||
// RCT2_GLOBAL(0x013CE952, uint16) = STR_SCR_BMP;
|
// RCT2_GLOBAL(0x013CE952, uint16) = STR_SCR_BMP;
|
||||||
@@ -96,7 +96,7 @@ static int screenshot_get_next_path(char *path, int format)
|
|||||||
|
|
||||||
int screenshot_dump()
|
int screenshot_dump()
|
||||||
{
|
{
|
||||||
switch (gGeneral_config.screenshot_format) {
|
switch (gConfigGeneral.screenshot_format) {
|
||||||
case SCREENSHOT_FORMAT_BMP:
|
case SCREENSHOT_FORMAT_BMP:
|
||||||
return screenshot_dump_bmp();
|
return screenshot_dump_bmp();
|
||||||
case SCREENSHOT_FORMAT_PNG:
|
case SCREENSHOT_FORMAT_PNG:
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ void viewport_create(rct_window *w, int x, int y, int width, int height, int zoo
|
|||||||
viewport->zoom = zoom;
|
viewport->zoom = zoom;
|
||||||
viewport->flags = 0;
|
viewport->flags = 0;
|
||||||
|
|
||||||
if (gGeneral_config.always_show_gridlines)
|
if (gConfigGeneral.always_show_gridlines)
|
||||||
viewport->flags |= VIEWPORT_FLAG_GRIDLINES;
|
viewport->flags |= VIEWPORT_FLAG_GRIDLINES;
|
||||||
w->viewport = viewport;
|
w->viewport = viewport;
|
||||||
|
|
||||||
@@ -1109,7 +1109,7 @@ void hide_gridlines()
|
|||||||
RCT2_GLOBAL(0x009E32B0, uint8)--;
|
RCT2_GLOBAL(0x009E32B0, uint8)--;
|
||||||
if (RCT2_GLOBAL(0x009E32B0, uint8) == 0) {
|
if (RCT2_GLOBAL(0x009E32B0, uint8) == 0) {
|
||||||
if ((mainWindow = window_get_main()) != NULL) {
|
if ((mainWindow = window_get_main()) != NULL) {
|
||||||
if (!gGeneral_config.always_show_gridlines) {
|
if (!gConfigGeneral.always_show_gridlines) {
|
||||||
mainWindow->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES;
|
mainWindow->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES;
|
||||||
window_invalidate(mainWindow);
|
window_invalidate(mainWindow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ void format_comma_separated_fixed_2dp(char **dest, long long value)
|
|||||||
|
|
||||||
void format_currency(char **dest, long long value)
|
void format_currency(char **dest, long long value)
|
||||||
{
|
{
|
||||||
const rct_currency_spec *currencySpec = &g_currency_specs[gGeneral_config.currency_format];
|
const rct_currency_spec *currencySpec = &g_currency_specs[gConfigGeneral.currency_format];
|
||||||
|
|
||||||
int rate = currencySpec->rate;
|
int rate = currencySpec->rate;
|
||||||
value *= rate;
|
value *= rate;
|
||||||
@@ -309,7 +309,7 @@ void format_currency(char **dest, long long value)
|
|||||||
|
|
||||||
void format_currency_2dp(char **dest, long long value)
|
void format_currency_2dp(char **dest, long long value)
|
||||||
{
|
{
|
||||||
const rct_currency_spec *currencySpec = &g_currency_specs[gGeneral_config.currency_format];
|
const rct_currency_spec *currencySpec = &g_currency_specs[gConfigGeneral.currency_format];
|
||||||
|
|
||||||
int rate = currencySpec->rate;
|
int rate = currencySpec->rate;
|
||||||
value *= rate;
|
value *= rate;
|
||||||
@@ -355,7 +355,7 @@ void format_length(char **dest, uint16 value)
|
|||||||
{
|
{
|
||||||
rct_string_id stringId = 2733;
|
rct_string_id stringId = 2733;
|
||||||
|
|
||||||
if (gGeneral_config.measurement_format == MEASUREMENT_FORMAT_IMPERIAL) {
|
if (gConfigGeneral.measurement_format == MEASUREMENT_FORMAT_IMPERIAL) {
|
||||||
value = metres_to_feet(value);
|
value = metres_to_feet(value);
|
||||||
stringId--;
|
stringId--;
|
||||||
}
|
}
|
||||||
@@ -368,7 +368,7 @@ void format_velocity(char **dest, uint16 value)
|
|||||||
{
|
{
|
||||||
rct_string_id stringId = 2734;
|
rct_string_id stringId = 2734;
|
||||||
|
|
||||||
if (gGeneral_config.measurement_format == MEASUREMENT_FORMAT_METRIC) {
|
if (gConfigGeneral.measurement_format == MEASUREMENT_FORMAT_METRIC) {
|
||||||
value = mph_to_kmph(value);
|
value = mph_to_kmph(value);
|
||||||
stringId++;
|
stringId++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,15 @@ void openrct2_launch()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
config_load();
|
config_set_defaults();
|
||||||
|
if (!config_open_default()) {
|
||||||
|
if (!config_find_or_browse_install_directory()) {
|
||||||
|
log_fatal("An RCT2 install directory must be specified!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config_save_default();
|
||||||
|
|
||||||
// TODO add configuration option to allow multiple instances
|
// TODO add configuration option to allow multiple instances
|
||||||
if (!platform_lock_single_instance()) {
|
if (!platform_lock_single_instance()) {
|
||||||
@@ -132,7 +140,7 @@ void openrct2_launch()
|
|||||||
audio_init();
|
audio_init();
|
||||||
audio_get_devices();
|
audio_get_devices();
|
||||||
get_dsound_devices();
|
get_dsound_devices();
|
||||||
language_open(gGeneral_config.language);
|
language_open(gConfigGeneral.language);
|
||||||
if (!rct2_init())
|
if (!rct2_init())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -120,9 +120,9 @@ void platform_update_fullscreen_resolutions()
|
|||||||
gNumResolutions = (int)(resPlace - &gResolutions[0]) + 1;
|
gNumResolutions = (int)(resPlace - &gResolutions[0]) + 1;
|
||||||
|
|
||||||
// Update config fullscreen resolution if not set
|
// Update config fullscreen resolution if not set
|
||||||
if (gGeneral_config.fullscreen_width == -1 || gGeneral_config.fullscreen_height == -1) {
|
if (gConfigGeneral.fullscreen_width == -1 || gConfigGeneral.fullscreen_height == -1) {
|
||||||
gGeneral_config.fullscreen_width = gResolutions[gNumResolutions - 1].width;
|
gConfigGeneral.fullscreen_width = gResolutions[gNumResolutions - 1].width;
|
||||||
gGeneral_config.fullscreen_height = gResolutions[gNumResolutions - 1].height;
|
gConfigGeneral.fullscreen_height = gResolutions[gNumResolutions - 1].height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,10 +352,10 @@ void platform_process_messages()
|
|||||||
gLastKeyPressed = e.key.keysym.sym;
|
gLastKeyPressed = e.key.keysym.sym;
|
||||||
gKeysPressed[e.key.keysym.scancode] = 1;
|
gKeysPressed[e.key.keysym.scancode] = 1;
|
||||||
if (e.key.keysym.sym == SDLK_RETURN && e.key.keysym.mod & KMOD_ALT) {
|
if (e.key.keysym.sym == SDLK_RETURN && e.key.keysym.mod & KMOD_ALT) {
|
||||||
int targetMode = gGeneral_config.fullscreen_mode == 0 ? 2 : 0;
|
int targetMode = gConfigGeneral.fullscreen_mode == 0 ? 2 : 0;
|
||||||
platform_set_fullscreen_mode(targetMode);
|
platform_set_fullscreen_mode(targetMode);
|
||||||
gGeneral_config.fullscreen_mode = targetMode;
|
gConfigGeneral.fullscreen_mode = targetMode;
|
||||||
config_save();
|
config_save_default();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,8 +473,8 @@ static void platform_create_window()
|
|||||||
RCT2_CALLPROC_EBPSAFE(0x0068371D);
|
RCT2_CALLPROC_EBPSAFE(0x0068371D);
|
||||||
|
|
||||||
// Get window size
|
// Get window size
|
||||||
width = gGeneral_config.window_width;
|
width = gConfigGeneral.window_width;
|
||||||
height = gGeneral_config.window_height;
|
height = gConfigGeneral.window_height;
|
||||||
if (width == -1) width = 640;
|
if (width == -1) width = 640;
|
||||||
if (height == -1) height = 480;
|
if (height == -1) height = 480;
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ static void platform_create_window()
|
|||||||
platform_resize(width, height);
|
platform_resize(width, height);
|
||||||
|
|
||||||
platform_update_fullscreen_resolutions();
|
platform_update_fullscreen_resolutions();
|
||||||
platform_set_fullscreen_mode(gGeneral_config.fullscreen_mode);
|
platform_set_fullscreen_mode(gConfigGeneral.fullscreen_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int platform_scancode_to_rct_keycode(int sdl_key)
|
int platform_scancode_to_rct_keycode(int sdl_key)
|
||||||
@@ -555,10 +555,10 @@ void platform_set_fullscreen_mode(int mode)
|
|||||||
// Set window size
|
// Set window size
|
||||||
if (mode == SDL_WINDOW_FULLSCREEN) {
|
if (mode == SDL_WINDOW_FULLSCREEN) {
|
||||||
platform_update_fullscreen_resolutions();
|
platform_update_fullscreen_resolutions();
|
||||||
platform_get_closest_resolution(gGeneral_config.fullscreen_width, gGeneral_config.fullscreen_height, &width, &height);
|
platform_get_closest_resolution(gConfigGeneral.fullscreen_width, gConfigGeneral.fullscreen_height, &width, &height);
|
||||||
SDL_SetWindowSize(gWindow, width, height);
|
SDL_SetWindowSize(gWindow, width, height);
|
||||||
} else if (mode == 0) {
|
} else if (mode == 0) {
|
||||||
SDL_SetWindowSize(gWindow, gGeneral_config.window_width, gGeneral_config.window_height);
|
SDL_SetWindowSize(gWindow, gConfigGeneral.window_width, gConfigGeneral.window_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_SetWindowFullscreen(gWindow, mode)) {
|
if (SDL_SetWindowFullscreen(gWindow, mode)) {
|
||||||
|
|||||||
12
src/rct2.c
12
src/rct2.c
@@ -57,7 +57,7 @@ static void rct2_update_2();
|
|||||||
static jmp_buf _end_update_jump;
|
static jmp_buf _end_update_jump;
|
||||||
|
|
||||||
void rct2_quit() {
|
void rct2_quit() {
|
||||||
if (gGeneral_config.confirmation_prompt) {
|
if (gConfigGeneral.confirmation_prompt) {
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) = PM_QUIT;
|
RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) = PM_QUIT;
|
||||||
window_save_prompt_open();
|
window_save_prompt_open();
|
||||||
} else
|
} else
|
||||||
@@ -116,7 +116,7 @@ int rct2_init()
|
|||||||
title_load();
|
title_load();
|
||||||
|
|
||||||
gfx_clear(RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo), 10);
|
gfx_clear(RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo), 10);
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = gGeneral_config.play_intro ? 8 : 255;
|
RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = gConfigGeneral.play_intro ? 8 : 255;
|
||||||
|
|
||||||
log_verbose("initialising game finished");
|
log_verbose("initialising game finished");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -131,15 +131,15 @@ int rct2_init_directories()
|
|||||||
// windows_get_registry_install_info((rct2_install_info*)0x009AA10C, "RollerCoaster Tycoon 2 Setup", "MS Sans Serif", 0);
|
// windows_get_registry_install_info((rct2_install_info*)0x009AA10C, "RollerCoaster Tycoon 2 Setup", "MS Sans Serif", 0);
|
||||||
|
|
||||||
// check install directory
|
// check install directory
|
||||||
if (!platform_directory_exists(gGeneral_config.game_path)) {
|
if (!platform_directory_exists(gConfigGeneral.game_path)) {
|
||||||
log_verbose("install directory does not exist, %s", gGeneral_config.game_path);
|
log_verbose("install directory does not exist, %s", gConfigGeneral.game_path);
|
||||||
if (!config_find_or_browse_install_directory()) {
|
if (!config_find_or_browse_install_directory()) {
|
||||||
log_fatal("Invalid RCT2 installation path. Please correct in config.ini.");
|
log_fatal("Invalid RCT2 installation path. Please correct in config.ini.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char), gGeneral_config.game_path);
|
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char), gConfigGeneral.game_path);
|
||||||
|
|
||||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH_SLASH, char), RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char));
|
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH_SLASH, char), RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char));
|
||||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH_SLASH, char), "\\");
|
strcat(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH_SLASH, char), "\\");
|
||||||
@@ -360,7 +360,7 @@ const char *get_file_path(int pathId)
|
|||||||
// The original implementation checks if the file is on CD-ROM here (file_on_cdrom[pathId] @ 0x009AA0B1).
|
// The original implementation checks if the file is on CD-ROM here (file_on_cdrom[pathId] @ 0x009AA0B1).
|
||||||
// If so, the CD-ROM path (cdrom_path @ 0x9AA318) is used instead. This has been removed for now for
|
// If so, the CD-ROM path (cdrom_path @ 0x9AA318) is used instead. This has been removed for now for
|
||||||
// the sake of simplicity.
|
// the sake of simplicity.
|
||||||
strcpy(path, gGeneral_config.game_path);
|
strcpy(path, gConfigGeneral.game_path);
|
||||||
|
|
||||||
// Make sure base path is terminated with a slash
|
// Make sure base path is terminated with a slash
|
||||||
if (strlen(path) == 0 || path[strlen(path) - 1] != '\\')
|
if (strlen(path) == 0 || path[strlen(path) - 1] != '\\')
|
||||||
|
|||||||
@@ -44,8 +44,9 @@ typedef unsigned long uint32;
|
|||||||
typedef unsigned long long uint64;
|
typedef unsigned long long uint64;
|
||||||
|
|
||||||
typedef char utf8;
|
typedef char utf8;
|
||||||
typedef wchar_t utf16;
|
|
||||||
typedef utf8* utf8string;
|
typedef utf8* utf8string;
|
||||||
|
typedef const utf8* const_utf8string;
|
||||||
|
typedef wchar_t utf16;
|
||||||
typedef utf16* utf16string;
|
typedef utf16* utf16string;
|
||||||
|
|
||||||
#define rol8(x, shift) (((uint8)(x) << (shift)) | ((uint8)(x) >> (8 - (shift))))
|
#define rol8(x, shift) (((uint8)(x) << (shift)) | ((uint8)(x) >> (8 - (shift))))
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ void title_update()
|
|||||||
if (RCT2_GLOBAL(0x009AAC73, uint8) != 255) {
|
if (RCT2_GLOBAL(0x009AAC73, uint8) != 255) {
|
||||||
RCT2_GLOBAL(0x009AAC73, uint8)++;
|
RCT2_GLOBAL(0x009AAC73, uint8)++;
|
||||||
if (RCT2_GLOBAL(0x009AAC73, uint8) == 255)
|
if (RCT2_GLOBAL(0x009AAC73, uint8) == 255)
|
||||||
config_save();
|
config_save_default();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ void window_editor_bottom_toolbar_jump_forward_to_save_scenario()
|
|||||||
// Save the scenario
|
// Save the scenario
|
||||||
parkFlagsBackup = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32);
|
parkFlagsBackup = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32);
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_18;
|
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_18;
|
||||||
success = scenario_save(path, gGeneral_config.save_plugin_data ? 3 : 2);
|
success = scenario_save(path, gConfigGeneral.save_plugin_data ? 3 : 2);
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = parkFlagsBackup;
|
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = parkFlagsBackup;
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|||||||
@@ -577,7 +577,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME) :
|
case (LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME) :
|
||||||
if (scenario_save((char*)path, gGeneral_config.save_plugin_data ? 1 : 0)) {
|
if (scenario_save((char*)path, gConfigGeneral.save_plugin_data ? 1 : 0)) {
|
||||||
window_close(w);
|
window_close(w);
|
||||||
|
|
||||||
game_do_command(0, 1047, 0, -1, GAME_COMMAND_0, 0, 0);
|
game_do_command(0, 1047, 0, -1, GAME_COMMAND_0, 0, 0);
|
||||||
@@ -599,7 +599,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE) :
|
case (LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE) :
|
||||||
if (scenario_save((char*)path, gGeneral_config.save_plugin_data ? 3 : 2)) {
|
if (scenario_save((char*)path, gConfigGeneral.save_plugin_data ? 3 : 2)) {
|
||||||
window_close(w);
|
window_close(w);
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
}
|
}
|
||||||
@@ -613,7 +613,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
|
|||||||
int parkFlagsBackup = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32);
|
int parkFlagsBackup = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32);
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_18;
|
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_18;
|
||||||
s6Info->var_000 = 255;
|
s6Info->var_000 = 255;
|
||||||
int success = scenario_save((char*)path, gGeneral_config.save_plugin_data ? 3 : 2);
|
int success = scenario_save((char*)path, gConfigGeneral.save_plugin_data ? 3 : 2);
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = parkFlagsBackup;
|
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = parkFlagsBackup;
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|||||||
@@ -293,8 +293,8 @@ static void window_options_mouseup()
|
|||||||
window_shortcut_keys_open();
|
window_shortcut_keys_open();
|
||||||
break;
|
break;
|
||||||
case WIDX_SCREEN_EDGE_SCROLLING:
|
case WIDX_SCREEN_EDGE_SCROLLING:
|
||||||
gGeneral_config.edge_scrolling ^= 1;
|
gConfigGeneral.edge_scrolling ^= 1;
|
||||||
config_save();
|
config_save_default();
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
break;
|
break;
|
||||||
case WIDX_REAL_NAME_CHECKBOX:
|
case WIDX_REAL_NAME_CHECKBOX:
|
||||||
@@ -302,30 +302,30 @@ static void window_options_mouseup()
|
|||||||
RCT2_CALLPROC_X(0x0069C52F, RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? 0 : 1, 0, 0, 0, 0, 0, 0);
|
RCT2_CALLPROC_X(0x0069C52F, RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? 0 : 1, 0, 0, 0, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
case WIDX_TILE_SMOOTHING_CHECKBOX:
|
case WIDX_TILE_SMOOTHING_CHECKBOX:
|
||||||
gGeneral_config.landscape_smoothing ^= 1;
|
gConfigGeneral.landscape_smoothing ^= 1;
|
||||||
config_save();
|
config_save_default();
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
break;
|
break;
|
||||||
case WIDX_GRIDLINES_CHECKBOX:
|
case WIDX_GRIDLINES_CHECKBOX:
|
||||||
gGeneral_config.always_show_gridlines ^= 1;
|
gConfigGeneral.always_show_gridlines ^= 1;
|
||||||
config_save();
|
config_save_default();
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
if ((w = window_get_main()) != NULL) {
|
if ((w = window_get_main()) != NULL) {
|
||||||
if (gGeneral_config.always_show_gridlines)
|
if (gConfigGeneral.always_show_gridlines)
|
||||||
w->viewport->flags |= VIEWPORT_FLAG_GRIDLINES;
|
w->viewport->flags |= VIEWPORT_FLAG_GRIDLINES;
|
||||||
else
|
else
|
||||||
w->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES;
|
w->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIDX_SAVE_PLUGIN_DATA_CHECKBOX:
|
case WIDX_SAVE_PLUGIN_DATA_CHECKBOX:
|
||||||
gGeneral_config.save_plugin_data ^= 1;
|
gConfigGeneral.save_plugin_data ^= 1;
|
||||||
config_save();
|
config_save_default();
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
break;
|
break;
|
||||||
case WIDX_SOUND_SW_BUFFER_CHECKBOX:
|
case WIDX_SOUND_SW_BUFFER_CHECKBOX:
|
||||||
pause_sounds();
|
pause_sounds();
|
||||||
gSound_config.forced_software_buffering ^= 1;
|
gConfigSound.forced_software_buffering ^= 1;
|
||||||
config_save();
|
config_save_default();
|
||||||
unpause_sounds();
|
unpause_sounds();
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
break;
|
break;
|
||||||
@@ -369,7 +369,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
|
|
||||||
window_options_show_dropdown(w, widget, 2);
|
window_options_show_dropdown(w, widget, 2);
|
||||||
|
|
||||||
gDropdownItemsChecked = gGeneral_config.show_height_as_units ? 1 : 2;
|
gDropdownItemsChecked = gConfigGeneral.show_height_as_units ? 1 : 2;
|
||||||
break;
|
break;
|
||||||
case WIDX_MUSIC_DROPDOWN:
|
case WIDX_MUSIC_DROPDOWN:
|
||||||
gDropdownItemsFormat[0] = 1142;
|
gDropdownItemsFormat[0] = 1142;
|
||||||
@@ -391,7 +391,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
|
|
||||||
window_options_show_dropdown(w, widget, num_items);
|
window_options_show_dropdown(w, widget, num_items);
|
||||||
|
|
||||||
gDropdownItemsChecked = 1 << gSound_config.sound_quality;
|
gDropdownItemsChecked = 1 << gConfigSound.sound_quality;
|
||||||
break;
|
break;
|
||||||
case WIDX_TITLE_MUSIC_DROPDOWN:
|
case WIDX_TITLE_MUSIC_DROPDOWN:
|
||||||
num_items = 3;
|
num_items = 3;
|
||||||
@@ -403,7 +403,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
|
|
||||||
window_options_show_dropdown(w, widget, num_items);
|
window_options_show_dropdown(w, widget, num_items);
|
||||||
|
|
||||||
gDropdownItemsChecked = 1 << gGeneral_config.title_music;
|
gDropdownItemsChecked = 1 << gConfigSound.title_music;
|
||||||
break;
|
break;
|
||||||
case WIDX_CURRENCY_DROPDOWN:
|
case WIDX_CURRENCY_DROPDOWN:
|
||||||
num_items = 10;
|
num_items = 10;
|
||||||
@@ -415,7 +415,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
|
|
||||||
window_options_show_dropdown(w, widget, num_items);
|
window_options_show_dropdown(w, widget, num_items);
|
||||||
|
|
||||||
gDropdownItemsChecked = 1 << gGeneral_config.currency_format;
|
gDropdownItemsChecked = 1 << gConfigGeneral.currency_format;
|
||||||
break;
|
break;
|
||||||
case WIDX_DISTANCE_DROPDOWN:
|
case WIDX_DISTANCE_DROPDOWN:
|
||||||
gDropdownItemsFormat[0] = 1142;
|
gDropdownItemsFormat[0] = 1142;
|
||||||
@@ -425,7 +425,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
|
|
||||||
window_options_show_dropdown(w, widget, 2);
|
window_options_show_dropdown(w, widget, 2);
|
||||||
|
|
||||||
gDropdownItemsChecked = 1 << gGeneral_config.measurement_format;
|
gDropdownItemsChecked = 1 << gConfigGeneral.measurement_format;
|
||||||
break;
|
break;
|
||||||
case WIDX_RESOLUTION_DROPDOWN:
|
case WIDX_RESOLUTION_DROPDOWN:
|
||||||
{
|
{
|
||||||
@@ -442,7 +442,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
args[1] = resolution->width;
|
args[1] = resolution->width;
|
||||||
args[2] = resolution->height;
|
args[2] = resolution->height;
|
||||||
|
|
||||||
if (resolution->width == gGeneral_config.fullscreen_width && resolution->height == gGeneral_config.fullscreen_height)
|
if (resolution->width == gConfigGeneral.fullscreen_width && resolution->height == gConfigGeneral.fullscreen_height)
|
||||||
selectedResolution = i;
|
selectedResolution = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
|
|
||||||
window_options_show_dropdown(w, widget, 3);
|
window_options_show_dropdown(w, widget, 3);
|
||||||
|
|
||||||
gDropdownItemsChecked = 1 << gGeneral_config.fullscreen_mode;
|
gDropdownItemsChecked = 1 << gConfigGeneral.fullscreen_mode;
|
||||||
break;
|
break;
|
||||||
case WIDX_TEMPERATURE_DROPDOWN:
|
case WIDX_TEMPERATURE_DROPDOWN:
|
||||||
gDropdownItemsFormat[0] = 1142;
|
gDropdownItemsFormat[0] = 1142;
|
||||||
@@ -473,7 +473,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
|
|
||||||
window_options_show_dropdown(w, widget, 2);
|
window_options_show_dropdown(w, widget, 2);
|
||||||
|
|
||||||
gDropdownItemsChecked = 1 << gGeneral_config.temperature_format;
|
gDropdownItemsChecked = 1 << gConfigGeneral.temperature_format;
|
||||||
break;
|
break;
|
||||||
case WIDX_CONSTRUCTION_MARKER_DROPDOWN:
|
case WIDX_CONSTRUCTION_MARKER_DROPDOWN:
|
||||||
gDropdownItemsFormat[0] = 1142;
|
gDropdownItemsFormat[0] = 1142;
|
||||||
@@ -483,7 +483,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
|
|
||||||
window_options_show_dropdown(w, widget, 2);
|
window_options_show_dropdown(w, widget, 2);
|
||||||
|
|
||||||
gDropdownItemsChecked = 1 << gGeneral_config.construction_marker_colour;
|
gDropdownItemsChecked = 1 << gConfigGeneral.construction_marker_colour;
|
||||||
break;
|
break;
|
||||||
case WIDX_LANGUAGE_DROPDOWN:
|
case WIDX_LANGUAGE_DROPDOWN:
|
||||||
for (i = 1; i < LANGUAGE_COUNT; i++) {
|
for (i = 1; i < LANGUAGE_COUNT; i++) {
|
||||||
@@ -536,64 +536,64 @@ static void window_options_dropdown()
|
|||||||
case WIDX_HEIGHT_LABELS_DROPDOWN:
|
case WIDX_HEIGHT_LABELS_DROPDOWN:
|
||||||
// reset flag and set it to 1 if height as units is selected
|
// reset flag and set it to 1 if height as units is selected
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) &= ~CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
|
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) &= ~CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
|
||||||
gGeneral_config.show_height_as_units = 0;
|
gConfigGeneral.show_height_as_units = 0;
|
||||||
|
|
||||||
if (dropdownIndex == 0) {
|
if (dropdownIndex == 0) {
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
|
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
|
||||||
gGeneral_config.show_height_as_units = 1;
|
gConfigGeneral.show_height_as_units = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
window_options_update_height_markers();
|
window_options_update_height_markers();
|
||||||
break;
|
break;
|
||||||
case WIDX_MUSIC_DROPDOWN:
|
case WIDX_MUSIC_DROPDOWN:
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) = (uint8)dropdownIndex;
|
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) = (uint8)dropdownIndex;
|
||||||
config_save();
|
config_save_default();
|
||||||
stop_ride_music();//RCT2_CALLPROC_EBPSAFE(0x006BCA9F);
|
stop_ride_music();//RCT2_CALLPROC_EBPSAFE(0x006BCA9F);
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
break;
|
break;
|
||||||
case WIDX_SOUND_QUALITY_DROPDOWN:
|
case WIDX_SOUND_QUALITY_DROPDOWN:
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_VEHICLE_SOUNDS, uint8) = RCT2_GLOBAL(0x009AF601 + dropdownIndex, uint8);
|
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_VEHICLE_SOUNDS, uint8) = RCT2_GLOBAL(0x009AF601 + dropdownIndex, uint8);
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_NO_SOUNDS, uint8) = RCT2_GLOBAL(0x009AF604 + dropdownIndex, uint8);
|
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_NO_SOUNDS, uint8) = RCT2_GLOBAL(0x009AF604 + dropdownIndex, uint8);
|
||||||
gSound_config.sound_quality = (sint8)dropdownIndex;
|
gConfigSound.sound_quality = (sint8)dropdownIndex;
|
||||||
config_save();
|
config_save_default();
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
break;
|
break;
|
||||||
case WIDX_TITLE_MUSIC_DROPDOWN:
|
case WIDX_TITLE_MUSIC_DROPDOWN:
|
||||||
if (dropdownIndex == 1 && !platform_file_exists(get_file_path(PATH_ID_CSS50))) {
|
if (dropdownIndex == 1 && !platform_file_exists(get_file_path(PATH_ID_CSS50))) {
|
||||||
window_error_open(2742, 2743);
|
window_error_open(2742, 2743);
|
||||||
} else {
|
} else {
|
||||||
gGeneral_config.title_music = (sint8)dropdownIndex;
|
gConfigSound.title_music = (sint8)dropdownIndex;
|
||||||
config_save();
|
config_save_default();
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIDX_CURRENCY_DROPDOWN:
|
case WIDX_CURRENCY_DROPDOWN:
|
||||||
gGeneral_config.currency_format = (sint8)dropdownIndex;
|
gConfigGeneral.currency_format = (sint8)dropdownIndex;
|
||||||
config_save();
|
config_save_default();
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
break;
|
break;
|
||||||
case WIDX_DISTANCE_DROPDOWN:
|
case WIDX_DISTANCE_DROPDOWN:
|
||||||
gGeneral_config.measurement_format = (sint8)dropdownIndex;
|
gConfigGeneral.measurement_format = (sint8)dropdownIndex;
|
||||||
config_save();
|
config_save_default();
|
||||||
window_options_update_height_markers();
|
window_options_update_height_markers();
|
||||||
break;
|
break;
|
||||||
case WIDX_RESOLUTION_DROPDOWN:
|
case WIDX_RESOLUTION_DROPDOWN:
|
||||||
{
|
{
|
||||||
resolution *resolution = &gResolutions[dropdownIndex];
|
resolution *resolution = &gResolutions[dropdownIndex];
|
||||||
if (resolution->width != gGeneral_config.fullscreen_width || resolution->height != gGeneral_config.fullscreen_height) {
|
if (resolution->width != gConfigGeneral.fullscreen_width || resolution->height != gConfigGeneral.fullscreen_height) {
|
||||||
gGeneral_config.fullscreen_width = resolution->width;
|
gConfigGeneral.fullscreen_width = resolution->width;
|
||||||
gGeneral_config.fullscreen_height = resolution->height;
|
gConfigGeneral.fullscreen_height = resolution->height;
|
||||||
|
|
||||||
if (gGeneral_config.fullscreen_mode == SDL_WINDOW_FULLSCREEN)
|
if (gConfigGeneral.fullscreen_mode == SDL_WINDOW_FULLSCREEN)
|
||||||
platform_set_fullscreen_mode(SDL_WINDOW_FULLSCREEN);
|
platform_set_fullscreen_mode(SDL_WINDOW_FULLSCREEN);
|
||||||
|
|
||||||
config_save();
|
config_save_default();
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIDX_FULLSCREEN_DROPDOWN:
|
case WIDX_FULLSCREEN_DROPDOWN:
|
||||||
if (dropdownIndex != gGeneral_config.fullscreen_mode){
|
if (dropdownIndex != gConfigGeneral.fullscreen_mode){
|
||||||
if (dropdownIndex == 2){
|
if (dropdownIndex == 2){
|
||||||
w->disabled_widgets |= (1 << WIDX_RESOLUTION_DROPDOWN);
|
w->disabled_widgets |= (1 << WIDX_RESOLUTION_DROPDOWN);
|
||||||
w->disabled_widgets |= (1 << WIDX_RESOLUTION);
|
w->disabled_widgets |= (1 << WIDX_RESOLUTION);
|
||||||
@@ -603,29 +603,29 @@ static void window_options_dropdown()
|
|||||||
}
|
}
|
||||||
platform_set_fullscreen_mode(dropdownIndex);
|
platform_set_fullscreen_mode(dropdownIndex);
|
||||||
|
|
||||||
gGeneral_config.fullscreen_mode = (uint8)dropdownIndex;
|
gConfigGeneral.fullscreen_mode = (uint8)dropdownIndex;
|
||||||
config_save();
|
config_save_default();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIDX_TEMPERATURE_DROPDOWN:
|
case WIDX_TEMPERATURE_DROPDOWN:
|
||||||
if (dropdownIndex != gGeneral_config.temperature_format) {
|
if (dropdownIndex != gConfigGeneral.temperature_format) {
|
||||||
gGeneral_config.temperature_format = (sint8)dropdownIndex;
|
gConfigGeneral.temperature_format = (sint8)dropdownIndex;
|
||||||
config_save();
|
config_save_default();
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIDX_CONSTRUCTION_MARKER_DROPDOWN:
|
case WIDX_CONSTRUCTION_MARKER_DROPDOWN:
|
||||||
if (dropdownIndex != gGeneral_config.construction_marker_colour) {
|
if (dropdownIndex != gConfigGeneral.construction_marker_colour) {
|
||||||
gGeneral_config.construction_marker_colour = (uint8)dropdownIndex;
|
gConfigGeneral.construction_marker_colour = (uint8)dropdownIndex;
|
||||||
config_save();
|
config_save_default();
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIDX_LANGUAGE_DROPDOWN:
|
case WIDX_LANGUAGE_DROPDOWN:
|
||||||
if (dropdownIndex != gCurrentLanguage - 1) {
|
if (dropdownIndex != gCurrentLanguage - 1) {
|
||||||
language_open(dropdownIndex + 1);
|
language_open(dropdownIndex + 1);
|
||||||
gGeneral_config.language = dropdownIndex + 1;
|
gConfigGeneral.language = dropdownIndex + 1;
|
||||||
config_save();
|
config_save_default();
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -652,9 +652,9 @@ static void window_options_invalidate()
|
|||||||
switch (w->page) {
|
switch (w->page) {
|
||||||
case WINDOW_OPTIONS_PAGE_DISPLAY:
|
case WINDOW_OPTIONS_PAGE_DISPLAY:
|
||||||
// resolution
|
// resolution
|
||||||
RCT2_GLOBAL(0x013CE952 + 16, uint16) = gGeneral_config.fullscreen_width;
|
RCT2_GLOBAL(0x013CE952 + 16, uint16) = (uint16)gConfigGeneral.fullscreen_width;
|
||||||
RCT2_GLOBAL(0x013CE952 + 18, uint16) = gGeneral_config.fullscreen_height;
|
RCT2_GLOBAL(0x013CE952 + 18, uint16) = (uint16)gConfigGeneral.fullscreen_height;
|
||||||
RCT2_GLOBAL(0x013CE952 + 12, uint16) = 2773 + gGeneral_config.fullscreen_mode;
|
RCT2_GLOBAL(0x013CE952 + 12, uint16) = 2773 + gConfigGeneral.fullscreen_mode;
|
||||||
|
|
||||||
// landscape tile smoothing checkbox
|
// landscape tile smoothing checkbox
|
||||||
if ((RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE))
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE))
|
||||||
@@ -682,16 +682,16 @@ static void window_options_invalidate()
|
|||||||
break;
|
break;
|
||||||
case WINDOW_OPTIONS_PAGE_CULTURE:
|
case WINDOW_OPTIONS_PAGE_CULTURE:
|
||||||
// currency: pounds, dollars, etc. (10 total)
|
// currency: pounds, dollars, etc. (10 total)
|
||||||
RCT2_GLOBAL(0x013CE952 + 12, uint16) = STR_POUNDS + gGeneral_config.currency_format;
|
RCT2_GLOBAL(0x013CE952 + 12, uint16) = STR_POUNDS + gConfigGeneral.currency_format;
|
||||||
|
|
||||||
// distance: metric/imperial
|
// distance: metric/imperial
|
||||||
RCT2_GLOBAL(0x013CE952 + 14, uint16) = STR_IMPERIAL + gGeneral_config.measurement_format;
|
RCT2_GLOBAL(0x013CE952 + 14, uint16) = STR_IMPERIAL + gConfigGeneral.measurement_format;
|
||||||
|
|
||||||
// temperature: celsius/fahrenheit
|
// temperature: celsius/fahrenheit
|
||||||
RCT2_GLOBAL(0x013CE952 + 20, uint16) = STR_CELSIUS + gGeneral_config.temperature_format;
|
RCT2_GLOBAL(0x013CE952 + 20, uint16) = STR_CELSIUS + gConfigGeneral.temperature_format;
|
||||||
|
|
||||||
// height: units/real values
|
// height: units/real values
|
||||||
RCT2_GLOBAL(0x013CE952 + 6, uint16) = gGeneral_config.show_height_as_units ? STR_UNITS : STR_REAL_VALUES;
|
RCT2_GLOBAL(0x013CE952 + 6, uint16) = gConfigGeneral.show_height_as_units ? STR_UNITS : STR_REAL_VALUES;
|
||||||
|
|
||||||
window_options_widgets[WIDX_LANGUAGE].type = WWT_DROPDOWN;
|
window_options_widgets[WIDX_LANGUAGE].type = WWT_DROPDOWN;
|
||||||
window_options_widgets[WIDX_LANGUAGE_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
window_options_widgets[WIDX_LANGUAGE_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
||||||
@@ -719,7 +719,7 @@ static void window_options_invalidate()
|
|||||||
RCT2_GLOBAL(0x013CE952 + 8, uint16) = STR_OFF + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8);
|
RCT2_GLOBAL(0x013CE952 + 8, uint16) = STR_OFF + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8);
|
||||||
|
|
||||||
// sound quality: low/medium/high
|
// sound quality: low/medium/high
|
||||||
RCT2_GLOBAL(0x013CE952 + 10, uint16) = STR_SOUND_LOW + gSound_config.sound_quality;
|
RCT2_GLOBAL(0x013CE952 + 10, uint16) = STR_SOUND_LOW + gConfigSound.sound_quality;
|
||||||
|
|
||||||
//Sound pause checkbox
|
//Sound pause checkbox
|
||||||
if (!g_sounds_disabled)
|
if (!g_sounds_disabled)
|
||||||
@@ -728,7 +728,7 @@ static void window_options_invalidate()
|
|||||||
w->pressed_widgets &= ~(1ULL << WIDX_SOUND_PAUSED_CHECKBOX);
|
w->pressed_widgets &= ~(1ULL << WIDX_SOUND_PAUSED_CHECKBOX);
|
||||||
|
|
||||||
// sound software mixing buffer checkbox
|
// sound software mixing buffer checkbox
|
||||||
if (gSound_config.forced_software_buffering)
|
if (gConfigSound.forced_software_buffering)
|
||||||
w->pressed_widgets |= (1ULL << WIDX_SOUND_SW_BUFFER_CHECKBOX);
|
w->pressed_widgets |= (1ULL << WIDX_SOUND_SW_BUFFER_CHECKBOX);
|
||||||
else
|
else
|
||||||
w->pressed_widgets &= ~(1ULL << WIDX_SOUND_SW_BUFFER_CHECKBOX);
|
w->pressed_widgets &= ~(1ULL << WIDX_SOUND_SW_BUFFER_CHECKBOX);
|
||||||
@@ -746,7 +746,7 @@ static void window_options_invalidate()
|
|||||||
break;
|
break;
|
||||||
case WINDOW_OPTIONS_PAGE_INPUT:
|
case WINDOW_OPTIONS_PAGE_INPUT:
|
||||||
// screen edge scrolling checkbox
|
// screen edge scrolling checkbox
|
||||||
if (gGeneral_config.edge_scrolling)
|
if (gConfigGeneral.edge_scrolling)
|
||||||
w->pressed_widgets |= (1ULL << WIDX_SCREEN_EDGE_SCROLLING);
|
w->pressed_widgets |= (1ULL << WIDX_SCREEN_EDGE_SCROLLING);
|
||||||
else
|
else
|
||||||
w->pressed_widgets &= ~(1ULL << WIDX_SCREEN_EDGE_SCROLLING);
|
w->pressed_widgets &= ~(1ULL << WIDX_SCREEN_EDGE_SCROLLING);
|
||||||
@@ -762,7 +762,7 @@ static void window_options_invalidate()
|
|||||||
w->pressed_widgets &= ~(1ULL << WIDX_REAL_NAME_CHECKBOX);
|
w->pressed_widgets &= ~(1ULL << WIDX_REAL_NAME_CHECKBOX);
|
||||||
|
|
||||||
// save plugin data checkbox
|
// save plugin data checkbox
|
||||||
if (gGeneral_config.save_plugin_data)
|
if (gConfigGeneral.save_plugin_data)
|
||||||
w->pressed_widgets |= (1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX);
|
w->pressed_widgets |= (1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX);
|
||||||
else
|
else
|
||||||
w->pressed_widgets &= ~(1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX);
|
w->pressed_widgets &= ~(1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX);
|
||||||
@@ -835,7 +835,7 @@ static void window_options_paint()
|
|||||||
gfx_draw_string_left(dpi, 2738, w, 12, w->x + 10, w->y + window_options_widgets[WIDX_TITLE_MUSIC].top + 1);
|
gfx_draw_string_left(dpi, 2738, w, 12, w->x + 10, w->y + window_options_widgets[WIDX_TITLE_MUSIC].top + 1);
|
||||||
gfx_draw_string_left(
|
gfx_draw_string_left(
|
||||||
dpi,
|
dpi,
|
||||||
2739 + gGeneral_config.title_music,
|
2739 + gConfigSound.title_music,
|
||||||
NULL,
|
NULL,
|
||||||
12,
|
12,
|
||||||
w->x + window_options_widgets[WIDX_TITLE_MUSIC].left + 1,
|
w->x + window_options_widgets[WIDX_TITLE_MUSIC].left + 1,
|
||||||
@@ -861,9 +861,9 @@ static void window_options_show_dropdown(rct_window *w, rct_widget *widget, int
|
|||||||
|
|
||||||
static void window_options_update_height_markers()
|
static void window_options_update_height_markers()
|
||||||
{
|
{
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16) = gGeneral_config.show_height_as_units ?
|
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16) = gConfigGeneral.show_height_as_units ?
|
||||||
0 : (gGeneral_config.measurement_format + 1) * 256;
|
0 : (gConfigGeneral.measurement_format + 1) * 256;
|
||||||
config_save();
|
config_save_default();
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ void window_save_prompt_open()
|
|||||||
window_save_prompt_widgets[WIDX_TITLE].image = stringId;
|
window_save_prompt_widgets[WIDX_TITLE].image = stringId;
|
||||||
window_save_prompt_widgets[WIDX_LABEL].image = prompt_mode + STR_SAVE_BEFORE_LOADING;
|
window_save_prompt_widgets[WIDX_LABEL].image = prompt_mode + STR_SAVE_BEFORE_LOADING;
|
||||||
|
|
||||||
if (!gGeneral_config.confirmation_prompt) {
|
if (!gConfigGeneral.confirmation_prompt) {
|
||||||
/* game_load_or_quit_no_save_prompt() will exec requested task and close this window
|
/* game_load_or_quit_no_save_prompt() will exec requested task and close this window
|
||||||
* immediately again.
|
* immediately again.
|
||||||
* TODO restructure these functions when we're sure game_load_or_quit_no_save_prompt()
|
* TODO restructure these functions when we're sure game_load_or_quit_no_save_prompt()
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ static void window_shortcut_mouseup()
|
|||||||
break;
|
break;
|
||||||
case WIDX_RESET:
|
case WIDX_RESET:
|
||||||
config_reset_shortcut_keys();
|
config_reset_shortcut_keys();
|
||||||
config_save();
|
config_save_default();
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user