mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
add options for finance and research on toolbar
This commit is contained in:
@@ -3451,3 +3451,7 @@ STR_3443 :Page 4
|
||||
STR_3444 :Page 5
|
||||
STR_3445 :Set Patrol Area
|
||||
STR_3446 :Cancel Patrol Area
|
||||
|
||||
# New strings, cleaner
|
||||
STR_5120 :Show finances button on toolbar
|
||||
STR_5121 :Show research button on toolbar
|
||||
@@ -162,6 +162,11 @@ config_property_definition _generalDefinitions[] = {
|
||||
{ offsetof(general_configuration, window_width), "window_width", CONFIG_VALUE_TYPE_SINT32, -1, NULL },
|
||||
};
|
||||
|
||||
config_property_definition _interfaceDefinitions[] = {
|
||||
{ offsetof(interface_configuration, toolbar_show_finances), "toolbar_show_finances", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
|
||||
{ offsetof(interface_configuration, toolbar_show_research), "toolbar_show_research", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
|
||||
};
|
||||
|
||||
config_property_definition _soundDefinitions[] = {
|
||||
{ offsetof(sound_configuration, forced_software_buffering), "forced_software_buffering", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
|
||||
{ offsetof(sound_configuration, sound_quality), "sound_quality", CONFIG_VALUE_TYPE_UINT8, 2, NULL },
|
||||
@@ -170,12 +175,14 @@ config_property_definition _soundDefinitions[] = {
|
||||
|
||||
config_section_definition _sectionDefinitions[] = {
|
||||
{ &gConfigGeneral, "general", _generalDefinitions, countof(_generalDefinitions) },
|
||||
{ &gConfigInterface, "interface", _interfaceDefinitions, countof(_interfaceDefinitions) },
|
||||
{ &gConfigSound, "sound", _soundDefinitions, countof(_soundDefinitions) }
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
general_configuration gConfigGeneral;
|
||||
interface_configuration gConfigInterface;
|
||||
sound_configuration gConfigSound;
|
||||
|
||||
bool config_open(const utf8string path);
|
||||
|
||||
12
src/config.h
12
src/config.h
@@ -105,7 +105,7 @@ enum {
|
||||
AUTOSAVE_NEVER
|
||||
};
|
||||
|
||||
typedef struct general_configuration {
|
||||
typedef struct {
|
||||
uint8 play_intro;
|
||||
uint8 confirmation_prompt;
|
||||
uint8 screenshot_format;
|
||||
@@ -131,18 +131,24 @@ typedef struct general_configuration {
|
||||
uint8 autosave_frequency;
|
||||
} general_configuration;
|
||||
|
||||
typedef struct sound_configuration {
|
||||
typedef struct {
|
||||
uint8 toolbar_show_finances;
|
||||
uint8 toolbar_show_research;
|
||||
} interface_configuration;
|
||||
|
||||
typedef struct {
|
||||
sint8 forced_software_buffering;
|
||||
sint8 sound_quality;
|
||||
uint8 title_music;
|
||||
} sound_configuration;
|
||||
|
||||
typedef struct shortcut_entry {
|
||||
typedef struct {
|
||||
uint8 key;
|
||||
uint8 modifier;
|
||||
} shortcut_entry;
|
||||
|
||||
extern general_configuration gConfigGeneral;
|
||||
extern interface_configuration gConfigInterface;
|
||||
extern sound_configuration gConfigSound;
|
||||
|
||||
extern uint16 gShortcutKeys[SHORTCUT_COUNT];
|
||||
|
||||
@@ -1113,3 +1113,11 @@ void widget_scroll_get_part(rct_window *w, rct_widget* widget, int x, int y, int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void widget_set_checkbox_value(rct_window *w, int widgetIndex, int value)
|
||||
{
|
||||
if (value)
|
||||
w->pressed_widgets |= (1ULL << widgetIndex);
|
||||
else
|
||||
w->pressed_widgets &= ~(1ULL << widgetIndex);
|
||||
}
|
||||
@@ -63,4 +63,7 @@ int widget_is_pressed(rct_window *w, int widgetIndex);
|
||||
int widget_is_highlighted(rct_window *w, int widgetIndex);
|
||||
int widget_is_active_tool(rct_window *w, int widgetIndex);
|
||||
void widget_scroll_get_part(rct_window *w, rct_widget* widget, int x, int y, int *output_x, int *output_y, int *output_scroll_area, int *scroll_id);
|
||||
|
||||
void widget_set_checkbox_value(rct_window *w, int widgetIndex, int value);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -82,11 +82,20 @@ static int utf8_get_next(char *char_ptr, char **nextchar_ptr)
|
||||
|
||||
const char *language_get_string(rct_string_id id)
|
||||
{
|
||||
if (id >= STR_OPENRCT2_BEGIN_STRING_ID) {
|
||||
const char *openrct = language_strings == NULL ? NULL : language_strings[id];
|
||||
if (openrct != NULL)
|
||||
return openrct;
|
||||
|
||||
// TODO Fall back to another language or otherwise English (UK)
|
||||
return "(undefined string)";
|
||||
} else {
|
||||
const char *rct = RCT2_ADDRESS(0x009BF2D4, const char*)[id];
|
||||
const char *openrct = language_strings == NULL ? NULL : language_strings[id];
|
||||
const char *str = (openrct == NULL || strlen(openrct) == 0 ? rct : openrct);
|
||||
return str == NULL ? "" : str;
|
||||
}
|
||||
}
|
||||
|
||||
int language_open(int id)
|
||||
{
|
||||
@@ -128,7 +137,7 @@ static int language_open_file(const char *filename)
|
||||
return 0;
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
language_buffer_size = ftell(f);
|
||||
language_buffer_size = ftell(f) + 1;
|
||||
language_buffer = calloc(1, language_buffer_size);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
fread(language_buffer, language_buffer_size, 1, f);
|
||||
|
||||
@@ -1394,6 +1394,8 @@ enum {
|
||||
STR_SET_PATROL_AREA = 3445,
|
||||
STR_CLEAR_PATROL_AREA = 3446,
|
||||
|
||||
STR_OPENRCT2_BEGIN_STRING_ID = 5120,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
STR_COUNT = 32768
|
||||
};
|
||||
|
||||
@@ -571,12 +571,12 @@ static void window_cheats_paint()
|
||||
window_cheats_draw_tab_images(dpi, w);
|
||||
|
||||
if (w->page == WINDOW_CHEATS_PAGE_MONEY){
|
||||
gfx_draw_string(dpi, language_get_string(2681), 0, w->x + XPL(0) + TXTO, w->y + YPL(0) + TXTO);
|
||||
gfx_draw_string(dpi, language_get_string(2682), 0, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO);
|
||||
gfx_draw_string(dpi, (char*)language_get_string(2681), 0, w->x + XPL(0) + TXTO, w->y + YPL(0) + TXTO);
|
||||
gfx_draw_string(dpi, (char*)language_get_string(2682), 0, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO);
|
||||
}
|
||||
else if (w->page == WINDOW_CHEATS_PAGE_GUESTS){
|
||||
gfx_draw_string(dpi, language_get_string(2683), 0, w->x + XPL(0) + TXTO, w->y + YPL(0) + TXTO);
|
||||
gfx_draw_string(dpi, language_get_string(2684), 0, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO);
|
||||
gfx_draw_string(dpi, (char*)language_get_string(2683), 0, w->x + XPL(0) + TXTO, w->y + YPL(0) + TXTO);
|
||||
gfx_draw_string(dpi, (char*)language_get_string(2684), 0, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
|
||||
|
||||
WIDX_SCREEN_EDGE_SCROLLING,
|
||||
WIDX_HOTKEY_DROPDOWN,
|
||||
WIDX_TOOLBAR_SHOW_FINANCES,
|
||||
WIDX_TOOLBAR_SHOW_RESEARCH,
|
||||
|
||||
WIDX_REAL_NAME_CHECKBOX,
|
||||
WIDX_SAVE_PLUGIN_DATA_CHECKBOX,
|
||||
@@ -151,6 +153,8 @@ static rct_widget window_options_widgets[] = {
|
||||
// Controls tab
|
||||
{ WWT_CHECKBOX, 2, 10, 299, 53, 64, STR_SCREEN_EDGE_SCROLLING, STR_SCREEN_EDGE_SCROLLING_TIP },
|
||||
{ WWT_DROPDOWN_BUTTON, 0, 26, 185, 68, 78, STR_HOTKEY, STR_HOTKEY_TIP },
|
||||
{ WWT_CHECKBOX, 2, 10, 299, 82, 93, 5120, STR_NONE },
|
||||
{ WWT_CHECKBOX, 2, 10, 299, 97, 108, 5121, STR_NONE },
|
||||
|
||||
// Misc
|
||||
{ WWT_CHECKBOX, 2, 10, 299, 53, 64, STR_REAL_NAME, STR_REAL_NAME_TIP },
|
||||
@@ -253,6 +257,8 @@ void window_options_open()
|
||||
(1ULL << WIDX_TEMPERATURE_DROPDOWN) |
|
||||
(1ULL << WIDX_HOTKEY_DROPDOWN) |
|
||||
(1ULL << WIDX_SCREEN_EDGE_SCROLLING) |
|
||||
(1ULL << WIDX_TOOLBAR_SHOW_FINANCES) |
|
||||
(1ULL << WIDX_TOOLBAR_SHOW_RESEARCH) |
|
||||
(1ULL << WIDX_REAL_NAME_CHECKBOX) |
|
||||
(1ULL << WIDX_CONSTRUCTION_MARKER) |
|
||||
(1ULL << WIDX_CONSTRUCTION_MARKER_DROPDOWN) |
|
||||
@@ -303,6 +309,18 @@ static void window_options_mouseup()
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_TOOLBAR_SHOW_FINANCES:
|
||||
gConfigInterface.toolbar_show_finances ^= 1;
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
window_invalidate_by_class(WC_TOP_TOOLBAR);
|
||||
break;
|
||||
case WIDX_TOOLBAR_SHOW_RESEARCH:
|
||||
gConfigInterface.toolbar_show_research ^= 1;
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
window_invalidate_by_class(WC_TOP_TOOLBAR);
|
||||
break;
|
||||
case WIDX_REAL_NAME_CHECKBOX:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
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);
|
||||
@@ -752,17 +770,8 @@ static void window_options_invalidate()
|
||||
// sound quality: low/medium/high
|
||||
RCT2_GLOBAL(0x013CE952 + 10, uint16) = STR_SOUND_LOW + gConfigSound.sound_quality;
|
||||
|
||||
//Sound pause checkbox
|
||||
if (!g_sounds_disabled)
|
||||
w->pressed_widgets |= (1ULL << WIDX_SOUND_PAUSED_CHECKBOX);
|
||||
else
|
||||
w->pressed_widgets &= ~(1ULL << WIDX_SOUND_PAUSED_CHECKBOX);
|
||||
|
||||
// sound software mixing buffer checkbox
|
||||
if (gConfigSound.forced_software_buffering)
|
||||
w->pressed_widgets |= (1ULL << WIDX_SOUND_SW_BUFFER_CHECKBOX);
|
||||
else
|
||||
w->pressed_widgets &= ~(1ULL << WIDX_SOUND_SW_BUFFER_CHECKBOX);
|
||||
widget_set_checkbox_value(w, WIDX_SOUND_PAUSED_CHECKBOX, !g_sounds_disabled);
|
||||
widget_set_checkbox_value(w, WIDX_SOUND_SW_BUFFER_CHECKBOX, gConfigSound.forced_software_buffering);
|
||||
|
||||
window_options_widgets[WIDX_SOUND].type = WWT_DROPDOWN;
|
||||
window_options_widgets[WIDX_SOUND_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
||||
@@ -776,14 +785,14 @@ static void window_options_invalidate()
|
||||
window_options_widgets[WIDX_TITLE_MUSIC_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
||||
break;
|
||||
case WINDOW_OPTIONS_PAGE_INPUT:
|
||||
// screen edge scrolling checkbox
|
||||
if (gConfigGeneral.edge_scrolling)
|
||||
w->pressed_widgets |= (1ULL << WIDX_SCREEN_EDGE_SCROLLING);
|
||||
else
|
||||
w->pressed_widgets &= ~(1ULL << WIDX_SCREEN_EDGE_SCROLLING);
|
||||
widget_set_checkbox_value(w, WIDX_SCREEN_EDGE_SCROLLING, gConfigGeneral.edge_scrolling);
|
||||
widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_FINANCES, gConfigInterface.toolbar_show_finances);
|
||||
widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_RESEARCH, gConfigInterface.toolbar_show_research);
|
||||
|
||||
window_options_widgets[WIDX_SCREEN_EDGE_SCROLLING].type = WWT_CHECKBOX;
|
||||
window_options_widgets[WIDX_HOTKEY_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
||||
window_options_widgets[WIDX_TOOLBAR_SHOW_FINANCES].type = WWT_CHECKBOX;
|
||||
window_options_widgets[WIDX_TOOLBAR_SHOW_RESEARCH].type = WWT_CHECKBOX;
|
||||
break;
|
||||
case WINDOW_OPTIONS_PAGE_MISC:
|
||||
// real name checkbox
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../config.h"
|
||||
#include "../editor.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
@@ -503,8 +504,11 @@ static void window_top_toolbar_invalidate()
|
||||
window_top_toolbar_widgets[WIDX_VIEW_MENU].type = WWT_EMPTY;
|
||||
}
|
||||
} else {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)
|
||||
if ((RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) || !gConfigInterface.toolbar_show_finances)
|
||||
window_top_toolbar_widgets[WIDX_FINANCES].type = WWT_EMPTY;
|
||||
|
||||
if (!gConfigInterface.toolbar_show_research)
|
||||
window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_EMPTY;
|
||||
}
|
||||
|
||||
enabledWidgets = 0;
|
||||
|
||||
Reference in New Issue
Block a user