From cd6d528c422de5906aac1882cc1924dda903f759 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 2 Jun 2008 06:51:59 +0000 Subject: Better implementation of packet games loading svn-id: r32490 --- engines/drascula/detection.cpp | 11 +++++++++++ engines/drascula/drascula.cpp | 10 +--------- engines/drascula/drascula.h | 2 ++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp index 358a2bc1c3..a79a1f5674 100644 --- a/engines/drascula/detection.cpp +++ b/engines/drascula/detection.cpp @@ -47,6 +47,17 @@ Common::Language DrasculaEngine::getLanguage() const { return _gameDescription->desc.language; } +void DrasculaEngine::loadArchives() { + const Common::ADGameFileDescription *ag; + + if (getFeatures() & GF_PACKED) { + for (ag = _gameDescription->desc.filesDescriptions; ag->fileName; ag++) + _arj.registerArchive(ag->fileName); + } + + _arj.enableFallback(true); +} + } static const PlainGameDescriptor drasculaGames[] = { diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 513581eb13..29bc4aad8b 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -58,8 +58,6 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); - const GameSettings *g; - _rnd = new Common::RandomSource(); syst->getEventManager()->registerRandomSource(*_rnd, "drascula"); @@ -102,13 +100,7 @@ int DrasculaEngine::init() { _lang = 0; } - _arj.registerArchive("packet.001"); - // Use override files for non-English versions - if (_lang == 3) // French - _arj.registerArchive("packet.002"); - else if (_lang == 2) // German - _arj.registerArchive("packet.003"); - _arj.enableFallback(true); + loadArchives(); return 0; } diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 4f9a487a6b..e98cad2a6c 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -162,6 +162,8 @@ public: Common::Language getLanguage() const; void updateEvents(); + void loadArchives(); + Audio::SoundHandle _soundHandle; void allocMemory(); -- cgit v1.2.3