aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Page2008-07-15 22:54:39 +0000
committerChristopher Page2008-07-15 22:54:39 +0000
commit7ecd54a9da6b9a14b4f16c3e53f87475d43bc2da (patch)
treec4330fc44397aa6294ebe44d70ecce4537e2ab0d
parent00aee7dd7373a6e6775b99e2768037e6d4b8419e (diff)
downloadscummvm-rg350-7ecd54a9da6b9a14b4f16c3e53f87475d43bc2da.tar.gz
scummvm-rg350-7ecd54a9da6b9a14b4f16c3e53f87475d43bc2da.tar.bz2
scummvm-rg350-7ecd54a9da6b9a14b4f16c3e53f87475d43bc2da.zip
Reverted some incorrect changes and fixed sound settings issues for LURE. Fixed issues with quitting and calling GMM during intro sequences in LURE. Added a KEYCODE_MAINMENU in common/keyboard.h for the GMM.
svn-id: r33081
-rw-r--r--backends/events/default/default-events.cpp2
-rw-r--r--common/keyboard.h5
-rw-r--r--engines/lure/animseq.cpp1
-rw-r--r--engines/lure/events.cpp5
-rw-r--r--engines/lure/game.h5
-rw-r--r--engines/lure/intro.cpp4
-rw-r--r--engines/lure/lure.cpp2
-rw-r--r--engines/lure/sound.cpp25
-rw-r--r--engines/lure/sound.h2
9 files changed, 33 insertions, 18 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index b91643c6fb..8648c5909e 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -392,7 +392,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
_keyRepeatTime = time + kKeyRepeatInitialDelay;
#endif
// Global Main Menu
- if (event.kbd.keycode == Common::KEYCODE_F11)
+ if (event.kbd.keycode == Common::KEYCODE_MAINMENU)
if (g_engine && !g_engine->isPaused()) {
Common::Event menuEvent;
menuEvent.type = Common::EVENT_MAINMENU;
diff --git a/common/keyboard.h b/common/keyboard.h
index 93579cbed6..8f07c89cc8 100644
--- a/common/keyboard.h
+++ b/common/keyboard.h
@@ -178,7 +178,10 @@ enum KeyCode {
KEYCODE_MENU = 319,
KEYCODE_POWER = 320, // Power Macintosh power key
KEYCODE_EURO = 321, // Some european keyboards
- KEYCODE_UNDO = 322 // Atari keyboard has Undo
+ KEYCODE_UNDO = 322, // Atari keyboard has Undo
+
+ // Global Main Menu key
+ KEYCODE_MAINMENU = KEYCODE_F11
};
/**
diff --git a/engines/lure/animseq.cpp b/engines/lure/animseq.cpp
index 2af02b0374..f33c3307be 100644
--- a/engines/lure/animseq.cpp
+++ b/engines/lure/animseq.cpp
@@ -45,6 +45,7 @@ AnimAbortType AnimationSequence::delay(uint32 milliseconds) {
while (events.pollEvent()) {
if ((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) {
if (events.event().kbd.keycode == Common::KEYCODE_ESCAPE) return ABORT_END_INTRO;
+ else if (events.event().kbd.keycode == Common::KEYCODE_MAINMENU) return ABORT_NONE;
else return ABORT_NEXT_SCENE;
} else if (events.type() == Common::EVENT_LBUTTONDOWN)
return ABORT_NEXT_SCENE;
diff --git a/engines/lure/events.cpp b/engines/lure/events.cpp
index eec9dbda11..ed1102e9b2 100644
--- a/engines/lure/events.cpp
+++ b/engines/lure/events.cpp
@@ -160,8 +160,6 @@ Events &Events::getReference() {
bool Events::pollEvent() {
- LureEngine &engine = LureEngine::getReference();
-
if (!g_system->getEventManager()->pollEvent(_event)) return false;
// Handle keypress
@@ -216,7 +214,8 @@ bool Events::interruptableDelay(uint32 milliseconds) {
if (engine.quit()) return true;
if (events.pollEvent()) {
- if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) ||
+ if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0) &&
+ events.event().kbd.keycode != KEYCODE_MAINMENU) ||
(events.type() == Common::EVENT_LBUTTONDOWN))
return true;
}
diff --git a/engines/lure/game.h b/engines/lure/game.h
index 5054074fb2..06dcee750f 100644
--- a/engines/lure/game.h
+++ b/engines/lure/game.h
@@ -27,6 +27,7 @@
#define LURE_GAME_H
+#include "common/config-manager.h"
#include "engines/engine.h"
#include "lure/luredefs.h"
#include "lure/menu.h"
@@ -85,8 +86,8 @@ public:
bool &debugFlag() { return _debugFlag; }
bool fastTextFlag() { return _fastTextFlag; }
bool soundFlag() { return _soundFlag; }
- uint8 sfxVolume() { return _sfxVolume; }
- uint8 musicVolume() { return _musicVolume; }
+ uint8 sfxVolume() { return ConfMan.getInt("sfx_volume"); }
+ uint8 musicVolume() { return ConfMan.getInt("music_volume"); }
Debugger &debugger() { return *_debugger; }
// Menu item support methods
diff --git a/engines/lure/intro.cpp b/engines/lure/intro.cpp
index 5b07dd3916..b4cbf4a833 100644
--- a/engines/lure/intro.cpp
+++ b/engines/lure/intro.cpp
@@ -60,6 +60,8 @@ bool Introduction::showScreen(uint16 screenId, uint16 paletteId, uint16 delaySiz
screen.update();
Palette p(paletteId);
+ if (LureEngine::getReference().quit()) return true;
+
if (isEGA) screen.setPalette(&p);
else screen.paletteFadeIn(&p);
@@ -82,6 +84,8 @@ bool Introduction::interruptableDelay(uint32 milliseconds) {
if (events.interruptableDelay(milliseconds)) {
if (events.type() == Common::EVENT_KEYDOWN)
return events.event().kbd.keycode == 27;
+ else if (LureEngine::getReference().quit())
+ return true;
else if (events.type() == Common::EVENT_LBUTTONDOWN)
return false;
}
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index 90c0c34454..3cab41da71 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -247,7 +247,7 @@ void LureEngine::GUIError(const char *msg, ...) {
}
void LureEngine::syncSoundSettings() {
- Sound.syncSounds(ConfMan.getInt("music_volume"), ConfMan.getInt("sfx_volume"));
+ Sound.syncSounds();
}
Common::String *LureEngine::detectSave(int slotNumber) {
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index d59d03f9c3..a0fbcdbac2 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -221,10 +221,10 @@ void SoundManager::addSound(uint8 soundIndex, bool tidyFlag) {
newEntry->numChannels = numChannels;
newEntry->flags = rec.flags;
- if (newEntry->soundNumber & 0x80)
- newEntry->volume = ConfMan.getInt("music_volume");
- else
- newEntry->volume = ConfMan.getInt("sfx_volume");
+ if (_isRoland)
+ newEntry->volume = rec.volume;
+ else /* resource volumes do not seem to work well with our adlib emu */
+ newEntry->volume = 240; /* 255 causes clipping with adlib */
_activeSounds.push_back(SoundList::value_type(newEntry));
@@ -284,16 +284,17 @@ uint8 SoundManager::descIndexOf(uint8 soundNumber) {
// Used to sync the volume for all channels with the Config Manager
//
-void SoundManager::syncSounds(uint8 musicVol, uint8 sfxVol) {
+void SoundManager::syncSounds() {
+ Game &game = Game::getReference();
musicInterface_TidySounds();
g_system->lockMutex(_soundMutex);
MusicListIterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
if ((*i)->isMusic())
- (*i)->setVolume(musicVol);
+ (*i)->setVolume(game.musicVolume());
else
- (*i)->setVolume(sfxVol);
+ (*i)->setVolume(game.sfxVolume());
}
g_system->unlockMutex(_soundMutex);
}
@@ -420,7 +421,8 @@ void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber, u
return;
bool isMusic = (soundNumber & 0x80) != 0;
-
+ uint8 volume = isMusic ? game.musicVolume() : game.sfxVolume();
+
if (!game.soundFlag())
// Don't play sounds if sound is turned off
return;
@@ -655,9 +657,14 @@ void MidiMusic::setVolume(int volume) {
_volume = volume;
+ Game &game = Game::getReference();
+ volume *= _isMusic ? game.musicVolume() : game.sfxVolume();
+
for (int i = 0; i < _numChannels; ++i) {
if (_channels[_channelNumber + i].midiChannel != NULL)
- _channels[_channelNumber + i].midiChannel->volume(volume);
+ _channels[_channelNumber + i].midiChannel->volume(
+ _channels[_channelNumber + i].volume *
+ volume / 65025);
}
}
diff --git a/engines/lure/sound.h b/engines/lure/sound.h
index 9959417e67..cf5dca7e96 100644
--- a/engines/lure/sound.h
+++ b/engines/lure/sound.h
@@ -143,7 +143,7 @@ public:
void stopSound(uint8 soundIndex);
void killSound(uint8 soundNumber);
void setVolume(uint8 soundNumber, uint8 volume);
- void syncSounds(uint8 musicVol, uint8 sfxVol);
+ void syncSounds();
void tidySounds();
uint8 descIndexOf(uint8 soundNumber);
SoundDescResource *findSound(uint8 soundNumber);