aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/lua-script.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-07-01 09:06:26 +0530
committerEugene Sandulenko2019-09-03 17:17:06 +0200
commite441680fbf46feb7cded0b3bd213b4d53d650644 (patch)
tree6901f2c8f028a4ab4576d0672dfa4ce497c80eca /engines/hdb/lua-script.cpp
parent50d297637f5b887a96d52543de73349bdaae3cf1 (diff)
downloadscummvm-rg350-e441680fbf46feb7cded0b3bd213b4d53d650644.tar.gz
scummvm-rg350-e441680fbf46feb7cded0b3bd213b4d53d650644.tar.bz2
scummvm-rg350-e441680fbf46feb7cded0b3bd213b4d53d650644.zip
HDB: Add Lua function for spawn()
Diffstat (limited to 'engines/hdb/lua-script.cpp')
-rw-r--r--engines/hdb/lua-script.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index a9256d4c7e..6c6fbf9c72 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -714,7 +714,27 @@ static int animation(lua_State *L) {
}
static int spawnEntity(lua_State *L) {
- warning("STUB: SPAWN ENTITY");
+ double type = lua_tonumber(L, 1);
+ double dir = lua_tonumber(L, 2);
+ double x = lua_tonumber(L, 3);
+ double y = lua_tonumber(L, 4);
+ char *funcInit = (char *)lua_tostring(L, 5);
+ char *funcAction = (char *)lua_tostring(L, 6);
+ char *funcUse = (char *)lua_tostring(L, 7);
+ double dir2 = lua_tonumber(L, 8);
+ double level = lua_tonumber(L, 9);
+ double value1 = lua_tonumber(L, 10);
+ double value2 = lua_tonumber(L, 11);
+
+ int t = (int)type;
+ int d = (int)dir;
+ int d2 = (int)dir2;
+
+ g_hdb->_lua->checkParameters("spawnEntity", 11);
+
+ lua_pop(L, 11);
+
+ g_hdb->_ai->spawn((AIType)t, (AIDir)d, (int)x, (int)y, funcInit, funcAction, funcUse, (AIDir)d2, (int)level, (int)value1, (int)value2, 1);
return 0;
}