aboutsummaryrefslogtreecommitdiff
path: root/saga/saga.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'saga/saga.cpp')
-rw-r--r--saga/saga.cpp135
1 files changed, 135 insertions, 0 deletions
diff --git a/saga/saga.cpp b/saga/saga.cpp
new file mode 100644
index 0000000000..02a233d1e5
--- /dev/null
+++ b/saga/saga.cpp
@@ -0,0 +1,135 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+
+#include "base/gameDetector.h"
+#include "base/plugins.h"
+#include "backends/fs/fs.h"
+
+#include "sound/mixer.h"
+#include "common/file.h"
+#include "common/config-manager.h"
+
+#include "saga.h"
+
+#include "gamedesc.h"
+
+
+struct SAGAGameSettings {
+ const char *name;
+ const char *description;
+ byte id;
+ uint32 features;
+ const char *detectname;
+ GameSettings toGameSettings() const {
+ GameSettings dummy = { name, description, features };
+ return dummy;
+ }
+};
+
+static const SAGAGameSettings saga_settings[] = {
+ /* Inherit the Earth - Original floppy version */
+ { "ite", "Inherit the Earth (DOS)", GID_ITE,
+ MDT_ADLIB, "ite.rsc" },
+ /* Inherit the Earth - CD version */
+ { "itecd", "Inherit the Earth (DOS CD Version)", GID_ITECD,
+ MDT_ADLIB, "sounds.rsc" },
+ /* I Have No Mouth and I Must Scream */
+ { "ihnm", "I Have No Mouth and I Must Scream (DOS)", GID_IHNM,
+ MDT_ADLIB, "scream.res" },
+
+ { NULL, NULL, 0, 0, NULL }
+};
+
+GameList Engine_SAGA_gameList() {
+ const SAGAGameSettings *g = saga_settings;
+ GameList games;
+ while (g->name) {
+ games.push_back(g->toGameSettings());
+ g++;
+ }
+ return games;
+}
+
+DetectedGameList Engine_SAGA_detectGames(const FSList &fslist) {
+ DetectedGameList detectedGames;
+ const SAGAGameSettings *g;
+
+ for (g = saga_settings; g->name; ++g) {
+ // 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(g->detectname, gameName)) {
+ // Match found, add to list of candidates, then abort inner loop.
+ detectedGames.push_back(g->toGameSettings());
+ break;
+ }
+ }
+ }
+ return detectedGames;
+}
+
+Engine *Engine_SAGA_create(GameDetector *detector, OSystem *syst) {
+ return new SagaEngine(detector, syst);
+}
+
+REGISTER_PLUGIN("SAGA Engine", Engine_SAGA_gameList, Engine_SAGA_create, Engine_SAGA_detectGames)
+
+namespace Saga {
+
+SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst)
+ : Engine(syst) {
+
+ SagaGameDesc::setGameDirectory(getGameDataPath());
+ SagaGameDesc::openGame();
+
+ // Setup mixer
+ if (!_mixer->isReady()) {
+ warning("Sound initialization failed.");
+ }
+
+ _mixer->setVolume(ConfMan.getInt("sfx_volume") * ConfMan.getInt("master_volume") / 255);
+
+ // Initialize backend
+ syst->initSize(320, 240);
+}
+
+SagaEngine::~SagaEngine() {
+
+}
+
+void SagaEngine::errorString(const char *buf1, char *buf2) {
+ strcpy(buf2, buf1);
+}
+
+void SagaEngine::go() {
+
+
+}
+
+void SagaEngine::shutdown() {
+
+ _system->quit();
+}
+
+}