aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-07-03 17:31:10 +0200
committerEugene Sandulenko2019-09-03 17:17:10 +0200
commit347dd30f784f7739da2a5ea29117851a7665e1ec (patch)
tree0f0a40167cad516b188357d48e1bfe72c28d9b83
parente97d425b8a70d4dac28291cb4262a37981db823a (diff)
downloadscummvm-rg350-347dd30f784f7739da2a5ea29117851a7665e1ec.tar.gz
scummvm-rg350-347dd30f784f7739da2a5ea29117851a7665e1ec.tar.bz2
scummvm-rg350-347dd30f784f7739da2a5ea29117851a7665e1ec.zip
HDB: Implement loadLua()
-rw-r--r--engines/hdb/hdb.cpp9
-rw-r--r--engines/hdb/lua-script.cpp12
-rw-r--r--engines/hdb/lua-script.h2
3 files changed, 12 insertions, 11 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index 3fefb2835b..9eaf120813 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -503,14 +503,7 @@ Common::Error HDBGame::run() {
tile->load(tileStream);
#endif
- Common::SeekableReadStream *luaStream = _fileMan->findFirstData("MAP00_LUA", TYPE_BINARY);
- int32 luaLength = _fileMan->getLength("MAP00_LUA", TYPE_BINARY);
- if (luaStream == NULL) {
- debug("The MAP00_LUA MPC entry can't be found.");
- return Common::kReadingFailed;
- }
-
- _lua->initScript(luaStream, "MAP00_LUA", luaLength);
+ _lua->loadLua("MAP00_LUA");
_lua->callFunction("level_loaded", 0);
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index eaf46abe85..5c273e2a3e 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -72,8 +72,16 @@ bool LuaScript::init() {
return true;
}
-bool LuaScript::loadLua(char *name) {
- warning("STUB: loadLua(%s)", name);
+bool LuaScript::loadLua(const char *name) {
+ Common::SeekableReadStream *luaStream = g_hdb->_fileMan->findFirstData(name, TYPE_BINARY);
+ int32 luaLength = g_hdb->_fileMan->getLength(name, TYPE_BINARY);
+ if (luaStream == NULL) {
+ warning("The %s MPC entry can't be found", name);
+
+ return false;
+ }
+
+ initScript(luaStream, name, luaLength);
return true;
}
diff --git a/engines/hdb/lua-script.h b/engines/hdb/lua-script.h
index 4679d2ca82..6949debc44 100644
--- a/engines/hdb/lua-script.h
+++ b/engines/hdb/lua-script.h
@@ -42,7 +42,7 @@ public:
LuaScript();
~LuaScript();
- bool loadLua(char *name);
+ bool loadLua(const char *name);
bool init();
bool initScript(Common::SeekableReadStream *stream, const char *scriptName, int32 length);