From 678de0f73f4f48348895efdaccb656a4ae583a48 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Thu, 27 Jun 2019 22:28:21 +0530 Subject: HDB: Add _callbacks data --- engines/hdb/ai-init.cpp | 3 +++ engines/hdb/ai.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/engines/hdb/ai-init.cpp b/engines/hdb/ai-init.cpp index 989454cffd..5bb8c89c05 100644 --- a/engines/hdb/ai-init.cpp +++ b/engines/hdb/ai-init.cpp @@ -840,6 +840,9 @@ void AI::restartSystem() { // Clear the Auto-Action list memset(_autoActions, 0, sizeof(_autoActions)); + // Clear the Callback List + memset(_callbacks, 0, sizeof(_callbacks)); + // Clear the Entity List _ents->clear(); diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 33e107a9f4..6f5653ad6c 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -39,6 +39,7 @@ enum { kMaxTeleporters = 20, kMaxAutoActions = 30, kMaxLuaEnts = 50, + kMaxCallbacks = 20, kPlayerMoveSpeed = 4, kEnemyMoveSpeed = 2, kPushMoveSpeed = (kPlayerMoveSpeed >> 1), @@ -354,6 +355,15 @@ enum CineType { C_ENDLIST }; +enum CallbackType { + NO_FUNCTION, + AI_BARREL_EXPLOSION_END, + CALLBACK_DOOR_OPEN_CLOSE, + CALLBACK_AUTODOOR_OPEN_CLOSE, + + CALLBACK_END +}; + struct AIStateDef { AIState state; const char name[64]; @@ -640,6 +650,22 @@ struct Trigger { Trigger() : id(""), x(0), y(0), value1(0), value2(0), luaFuncInit(""), luaFuncUse("") {} }; +struct CallbackDef { + CallbackType type; + void(*function)(int x, int y); + + CallbackDef() : type(NO_FUNCTION), function(NULL) {} + CallbackDef(CallbackType type, void(*function)(int, int)) : type(type), function(function) {} +}; + +struct Callback { + CallbackType type; + uint16 x, y; + uint16 delay; + + Callback() : type(NO_FUNCTION), x(0), y(0), delay(0) {} +}; + struct CineCommand { CineType cmdType; double x, y; @@ -1034,6 +1060,8 @@ public: AutoAction _autoActions[kMaxAutoActions]; + Callback _callbacks[kMaxCallbacks]; + Common::Array *_arrowPaths; Common::Array *_hereList; Common::Array *_triggerList; -- cgit v1.2.3