diff options
author | Nipun Garg | 2019-06-03 18:08:45 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:42 +0200 |
commit | fd666efd6ad39cc3c0fec61e14b096f74012b8e5 (patch) | |
tree | d416c93ceaeb89e9f291b98ae28750abcc3fc65b | |
parent | 708819839da585a251b0dcd70c3d4598ef24d61f (diff) | |
download | scummvm-rg350-fd666efd6ad39cc3c0fec61e14b096f74012b8e5.tar.gz scummvm-rg350-fd666efd6ad39cc3c0fec61e14b096f74012b8e5.tar.bz2 scummvm-rg350-fd666efd6ad39cc3c0fec61e14b096f74012b8e5.zip |
HDB: Check if demo version is running
-rw-r--r-- | engines/hdb/detection.cpp | 14 | ||||
-rw-r--r-- | engines/hdb/hdb.cpp | 19 | ||||
-rw-r--r-- | engines/hdb/hdb.h | 3 |
3 files changed, 31 insertions, 5 deletions
diff --git a/engines/hdb/detection.cpp b/engines/hdb/detection.cpp index ca5acd657f..84d103d2d4 100644 --- a/engines/hdb/detection.cpp +++ b/engines/hdb/detection.cpp @@ -29,6 +29,20 @@ namespace HDB { const char *HDBGame::getGameId() const { return _gameDescription->gameId; } Common::Platform HDBGame::getPlatform() const { return _gameDescription->platform; } + +const char *HDBGame::getGameFile() const { + return _gameDescription->filesDescriptions[0].fileName; +} + +void HDBGame::setGameFlags() { + _voiceless = false; + if (_gameDescription->flags & ADGF_DEMO) { + _isDemo = true; + return; + } + _isDemo = false; +} + } // End of namespace HDB static const PlainGameDescriptor hdbGames[] = { diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 40857e7c12..e929835598 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -61,16 +61,18 @@ bool HDBGame::init() { */ // Init fileMan - if (!fileMan->openMPC("hyperdemo.mpc")) { + setGameFlags(); + + if (!fileMan->openMPC(getGameFile())) { error("FileMan::openMPC: Cannot find the hyperspace.mpc data file."); return false; } // Init Lua - if (!lua->init()) { + /*if (!lua->init()) { error("LuaScript::int: Cannot initialize LuaScript."); return false; - } + }*/ gameShutdown = false; _systemInit = true; @@ -139,8 +141,15 @@ Common::Error HDBGame::run() { Tile *tile = new Tile; Graphics::Surface surf2 = tile->load(tileStream); - lua->executeFile("test.lua"); - + /*Common::SeekableReadStream *luaStream = fileMan->findFirstData("CINE_INTRO_DEMO_LUA", TYPE_BINARY); + int32 luaLength = fileMan->getLength("CINE_INTRO_DEMO_LUA", TYPE_BINARY); + if (luaStream == NULL) { + debug("The CINE_INTRO_DEMO_LUA MPC entry can't be found."); + return Common::kReadingFailed; + } + + lua->executeMPC(luaStream, "CINE_INTRO_DEMO_LUA", luaLength); + */ while (!shouldQuit()) { Common::Event event; diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index b28de32005..ccbbc80a15 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -69,6 +69,8 @@ public: // Detection related members; const ADGameDescription *_gameDescription; const char *getGameId() const; + const char *getGameFile() const; + void setGameFlags(); Common::Platform getPlatform() const; /* @@ -95,6 +97,7 @@ private: bool _systemInit; GameState _gameState; bool _voiceless; + bool _isDemo; }; |