diff options
Diffstat (limited to 'sword1/sword1.cpp')
-rw-r--r-- | sword1/sword1.cpp | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp index f0eb203b3d..659c4177e8 100644 --- a/sword1/sword1.cpp +++ b/sword1/sword1.cpp @@ -47,29 +47,43 @@ using namespace Sword1; /* Broken Sword 1 */ -static const GameSettings sword1_setting = - {"sword1", "Broken Sword I", GF_DEFAULT_TO_1X_SCALER}; +static const GameSettings sword1_settings[] = { + {"sword1", "Broken Sword I", GF_DEFAULT_TO_1X_SCALER}, + {"sword1demo", "Broken Sword I (Demo)", GF_DEFAULT_TO_1X_SCALER | Sword1::GF_DEMO }, + { NULL, NULL, 0 } +}; GameList Engine_SWORD1_gameList() { + const GameSettings *g = sword1_settings; GameList games; - games.push_back(sword1_setting); + while (g->name) { + games.push_back(*g); + g++; + } return games; } DetectedGameList Engine_SWORD1_detectGames(const FSList &fslist) { DetectedGameList detectedGames; + const GameSettings *g = sword1_settings; - // Iterate over all files in the given directory - for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { - const char *gameName = file->displayName().c_str(); + // TODO: It would be nice if we had code here which distinguishes + // between the 'sword1' and 'sword1demo' targets. - if ((0 == scumm_stricmp("swordres.rif", gameName)) || - (0 == scumm_stricmp("cd1.id", gameName)) || - (0 == scumm_stricmp("cd2.id", gameName))) { - // Match found, add to list of candidates, then abort inner loop. - detectedGames.push_back(sword1_setting); - break; + while (g->name) { + // Iterate over all files in the given directory + for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { + const char *gameName = file->displayName().c_str(); + + if ((0 == scumm_stricmp("swordres.rif", gameName)) || + (0 == scumm_stricmp("cd1.id", gameName)) || + (0 == scumm_stricmp("cd2.id", gameName))) { + // Match found, add to list of candidates, then abort inner loop. + detectedGames.push_back(*g); + break; + } } + g++; } return detectedGames; @@ -92,6 +106,8 @@ void SwordEngine::errorString(const char *buf1, char *buf2) { SwordEngine::SwordEngine(GameDetector *detector, OSystem *syst) : Engine(syst) { + _features = detector->_game.features; + if (!_mixer->isReady()) warning("Sound initialization failed"); } @@ -122,7 +138,7 @@ void SwordEngine::initialize(void) { _mouse = new Mouse(_system, _resMan, _objectMan); _screen = new Screen(_system, _resMan, _objectMan); _music = new Music(_system, _mixer); - _sound = new Sound("", _mixer, _resMan); + _sound = new Sound("", _mixer, _resMan, (_features & GF_DEMO) != 0); _menu = new Menu(_screen, _mouse); _logic = new Logic(_objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, _system, _mixer); _mouse->useLogicAndMenu(_logic, _menu); |