Merge pull request #662 from duncanspumpkin/fix_pause_sound

Fixed #659
This commit is contained in:
Ted John 2015-01-01 14:31:25 +00:00
commit 592e6bdd45
7 changed files with 16 additions and 9 deletions

View File

@ -70,6 +70,11 @@
#define RCT2_ADDRESS_CONFIG_MUSIC 0x009AAC72
#define RCT2_ADDRESS_CONFIG_FLAGS 0x009AAC74
// MAX vehicle sounds not used anymore
#define RCT2_ADDRESS_CONFIG_MAX_VEHICLE_SOUNDS 0x009AAC75
#define RCT2_ADDRESS_CONFIG_MAX_NO_SOUNDS 0x009AAC76
#define RCT2_ADDRESS_CONFIG_SOUND_QUALITY 0x009AAC77
#define RCT2_ADDRESS_CONFIG_METRIC 0x009AAC78
#define RCT2_ADDRESS_CONFIG_TEMPERATURE 0x009AAC79

View File

@ -1481,7 +1481,7 @@ int sound_play_panned(int sound_id, int ebx, sint16 x, sint16 y, sint16 z)
while (other_sound->id != 0xFFFF) {
i++;
other_sound = &RCT2_ADDRESS(0x009AF484, rct_other_sound)[i];
if (i > RCT2_GLOBAL(0x009AAC76, uint8)) { // too many sounds playing
if (i > RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_NO_SOUNDS, uint8)) { // too many sounds playing
return sound_id;
}
}

View File

@ -870,8 +870,8 @@ void config_dat_load()
*/
RCT2_GLOBAL(0x009AAC75, sint8) = RCT2_ADDRESS(0x009AF601, sint8)[RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8)];
RCT2_GLOBAL(0x009AAC76, sint8) = RCT2_ADDRESS(0x009AF604, sint8)[RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8)];
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_VEHICLE_SOUNDS, sint8) = RCT2_ADDRESS(0x009AF601, sint8)[RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8)];
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_NO_SOUNDS, sint8) = RCT2_ADDRESS(0x009AF604, sint8)[RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8)];
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS))
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256;

View File

@ -272,6 +272,8 @@ void game_update()
update_palette_effects();
update_rain_animation();
stop_completed_sounds(); // removes other sounds that are no longer playing, this is normally called somewhere in rct2_init
if (RCT2_GLOBAL(0x009AAC73, uint8) != 255) {
RCT2_GLOBAL(0x009AAC73, uint8)++;
if (RCT2_GLOBAL(0x009AAC73, uint8) == 255)
@ -309,8 +311,6 @@ void game_logic_update()
news_item_update_current();
editor_open_windows_for_current_step();
stop_completed_sounds(); // removes other sounds that are no longer playing, this is normally called somewhere in rct2_init
// Update windows
window_dispatch_update_all();

View File

@ -1004,6 +1004,9 @@ void input_state_widget_pressed( int x, int y, int state, int widgetIndex, rct_w
if (!w)
break;
if (!widget)
break;
int mid_point_x = (widget->left + widget->right) / 2 + w->x;
sound_play_panned(5, mid_point_x, 0, 0, 0);
if (cursor_w_class != w->classification || cursor_w_number != w->number || widgetIndex != cursor_widgetIndex)

View File

@ -305,7 +305,7 @@ void vehicle_sounds_update()
while (vehicle_sound->id != (uint16)-1) {
vehicle_sound++;
i++;
if (i >= countof(gVehicleSoundList)/*i >= RCT2_GLOBAL(0x009AAC75, uint8)*/) {
if (i >= countof(gVehicleSoundList)/*i >= RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_VEHICLE_SOUNDS, uint8)*/) {
vehicle_sound_params = (rct_vehicle_sound_params*)((int)vehicle_sound_params + 10);
goto label28;
}

View File

@ -510,9 +510,8 @@ static void window_options_dropdown()
window_invalidate(w);
break;
case WIDX_SOUND_QUALITY_DROPDOWN:
// TODO: no clue what this does (and if it's correct)
RCT2_GLOBAL(0x009AAC75, uint8) = RCT2_GLOBAL(0x009AF601 + dropdownIndex, uint8);
RCT2_GLOBAL(0x009AAC76, uint8) = RCT2_GLOBAL(0x009AF604 + 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);
gSound_config.sound_quality = (sint8)dropdownIndex;
config_save();
window_invalidate(w);