aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/draci/draci.cpp9
-rw-r--r--engines/draci/music.cpp24
-rw-r--r--engines/draci/music.h1
3 files changed, 19 insertions, 15 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index e32a239f94..f472592684 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -265,14 +265,13 @@ void DraciEngine::handleEvents() {
_showWalkingMap = !_showWalkingMap;
break;
case Common::KEYCODE_i:
- if (_game->getRoomNum() == _game->getMapRoom()) {
+ if (_game->getRoomNum() == _game->getMapRoom() ||
+ _game->getLoopSubstatus() != kSubstatusOrdinary) {
break;
}
- if (_game->getLoopStatus() == kStatusInventory &&
- _game->getLoopSubstatus() == kSubstatusOrdinary) {
+ if (_game->getLoopStatus() == kStatusInventory) {
_game->inventoryDone();
- } else if (_game->getLoopStatus() == kStatusOrdinary &&
- _game->getLoopSubstatus() == kSubstatusOrdinary) {
+ } else if (_game->getLoopStatus() == kStatusOrdinary) {
_game->inventoryInit();
}
break;
diff --git a/engines/draci/music.cpp b/engines/draci/music.cpp
index ec6d85c66c..7917ad7304 100644
--- a/engines/draci/music.cpp
+++ b/engines/draci/music.cpp
@@ -58,22 +58,24 @@ MusicPlayer::~MusicPlayer() {
delete _midiMusicData;
}
+void MusicPlayer::setChannelVolume(int channel) {
+ int newVolume = _channelVolume[channel] * _masterVolume / 255;
+ debugC(3, kDraciSoundDebugLevel, "Music channel %d: volume %d->%d",
+ channel, _channelVolume[channel], newVolume);
+ _channel[channel]->volume(newVolume);
+}
+
void MusicPlayer::setVolume(int volume) {
- volume = CLIP(volume, 0, 255);
+ Common::StackLock lock(_mutex);
+ volume = CLIP(volume, 0, 255);
if (_masterVolume == volume)
return;
-
_masterVolume = volume;
- Common::StackLock lock(_mutex);
-
for (int i = 0; i < 16; ++i) {
if (_channel[i]) {
- int newVolume = _channelVolume[i] * _masterVolume / 255;
- debugC(3, kDraciSoundDebugLevel, "Music channel %d: volume %d->%d",
- i, _channelVolume[i], newVolume);
- _channel[i]->volume(newVolume);
+ setChannelVolume(i);
}
}
}
@@ -121,8 +123,10 @@ void MusicPlayer::send(uint32 b) {
return;
}
- if (!_channel[channel])
+ if (!_channel[channel]) {
_channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
+ setChannelVolume(channel);
+ }
if (_channel[channel])
_channel[channel]->send(b);
@@ -147,7 +151,7 @@ void MusicPlayer::onTimer(void *refCon) {
MusicPlayer *music = (MusicPlayer *)refCon;
Common::StackLock lock(music->_mutex);
- if (music->_isPlaying)
+ if (music->_parser)
music->_parser->onTimer();
}
diff --git a/engines/draci/music.h b/engines/draci/music.h
index d56de17866..82e85208ac 100644
--- a/engines/draci/music.h
+++ b/engines/draci/music.h
@@ -79,6 +79,7 @@ public:
protected:
static void onTimer(void *data);
+ void setChannelVolume(int channel);
MidiChannel *_channel[16];
MidiDriver *_driver;