aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb
diff options
context:
space:
mode:
authorNipun Garg2019-06-20 02:29:49 +0530
committerEugene Sandulenko2019-09-03 17:16:51 +0200
commit16740814d0c73bf8452c266526c67e01ab15dda6 (patch)
treede03a715461d2cd6a81c5d87bcb51bc547074f6e /engines/hdb
parent71e735e101d0559dfb4caa0cd1dd7b3c3b3e95c5 (diff)
downloadscummvm-rg350-16740814d0c73bf8452c266526c67e01ab15dda6.tar.gz
scummvm-rg350-16740814d0c73bf8452c266526c67e01ab15dda6.tar.bz2
scummvm-rg350-16740814d0c73bf8452c266526c67e01ab15dda6.zip
HDB: Add spawn()
The usage of cacheEntGfx is currently stubbed
Diffstat (limited to 'engines/hdb')
-rw-r--r--engines/hdb/ai-funcs.cpp51
-rw-r--r--engines/hdb/ai.h1
2 files changed, 52 insertions, 0 deletions
diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp
index acaae9eef3..f10638adb3 100644
--- a/engines/hdb/ai-funcs.cpp
+++ b/engines/hdb/ai-funcs.cpp
@@ -24,6 +24,57 @@
namespace HDB {
+AIEntity *AI::spawn(AIType type, AIDir dir, int x, int y, char *funcInit, char *funcAction, char *funcUse, AIDir dir2, int level, int value1, int value2, int callInit) {
+ AIEntity *e = new AIEntity;
+
+ e->type = type;
+ e->dir = dir;
+
+ // Set Co-ordinates & Speed
+ e->x = x * kTileWidth;
+ e->tileX = x;
+ e->y = y * kTileHeight;
+ e->tileY = y;
+ e->moveSpeed = kPlayerMoveSpeed; // Default Speed
+ if (!g_hdb->getActionMode()) {
+ e->moveSpeed /= 2;
+ }
+
+ // Other variables
+ e->dir2 = dir2;
+ if (!level)
+ level = 1;
+ e->level = level;
+ e->value1 = value1;
+ e->value2 = value2;
+ e->animCycle = 2; // Game frames to wait before animating graphic frames
+ e->animDelay = e->animCycle;
+ e->animFrame = 0;
+
+ if (funcInit) {
+ strcpy(e->luaFuncInit, funcInit);
+ }
+ if (funcAction) {
+ strcpy(e->luaFuncAction, funcAction);
+ }
+ if (funcUse) {
+ strcpy(e->luaFuncUse, funcUse);
+ }
+
+ if (e->luaFuncInit[0] == '*')
+ e->luaFuncInit[0] = 0;
+ if (e->luaFuncAction[0] == '*')
+ e->luaFuncAction[0] = 0;
+ if (e->luaFuncUse[0] == '*')
+ e->luaFuncUse[0] = 0;
+
+ _ents->push_back(e);
+
+ warning("STUB: AI::spawn: CacheEntGfx required");
+
+ return e;
+}
+
AIEntity *AI::locateEntity(const char *luaName) {
for (Common::Array<AIEntity *>::iterator it = _ents->begin(); it != _ents->end(); it++) {
if (Common::matchString((*it)->entityName, luaName)) {
diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h
index 5d157c2e6a..cf21f651eb 100644
--- a/engines/hdb/ai.h
+++ b/engines/hdb/ai.h
@@ -414,6 +414,7 @@ public:
void restartSystem();
// Entity Functions
+ AIEntity *spawn(AIType type, AIDir dir, int x, int y, char *funcInit, char *funcAction, char *funcUse, AIDir dir2, int level, int value1, int value2, int callInit);
AIEntity *locateEntity(const char *luaName);
void removeEntity(AIEntity *e);
void initAllEnts();