aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2014-07-25 20:24:10 +0200
committeruruk2014-07-25 20:24:10 +0200
commitaaf1f6a1a084ef1d5d40a4e8794014a62795b7db (patch)
tree92e292a1f41747a641d7e1e4a5ddd9d34f8ab7af /engines
parent3c0665edfa5fcbb1557aba3bc13c512f48f86dc6 (diff)
downloadscummvm-rg350-aaf1f6a1a084ef1d5d40a4e8794014a62795b7db.tar.gz
scummvm-rg350-aaf1f6a1a084ef1d5d40a4e8794014a62795b7db.tar.bz2
scummvm-rg350-aaf1f6a1a084ef1d5d40a4e8794014a62795b7db.zip
CGE2: Fix initialization of sound switches on the toolbar.
Diffstat (limited to 'engines')
-rw-r--r--engines/cge2/cge2.cpp9
-rw-r--r--engines/cge2/cge2.h6
-rw-r--r--engines/cge2/toolbar.cpp5
3 files changed, 15 insertions, 5 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index 5a5e3451aa..d28215bc93 100644
--- a/engines/cge2/cge2.cpp
+++ b/engines/cge2/cge2.cpp
@@ -74,7 +74,6 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_quitFlag = false;
_bitmapPalette = nullptr;
_music = true;
- _oldMusicVolume = ConfMan.getInt("music_volume");
_startupMode = 1;
_now = 1;
_sex = 1;
@@ -94,11 +93,17 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_enaVox = true;
_sayCap = true;
_sayVox = true;
- _oldSpeechVolume = ConfMan.getInt("speech_volume");
_req = 1;
_midiNotify = nullptr;
_spriteNotify = nullptr;
_enaCap = true;
+ if (ConfMan.getBool("mute")) {
+ _oldSpeechVolume = _oldMusicVolume = _musicVolume = _sfxVolume = 0;
+ } else {
+ _oldSpeechVolume = ConfMan.getInt("speech_volume");
+ _oldMusicVolume = _musicVolume = ConfMan.getInt("music_volume");
+ _sfxVolume = ConfMan.getInt("sfx_volume");
+ }
}
void CGE2Engine::init() {
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index 8d3f052b63..e6c1308238 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -113,6 +113,10 @@ struct SavegameHeader;
#define kSavegameStrSize 12
#define kSavegameStr "SCUMMVM_CGE2"
+#define kSoundSwtichRate 25.7
+// == 257 / 10; where 10 equals to the sound switches' number of states
+// and ScummVM has a scale of 257 different values for setting sounds.
+
enum CallbackType {
kNullCB = 0, kQGame, kXScene, kSoundSetVolume
};
@@ -283,6 +287,8 @@ public:
int _startGameSlot;
bool _enaCap;
bool _enaVox;
+ int _musicVolume;
+ int _sfxVolume;
ResourceManager *_resman;
Vga *_vga;
diff --git a/engines/cge2/toolbar.cpp b/engines/cge2/toolbar.cpp
index 23c6fd17c0..08a21da753 100644
--- a/engines/cge2/toolbar.cpp
+++ b/engines/cge2/toolbar.cpp
@@ -214,11 +214,10 @@ void CGE2Engine::initToolbar() {
_vol[0] = _vga->_showQ->locate(kDvolRef);
_vol[1] = _vga->_showQ->locate(kMvolRef);
- // these sprites are loaded with SeqPtr==0 (why?!)
if (_vol[0])
- _vol[0]->step((/*(int)SNDDrvInfo.VOL4.DL * */ _vol[0]->_seqCnt + _vol[0]->_seqCnt / 2) >> 4);
+ _vol[0]->step(_sfxVolume / kSoundSwtichRate);
if (_vol[1])
- _vol[1]->step((/*(int)SNDDrvInfo.VOL4.ML * */ _vol[1]->_seqCnt + _vol[1]->_seqCnt / 2) >> 4);
+ _vol[1]->step(_musicVolume / kSoundSwtichRate);
// TODO: Recheck these! ^
}