aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/ai-lists.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-06-27 07:10:57 +0530
committerEugene Sandulenko2019-09-03 17:17:02 +0200
commit0f313f3eda614b828574e62fbca66a1eb3b9fb71 (patch)
tree4c81407e03d3bc2fd2bc48742c8729919248fcce /engines/hdb/ai-lists.cpp
parent368e80c75f157da79747d2166502d97215b7b5bc (diff)
downloadscummvm-rg350-0f313f3eda614b828574e62fbca66a1eb3b9fb71.tar.gz
scummvm-rg350-0f313f3eda614b828574e62fbca66a1eb3b9fb71.tar.bz2
scummvm-rg350-0f313f3eda614b828574e62fbca66a1eb3b9fb71.zip
HDB: Add functions related to _triggerList
Diffstat (limited to 'engines/hdb/ai-lists.cpp')
-rw-r--r--engines/hdb/ai-lists.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/engines/hdb/ai-lists.cpp b/engines/hdb/ai-lists.cpp
index 3d1e235740..207e51f2be 100644
--- a/engines/hdb/ai-lists.cpp
+++ b/engines/hdb/ai-lists.cpp
@@ -623,4 +623,59 @@ ArrowPath *AI::findArrowPath(int x, int y) {
return NULL;
}
+void AI::addToTriggerList(char *luaFuncInit, char *luaFuncUse, int x, int y, int value1, int value2, char *id) {
+ Trigger *t = new Trigger;
+
+ strcpy(t->id, id);
+ t->x = x;
+ t->y = y;
+ t->value1 = value1;
+ t->value2 = value2;
+ if (luaFuncInit[0] != '*')
+ strcpy(t->luaFuncInit, luaFuncInit);
+ if (luaFuncUse[0] != '*')
+ strcpy(t->luaFuncUse, luaFuncUse);
+
+ if (!t->luaFuncUse[0])
+ warning("STUB: addToTriggerList: Open MessageBar");
+
+ if (t->luaFuncInit[0]) {
+ g_hdb->_lua->pushFunction(t->luaFuncInit);
+ g_hdb->_lua->pushInt(x);
+ g_hdb->_lua->pushInt(y);
+ g_hdb->_lua->pushInt(value1);
+ g_hdb->_lua->pushInt(value2);
+ g_hdb->_lua->call(4, 0);
+ }
+}
+
+bool AI::checkTriggerList(char *entName, int x, int y) {
+ Trigger *t;
+
+ for (Common::Array<Trigger *>::iterator it = _triggerList->begin(); it != _triggerList->end(); it++) {
+ if (t->x == x && t->y == y) {
+ if (!t->luaFuncUse[0])
+ return false;
+
+ g_hdb->_lua->pushFunction(t->luaFuncUse);
+ g_hdb->_lua->pushString(entName);
+ g_hdb->_lua->pushInt(t->x);
+ g_hdb->_lua->pushInt(t->y);
+ g_hdb->_lua->pushInt(t->value1);
+ g_hdb->_lua->pushInt(t->value2);
+ g_hdb->_lua->call(5, 0);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void AI::killTrigger(char *id) {
+ for (Common::Array<Trigger *>::iterator it = _triggerList->begin(); it != _triggerList->end(); it++) {
+ if (!scumm_stricmp(id, (*it)->id))
+ _triggerList->erase(it);
+ }
+}
+
} // End of Namespace