aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/fullpipe/behavior.cpp49
-rw-r--r--engines/fullpipe/behavior.h7
-rw-r--r--engines/fullpipe/objects.h1
-rw-r--r--engines/fullpipe/stateloader.cpp13
4 files changed, 67 insertions, 3 deletions
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp
index d1048948ac..f2d0d5594d 100644
--- a/engines/fullpipe/behavior.cpp
+++ b/engines/fullpipe/behavior.cpp
@@ -145,12 +145,57 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, unsigned int
warning("STUB: BehaviorManager::updateStaticAniBehavior()");
}
+void BehaviorInfo::clear() {
+ _ani = 0;
+ _staticsId = 0;
+ _counter = 0;
+ _counterMax = 0;
+ _flags = 0;
+ _subIndex = 0;
+ _itemsCount = 0;
+
+ _bheItems.clear();
+}
+
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));
+void BehaviorInfo::initObjectBehavior(CGameVar *var, Scene *sc, StaticANIObject *ani) {
+ debug(0, "BehaviorInfo::initObjectBehavior(%s)", transCyrillic((byte *)var->_varName));
+
+ clear();
+
+ _itemsCount = var->getSubVarsCount();
+ _counterMax = -1;
+
+ while (var->_varType == 2) {
+ if (strcmp(var->_value.stringValue, "ROOT"))
+ break;
+
+ CGameVar *v1 = g_fullpipe->getGameLoaderGameVar()->getSubVarByName("BEHAVIOR")->getSubVarByName(ani->getName());
+ if (v1 == var)
+ return;
+
+ sc = g_fullpipe->accessScene(ani->_sceneId);
+ clear();
+ var = v1;
+ _itemsCount = var->getSubVarsCount();
+ _counterMax = -1;
+ }
+
+ for (int i = 0; i < _itemsCount; i++) {
+ int maxDelay;
+
+ _bheItems.push_back(new BehaviorEntry(var->getSubVarByIndex(i), sc, ani, &maxDelay));
+
+ if (maxDelay < _counterMax )
+ _counterMax = maxDelay;
+ }
+}
+
+BehaviorEntry::BehaviorEntry(CGameVar *var, Scene *sc, StaticANIObject *ani, int *maxDelay) {
+ warning("STUB: BehaviorEntry::BehaviorEntry()");
}
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/behavior.h b/engines/fullpipe/behavior.h
index 7cddabc0af..ecb7d3a428 100644
--- a/engines/fullpipe/behavior.h
+++ b/engines/fullpipe/behavior.h
@@ -37,6 +37,8 @@ struct BehaviorEntry {
int _itemsCount;
int _flags;
BehaviorEntryInfo **_items;
+
+ BehaviorEntry(CGameVar *var, Scene *sc, StaticANIObject *ani, int *maxDelay);
};
struct BehaviorInfo {
@@ -49,8 +51,11 @@ struct BehaviorInfo {
int _itemsCount;
Common::Array<BehaviorEntry *> _bheItems;
+ BehaviorInfo() { clear(); }
+
+ void clear();
void initAmbientBehavior(CGameVar *var);
- void initObjectBehavior(CGameVar *var, Scene *sceneObj, StaticANIObject *ani);
+ void initObjectBehavior(CGameVar *var, Scene *sc, StaticANIObject *ani);
};
class BehaviorManager : public CObject {
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 33406bb217..590e8ebcbc 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -115,6 +115,7 @@ class CGameVar : public CObject {
CGameVar *addSubVarAsInt(const char *name, int value);
bool addSubVar(CGameVar *subvar);
int getSubVarsCount();
+ CGameVar *getSubVarByIndex(int idx);
};
struct PreloadItem {
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 3cc4d0046f..6d6185e58c 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -300,6 +300,19 @@ int CGameVar::getSubVarsCount() {
return res;
}
+CGameVar *CGameVar::getSubVarByIndex(int idx) {
+ CGameVar *sub = _subVars;
+
+ while (idx--) {
+ sub = sub->_nextVarObj;
+
+ if (!sub)
+ return 0;
+ }
+
+ return sub;
+}
+
Sc2::Sc2() {
_sceneId = 0;
_field_2 = 0;