diff options
author | Max Horn | 2008-09-01 17:55:52 +0000 |
---|---|---|
committer | Max Horn | 2008-09-01 17:55:52 +0000 |
commit | dcd52c1210506128ee659f3bda0bd40c85a2959e (patch) | |
tree | 98dddd5ee6e57c2d959ba37390ec89f40aa5147e /engines | |
parent | 91df44f8f6448e9adad901cd675926335d84b9db (diff) | |
parent | 852bc9dbb750b9995d31e70f4158c97d3758c46f (diff) | |
download | scummvm-rg350-dcd52c1210506128ee659f3bda0bd40c85a2959e.tar.gz scummvm-rg350-dcd52c1210506128ee659f3bda0bd40c85a2959e.tar.bz2 scummvm-rg350-dcd52c1210506128ee659f3bda0bd40c85a2959e.zip |
Merging more of the GSoC 2008 RTL branch: QUEEN
svn-id: r34247
Diffstat (limited to 'engines')
-rw-r--r-- | engines/queen/input.cpp | 5 | ||||
-rw-r--r-- | engines/queen/journal.cpp | 2 | ||||
-rw-r--r-- | engines/queen/logic.cpp | 10 | ||||
-rw-r--r-- | engines/queen/midiadlib.cpp | 2 | ||||
-rw-r--r-- | engines/queen/queen.cpp | 54 | ||||
-rw-r--r-- | engines/queen/queen.h | 5 | ||||
-rw-r--r-- | engines/queen/sound.cpp | 5 | ||||
-rw-r--r-- | engines/queen/talk.cpp | 2 |
8 files changed, 67 insertions, 18 deletions
diff --git a/engines/queen/input.cpp b/engines/queen/input.cpp index 9f03c341c9..84e21fbcaa 100644 --- a/engines/queen/input.cpp +++ b/engines/queen/input.cpp @@ -118,9 +118,10 @@ void Input::delay(uint amount) { case Common::EVENT_RBUTTONDOWN: _mouseButton |= MOUSE_RBUTTON; break; - + case Common::EVENT_RTL: case Common::EVENT_QUIT: - _vm->quitGame(); + if (_cutawayRunning) + _cutawayQuit = true; return; default: diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp index 0327fb74b8..ead759cdb6 100644 --- a/engines/queen/journal.cpp +++ b/engines/queen/journal.cpp @@ -84,8 +84,8 @@ void Journal::use() { case Common::EVENT_WHEELDOWN: handleMouseWheel(1); break; + case Common::EVENT_RTL: case Common::EVENT_QUIT: - _vm->quitGame(); return; default: break; diff --git a/engines/queen/logic.cpp b/engines/queen/logic.cpp index 9e4770553c..7fcc761018 100644 --- a/engines/queen/logic.cpp +++ b/engines/queen/logic.cpp @@ -2076,6 +2076,8 @@ bool LogicDemo::changeToSpecialRoom() { displayRoom(currentRoom(), RDM_FADE_NOJOE, 100, 2, true); playCutaway("CLOGO.CUT"); sceneReset(); + if (_vm->quit()) + return true; currentRoom(ROOM_HOTEL_LOBBY); entryObj(584); displayRoom(currentRoom(), RDM_FADE_JOE, 100, 2, true); @@ -2129,7 +2131,11 @@ bool LogicGame::changeToSpecialRoom() { } else if (currentRoom() == FOTAQ_LOGO && gameState(VAR_INTRO_PLAYED) == 0) { displayRoom(currentRoom(), RDM_FADE_NOJOE, 100, 2, true); playCutaway("COPY.CUT"); + if (_vm->quit()) + return true; playCutaway("CLOGO.CUT"); + if (_vm->quit()) + return true; if (_vm->resource()->getPlatform() != Common::kPlatformAmiga) { if (ConfMan.getBool("alt_intro") && _vm->resource()->isCD()) { playCutaway("CINTR.CUT"); @@ -2137,7 +2143,11 @@ bool LogicGame::changeToSpecialRoom() { playCutaway("CDINT.CUT"); } } + if (_vm->quit()) + return true; playCutaway("CRED.CUT"); + if (_vm->quit()) + return true; _vm->display()->palSetPanel(); sceneReset(); currentRoom(ROOM_HOTEL_LOBBY); diff --git a/engines/queen/midiadlib.cpp b/engines/queen/midiadlib.cpp index 155bb66716..200c7282f9 100644 --- a/engines/queen/midiadlib.cpp +++ b/engines/queen/midiadlib.cpp @@ -132,7 +132,7 @@ int AdlibMidiDriver::open() { adlibSetNoteVolume(i, 0); adlibTurnNoteOff(i); } - _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, false, true); + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, false, true); return 0; } diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index c95e44b477..d5c8203d6c 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -60,9 +60,11 @@ public: virtual const char *getName() const; virtual const char *getCopyright() const; + virtual bool hasFeature(MetaEngineFeature f) const; virtual GameList getSupportedGames() const; virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const FSList &fslist) const; + virtual SaveStateList listSaves(const char *target) const; virtual PluginError createInstance(OSystem *syst, Engine **engine) const; }; @@ -75,6 +77,14 @@ const char *QueenMetaEngine::getCopyright() const { return "Flight of the Amazon Queen (C) John Passfield and Steve Stamatiadis"; } +bool QueenMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsListSaves) || + (f == kSupportsDirectLoad) || + (f == kSupportsDeleteSave); +} + GameList QueenMetaEngine::getSupportedGames() const { GameList games; games.push_back(queenGameDescriptor); @@ -121,6 +131,36 @@ GameList QueenMetaEngine::detectGames(const FSList &fslist) const { return detectedGames; } +SaveStateList QueenMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringList filenames; + char saveDesc[32]; + Common::String pattern = target; + pattern += ".s??"; + + 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 2 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 2); + + if (slotNum >= 0 && slotNum <= 99) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { + for (int i = 0; i < 4; i++) + in->readUint32BE(); + in->read(saveDesc, 32); + saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file)); + delete in; + } + } + } + + return saveList; +} + PluginError QueenMetaEngine::createInstance(OSystem *syst, Engine **engine) const { assert(engine); *engine = new Queen::QueenEngine(syst); @@ -180,6 +220,10 @@ void QueenEngine::checkOptionSettings() { } } +void QueenEngine::syncSoundSettings() { + readOptionSettings(); +} + void QueenEngine::readOptionSettings() { _sound->setVolume(ConfMan.getInt("music_volume")); _sound->musicToggle(!ConfMan.getBool("music_mute")); @@ -381,8 +425,8 @@ int QueenEngine::go() { loadGameState(ConfMan.getInt("save_slot")); } _lastSaveTime = _lastUpdateTime = _system->getMillis(); - _quit = false; - while (!_quit) { + + while (!quit()) { if (_logic->newRoom() > 0) { _logic->update(); _logic->oldRoom(_logic->currentRoom()); @@ -400,7 +444,7 @@ int QueenEngine::go() { update(true); } } - return 0; + return _eventMan->shouldRTL(); } int QueenEngine::init() { @@ -428,10 +472,6 @@ int QueenEngine::init() { _logic = new LogicGame(this); } - _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); - // Set mixer music volume to maximum, since music volume is regulated by MusicPlayer's MIDI messages - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume); - _sound = Sound::makeSoundInstance(_mixer, this, _resource->getCompression()); _walk = new Walk(this); //_talkspeedScale = (MAX_TEXT_SPEED - MIN_TEXT_SPEED) / 255.0; diff --git a/engines/queen/queen.h b/engines/queen/queen.h index 1eea43e882..66931e037d 100644 --- a/engines/queen/queen.h +++ b/engines/queen/queen.h @@ -97,13 +97,13 @@ public: void checkOptionSettings(); void readOptionSettings(); void writeOptionSettings(); + virtual void syncSoundSettings(); int talkSpeed() const { return _talkSpeed; } void talkSpeed(int speed) { _talkSpeed = speed; } bool subtitles() const { return _subtitles; } void subtitles(bool enable) { _subtitles = enable; } - void quitGame() { _quit = true; } - + void update(bool checkPlayerInput = false); bool canLoadOrSave() const; @@ -137,7 +137,6 @@ protected: int _talkSpeed; bool _subtitles; - bool _quit; uint32 _lastSaveTime; uint32 _lastUpdateTime; diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp index d4fed86bb7..ccaac8227d 100644 --- a/engines/queen/sound.cpp +++ b/engines/queen/sound.cpp @@ -278,8 +278,6 @@ void PCSound::playSpeech(const char *base) { void PCSound::setVolume(int vol) { Sound::setVolume(vol); - // Set mixer music volume to maximum, since music volume is regulated by MusicPlayer's MIDI messages - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume); _music->setVolume(vol); } @@ -333,7 +331,8 @@ void SBSound::playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *so if (sound) { f->read(sound, size); byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE; - _mixer->playRaw(Audio::Mixer::kSFXSoundType, soundHandle, sound, size, 11840, flags); + Audio::Mixer::SoundType type = (soundHandle == &_speechHandle) ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType; + _mixer->playRaw(type, soundHandle, sound, size, 11840, flags); } } diff --git a/engines/queen/talk.cpp b/engines/queen/talk.cpp index ff18ef37d1..fa2ca669cd 100644 --- a/engines/queen/talk.cpp +++ b/engines/queen/talk.cpp @@ -807,7 +807,7 @@ void Talk::speakSegment( switch (command) { case SPEAK_PAUSE: - for (i = 0; i < 10 && !_vm->input()->talkQuit(); i++) { + for (i = 0; i < 10 && !_vm->input()->talkQuit() && !_vm->quit(); i++) { _vm->update(); } return; |