aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/fullpipe/behavior.cpp53
-rw-r--r--engines/fullpipe/behavior.h7
-rw-r--r--engines/fullpipe/scene.h5
3 files changed, 59 insertions, 6 deletions
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp
index cf1a436c6a..d1048948ac 100644
--- a/engines/fullpipe/behavior.cpp
+++ b/engines/fullpipe/behavior.cpp
@@ -34,8 +34,49 @@ BehaviorManager::BehaviorManager() {
_isActive = 1;
}
-void BehaviorManager::initBehavior(Scene *scene, CGameVar *var) {
- warning("STUB: BehaviorManager::initBehavior()");
+BehaviorManager::~BehaviorManager() {
+ clear();
+}
+
+void BehaviorManager::clear() {
+ for (uint i = 0; i < _behaviors.size(); i++) {
+ for (int j = 0; j < _behaviors[i]->_itemsCount; j++)
+ delete _behaviors[i]->_bheItems[j];
+
+ delete _behaviors[i];
+ }
+ _behaviors.clear();
+}
+
+void BehaviorManager::initBehavior(Scene *sc, CGameVar *var) {
+ clear();
+ _scene = sc;
+
+ BehaviorInfo *behinfo;
+
+ CGameVar *behvar = var->getSubVarByName("BEHAVIOR");
+ if (!behvar)
+ return;
+
+ for (CGameVar *subvar = behvar->_subVars; subvar; subvar = subvar->_nextVarObj) {
+ if (!strcmp(subvar->_varName, "AMBIENT")) {
+ behinfo = new BehaviorInfo;
+ behinfo->initAmbientBehavior(subvar);
+
+ _behaviors.push_back(behinfo);
+ } else {
+ StaticANIObject *ani = sc->getStaticANIObject1ByName(subvar->_varName, -1);
+ if (ani)
+ for (uint i = 0; i < sc->_staticANIObjectList1.size(); i++)
+ if (((StaticANIObject *)sc->_staticANIObjectList1[i])->_id == ani->_id) {
+ behinfo = new BehaviorInfo;
+ behinfo->initObjectBehavior(subvar, sc, ani);
+ behinfo->_ani = (StaticANIObject *)sc->_staticANIObjectList1[i];
+
+ _behaviors.push_back(behinfo);
+ }
+ }
+ }
}
void BehaviorManager::updateBehaviors() {
@@ -104,4 +145,12 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, unsigned int
warning("STUB: BehaviorManager::updateStaticAniBehavior()");
}
+void BehaviorInfo::initAmbientBehavior(CGameVar *var) {
+ warning("STUB: BehaviorInfo::initAmbientBehavior(%s)", transCyrillic((byte *)var->_varName));
+}
+
+void BehaviorInfo::initObjectBehavior(CGameVar *var, Scene *sceneObj, StaticANIObject *ani) {
+ warning("STUB: BehaviorInfo::initObjectBehavior(%s)", transCyrillic((byte *)var->_varName));
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/behavior.h b/engines/fullpipe/behavior.h
index 5029b3ee17..7cddabc0af 100644
--- a/engines/fullpipe/behavior.h
+++ b/engines/fullpipe/behavior.h
@@ -48,6 +48,9 @@ struct BehaviorInfo {
int _subIndex;
int _itemsCount;
Common::Array<BehaviorEntry *> _bheItems;
+
+ void initAmbientBehavior(CGameVar *var);
+ void initObjectBehavior(CGameVar *var, Scene *sceneObj, StaticANIObject *ani);
};
class BehaviorManager : public CObject {
@@ -57,8 +60,12 @@ class BehaviorManager : public CObject {
public:
BehaviorManager();
+ ~BehaviorManager();
+
+ void clear();
void initBehavior(Scene *scene, CGameVar *var);
+
void updateBehaviors();
void updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *entry);
void updateStaticAniBehavior(StaticANIObject *ani, unsigned int delay, BehaviorEntry *behaviorEntry);
diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h
index d8d436208b..1b05234853 100644
--- a/engines/fullpipe/scene.h
+++ b/engines/fullpipe/scene.h
@@ -30,10 +30,7 @@ namespace Fullpipe {
class MessageQueue;
class Scene : public Background {
- friend class FullpipeEngine;
- friend class SceneTag;
- friend class StaticANIObject;
-
+ public:
CPtrList _staticANIObjectList1;
CPtrList _staticANIObjectList2;
CPtrList _messageQueueList;