diff options
Diffstat (limited to 'engines/sword2')
-rw-r--r-- | engines/sword2/mouse.cpp | 2 | ||||
-rw-r--r-- | engines/sword2/screen.cpp | 4 | ||||
-rw-r--r-- | engines/sword2/sprite.cpp | 10 | ||||
-rw-r--r-- | engines/sword2/sword2.cpp | 20 |
4 files changed, 26 insertions, 10 deletions
diff --git a/engines/sword2/mouse.cpp b/engines/sword2/mouse.cpp index 273ad1ec60..4dbb38eaca 100644 --- a/engines/sword2/mouse.cpp +++ b/engines/sword2/mouse.cpp @@ -341,7 +341,7 @@ void Mouse::systemMenuMouse() { if ((icon_list[hit] == OPTIONS_ICON || icon_list[hit] == QUIT_ICON || icon_list[hit] == SAVE_ICON || icon_list[hit] == RESTORE_ICON - || icon_list[hit] == RESTART_ICON ) && Sword2Engine::isPsx() ) + || icon_list[hit] == RESTART_ICON) && Sword2Engine::isPsx()) return; // No save when dead diff --git a/engines/sword2/screen.cpp b/engines/sword2/screen.cpp index fb2e108b2f..1e45c0fc1f 100644 --- a/engines/sword2/screen.cpp +++ b/engines/sword2/screen.cpp @@ -966,11 +966,15 @@ void Screen::rollCredits() { if (Sword2Engine::isPsx()) { if (!f.open("credits.txt")) { warning("Can't find credits.txt"); + + free(logoData); return; } } else { if (!f.open("credits.clu")) { warning("Can't find credits.clu"); + + free(logoData); return; } } diff --git a/engines/sword2/sprite.cpp b/engines/sword2/sprite.cpp index 5a45c19ab6..7d45f8df4e 100644 --- a/engines/sword2/sprite.cpp +++ b/engines/sword2/sprite.cpp @@ -528,8 +528,11 @@ int32 Screen::drawSprite(SpriteInfo *s) { decompData = decompressHIF(s->data, tempBuf); // Check that we correctly decompressed data - if (!decompData) + if (!decompData) { + free(tempBuf); + return RDERR_DECOMPRESSION; + } s->w = (decompData / (s->h / 2)) * 2; byte *tempBuf2 = (byte *)malloc(s->w * s->h * 10); @@ -571,8 +574,11 @@ int32 Screen::drawSprite(SpriteInfo *s) { uint32 decompData = decompressHIF(s->data, tempBuf); // Check that we correctly decompressed data - if (!decompData) + if (!decompData) { + free(tempBuf); + return RDERR_DECOMPRESSION; + } s->w = (decompData / (s->h / 2)); sprite = (byte *)malloc(s->w * s->h); diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 3cdab2bd2b..b3b688771a 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -326,18 +326,24 @@ void Sword2Engine::registerDefaultSettings() { } void Sword2Engine::syncSoundSettings() { - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); - _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); - _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + bool mute = ConfMan.getBool("mute"); + + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, mute ? 0 : ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, mute ? 0 : ConfMan.getInt("speech_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, mute ? 0 : ConfMan.getInt("sfx_volume")); setSubtitles(ConfMan.getBool("subtitles")); // Our own settings dialog can mute the music, speech and sound effects // individually. ScummVM's settings dialog has one master mute setting. - if (ConfMan.getBool("mute")) { - ConfMan.setBool("music_mute", true); - ConfMan.setBool("speech_mute", true); - ConfMan.setBool("sfx_mute", true); + if (ConfMan.hasKey("mute")) { + ConfMan.setBool("music_mute", ConfMan.getBool("mute")); + ConfMan.setBool("speech_mute", ConfMan.getBool("mute")); + ConfMan.setBool("sfx_mute", ConfMan.getBool("mute")); + + if (!mute) // it is false + // So remove it in order to let individual volumes work + ConfMan.removeKey("mute", ConfMan.getActiveDomainName()); } _sound->muteMusic(ConfMan.getBool("music_mute")); |