From e0f49e8aee8aa22c196969c27a99774f2e85f805 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Sat, 13 Jul 2019 23:32:55 +0530 Subject: HDB: Add cineFunction() --- engines/hdb/ai-cinematic.cpp | 11 +++++++++++ engines/hdb/ai.h | 1 + engines/hdb/lua-script.cpp | 9 ++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) (limited to 'engines/hdb') diff --git a/engines/hdb/ai-cinematic.cpp b/engines/hdb/ai-cinematic.cpp index e2ed00bfb1..f0ff15adf8 100644 --- a/engines/hdb/ai-cinematic.cpp +++ b/engines/hdb/ai-cinematic.cpp @@ -449,6 +449,10 @@ void AI::processCines() { g_hdb->_map->addFGTileAnimation((int)_cine[i]->x, (int)_cine[i]->y); complete = true; break; + case C_FUNCTION: + g_hdb->_lua->callFunction(_cine[i]->title, 0); + complete = true; + break; default: warning("STUB: AI::PROCESSCINES incomplete for %d", _cine[i]->cmdType); break; @@ -872,4 +876,11 @@ void AI::cineSetForeground(int x, int y, int index) { _cine.push_back(cmd); } +void AI::cineFunction(const char *func) { + CineCommand *cmd = new CineCommand; + cmd->title = func; + cmd->cmdType = C_FUNCTION; + _cine.push_back(cmd); +} + } // End of Namespace diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index c63dfdded1..3d20a1ed74 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -1005,6 +1005,7 @@ public: void cineClearForeground(int x, int y); void cineSetBackground(int x, int y, int index); void cineSetForeground(int x, int y, int index); + void cineFunction(const char *func); // Waypoint & Movement Functions void lookAtXY(int x, int y); diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index 01a3c7feb1..06eb67b2e4 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -602,7 +602,14 @@ static int cineSetBackground(lua_State *L) { } static int cineFunction(lua_State *L) { - warning("STUB: CINE FUNCTION"); + const char *func = lua_tostring(L, 1); + + g_hdb->_lua->checkParameters("cineFunction", 1); + + lua_pop(L, 1); + + g_hdb->_ai->cineFunction(func); + return 0; } -- cgit v1.2.3