aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hdb/ai-cinematic.cpp30
-rw-r--r--engines/hdb/ai.h2
-rw-r--r--engines/hdb/lua-script.cpp22
3 files changed, 53 insertions, 1 deletions
diff --git a/engines/hdb/ai-cinematic.cpp b/engines/hdb/ai-cinematic.cpp
index 58287a8153..d230ab3015 100644
--- a/engines/hdb/ai-cinematic.cpp
+++ b/engines/hdb/ai-cinematic.cpp
@@ -348,6 +348,17 @@ void AI::processCines() {
complete = true;
}
break;
+ case C_SPAWNENTITY:
+ {
+ int x2, y2;
+ x2 = (int)_cine[i]->x2;
+ y2 = (int)_cine[i]->y2;
+ spawn((AIType)x2, (AIDir)y2, (int)_cine[i]->x, (int)_cine[i]->y, _cine[i]->title, _cine[i]->string,
+ _cine[i]->id, (AIDir)_cine[i]->start, (int)_cine[i]->end, (int)_cine[i]->delay, (int)_cine[i]->speed, 1);
+ complete = true;
+ break;
+ }
+ break;
case C_CLEAR_FG:
g_hdb->_map->setMapFGTileIndex((int)_cine[i]->x, (int)_cine[i]->y, -1);
g_hdb->_map->removeFGTileAnimation((int)_cine[i]->x, (int)_cine[i]->y);
@@ -576,6 +587,25 @@ void AI::cineEntityFace(const char *luaName, double dir) {
_cine.push_back(cmd);
}
+void AI::cineSpawnEntity(AIType t, AIDir d, int x, int y, const char *func_init, const char *func_action,
+ const char *func_use, AIDir d2, int level, int value1, int value2) {
+ CineCommand *cmd = new CineCommand;
+ cmd->cmdType = C_SPAWNENTITY;
+ cmd->x2 = (double)t;
+ cmd->y2 = (double)d;
+ cmd->x = (double)x;
+ cmd->y = (double)y;
+ cmd->title = func_init;
+ cmd->string = func_action;
+ cmd->id = func_use;
+ cmd->start = (int)d2;
+ cmd->end = level;
+ cmd->delay = value1;
+ cmd->speed = value2;
+
+ _cine.push_back(cmd);
+}
+
void AI::cineDialog(const char *title, const char *string, int seconds) {
CineCommand *cmd = new CineCommand;
cmd->title = title;
diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h
index adb6ee89b9..78de3d48d5 100644
--- a/engines/hdb/ai.h
+++ b/engines/hdb/ai.h
@@ -942,6 +942,8 @@ public:
void cineWaitUntilDone();
void cineSetEntity(const char *entName, int x, int y, int level);
void cineMoveEntity(const char *entName, int x, int y, int level, int speed);
+ void cineSpawnEntity(AIType t, AIDir d, int x, int y, const char *func_init, const char *func_action,
+ const char *func_use, AIDir d2, int level, int value1, int value2);
void cineAnimEntity(const char *entName, AIState state, int loop);
void cineSetAnimFrame(const char *entName, AIState state, int frame);
void cineEntityFace(const char *luaName, double dir);
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index bffb7856d2..e4d5f0efe7 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -362,7 +362,27 @@ static int cineMoveMaskedPic(lua_State *L) {
}
static int cineSpawnEntity(lua_State *L) {
- warning("STUB: CINE 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 );
+ const char *func_init = lua_tostring( L, 5 );
+ const char *func_action = lua_tostring( L, 6 );
+ const char *func_use = 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("Cine_SpawnEntity", 11);
+
+ lua_pop(L, 11);
+ g_hdb->_ai->cineSpawnEntity((AIType)t, (AIDir)d, (int)x, (int)y, func_init, func_action, func_use,
+ (AIDir)d2, (int)level, (int)value1, (int)value2);
return 0;
}