[Scummvm-cvs-logs] SF.net SVN: scummvm:[41252] scummvm/trunk/engines/agi
sev at users.sourceforge.net
sev at users.sourceforge.net
Sat Jun 6 19:44:46 CEST 2009
Revision: 41252
http://scummvm.svn.sourceforge.net/scummvm/?rev=41252&view=rev
Author: sev
Date: 2009-06-06 17:44:46 +0000 (Sat, 06 Jun 2009)
Log Message:
-----------
Implement scummvm.ini flag features for AGI engine
Modified Paths:
--------------
scummvm/trunk/engines/agi/agi.cpp
scummvm/trunk/engines/agi/agi.h
scummvm/trunk/engines/agi/detection.cpp
Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp 2009-06-06 17:44:24 UTC (rev 41251)
+++ scummvm/trunk/engines/agi/agi.cpp 2009-06-06 17:44:46 UTC (rev 41252)
@@ -627,6 +627,8 @@
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 @@
if (!scumm_stricmp(g->gameid, gameid))
_gameId = g->id;
+ parseFeatures();
+
_rnd = new Common::RandomSource();
syst->getEventManager()->registerRandomSource(*_rnd, "agi");
@@ -838,4 +842,45 @@
_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
Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h 2009-06-06 17:44:24 UTC (rev 41251)
+++ scummvm/trunk/engines/agi/agi.h 2009-06-06 17:44:46 UTC (rev 41252)
@@ -750,6 +750,9 @@
void flipflag(int);
const AGIGameDescription *_gameDescription;
+
+ uint32 _gameFeatures;
+
uint32 getGameID() const;
uint32 getFeatures() const;
uint16 getVersion() const;
@@ -757,6 +760,8 @@
Common::Language getLanguage() const;
Common::Platform getPlatform() const;
const char *getGameMD5() const;
+ void initFeatures(void);
+ void setFeature(uint32 feature);
Common::Error loadGameState(int slot);
Common::Error saveGameState(int slot, const char *desc);
@@ -796,7 +801,7 @@
int checkCollision(VtEntry *v);
int checkPosition(VtEntry *v);
- uint32 matchVersion(uint32 crc);
+ void parseFeatures(void);
int _firstSlot;
Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp 2009-06-06 17:44:24 UTC (rev 41251)
+++ scummvm/trunk/engines/agi/detection.cpp 2009-06-06 17:44:46 UTC (rev 41252)
@@ -51,7 +51,7 @@
}
uint32 AgiBase::getFeatures() const {
- return _gameDescription->features;
+ return _gameFeatures;
}
Common::Platform AgiBase::getPlatform() const {
@@ -74,8 +74,16 @@
return _gameDescription->desc.filesDescriptions[0].md5;
}
+void AgiBase::initFeatures(void) {
+ _gameFeatures = _gameDescription->features;
}
+void AgiBase::setFeature(uint32 feature) {
+ _gameFeatures |= feature;
+}
+
+}
+
static const PlainGameDescriptor agiGames[] = {
{"agi", "Sierra AGI game"},
{"agi-fanmade", "Fanmade AGI game"},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list