aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-09-28 15:59:46 +0300
committerEugene Sandulenko2013-09-28 15:59:46 +0300
commitac1be668d93a2cd83d8f20ff3fb7f8541ec878d7 (patch)
tree191e4b1420936eaadb2e70bd889f43b8abf36ce3 /engines
parentdd7995958dd5d1efd59f86c27384fd1b58dfa098 (diff)
downloadscummvm-rg350-ac1be668d93a2cd83d8f20ff3fb7f8541ec878d7.tar.gz
scummvm-rg350-ac1be668d93a2cd83d8f20ff3fb7f8541ec878d7.tar.bz2
scummvm-rg350-ac1be668d93a2cd83d8f20ff3fb7f8541ec878d7.zip
FULLPIPE: Implement MovGraph2::initDirections()
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/motion.cpp128
-rw-r--r--engines/fullpipe/motion.h8
-rw-r--r--engines/fullpipe/statics.cpp6
-rw-r--r--engines/fullpipe/statics.h2
4 files changed, 137 insertions, 7 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)) {
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 7cc20e392c..99d8d3eb79 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -204,7 +204,7 @@ class Movement;
struct MG2I {
int _movementId;
- Movement *_movement;
+ Movement *_mov;
int _mx;
int _my;
};
@@ -212,9 +212,9 @@ struct MG2I {
struct MovGraph2ItemSub {
int _staticsId2;
int _staticsId1;
- MG2I _field_8[3];
- MG2I _field_38[4];
- MG2I _field_78[4];
+ MG2I _walk[3];
+ MG2I _turn[4];
+ MG2I _turnS[4];
};
struct MovGraph2Item {
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index e33eb1139e..a7805395ad 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -1245,6 +1245,12 @@ Common::Point *Movement::getCurrDynamicPhaseXY(Common::Point &p) {
return &p;
}
+Common::Point *Movement::calcSomeXY(Common::Point &p, int idx) {
+ warning("STUB: Movement::calcSomeXY()");
+
+ return &p;
+}
+
void Movement::setAlpha(int alpha) {
if (_currMovement)
for (uint i = 0; i < _currMovement->_dynamicPhases.size(); i++) {
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index 1767a5720e..2879edd8e1 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -140,6 +140,8 @@ class Movement : public GameObject {
Common::Point *getCenter(Common::Point *p);
Common::Point *getDimensionsOfPhase(Common::Point *p, int phaseIndex);
+ Common::Point *calcSomeXY(Common::Point &p, int idx);
+
void initStatics(StaticANIObject *ani);
void updateCurrDynamicPhase();