diff options
author | Eugene Sandulenko | 2013-08-14 09:30:30 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:14 +0300 |
commit | 682eb87af6788cf576691ecc938da9dbc48802cf (patch) | |
tree | 0912d64e521b4dd04e79a8efd5a45cc4db09649e /engines/fullpipe | |
parent | db290e9b0ce3c0a76d42365cd9ca494605f3bf05 (diff) | |
download | scummvm-rg350-682eb87af6788cf576691ecc938da9dbc48802cf.tar.gz scummvm-rg350-682eb87af6788cf576691ecc938da9dbc48802cf.tar.bz2 scummvm-rg350-682eb87af6788cf576691ecc938da9dbc48802cf.zip |
FULLPIPE: Implement BehaviorInfo::initObjectBehavior()
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/behavior.cpp | 49 | ||||
-rw-r--r-- | engines/fullpipe/behavior.h | 7 | ||||
-rw-r--r-- | engines/fullpipe/objects.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 13 |
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; |