diff options
author | Nipun Garg | 2019-07-09 00:18:01 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:15 +0200 |
commit | 961f3b46f0cf1a458a425c576914cfc621bf962d (patch) | |
tree | 29c97643865fe45464d2f5d6760ab0dddfe5f8b1 /engines/hdb/lua-script.h | |
parent | d510e3efe5da326b0a2c12a86f9937b097494b2b (diff) | |
download | scummvm-rg350-961f3b46f0cf1a458a425c576914cfc621bf962d.tar.gz scummvm-rg350-961f3b46f0cf1a458a425c576914cfc621bf962d.tar.bz2 scummvm-rg350-961f3b46f0cf1a458a425c576914cfc621bf962d.zip |
HDB: Add structs and functions for Lua Globals
Diffstat (limited to 'engines/hdb/lua-script.h')
-rw-r--r-- | engines/hdb/lua-script.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/engines/hdb/lua-script.h b/engines/hdb/lua-script.h index 4f2ffd2d09..b84a19da7d 100644 --- a/engines/hdb/lua-script.h +++ b/engines/hdb/lua-script.h @@ -37,12 +37,28 @@ enum { kCameraYOff = (32 * 2 + 16) // 2.50 Tiles Extra }; +struct Global { + char global[32]; // name of global variable + int valueOrString; // value = 0, string = 1 + double value; // value + char string[32]; // string + + Global() : valueOrString(0), value(0) { + global[0] = 0; + string[0] = 0; + } +}; + class LuaScript { public: LuaScript(); ~LuaScript(); bool loadLua(const char *name); + void saveGlobalNumber(const char *global, double value); + void saveGlobalString(const char *global, const char *string); + void loadGlobal(const char *global); + void purgeGlobals(); bool init(); bool initScript(Common::SeekableReadStream *stream, const char *scriptName, int32 length); @@ -74,6 +90,8 @@ private: bool registerExtensions(); void stripComments(char *chunk); void addPatches(Common::String &chunk, const char *scriptName); + + Common::Array<Global *> _globals; }; void lua_printstack(lua_State *L); |