aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui_hof.cpp3
-rw-r--r--engines/kyra/gui_lol.cpp2
-rw-r--r--engines/kyra/gui_mr.cpp3
-rw-r--r--engines/kyra/kyra_v1.cpp16
-rw-r--r--engines/kyra/kyra_v1.h4
-rw-r--r--engines/kyra/lol.h4
-rw-r--r--engines/kyra/script_lol.cpp2
-rw-r--r--engines/kyra/sound_lol.cpp4
-rw-r--r--engines/kyra/text_lok.cpp2
9 files changed, 19 insertions, 21 deletions
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index d89529a9aa..6cfa68cc79 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -855,8 +855,7 @@ void GUI_HoF::drawSliderBar(int slider, const uint8 *shape) {
position = _vm->_configTextspeed;
}
- position = MAX(2, position);
- position = MIN(97, position);
+ position = CLIP(position, 2, 97);
_screen->drawShape(0, shape, x+position, y, 0, 0);
}
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 5ac6ed8380..27780fef8d 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -2690,7 +2690,7 @@ int GUI_LoL::clickedAudioMenu(Button *button) {
_screen->drawShape(0, _vm->_gameShapes[87], tX + oldVolume, button->y, 0, 0x10);
// Temporary HACK
- const int volumeDrawX = _vm->convertValueFromMixer(_vm->convertValueToMixer(newVolume));
+ const int volumeDrawX = _vm->convertVolumeFromMixer(_vm->convertVolumeToMixer(newVolume));
_screen->drawShape(0, _vm->_gameShapes[86], tX + volumeDrawX, button->y, 0, 0x10);
_screen->updateScreen();
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp
index 02ed7f8746..515c51cb2c 100644
--- a/engines/kyra/gui_mr.cpp
+++ b/engines/kyra/gui_mr.cpp
@@ -1620,8 +1620,7 @@ void GUI_MR::drawSliderBar(int slider, const uint8 *shape) {
int position = _vm->getVolume(KyraEngine_v1::kVolumeEntry(slider));
- position = MAX(2, position);
- position = MIN(97, position);
+ position = CLIP(position, 2, 97);
_screen->drawShape(0, shape, x+position, y, 0, 0);
}
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index 74b033822f..9c5fe04085 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -594,27 +594,27 @@ bool KyraEngine_v1::textEnabled() {
return !_flags.isTalkie || (_configVoice == 0 || _configVoice == 2);
}
-int KyraEngine_v1::convertValueToMixer(int value) {
+int KyraEngine_v1::convertVolumeToMixer(int value) {
value -= 2;
return (value * Audio::Mixer::kMaxMixerVolume) / 95;
}
-int KyraEngine_v1::convertValueFromMixer(int value) {
+int KyraEngine_v1::convertVolumeFromMixer(int value) {
return (value * 95) / Audio::Mixer::kMaxMixerVolume + 2;
}
void KyraEngine_v1::setVolume(kVolumeEntry vol, uint8 value) {
switch (vol) {
case kVolumeMusic:
- ConfMan.setInt("music_volume", convertValueToMixer(value));
+ ConfMan.setInt("music_volume", convertVolumeToMixer(value));
break;
case kVolumeSfx:
- ConfMan.setInt("sfx_volume", convertValueToMixer(value));
+ ConfMan.setInt("sfx_volume", convertVolumeToMixer(value));
break;
case kVolumeSpeech:
- ConfMan.setInt("speech_volume", convertValueToMixer(value));
+ ConfMan.setInt("speech_volume", convertVolumeToMixer(value));
break;
}
@@ -629,16 +629,16 @@ void KyraEngine_v1::setVolume(kVolumeEntry vol, uint8 value) {
uint8 KyraEngine_v1::getVolume(kVolumeEntry vol) {
switch (vol) {
case kVolumeMusic:
- return convertValueFromMixer(ConfMan.getInt("music_volume"));
+ return convertVolumeFromMixer(ConfMan.getInt("music_volume"));
break;
case kVolumeSfx:
- return convertValueFromMixer(ConfMan.getInt("sfx_volume"));
+ return convertVolumeFromMixer(ConfMan.getInt("sfx_volume"));
break;
case kVolumeSpeech:
if (speechEnabled())
- return convertValueFromMixer(ConfMan.getInt("speech_volume"));
+ return convertVolumeFromMixer(ConfMan.getInt("speech_volume"));
else
return 2;
break;
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index f69d12a81a..549511a6b1 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -289,8 +289,8 @@ protected:
const int8 *_trackMap;
int _trackMapSize;
- virtual int convertValueToMixer(int value);
- virtual int convertValueFromMixer(int value);
+ virtual int convertVolumeToMixer(int value);
+ virtual int convertVolumeFromMixer(int value);
// pathfinder
virtual int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize);
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 0a32ec8793..9d9a8948de 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -446,8 +446,8 @@ private:
int _timer3Para;
// sound
- int convertValueToMixer(int value);
- int convertValueFromMixer(int value);
+ int convertVolumeToMixer(int value);
+ int convertVolumeFromMixer(int value);
void loadTalkFile(int index);
void snd_playVoiceFile(int track) {}
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 017f60a3d4..ad1041e7cf 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -663,7 +663,7 @@ int LoLEngine::olol_getGlobalVar(EMCState *script) {
case 12:
return _drainMagic;
case 13:
- return getVolume(kVolumeSpeech);
+ return getVolume(kVolumeSpeech) - 2;
default:
break;
}
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp
index c233e1af52..63a42837aa 100644
--- a/engines/kyra/sound_lol.cpp
+++ b/engines/kyra/sound_lol.cpp
@@ -304,12 +304,12 @@ int LoLEngine::snd_stopMusic() {
return snd_playTrack(-1);
}
-int LoLEngine::convertValueToMixer(int value) {
+int LoLEngine::convertVolumeToMixer(int value) {
value -= 2;
return (value * Audio::Mixer::kMaxMixerVolume) / 100;
}
-int LoLEngine::convertValueFromMixer(int value) {
+int LoLEngine::convertVolumeFromMixer(int value) {
return (value * 100) / Audio::Mixer::kMaxMixerVolume + 2;
}
diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp
index 6b1cb4eca2..a61bd1950a 100644
--- a/engines/kyra/text_lok.cpp
+++ b/engines/kyra/text_lok.cpp
@@ -44,7 +44,7 @@ void KyraEngine_LoK::waitForChatToFinish(int vocFile, int16 chatDuration, const
uint32 timeToEnd = strlen(chatStr) * 8 * _tickLength + _system->getMillis();
- if (_configVoice == 0 && chatDuration != -1) {
+ if (textEnabled() && !speechEnabled() && chatDuration != -1) {
switch (_configTextspeed) {
case 0:
chatDuration *= 2;