diff options
Diffstat (limited to 'engines/agi/agi.cpp')
-rw-r--r-- | engines/agi/agi.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index dc4764ba23..26e51f334f 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -627,6 +627,8 @@ AgiButtonStyle::AgiButtonStyle(Common::RenderMode renderMode) { AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { _noSaveLoadAllowed = false; + + initFeatures(); } AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) { @@ -642,6 +644,8 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas if (!scumm_stricmp(g->gameid, gameid)) _gameId = g->id; + parseFeatures(); + _rnd = new Common::RandomSource(); syst->getEventManager()->registerRandomSource(*_rnd, "agi"); @@ -838,4 +842,45 @@ void AgiEngine::syncSoundSettings() { _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech); } +void AgiEngine::parseFeatures(void) { + if (!ConfMan.hasKey("features")) + return; + + char *features = strdup(ConfMan.get("features").c_str()); + const char *feature[100]; + int numFeatures = 0; + + char *tok = strtok(features, " "); + if (tok) { + do { + feature[numFeatures++] = tok; + } while ((tok = strtok(NULL, " ")) != NULL); + } else { + feature[numFeatures++] = features; + } + + const struct Flags { + const char *name; + uint32 flag; + } flags[] = { + { "agimouse", GF_AGIMOUSE }, + { "agds", GF_AGDS }, + { "agi256", GF_AGI256 }, + { "agi256-2", GF_AGI256_2 }, + { "agipal", GF_AGIPAL }, + { 0, 0 } + }; + + for (int i = 0; i < numFeatures; i++) { + for (const Flags *flag = flags; flag->name; flag++) { + if (!scumm_stricmp(feature[i], flag->name)) { + debug(0, "Added feature: %s", flag->name); + + setFeature(flag->flag); + break; + } + } + } +} + } // End of namespace Agi |