From 09b682cb63fed029f43133f4a2d9daa3438ac8e2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 27 Nov 2018 21:02:49 -0800 Subject: GLK: TADS: Skeletons for TADS 2 & 3 subengines, extra detection logic --- engines/glk/tads/detection.cpp | 15 +++++----- engines/glk/tads/detection.h | 18 +++++++++++- engines/glk/tads/detection_tables.h | 7 +++-- engines/glk/tads/tads.cpp | 4 --- engines/glk/tads/tads.h | 5 ---- engines/glk/tads/tads2/tads2.cpp | 38 +++++++++++++++++++++++++ engines/glk/tads/tads2/tads2.h | 57 +++++++++++++++++++++++++++++++++++++ engines/glk/tads/tads3/tads3.cpp | 38 +++++++++++++++++++++++++ engines/glk/tads/tads3/tads3.h | 57 +++++++++++++++++++++++++++++++++++++ 9 files changed, 219 insertions(+), 20 deletions(-) create mode 100644 engines/glk/tads/tads2/tads2.cpp create mode 100644 engines/glk/tads/tads2/tads2.h create mode 100644 engines/glk/tads/tads3/tads3.cpp create mode 100644 engines/glk/tads/tads3/tads3.h (limited to 'engines/glk/tads') 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 @@ -29,6 +29,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 */ @@ -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 @@ -44,11 +44,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 */ 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 -- cgit v1.2.3