From 106a63aa81a17d9598936785b55d80641d6432de Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 3 Jul 2019 14:55:25 +0200 Subject: HDB: Add LASTMAPNAME Lua variable --- engines/hdb/hdb.cpp | 2 ++ engines/hdb/hdb.h | 4 ++++ engines/hdb/lua-script.cpp | 7 +++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 978e85ca31..d4db1cf536 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -76,6 +76,8 @@ bool HDBGame::init() { Game Subsystem Initializations */ + _lastMapname[0] = 0; + // Init fileMan if (!_fileMan->openMPC(getGameFile())) { diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index c93cdf4542..62c266e442 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -189,6 +189,8 @@ public: return _timeSlice - _prevTimeSlice; } + char *lastMapname() { return _lastMapname; } + bool _gameShutdown; Graphics::PixelFormat _format; @@ -207,6 +209,8 @@ private: int _actionMode; // 0 or 1 int _pauseFlag; + char _lastMapname[64]; + }; extern HDBGame *g_hdb; diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index a42ca79857..8e7083b653 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -1346,10 +1346,9 @@ bool LuaScript::initScript(Common::SeekableReadStream *stream, const char *scrip lua_setglobal(_state, luaGlobalValues[j].luaName); } - /* - TODO: Set the last mapName as a global - after implementing the map-manager. - */ + // set the last mapname as a global + lua_pushstring(_state, g_hdb->lastMapname()); + lua_setglobal(_state, "LASTMAP"); // Set the lowest printable line lua_pushnumber(_state, 480 - 14); -- cgit v1.2.3