aboutsummaryrefslogtreecommitdiff
path: root/engines/lure
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lure')
-rw-r--r--engines/lure/animseq.cpp3
-rw-r--r--engines/lure/detection.cpp39
-rw-r--r--engines/lure/events.cpp19
-rw-r--r--engines/lure/events.h2
-rw-r--r--engines/lure/fights.cpp8
-rw-r--r--engines/lure/game.cpp29
-rw-r--r--engines/lure/game.h5
-rw-r--r--engines/lure/intro.cpp7
-rw-r--r--engines/lure/lure.cpp73
-rw-r--r--engines/lure/lure.h6
-rw-r--r--engines/lure/menu.cpp6
-rw-r--r--engines/lure/scripts.cpp6
-rw-r--r--engines/lure/sound.cpp32
-rw-r--r--engines/lure/sound.h4
-rw-r--r--engines/lure/surface.cpp14
15 files changed, 69 insertions, 184 deletions
diff --git a/engines/lure/animseq.cpp b/engines/lure/animseq.cpp
index 3d5265c90f..2af02b0374 100644
--- a/engines/lure/animseq.cpp
+++ b/engines/lure/animseq.cpp
@@ -45,11 +45,10 @@ 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;
- else if ((events.type() == Common::EVENT_QUIT) || (events.type() == Common::EVENT_RTL))
+ else if (events.type() == Common::EVENT_QUIT)
return ABORT_END_INTRO;
}
diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp
index ccfa26fadc..7dd1c77348 100644
--- a/engines/lure/detection.cpp
+++ b/engines/lure/detection.cpp
@@ -26,7 +26,6 @@
#include "base/plugins.h"
#include "common/advancedDetector.h"
-#include "common/savefile.h"
#include "lure/lure.h"
@@ -185,19 +184,9 @@ public:
return "Lure of the Temptress (C) Revolution";
}
- virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
- virtual SaveStateList listSaves(const char *target) const;
};
-bool LureMetaEngine::hasFeature(MetaEngineFeature f) const {
- return
- (f == kSupportsRTL) ||
- (f == kSupportsListSaves) ||
- (f == kSupportsDirectLoad) ||
- (f == kSupportsDeleteSave);
-}
-
bool LureMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
const Lure::LureGameDescription *gd = (const Lure::LureGameDescription *)desc;
if (gd) {
@@ -206,34 +195,6 @@ bool LureMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common
return gd != 0;
}
-SaveStateList LureMetaEngine::listSaves(const char *target) const {
- Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
- Common::StringList filenames;
- Common::String saveDesc;
- Common::String pattern = target;
- pattern += ".???";
-
- filenames = saveFileMan->listSavefiles(pattern.c_str());
- sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
-
- SaveStateList saveList;
- for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
- // Obtain the last 3 digits of the filename, since they correspond to the save slot
- int slotNum = atoi(file->c_str() + file->size() - 3);
-
- if (slotNum >= 0 && slotNum <= 999) {
- Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
- if (in) {
- saveDesc = Lure::getSaveName(in);
- saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file));
- delete in;
- }
- }
- }
-
- return saveList;
-}
-
#if PLUGIN_ENABLED_DYNAMIC(LURE)
REGISTER_PLUGIN_DYNAMIC(LURE, PLUGIN_TYPE_ENGINE, LureMetaEngine);
#else
diff --git a/engines/lure/events.cpp b/engines/lure/events.cpp
index 97da8bdb03..30e0e571b7 100644
--- a/engines/lure/events.cpp
+++ b/engines/lure/events.cpp
@@ -29,7 +29,6 @@
#include "graphics/cursorman.h"
#include "lure/events.h"
-#include "lure/lure.h"
#include "lure/res.h"
namespace Lure {
@@ -138,12 +137,11 @@ void Mouse::setPosition(int newX, int newY) {
void Mouse::waitForRelease() {
Events &e = Events::getReference();
- LureEngine &engine = LureEngine::getReference();
do {
- while (e.pollEvent() && !engine.quit()) ;
+ while (e.pollEvent() && !e.quitFlag) ;
g_system->delayMillis(20);
- } while (!engine.quit() && (lButton() || rButton() || mButton()));
+ } while (!e.quitFlag && (lButton() || rButton() || mButton()));
}
/*--------------------------------------------------------------------------*/
@@ -152,6 +150,7 @@ static Events *int_events = NULL;
Events::Events() {
int_events = this;
+ quitFlag = false;
}
Events &Events::getReference() {
@@ -164,6 +163,10 @@ bool Events::pollEvent() {
// Handle keypress
switch (_event.type) {
+ case Common::EVENT_QUIT:
+ quitFlag = true;
+ break;
+
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONDOWN:
@@ -187,7 +190,7 @@ void Events::waitForPress() {
bool keyButton = false;
while (!keyButton) {
while (pollEvent()) {
- if ((_event.type == Common::EVENT_QUIT) || (_event.type == Common::EVENT_RTL)) return;
+ if (_event.type == Common::EVENT_QUIT) return;
else if ((_event.type == Common::EVENT_KEYDOWN) && (_event.kbd.ascii != 0))
keyButton = true;
else if ((_event.type == Common::EVENT_LBUTTONDOWN) ||
@@ -207,15 +210,13 @@ void Events::waitForPress() {
bool Events::interruptableDelay(uint32 milliseconds) {
Events &events = Events::getReference();
- LureEngine &engine = LureEngine::getReference();
uint32 delayCtr = g_system->getMillis() + milliseconds;
while (g_system->getMillis() < delayCtr) {
- if (engine.quit()) return true;
+ if (events.quitFlag) return true;
if (events.pollEvent()) {
- if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0) &&
- events.event().kbd.keycode != KEYCODE_MAINMENU) ||
+ if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) ||
(events.type() == Common::EVENT_LBUTTONDOWN))
return true;
}
diff --git a/engines/lure/events.h b/engines/lure/events.h
index f04072aa0f..d1246f95d8 100644
--- a/engines/lure/events.h
+++ b/engines/lure/events.h
@@ -66,6 +66,8 @@ class Events {
private:
Common::Event _event;
public:
+ bool quitFlag;
+
Events();
static Events &getReference();
diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp
index 51fce850e6..dcf09ba50d 100644
--- a/engines/lure/fights.cpp
+++ b/engines/lure/fights.cpp
@@ -22,7 +22,6 @@
#include "lure/fights.h"
#include "lure/luredefs.h"
#include "lure/game.h"
-#include "lure/lure.h"
#include "lure/res.h"
#include "lure/room.h"
#include "lure/sound.h"
@@ -109,15 +108,15 @@ bool FightsManager::isFighting() {
}
void FightsManager::fightLoop() {
- LureEngine &engine = LureEngine::getReference();
Resources &res = Resources::getReference();
Game &game = Game::getReference();
Room &room = Room::getReference();
+ Events &events = Events::getReference();
FighterRecord &playerFight = getDetails(PLAYER_ID);
uint32 timerVal = g_system->getMillis();
// Loop for the duration of the battle
- while (!engine.quit() && (playerFight.fwhits != GENERAL_MAGIC_ID)) {
+ while (!events.quitFlag && (playerFight.fwhits != GENERAL_MAGIC_ID)) {
checkEvents();
if (g_system->getMillis() > timerVal + GAME_FRAME_DELAY) {
@@ -185,7 +184,6 @@ const KeyMapping keyList[] = {
{Common::KEYCODE_INVALID, 0}};
void FightsManager::checkEvents() {
- LureEngine &engine = LureEngine::getReference();
Game &game = Game::getReference();
Events &events = Events::getReference();
Mouse &mouse = Mouse::getReference();
@@ -198,7 +196,7 @@ void FightsManager::checkEvents() {
if (events.type() == Common::EVENT_KEYDOWN) {
switch (events.event().kbd.keycode) {
case Common::KEYCODE_ESCAPE:
- engine.quitGame();
+ events.quitFlag = true;
return;
case Common::KEYCODE_d:
diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp
index 479877f229..f9b31c21c5 100644
--- a/engines/lure/game.cpp
+++ b/engines/lure/game.cpp
@@ -23,10 +23,10 @@
*
*/
+#include "lure/lure.h"
#include "lure/game.h"
#include "lure/animseq.h"
#include "lure/fights.h"
-#include "lure/lure.h"
#include "lure/res_struct.h"
#include "lure/room.h"
#include "lure/scripts.h"
@@ -125,7 +125,6 @@ void Game::nextFrame() {
void Game::execute() {
OSystem &system = *g_system;
- LureEngine &engine = LureEngine::getReference();
Room &room = Room::getReference();
Resources &res = Resources::getReference();
Events &events = Events::getReference();
@@ -138,20 +137,12 @@ void Game::execute() {
screen.empty();
screen.setPaletteEmpty();
-
- bool _loadSavegame = false;
-
- if (engine.gameToLoad() != -1)
- _loadSavegame = engine.loadGame(engine.gameToLoad());
-
- if (!_loadSavegame) {
- // Flag for starting game
- setState(GS_RESTART);
- }
+ // Flag for starting game
+ setState(GS_RESTART);
bool initialRestart = true;
- while (!engine.quit()) {
+ while (!events.quitFlag) {
if ((_state & GS_RESTART) != 0) {
res.reset();
@@ -171,7 +162,7 @@ void Game::execute() {
mouse.cursorOn();
// Main game loop
- while (!engine.quit() && ((_state & GS_RESTART) == 0)) {
+ while (!events.quitFlag && ((_state & GS_RESTART) == 0)) {
// If time for next frame, allow everything to update
if (system.getMillis() > timerVal + GAME_FRAME_DELAY) {
timerVal = system.getMillis();
@@ -300,7 +291,10 @@ void Game::execute() {
if (restartFlag)
setState(GS_RESTART);
- }
+
+ } else if ((_state & GS_RESTART) == 0)
+ // Exiting game
+ events.quitFlag = true;
}
}
@@ -898,7 +892,7 @@ void Game::doShowCredits() {
void Game::doQuit() {
Sound.pause();
if (getYN())
- LureEngine::getReference().quitGame();
+ Events::getReference().quitFlag = true;
Sound.resume();
}
@@ -983,7 +977,6 @@ bool Game::getYN() {
Events &events = Events::getReference();
Screen &screen = Screen::getReference();
Resources &res = Resources::getReference();
- LureEngine &engine = LureEngine::getReference();
Common::Language l = LureEngine::getReference().getLanguage();
Common::KeyCode y = Common::KEYCODE_y;
@@ -1025,7 +1018,7 @@ bool Game::getYN() {
}
g_system->delayMillis(10);
- } while (!engine.quit() && !breakFlag);
+ } while (!events.quitFlag && !breakFlag);
screen.update();
if (!vKbdFlag)
diff --git a/engines/lure/game.h b/engines/lure/game.h
index 06dcee750f..5054074fb2 100644
--- a/engines/lure/game.h
+++ b/engines/lure/game.h
@@ -27,7 +27,6 @@
#define LURE_GAME_H
-#include "common/config-manager.h"
#include "engines/engine.h"
#include "lure/luredefs.h"
#include "lure/menu.h"
@@ -86,8 +85,8 @@ public:
bool &debugFlag() { return _debugFlag; }
bool fastTextFlag() { return _fastTextFlag; }
bool soundFlag() { return _soundFlag; }
- uint8 sfxVolume() { return ConfMan.getInt("sfx_volume"); }
- uint8 musicVolume() { return ConfMan.getInt("music_volume"); }
+ uint8 sfxVolume() { return _sfxVolume; }
+ uint8 musicVolume() { return _musicVolume; }
Debugger &debugger() { return *_debugger; }
// Menu item support methods
diff --git a/engines/lure/intro.cpp b/engines/lure/intro.cpp
index b4cbf4a833..4d3e172dc5 100644
--- a/engines/lure/intro.cpp
+++ b/engines/lure/intro.cpp
@@ -55,18 +55,17 @@ static const AnimRecord anim_screens[] = {
bool Introduction::showScreen(uint16 screenId, uint16 paletteId, uint16 delaySize) {
Screen &screen = Screen::getReference();
+ Events &events = Events::getReference();
bool isEGA = LureEngine::getReference().isEGA();
screen.screen().loadScreen(screenId);
screen.update();
Palette p(paletteId);
- if (LureEngine::getReference().quit()) return true;
-
if (isEGA) screen.setPalette(&p);
else screen.paletteFadeIn(&p);
bool result = interruptableDelay(delaySize);
- if (LureEngine::getReference().quit()) return true;
+ if (events.quitFlag) return true;
if (!isEGA)
screen.paletteFadeOut();
@@ -84,8 +83,6 @@ 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 335f3384a1..ea760ddb4f 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -92,7 +92,6 @@ int LureEngine::init() {
_room = new Room();
_fights = new FightsManager();
- _gameToLoad = -1;
_initialised = true;
return 0;
}
@@ -122,45 +121,38 @@ LureEngine &LureEngine::getReference() {
}
int LureEngine::go() {
- Game *gameInstance = new Game();
-
- // If requested, load a savegame instead of showing the intro
- if (ConfMan.hasKey("save_slot")) {
- _gameToLoad = ConfMan.getInt("save_slot");
- if (_gameToLoad < 0 || _gameToLoad > 999)
- _gameToLoad = -1;
+
+ if (ConfMan.getBool("copy_protection")) {
+ CopyProtectionDialog *dialog = new CopyProtectionDialog();
+ bool result = dialog->show();
+ delete dialog;
+ if (_events->quitFlag)
+ return 0;
+
+ if (!result)
+ error("Sorry - copy protection failed");
}
-
- if (_gameToLoad == -1) {
- if (ConfMan.getBool("copy_protection")) {
- CopyProtectionDialog *dialog = new CopyProtectionDialog();
- bool result = dialog->show();
- delete dialog;
- if (quit())
- return _eventMan->shouldRTL();
-
- if (!result)
- error("Sorry - copy protection failed");
- }
- if (ConfMan.getInt("boot_param") == 0) {
- // Show the introduction
- Sound.loadSection(Sound.isRoland() ? ROLAND_INTRO_SOUND_RESOURCE_ID : ADLIB_INTRO_SOUND_RESOURCE_ID);
- Introduction *intro = new Introduction();
- intro->show();
- delete intro;
- }
+ Game *gameInstance = new Game();
+
+ if (ConfMan.getInt("boot_param") == 0) {
+ // Show the introduction
+ Sound.loadSection(Sound.isRoland() ? ROLAND_INTRO_SOUND_RESOURCE_ID : ADLIB_INTRO_SOUND_RESOURCE_ID);
+
+ Introduction *intro = new Introduction();
+ intro->show();
+ delete intro;
}
// Play the game
- if (!quit()) {
+ if (!_events->quitFlag) {
// Play the game
Sound.loadSection(Sound.isRoland() ? ROLAND_MAIN_SOUND_RESOURCE_ID : ADLIB_MAIN_SOUND_RESOURCE_ID);
gameInstance->execute();
}
delete gameInstance;
- return _eventMan->shouldRTL();
+ return 0;
}
void LureEngine::pauseEngineIntern(bool pause) {
@@ -254,10 +246,6 @@ void LureEngine::GUIError(const char *msg, ...) {
Engine::GUIErrorMessage(buffer);
}
-void LureEngine::syncSoundSettings() {
- Sound.syncSounds();
-}
-
Common::String *LureEngine::detectSave(int slotNumber) {
Common::ReadStream *f = this->_saveFileMan->openForLoading(
generateSaveName(slotNumber));
@@ -286,23 +274,4 @@ Common::String *LureEngine::detectSave(int slotNumber) {
return result;
}
-Common::String getSaveName(Common::InSaveFile *in) {
- // Check for header
- char saveName[MAX_DESC_SIZE];
- char buffer[5];
- in->read(&buffer[0], 5);
- if (memcmp(&buffer[0], "lure", 5) == 0) {
- // Check language version
- in->readByte();
- in->readByte();
- char *p = saveName;
- int decCtr = MAX_DESC_SIZE - 1;
- while ((decCtr > 0) && ((*p++ = in->readByte()) != 0)) --decCtr;
- *p = '\0';
-
- }
-
- return Common::String(saveName);
-}
-
} // End of namespace Lure
diff --git a/engines/lure/lure.h b/engines/lure/lure.h
index 2c1a70329e..1c5b40e54b 100644
--- a/engines/lure/lure.h
+++ b/engines/lure/lure.h
@@ -30,7 +30,6 @@
#include "common/rect.h"
#include "sound/mixer.h"
#include "common/file.h"
-#include "common/savefile.h"
#include "lure/disk.h"
#include "lure/res.h"
@@ -48,7 +47,6 @@ struct LureGameDescription;
class LureEngine : public Engine {
private:
bool _initialised;
- int _gameToLoad;
uint8 _saveVersion;
Disk *_disk;
Resources *_resources;
@@ -72,11 +70,9 @@ public:
virtual int init();
virtual int go();
virtual void pauseEngineIntern(bool pause);
- virtual void syncSoundSettings();
Disk &disk() { return *_disk; }
- int gameToLoad() { return _gameToLoad; }
bool loadGame(uint8 slotNumber);
bool saveGame(uint8 slotNumber, Common::String &caption);
Common::String *detectSave(int slotNumber);
@@ -88,7 +84,7 @@ public:
Common::Platform getPlatform() const;
bool isEGA() const { return (getFeatures() & GF_EGA) != 0; }
};
- Common::String getSaveName(Common::InSaveFile *in);
+
} // End of namespace Lure
#endif
diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp
index 562f54da20..0b4ef06081 100644
--- a/engines/lure/menu.cpp
+++ b/engines/lure/menu.cpp
@@ -116,7 +116,6 @@ Menu &Menu::getReference() {
uint8 Menu::execute() {
OSystem &system = *g_system;
- LureEngine &engine = LureEngine::getReference();
Mouse &mouse = Mouse::getReference();
Events &events = Events::getReference();
Screen &screen = Screen::getReference();
@@ -131,7 +130,7 @@ uint8 Menu::execute() {
while (mouse.lButton() || mouse.rButton()) {
while (events.pollEvent()) {
- if (engine.quit()) return MENUITEM_NONE;
+ if (events.quitFlag) return MENUITEM_NONE;
if (mouse.y() < MENUBAR_Y_SIZE) {
MenuRecord *p = getMenuAt(mouse.x());
@@ -468,7 +467,6 @@ Action PopupMenu::Show(int numEntries, Action *actions) {
uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
if (numEntries == 0) return 0xffff;
- LureEngine &engine = LureEngine::getReference();
Events &e = Events::getReference();
Mouse &mouse = Mouse::getReference();
OSystem &system = *g_system;
@@ -547,7 +545,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
}
while (e.pollEvent()) {
- if (engine.quit()) {
+ if (e.quitFlag) {
selectedIndex = 0xffff;
goto bail_out;
diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp
index 495f8046bb..7490f05b24 100644
--- a/engines/lure/scripts.cpp
+++ b/engines/lure/scripts.cpp
@@ -26,7 +26,6 @@
#include "lure/animseq.h"
#include "lure/fights.h"
#include "lure/game.h"
-#include "lure/lure.h"
#include "lure/res.h"
#include "lure/room.h"
#include "lure/screen.h"
@@ -191,7 +190,6 @@ void Script::addSound(uint16 soundIndex, uint16 v2, uint16 v3) {
}
void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {
- LureEngine &engine = LureEngine::getReference();
Screen &screen = Screen::getReference();
Mouse &mouse = Mouse::getReference();
Events &events = Events::getReference();
@@ -221,7 +219,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {
anim->show();
if (!events.interruptableDelay(30000)) {
// No key yet pressed, so keep waiting
- while (Sound.musicInterface_CheckPlaying(6) && !engine.quit()) {
+ while (Sound.musicInterface_CheckPlaying(6) && !events.quitFlag) {
if (events.interruptableDelay(20))
break;
}
@@ -229,7 +227,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {
delete anim;
screen.paletteFadeOut();
- engine.quitGame();
+ events.quitFlag = true;
}
// Setup the pig fight in the cave
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index 569058b282..285f66e4e2 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -220,12 +220,10 @@ void SoundManager::addSound(uint8 soundIndex, bool tidyFlag) {
newEntry->channel = channelCtr;
newEntry->numChannels = numChannels;
newEntry->flags = rec.flags;
-
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));
musicInterface_Play(rec.soundNumber, channelCtr, numChannels);
@@ -282,23 +280,6 @@ uint8 SoundManager::descIndexOf(uint8 soundNumber) {
return 0xff; // Couldn't find entry
}
-// Used to sync the volume for all channels with the Config Manager
-//
-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(game.musicVolume());
- else
- (*i)->setVolume(game.sfxVolume());
- }
- g_system->unlockMutex(_soundMutex);
-}
-
SoundDescResource *SoundManager::findSound(uint8 soundNumber) {
debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::findSound soundNumber=%d", soundNumber);
SoundListIterator i;
@@ -421,8 +402,9 @@ 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())
+ if (!game.soundFlag() || (volume == 0))
// Don't play sounds if sound is turned off
return;
@@ -581,12 +563,12 @@ void SoundManager::doTimer() {
/*------------------------------------------------------------------------*/
MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS],
- uint8 channelNum, uint8 soundNum, bool isMus, uint8 numChannels, void *soundData, uint32 size) {
+ uint8 channelNum, uint8 soundNum, bool isMusic, uint8 numChannels, void *soundData, uint32 size) {
_driver = driver;
_channels = channels;
_soundNumber = soundNum;
_channelNumber = channelNum;
- _isMusic = isMus;
+ _isMusic = isMusic;
_numChannels = numChannels;
_volume = 0;
@@ -594,11 +576,7 @@ MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS],
/* 90 is power on default for midi compliant devices */
_channels[_channelNumber + i].volume = 90;
}
-
- if (_isMusic)
- setVolume(ConfMan.getInt("music_volume"));
- else
- setVolume(ConfMan.getInt("sfx_volume"));
+ setVolume(240); /* 255 causes clipping with mastervol 192 and adlib */
_passThrough = false;
diff --git a/engines/lure/sound.h b/engines/lure/sound.h
index cf5dca7e96..c5a31a6c28 100644
--- a/engines/lure/sound.h
+++ b/engines/lure/sound.h
@@ -66,7 +66,7 @@ private:
public:
MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS],
- uint8 channelNum, uint8 soundNum, bool isMus, uint8 numChannels, void *soundData, uint32 size);
+ uint8 channelNum, uint8 soundNum, bool isMusic, uint8 numChannels, void *soundData, uint32 size);
~MidiMusic();
void setVolume(int volume);
int getVolume() { return _volume; }
@@ -98,7 +98,6 @@ public:
uint8 channelNumber() { return _channelNumber; }
uint8 soundNumber() { return _soundNumber; }
bool isPlaying() { return _isPlaying; }
- bool isMusic() {return _isMusic; }
};
class SoundManager: public Common::Singleton<SoundManager> {
@@ -143,7 +142,6 @@ public:
void stopSound(uint8 soundIndex);
void killSound(uint8 soundNumber);
void setVolume(uint8 soundNumber, uint8 volume);
- void syncSounds();
void tidySounds();
uint8 descIndexOf(uint8 soundNumber);
SoundDescResource *findSound(uint8 soundNumber);
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index 23cc9043cf..64394545d1 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -506,7 +506,6 @@ Surface *Surface::getScreen(uint16 resourceId) {
bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool varLength, int16 x, int16 y) {
OSystem &system = *g_system;
- LureEngine &engine = LureEngine::getReference();
Mouse &mouse = Mouse::getReference();
Events &events = Events::getReference();
Screen &screen = Screen::getReference();
@@ -534,7 +533,7 @@ bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool
// Loop until the input string changes
refreshFlag = false;
while (!refreshFlag && !abortFlag) {
- abortFlag = engine.quit();
+ abortFlag = events.quitFlag;
if (abortFlag) break;
while (events.pollEvent()) {
@@ -976,7 +975,7 @@ bool SaveRestoreDialog::show(bool saveDialog) {
// Provide highlighting of lines to select a save slot
while (!abortFlag && !(mouse.lButton() && (selectedLine != -1))
&& !mouse.rButton() && !mouse.mButton()) {
- abortFlag = engine.quit();
+ abortFlag = events.quitFlag;
if (abortFlag) break;
while (events.pollEvent()) {
@@ -1179,7 +1178,7 @@ bool RestartRestoreDialog::show() {
// Event loop for making selection
bool buttonPressed = false;
- while (!engine.quit()) {
+ while (!events.quitFlag) {
// Handle events
while (events.pollEvent()) {
if ((events.type() == Common::EVENT_LBUTTONDOWN) && (highlightedButton != -1)) {
@@ -1231,7 +1230,7 @@ bool RestartRestoreDialog::show() {
Sound.killSounds();
- if (!restartFlag && !engine.quit()) {
+ if (!restartFlag && !events.quitFlag) {
// Need to show Restore game dialog
if (!SaveRestoreDialog::show(false))
// User cancelled, so fall back on Restart
@@ -1300,7 +1299,6 @@ bool CopyProtectionDialog::show() {
Screen &screen = Screen::getReference();
Events &events = Events::getReference();
Common::RandomSource rnd;
- LureEngine &engine = LureEngine::getReference();
screen.setPaletteEmpty();
Palette p(COPY_PROTECTION_RESOURCE_ID - 1);
@@ -1351,7 +1349,7 @@ bool CopyProtectionDialog::show() {
// Clear any prior try
_charIndex = 0;
- while (!engine.quit()) {
+ while (!events.quitFlag) {
while (events.pollEvent() && (_charIndex < 4)) {
if (events.type() == Common::EVENT_KEYDOWN) {
if ((events.event().kbd.keycode == Common::KEYCODE_BACKSPACE) && (_charIndex > 0)) {
@@ -1385,7 +1383,7 @@ bool CopyProtectionDialog::show() {
break;
}
- if (engine.quit())
+ if (events.quitFlag)
return false;
// At this point, two page numbers have been entered - validate them