From 9a3a04f6dd8456f20298f157f7ea9c0f36e8127d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 11 Dec 2008 13:43:52 +0000 Subject: Added a HACK/FIXME to prevent tinsel games from crashing, when for example the music volume is set to 256 via the launcher. svn-id: r35301 --- engines/tinsel/config.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/engines/tinsel/config.cpp b/engines/tinsel/config.cpp index c6d774de7a..bec286a96b 100644 --- a/engines/tinsel/config.cpp +++ b/engines/tinsel/config.cpp @@ -98,9 +98,14 @@ void ReadConfig(void) { if (ConfMan.hasKey("dclick_speed")) dclickSpeed = ConfMan.getInt("dclick_speed"); - volMusic = ConfMan.getInt("music_volume"); - volSound = ConfMan.getInt("sfx_volume"); - volVoice = ConfMan.getInt("speech_volume"); + // HACK/FIXME: + // We need to clip the volumes from [0, 256] to [0, 255] + // here, since for example Tinsel's internal options dialog + // and also the midi playback code rely on the volumes to be + // in [0, 255] + volMusic = CLIP(ConfMan.getInt("music_volume"), 0, 255); + volSound = CLIP(ConfMan.getInt("sfx_volume"), 0, 255); + volVoice = CLIP(ConfMan.getInt("speech_volume"), 0, 255); if (ConfMan.hasKey("talkspeed")) speedText = (ConfMan.getInt("talkspeed") * 100) / 255; -- cgit v1.2.3