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/queen/queen.cpp | |
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/queen/queen.cpp')
-rw-r--r-- | engines/queen/queen.cpp | 54 |
1 files changed, 47 insertions, 7 deletions
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; |