diff options
author | Nipun Garg | 2019-06-05 04:31:57 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:42 +0200 |
commit | 79ebe8927e222e151083fa136a03869f39678eaf (patch) | |
tree | 761d8c96832b8597c746fe7cdd34898df5fb6209 | |
parent | 4b8f7f339e3be160b8acb77b4efd71d21877c79f (diff) | |
download | scummvm-rg350-79ebe8927e222e151083fa136a03869f39678eaf.tar.gz scummvm-rg350-79ebe8927e222e151083fa136a03869f39678eaf.tar.bz2 scummvm-rg350-79ebe8927e222e151083fa136a03869f39678eaf.zip |
HDB: Add *g_hdb to access the subsystems
-rw-r--r-- | engines/hdb/hdb.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/hdb.h | 2 | ||||
-rw-r--r-- | engines/hdb/lua-script.cpp | 10 |
3 files changed, 14 insertions, 0 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index a33cb82a90..5c816bff3f 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -39,6 +39,7 @@ namespace HDB { HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { _console = nullptr; _systemInit = false; + g_hdb = this; fileMan = new FileMan; lua = new LuaScript; @@ -48,6 +49,7 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst HDBGame::~HDBGame() { delete _console; + delete g_hdb; delete fileMan; delete lua; DebugMan.clearAllDebugChannels(); diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index e76510dd4b..641a4f2cee 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -103,6 +103,8 @@ private: }; +static HDBGame *g_hdb; + }// End of namespace HDB #endif diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index 55ad724c48..0d0e36b2fc 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -53,6 +53,15 @@ LuaScript::~LuaScript() { return true; }*/ +/* + Called from Lua, this will pop into the menu +*/ + +static int gotoMenu(lua_State *L) { + g_hdb->changeGameState(); + return 0; +} + struct VarInit { char *realName; char *luaName; @@ -73,6 +82,7 @@ struct FuncInit { char *luaName; int (*function) (lua_State *L); } luaFuncs[] = { + {"GotoMenu", gotoMenu}, {NULL, NULL} }; |