aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/lua-script.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-07-01 09:04:39 +0530
committerEugene Sandulenko2019-09-03 17:17:06 +0200
commita07cbc0dd1c9ca5518389376e0ec4711af403336 (patch)
tree66a57bd238f8742dc1d6d6af2d04161fb012def8 /engines/hdb/lua-script.cpp
parente895a0929bd3acfccf8b3dd5a8eea617d629e04f (diff)
downloadscummvm-rg350-a07cbc0dd1c9ca5518389376e0ec4711af403336.tar.gz
scummvm-rg350-a07cbc0dd1c9ca5518389376e0ec4711af403336.tar.bz2
scummvm-rg350-a07cbc0dd1c9ca5518389376e0ec4711af403336.zip
HDB: Add Lua functions for Entities + entityFace()
Diffstat (limited to 'engines/hdb/lua-script.cpp')
-rw-r--r--engines/hdb/lua-script.cpp40
1 files changed, 36 insertions, 4 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index e8abd341be..348f74959f 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -528,7 +528,14 @@ static int setEntDir(lua_State *L) {
}
static int removeEntity(lua_State *L) {
- warning("STUB: REMOVE ENTITY");
+ const char *entName = lua_tostring(L, 1);
+
+ g_hdb->_lua->checkParameters("removeEntity", 1);
+
+ lua_pop(L, 1);
+
+ g_hdb->_ai->removeLuaEntity(entName);
+
return 0;
}
@@ -545,17 +552,42 @@ static int animEntity(lua_State *L) {
}
static int setAnimFrame(lua_State *L) {
- warning("STUB: SET ANIM FRAME");
+ const char *entName = lua_tostring(L, 1);
+ double state = lua_tonumber(L, 2);
+ double frame = lua_tonumber(L, 3);
+
+ g_hdb->_lua->checkParameters("setAnimFrame", 3);
+
+ lua_pop(L, 3);
+
+ int s = (int)state;
+ g_hdb->_ai->setLuaAnimFrame(entName, (AIState)s, (int)frame);
+
return 0;
}
static int useEntity(lua_State *L) {
- warning("STUB: USE ENTITY");
+ const char *initName = lua_tostring(L, 1);
+
+ g_hdb->_lua->checkParameters("useEntity", 1);
+
+ lua_pop(L, 1);
+
+ g_hdb->_ai->useLuaEntity(initName);
+
return 0;
}
static int entityFace(lua_State *L) {
- warning("STUB: ENTITY FACE");
+ const char *initName = lua_tostring(L, 1);
+ double dir = lua_tonumber(L, 2);
+
+ g_hdb->_lua->checkParameters("entityFace", 2);
+
+ lua_pop(L, 2);
+
+ g_hdb->_ai->entityFace(initName, (int)dir);
+
return 0;
}