diff options
| author | Eugene Sandulenko | 2013-09-28 15:59:46 +0300 |
|---|---|---|
| committer | Eugene Sandulenko | 2013-09-28 15:59:46 +0300 |
| commit | ac1be668d93a2cd83d8f20ff3fb7f8541ec878d7 (patch) | |
| tree | 191e4b1420936eaadb2e70bd889f43b8abf36ce3 /engines/fullpipe/motion.cpp | |
| parent | dd7995958dd5d1efd59f86c27384fd1b58dfa098 (diff) | |
| download | scummvm-rg350-ac1be668d93a2cd83d8f20ff3fb7f8541ec878d7.tar.gz scummvm-rg350-ac1be668d93a2cd83d8f20ff3fb7f8541ec878d7.tar.bz2 scummvm-rg350-ac1be668d93a2cd83d8f20ff3fb7f8541ec878d7.zip | |
FULLPIPE: Implement MovGraph2::initDirections()
Diffstat (limited to 'engines/fullpipe/motion.cpp')
| -rw-r--r-- | engines/fullpipe/motion.cpp | 128 |
1 files changed, 125 insertions, 3 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index d2ece50aa2..a7726f3725 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -244,9 +244,132 @@ int MovGraph2::getItemIndexByGameObjectId(int objectId) { } bool MovGraph2::initDirections(StaticANIObject *obj, MovGraph2Item *item) { - warning("STUB: MovGraph2::initDirections()"); + item->_obj = obj; + item->_objectId = obj->_id; + + GameVar *var = g_fullpipe->getGameLoaderGameVar()->getSubVarByName(obj->_objectName); + if (!var) + return false; + + var = var->getSubVarByName("Test_walk"); + + if (!var) + return false; + + GameVar *varD = 0; + Common::Point point; + + for (int dir = 0; dir < 4; dir++) { + switch (dir) { + case 0: + varD = var->getSubVarByName("Right"); + break; + case 1: + varD = var->getSubVarByName("Left"); + break; + case 2: + varD = var->getSubVarByName("Up"); + break; + case 3: + varD = var->getSubVarByName("Down"); + break; + } + + if (!varD) + return false; + + for (int act = 0; act < 3; act++) { + int idx; + + switch(act) { + case 0: + idx = varD->getSubVarAsInt("Start"); + break; + case 1: + idx = varD->getSubVarAsInt("Go"); + break; + case 2: + idx = varD->getSubVarAsInt("Stop"); + break; + } + + item->_subItems[dir]._walk[act]._movementId = idx; + + Movement *mov = obj->getMovementById(idx); + + item->_subItems[dir]._walk[act]._mov = mov; + if (mov) { + mov->calcSomeXY(point, 0); + item->_subItems[dir]._walk[act]._mx = point.x; + item->_subItems[dir]._walk[act]._my = point.y; + } + } - return false; + for (int act = 0; act < 4; act++) { + int idx; + + switch(act) { + case 0: + idx = varD->getSubVarAsInt("TurnR"); + break; + case 1: + idx = varD->getSubVarAsInt("TurnL"); + break; + case 2: + idx = varD->getSubVarAsInt("TurnU"); + break; + case 3: + idx = varD->getSubVarAsInt("TurnD"); + break; + } + + item->_subItems[dir]._turn[act]._movementId = idx; + + Movement *mov = obj->getMovementById(idx); + + item->_subItems[dir]._turn[act]._mov = mov; + if (mov) { + mov->calcSomeXY(point, 0); + item->_subItems[dir]._turn[act]._mx = point.x; + item->_subItems[dir]._turn[act]._my = point.y; + } + } + + for (int act = 0; act < 4; act++) { + int idx; + + switch(act) { + case 0: + idx = varD->getSubVarAsInt("TurnSR"); + break; + case 1: + idx = varD->getSubVarAsInt("TurnSL"); + break; + case 2: + idx = varD->getSubVarAsInt("TurnSU"); + break; + case 3: + idx = varD->getSubVarAsInt("TurnSD"); + break; + } + + item->_subItems[dir]._turnS[act]._movementId = idx; + + Movement *mov = obj->getMovementById(idx); + + item->_subItems[dir]._turnS[act]._mov = mov; + if (mov) { + mov->calcSomeXY(point, 0); + item->_subItems[dir]._turnS[act]._mx = point.x; + item->_subItems[dir]._turnS[act]._my = point.y; + } + } + + item->_subItems[dir]._staticsId1 = item->_subItems[dir]._walk[0]._mov->_staticsObj1->_staticsId; + item->_subItems[dir]._staticsId2 = item->_subItems[dir]._walk[0]._mov->_staticsObj2->_staticsId; + + } + return true; } void MovGraph2::addObject(StaticANIObject *obj) { @@ -257,7 +380,6 @@ void MovGraph2::addObject(StaticANIObject *obj) { if (id >= 0) { _items[id]->_obj = obj; } else { - MovGraph2Item *item = new MovGraph2Item; if (initDirections(obj, item)) { |
