From 6b5fd8a95ff3713a0e199f2757ddde8d1ad8a9c8 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Sun, 30 Jun 2019 04:37:42 +0530 Subject: HDB: Add lua functions for dialog and getEntityXY --- engines/hdb/lua-script.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index aeb629b69c..2a3b032ec6 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -443,8 +443,18 @@ static int deliveriesLeft(lua_State *L) { } static int getEntityXY(lua_State *L) { - warning("STUB: GET ENTITYXY"); - return 0; + int x, y; + const char *initName = lua_tostring(L, 1); + + g_hdb->_lua->checkParameters("getEntityXY", 1); + + lua_pop(L, 1); + + g_hdb->_ai->getEntityXY(initName, &x, &y); + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + return 2; } static int setEntity(lua_State *L) { @@ -546,7 +556,22 @@ static int setBackground(lua_State *L) { } static int dialog(lua_State *L) { - warning("STUB: DIALOG"); + const char *title, *string, *more; + double tileIndex; + + title = lua_tostring(L, 1); + tileIndex = lua_tonumber(L, 2); + string = lua_tostring(L, 3); + more = lua_tostring(L, 4); + + if (!more || more[0] == '0') + more = NULL; + + g_hdb->_lua->checkParameters("dialog", 4); + + lua_pop(L, 4); + if (string) + g_hdb->_window->openDialog(title, (int)tileIndex, string, (int)more, more); return 0; } -- cgit v1.2.3