aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-27 21:02:49 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit09b682cb63fed029f43133f4a2d9daa3438ac8e2 (patch)
tree60da8622fda66f8477c463a4b99d0ffe54fb72d0
parent0b7a29c7973025d32d8952e97cdc4d13a2794c36 (diff)
downloadscummvm-rg350-09b682cb63fed029f43133f4a2d9daa3438ac8e2.tar.gz
scummvm-rg350-09b682cb63fed029f43133f4a2d9daa3438ac8e2.tar.bz2
scummvm-rg350-09b682cb63fed029f43133f4a2d9daa3438ac8e2.zip
GLK: TADS: Skeletons for TADS 2 & 3 subengines, extra detection logic
-rw-r--r--engines/glk/blorb.cpp3
-rw-r--r--engines/glk/detection.cpp11
-rw-r--r--engines/glk/glk_types.h3
-rw-r--r--engines/glk/module.mk4
-rw-r--r--engines/glk/tads/detection.cpp15
-rw-r--r--engines/glk/tads/detection.h18
-rw-r--r--engines/glk/tads/detection_tables.h7
-rw-r--r--engines/glk/tads/tads.cpp4
-rw-r--r--engines/glk/tads/tads.h5
-rw-r--r--engines/glk/tads/tads2/tads2.cpp38
-rw-r--r--engines/glk/tads/tads2/tads2.h57
-rw-r--r--engines/glk/tads/tads3/tads3.cpp38
-rw-r--r--engines/glk/tads/tads3/tads3.h57
13 files changed, 234 insertions, 26 deletions
diff --git a/engines/glk/blorb.cpp b/engines/glk/blorb.cpp
index 5c1f0bd962..038a79e046 100644
--- a/engines/glk/blorb.cpp
+++ b/engines/glk/blorb.cpp
@@ -171,7 +171,8 @@ Common::ErrorCode Blorb::load() {
if (
(_interpType == INTERPRETER_FROTZ && type == "ZCOD") ||
- (_interpType == INTERPRETER_TADS && (type == "TAD2" || type == "TAD3")) ||
+ (_interpType == INTERPRETER_TADS2 && type == "TAD2") ||
+ (_interpType == INTERPRETER_TADS3 && type == "TAD3") ||
(_interpType == INTERPRETER_HUGO && type == "HUGO")
) {
// Game executable
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index d5b0ce8286..491c6c8b82 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -26,7 +26,8 @@
#include "glk/scott/detection.h"
#include "glk/scott/scott.h"
#include "glk/tads/detection.h"
-#include "glk/tads/tads.h"
+#include "glk/tads/tads2/tads2.h"
+#include "glk/tads/tads3/tads3.h"
#include "base/plugins.h"
#include "common/md5.h"
@@ -100,6 +101,7 @@ bool Glk::GlkEngine::hasFeature(EngineFeature f) const {
}
Common::Error GlkMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
+ Glk::TADS::TADSDescriptor td;
assert(engine);
// Populate the game description
@@ -135,8 +137,11 @@ Common::Error GlkMetaEngine::createInstance(OSystem *syst, Engine **engine) cons
*engine = new Glk::Frotz::Frotz(syst, gameDesc);
} else if (Glk::Scott::ScottMetaEngine::findGame(gameDesc._gameId.c_str()).description) {
*engine = new Glk::Scott::Scott(syst, gameDesc);
- } else if (Glk::TADS::TADSMetaEngine::findGame(gameDesc._gameId.c_str()).description) {
- *engine = new Glk::TADS::TADS(syst, gameDesc);
+ } else if ((td = Glk::TADS::TADSMetaEngine::findGame(gameDesc._gameId.c_str())).description) {
+ if (td.isTADS3)
+ *engine = new Glk::TADS::TADS3::TADS3(syst, gameDesc);
+ else
+ *engine = new Glk::TADS::TADS2::TADS2(syst, gameDesc);
} else {
return Common::kNoGameDataFoundError;
}
diff --git a/engines/glk/glk_types.h b/engines/glk/glk_types.h
index 4ac9566f58..81a36d8108 100644
--- a/engines/glk/glk_types.h
+++ b/engines/glk/glk_types.h
@@ -50,7 +50,8 @@ enum InterpreterType {
INTERPRETER_NITFOL = 11,
INTERPRETER_SCARE = 12,
INTERPRETER_SCOTT = 13,
- INTERPRETER_TADS = 14
+ INTERPRETER_TADS2 = 14,
+ INTERPRETER_TADS3 = 15
};
/**
diff --git a/engines/glk/module.mk b/engines/glk/module.mk
index b75772dc4f..bb55c98cfb 100644
--- a/engines/glk/module.mk
+++ b/engines/glk/module.mk
@@ -44,7 +44,9 @@ MODULE_OBJS := \
scott/detection.o \
scott/scott.o \
tads/detection.o \
- tads/tads.o
+ tads/tads.o \
+ tads/tads2/tads2.o \
+ tads/tads3/tads3.o
# This module can be built as a plugin
ifeq ($(ENABLE_GLK), DYNAMIC_PLUGIN)
diff --git a/engines/glk/tads/detection.cpp b/engines/glk/tads/detection.cpp
index ef2caa2edc..6627b8f53b 100644
--- a/engines/glk/tads/detection.cpp
+++ b/engines/glk/tads/detection.cpp
@@ -30,17 +30,18 @@ namespace Glk {
namespace TADS {
void TADSMetaEngine::getSupportedGames(PlainGameList &games) {
- for (const PlainGameDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd)
+ for (const TADSDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd) {
games.push_back(*pd);
+ }
}
-PlainGameDescriptor TADSMetaEngine::findGame(const char *gameId) {
- for (const PlainGameDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd) {
+TADSDescriptor TADSMetaEngine::findGame(const char *gameId) {
+ for (const TADSDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
return *pd;
}
- return PlainGameDescriptor();;
+ return TADSDescriptor();;
}
bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
@@ -49,8 +50,8 @@ bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &ga
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
- if (file->isDirectory() || !(file->getName().hasSuffixIgnoreCase(".saga")
- || file->getName().hasSuffixIgnoreCase(".dat")))
+ if (file->isDirectory() || !(file->getName().hasSuffixIgnoreCase(".gam")
+ || file->getName().hasSuffixIgnoreCase(".t3")))
continue;
if (gameFile.open(*file)) {
@@ -63,7 +64,7 @@ bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &ga
if (p->_filesize) {
// Found a match
- PlainGameDescriptor gameDesc = findGame(p->_gameId);
+ TADSDescriptor gameDesc = findGame(p->_gameId);
DetectedGame gd(p->_gameId, gameDesc.description, Common::EN_ANY, Common::kPlatformUnknown);
gd.addExtraEntry("filename", file->getName());
diff --git a/engines/glk/tads/detection.h b/engines/glk/tads/detection.h
index 59a6bc72a3..3e4d3e3a00 100644
--- a/engines/glk/tads/detection.h
+++ b/engines/glk/tads/detection.h
@@ -30,6 +30,22 @@ namespace Glk {
namespace TADS {
/**
+ * TADS game descriptior
+ */
+struct TADSDescriptor {
+ const char *gameId;
+ const char *description;
+ bool isTADS3;
+
+ operator PlainGameDescriptor() const {
+ PlainGameDescriptor pd;
+ pd.gameId = gameId;
+ pd.description = description;
+ return pd;
+ }
+};
+
+/**
* Meta engine for TADS interpreter
*/
class TADSMetaEngine {
@@ -42,7 +58,7 @@ public:
/**
* Returns a game description for the given game Id, if it's supported
*/
- static PlainGameDescriptor findGame(const char *gameId);
+ static TADSDescriptor findGame(const char *gameId);
/**
* Detect supported games
diff --git a/engines/glk/tads/detection_tables.h b/engines/glk/tads/detection_tables.h
index eb9441f736..c8fe3184b5 100644
--- a/engines/glk/tads/detection_tables.h
+++ b/engines/glk/tads/detection_tables.h
@@ -36,9 +36,10 @@ struct TADSGame {
int32 _filesize;
};
-const PlainGameDescriptor TADS_GAME_LIST[] = {
- { "tads", "TADS" },
- { nullptr, nullptr }
+const TADSDescriptor TADS_GAME_LIST[] = {
+ { "tads2", "TADS 2 Game", false },
+ { "tads3", "TADS 3 Game", true },
+ { nullptr, nullptr, false }
};
const TADSGame TADS_GAMES[] = {
diff --git a/engines/glk/tads/tads.cpp b/engines/glk/tads/tads.cpp
index 8a40dbd7d0..8301813231 100644
--- a/engines/glk/tads/tads.cpp
+++ b/engines/glk/tads/tads.cpp
@@ -30,10 +30,6 @@ namespace TADS {
TADS::TADS(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc) {
}
-void TADS::runGame(Common::SeekableReadStream *gameFile) {
- // TODO
-}
-
Common::Error TADS::loadGameData(strid_t file) {
// TODO
return Common::kNoError;
diff --git a/engines/glk/tads/tads.h b/engines/glk/tads/tads.h
index 23caef7c23..8582897c1d 100644
--- a/engines/glk/tads/tads.h
+++ b/engines/glk/tads/tads.h
@@ -45,11 +45,6 @@ public:
virtual InterpreterType getInterpreterType() const override { return INTERPRETER_SCOTT; }
/**
- * Execute the game
- */
- virtual void runGame(Common::SeekableReadStream *gameFile) override;
-
- /**
* Load a savegame from the passed stream
*/
virtual Common::Error loadGameData(strid_t file) override;
diff --git a/engines/glk/tads/tads2/tads2.cpp b/engines/glk/tads/tads2/tads2.cpp
new file mode 100644
index 0000000000..81f7272f85
--- /dev/null
+++ b/engines/glk/tads/tads2/tads2.cpp
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "glk/tads/tads2/tads2.h"
+
+namespace Glk {
+namespace TADS {
+namespace TADS2 {
+
+TADS2::TADS2(OSystem *syst, const GlkGameDescription &gameDesc) : TADS(syst, gameDesc) {
+}
+
+void TADS2::runGame(Common::SeekableReadStream *gameFile) {
+ // TODO
+}
+
+} // End of namespace TADS2
+} // End of namespace TADS
+} // End of namespace Glk
diff --git a/engines/glk/tads/tads2/tads2.h b/engines/glk/tads/tads2/tads2.h
new file mode 100644
index 0000000000..e07b5c8bc4
--- /dev/null
+++ b/engines/glk/tads/tads2/tads2.h
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GLK_TADS_TADS2
+#define GLK_TADS_TADS2
+
+#include "glk/tads/tads.h"
+
+namespace Glk {
+namespace TADS {
+namespace TADS2 {
+
+/**
+ * TADS 2 game interpreter
+ */
+class TADS2 : public TADS {
+public:
+ /**
+ * Constructor
+ */
+ TADS2(OSystem *syst, const GlkGameDescription &gameDesc);
+
+ /**
+ * Execute the game
+ */
+ virtual void runGame(Common::SeekableReadStream *gameFile) override;
+
+ /**
+ * Returns the running interpreter type
+ */
+ virtual InterpreterType getInterpreterType() const override { return INTERPRETER_TADS2; }
+};
+
+} // End of namespace TADS2
+} // End of namespace TADS
+} // End of namespace Glk
+
+#endif
diff --git a/engines/glk/tads/tads3/tads3.cpp b/engines/glk/tads/tads3/tads3.cpp
new file mode 100644
index 0000000000..911e87fd2b
--- /dev/null
+++ b/engines/glk/tads/tads3/tads3.cpp
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "glk/tads/tads3/tads3.h"
+
+namespace Glk {
+namespace TADS {
+namespace TADS3 {
+
+TADS3::TADS3(OSystem *syst, const GlkGameDescription &gameDesc) : TADS(syst, gameDesc) {
+}
+
+void TADS3::runGame(Common::SeekableReadStream *gameFile) {
+ // TODO
+}
+
+} // End of namespace TADS2
+} // End of namespace TADS
+} // End of namespace Glk
diff --git a/engines/glk/tads/tads3/tads3.h b/engines/glk/tads/tads3/tads3.h
new file mode 100644
index 0000000000..2fc4961738
--- /dev/null
+++ b/engines/glk/tads/tads3/tads3.h
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GLK_TADS_TADS3
+#define GLK_TADS_TADS3
+
+#include "glk/tads/tads.h"
+
+namespace Glk {
+namespace TADS {
+namespace TADS3 {
+
+/**
+ * TADS 3 game interpreter
+ */
+class TADS3 : public TADS {
+public:
+ /**
+ * Constructor
+ */
+ TADS3(OSystem *syst, const GlkGameDescription &gameDesc);
+
+ /**
+ * Execute the game
+ */
+ virtual void runGame(Common::SeekableReadStream *gameFile) override;
+
+ /**
+ * Returns the running interpreter type
+ */
+ virtual InterpreterType getInterpreterType() const override { return INTERPRETER_TADS3; }
+};
+
+} // End of namespace TADS3
+} // End of namespace TADS
+} // End of namespace Glk
+
+#endif