mirror of https://github.com/OpenRCT2/OpenRCT2.git
parent
6caa48d3c3
commit
db9ea4cdf3
|
@ -3830,3 +3830,4 @@ STR_5485 :{SMALLFONT}{STRING}
|
|||
STR_5486 :{BLACK}{COMMA16}
|
||||
STR_5487 :{SMALLFONT}{BLACK}Show recent messages
|
||||
STR_5488 :No entrance
|
||||
STR_5490 :Disable audio on focus loss
|
||||
|
|
|
@ -206,7 +206,8 @@ config_property_definition _interfaceDefinitions[] = {
|
|||
config_property_definition _soundDefinitions[] = {
|
||||
{ offsetof(sound_configuration, title_music), "title_music", CONFIG_VALUE_TYPE_UINT8, 2, NULL },
|
||||
{ offsetof(sound_configuration, sound), "sound", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
|
||||
{ offsetof(sound_configuration, ride_music), "ride_music", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
|
||||
{ offsetof(sound_configuration, ride_music), "ride_music", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
|
||||
{ offsetof(sound_configuration, audio_focus), "audio_focus", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
|
||||
{ offsetof(sound_configuration, master_volume), "master_volume", CONFIG_VALUE_TYPE_UINT8, 100, NULL },
|
||||
{ offsetof(sound_configuration, music_volume), "music_volume", CONFIG_VALUE_TYPE_UINT8, 100, NULL },
|
||||
{ offsetof(sound_configuration, device), "audio_device", CONFIG_VALUE_TYPE_STRING, { .value_string = NULL }, NULL },
|
||||
|
|
|
@ -180,6 +180,7 @@ typedef struct {
|
|||
uint8 title_music;
|
||||
uint8 sound;
|
||||
uint8 ride_music;
|
||||
uint8 audio_focus;
|
||||
uint8 master_volume;
|
||||
uint8 music_volume;
|
||||
utf8string device;
|
||||
|
|
|
@ -2025,6 +2025,8 @@ enum {
|
|||
|
||||
STR_TRACKED_GUESTS_ONLY_TIP = 5489,
|
||||
|
||||
STR_AUDIO_FOCUS = 5490,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
STR_COUNT = 32768
|
||||
};
|
||||
|
|
|
@ -352,13 +352,11 @@ void platform_process_messages()
|
|||
case SDL_WINDOWEVENT:
|
||||
if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
|
||||
platform_resize(e.window.data1, e.window.data2);
|
||||
if (e.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
|
||||
if (gConfigSound.sound) {
|
||||
if (gConfigSound.audio_focus && gConfigSound.sound) {
|
||||
if (e.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
|
||||
unpause_sounds();
|
||||
}
|
||||
}
|
||||
if (e.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
|
||||
if (gConfigSound.sound) {
|
||||
if (e.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
|
||||
pause_sounds();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
|
|||
WIDX_SOUND_DROPDOWN,
|
||||
WIDX_SOUND_CHECKBOX,
|
||||
WIDX_MUSIC_CHECKBOX,
|
||||
WIDX_AUDIO_FOCUS_CHECKBOX,
|
||||
WIDX_TITLE_MUSIC,
|
||||
WIDX_TITLE_MUSIC_DROPDOWN,
|
||||
WIDX_MASTER_VOLUME,
|
||||
|
@ -202,14 +203,15 @@ static rct_widget window_options_culture_widgets[] = {
|
|||
|
||||
static rct_widget window_options_audio_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
{ WWT_DROPDOWN, 1, 10, 299, 53, 64, 865, STR_NONE }, // audio device
|
||||
{ WWT_DROPDOWN_BUTTON, 1, 288, 298, 54, 63, 876, STR_NONE },
|
||||
{ WWT_CHECKBOX, 1, 10, 229, 69, 80, STR_SOUND, STR_NONE }, // enable / disable sound
|
||||
{ WWT_CHECKBOX, 1, 10, 229, 84, 95, STR_MUSIC, STR_NONE }, // enable / disable music
|
||||
{ WWT_DROPDOWN, 1, 155, 299, 98, 109, STR_NONE, STR_NONE }, // title music
|
||||
{ WWT_DROPDOWN_BUTTON, 1, 288, 298, 99, 108, 876, STR_NONE },
|
||||
{ WWT_SCROLL, 1, 155, 299, 68, 80, 1, STR_NONE }, // master volume
|
||||
{ WWT_SCROLL, 1, 155, 299, 83, 95, 1, STR_NONE }, // music volume
|
||||
{ WWT_DROPDOWN, 1, 10, 299, 53, 64, 865, STR_NONE }, // audio device
|
||||
{ WWT_DROPDOWN_BUTTON, 1, 288, 298, 54, 63, 876, STR_NONE },
|
||||
{ WWT_CHECKBOX, 1, 10, 229, 69, 80, STR_SOUND, STR_NONE }, // enable / disable sound
|
||||
{ WWT_CHECKBOX, 1, 10, 229, 84, 95, STR_MUSIC, STR_NONE }, // enable / disable music
|
||||
{ WWT_CHECKBOX, 1, 10, 229, 98, 110, STR_AUDIO_FOCUS, STR_NONE }, // enable / disable audio disabled on focus lost
|
||||
{ WWT_DROPDOWN, 1, 155, 299, 112, 124, STR_NONE, STR_NONE }, // title music
|
||||
{ WWT_DROPDOWN_BUTTON, 1, 288, 298, 113, 123, 876, STR_NONE },
|
||||
{ WWT_SCROLL, 1, 155, 299, 68, 80, 1, STR_NONE }, // master volume
|
||||
{ WWT_SCROLL, 1, 155, 299, 83, 95, 1, STR_NONE }, // music volume
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
|
@ -372,6 +374,7 @@ static uint32 window_options_page_enabled_widgets[] = {
|
|||
(1 << WIDX_SOUND_DROPDOWN) |
|
||||
(1 << WIDX_SOUND_CHECKBOX) |
|
||||
(1 << WIDX_MUSIC_CHECKBOX) |
|
||||
(1 << WIDX_AUDIO_FOCUS_CHECKBOX) |
|
||||
(1 << WIDX_TITLE_MUSIC) |
|
||||
(1 << WIDX_TITLE_MUSIC_DROPDOWN),
|
||||
|
||||
|
@ -523,6 +526,11 @@ static void window_options_mouseup(rct_window *w, int widgetIndex)
|
|||
config_save_default();
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_AUDIO_FOCUS_CHECKBOX:
|
||||
gConfigSound.audio_focus = !gConfigSound.audio_focus;
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1154,6 +1162,7 @@ static void window_options_invalidate(rct_window *w)
|
|||
|
||||
widget_set_checkbox_value(w, WIDX_SOUND_CHECKBOX, gConfigSound.sound);
|
||||
widget_set_checkbox_value(w, WIDX_MUSIC_CHECKBOX, gConfigSound.ride_music);
|
||||
widget_set_checkbox_value(w, WIDX_AUDIO_FOCUS_CHECKBOX, gConfigSound.audio_focus);
|
||||
|
||||
if(w->frame_no == 0){ // initialize only on first frame, otherwise the scrollbars wont be able to be modified
|
||||
widget = &window_options_audio_widgets[WIDX_MASTER_VOLUME];
|
||||
|
@ -1169,6 +1178,7 @@ static void window_options_invalidate(rct_window *w)
|
|||
window_options_audio_widgets[WIDX_SOUND_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
||||
window_options_audio_widgets[WIDX_SOUND_CHECKBOX].type = WWT_CHECKBOX;
|
||||
window_options_audio_widgets[WIDX_MUSIC_CHECKBOX].type = WWT_CHECKBOX;
|
||||
window_options_audio_widgets[WIDX_AUDIO_FOCUS_CHECKBOX].type = WWT_CHECKBOX;
|
||||
window_options_audio_widgets[WIDX_TITLE_MUSIC].type = WWT_DROPDOWN;
|
||||
window_options_audio_widgets[WIDX_TITLE_MUSIC_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
||||
window_options_audio_widgets[WIDX_MASTER_VOLUME].type = WWT_SCROLL;
|
||||
|
|
Loading…
Reference in New Issue