aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-07-13 11:51:22 +0300
committerEugene Sandulenko2013-09-06 14:48:15 +0300
commit1c1d8db613fccbab568efd1e57a86a419dc813c9 (patch)
tree35f452e538864deae2ad8f575cdacedb5af3fd21 /engines
parent0b6591e4912117e730f4227975e83285583933e0 (diff)
downloadscummvm-rg350-1c1d8db613fccbab568efd1e57a86a419dc813c9.tar.gz
scummvm-rg350-1c1d8db613fccbab568efd1e57a86a419dc813c9.tar.bz2
scummvm-rg350-1c1d8db613fccbab568efd1e57a86a419dc813c9.zip
FULLPIPE: Now StaticANIObject is loaded fully
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/gfx.cpp7
-rw-r--r--engines/fullpipe/gfx.h5
-rw-r--r--engines/fullpipe/statics.cpp214
-rw-r--r--engines/fullpipe/statics.h38
-rw-r--r--engines/fullpipe/utils.cpp2
5 files changed, 257 insertions, 9 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 26f7f3e3a9..8b801a7031 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -57,7 +57,7 @@ bool Background::load(MfcArchive &file) {
_bigPictureArray = (BigPicture ***)calloc(_bigPictureArray1Count, sizeof(BigPicture **));
- debug(0, "bigPictureArray[%d][%d]", _bigPictureArray1Count, _bigPictureArray2Count);
+ debug(6, "bigPictureArray[%d][%d]", _bigPictureArray1Count, _bigPictureArray2Count);
for (int i = 0; i < _bigPictureArray1Count; i++) {
_bigPictureArray[i] = (BigPicture **)calloc(_bigPictureArray2Count, sizeof(BigPicture *));
@@ -138,6 +138,11 @@ bool GameObject::load(MfcArchive &file) {
return true;
}
+void GameObject::setOXY(int x, int y) {
+ _ox = x;
+ _oy = y;
+}
+
Picture::Picture() {
_x = 0;
_y = 0;
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index ae06910abd..7b304eab22 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -31,6 +31,8 @@ class ShadowsItemArray : public Common::Array<CObject>, public CObject {
};
class Picture : public MemoryObject {
+ friend class Movement;
+
Common::Rect _rect;
int _convertedBitmap;
int _x;
@@ -57,7 +59,7 @@ class BigPicture : public Picture {
};
class GameObject : public CObject {
- protected:
+ public:
int16 _field_4;
int16 _field_6;
int _field_8;
@@ -72,6 +74,7 @@ class GameObject : public CObject {
public:
GameObject();
virtual bool load(MfcArchive &file);
+ void setOXY(int x, int y);
};
class PictureObject : public GameObject {
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 5db1154c8b..04aa8cf85c 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -25,6 +25,7 @@
#include "fullpipe/objects.h"
#include "fullpipe/ngiarchive.h"
#include "fullpipe/statics.h"
+#include "fullpipe/gameobj.h"
namespace Fullpipe {
@@ -58,6 +59,7 @@ bool StaticANIObject::load(MfcArchive &file) {
}
count = file.readUint16LE();
+ debug(7, "Movements: %d", count);
for (int i = 0; i < count; i++) {
int movNum = file.readUint16LE();
@@ -91,9 +93,75 @@ bool StaticANIObject::load(MfcArchive &file) {
}
void StaticANIObject::setOXY(int x, int y) {
+ _ox = x;
+ _oy = y;
+
+ if (_movementObj)
+ _movementObj->setOXY(x, y);
+}
+
+Statics *StaticANIObject::getStaticsById(int itemId) {
+ for (uint i = 0; i < _staticsList.size(); i++)
+ if (((Statics *)_staticsList[i])->_staticsId == itemId)
+ return (Statics *)_staticsList[i];
+
+ return 0;
+}
+
+Movement *StaticANIObject::getMovementById(int itemId) {
+ for (uint i = 0; i < _movements.size(); i++)
+ if (((Movement *)_movements[i])->_id == itemId)
+ return (Movement *)_movements[i];
+
+ return 0;
+}
+
+Statics *StaticANIObject::addStatics(Statics *ani) {
+ warning("STUB: StaticANIObject::addStatics");
+
+ return 0;
+}
+
+Statics::Statics() {
+ _staticsId = 0;
+ _picture = 0;
+}
+
+bool Statics::load(MfcArchive &file) {
+ DynamicPhase::load(file);
+
+ _staticsId = file.readUint16LE();
+
+ _stringObj = file.readPascalString();
+ debug(7, "statics: <%s>", _stringObj);
+
+ _picture = new Picture();
+ _picture->load(file);
+
+ return true;
}
Movement::Movement() {
+ _lastFrameSpecialFlag = 0;
+ _flipFlag = 0;
+ _updateFlag1 = 0;
+ _staticsObj1 = 0;
+ _staticsObj2 = 0;
+ _mx = 0;
+ _my = 0;
+ _m2x = 0;
+ _m2y = 0;
+ _field_50 = 1;
+ _field_78 = 0;
+ _framePosOffsets = 0;
+ _field_84 = 0;
+ _currDynamicPhase = 0;
+ _field_8C = 0;
+ _currDynamicPhaseIndex = 0;
+ _field_94 = 0;
+ _currMovementObj = 0;
+ _counter = 0;
+ _counterMax = 83;
}
bool Movement::load(MfcArchive &file) {
@@ -101,6 +169,84 @@ bool Movement::load(MfcArchive &file) {
return true;
}
bool Movement::load(MfcArchive &file, StaticANIObject *ani) {
+ GameObject::load(file);
+
+ int dynCount = file.readUint16LE();
+
+ debug(7, "dynCount: %d _id: %d", dynCount, _id);
+ if (dynCount != 0xffff || _id == MV_MAN_TURN_LU) {
+ _framePosOffsets = (Common::Point **)calloc(dynCount + 2, sizeof(Common::Point *));
+
+ for (int i = 0; i < dynCount + 2; i++)
+ _framePosOffsets[i] = new Common::Point();
+
+ for (int i = 0; i < dynCount; i++) {
+ DynamicPhase *ph = new DynamicPhase();
+ ph->load(file);
+
+ _dynamicPhases.push_back(ph);
+
+ _framePosOffsets[i]->x = ph->_x;
+ _framePosOffsets[i]->y = ph->_y;
+ }
+
+ int staticsid = file.readUint16LE();
+
+ _staticsObj1 = ani->getStaticsById(staticsid);
+
+ if (!_staticsObj1 && (staticsid & 0x4000)) {
+ Statics *s = ani->getStaticsById(staticsid ^ 0x4000);
+ _staticsObj1 = ani->addStatics(s);
+ }
+
+ _mx = file.readUint32LE();
+ _my = file.readUint32LE();
+
+ staticsid = file.readUint16LE();
+
+ _staticsObj2 = ani->getStaticsById(staticsid);
+
+ if (!_staticsObj2 && (staticsid & 0x4000)) {
+ Statics *s = ani->getStaticsById(staticsid ^ 0x4000);
+ _staticsObj2 = ani->addStatics(s);
+ }
+
+ _m2x = file.readUint32LE();
+ _m2y = file.readUint32LE();
+
+ if (_staticsObj2) {
+ _dynamicPhases.push_back(_staticsObj2);
+
+ _framePosOffsets[_dynamicPhases.size() - 1]->x = _m2x;
+ _framePosOffsets[_dynamicPhases.size() - 1]->y = _m2y;
+ }
+
+ } else {
+ int movid = file.readUint16LE();
+
+ _currMovementObj = ani->getMovementById(movid);
+ _staticsObj1 = 0;
+ _staticsObj2 = 0;
+
+ initStatics(ani);
+ }
+
+ if (_staticsObj1 && _staticsObj2) {
+ if ((_staticsObj1->_staticsId ^ _staticsObj2->_staticsId) & 0x4000)
+ _flipFlag = 1;
+ }
+
+ if (g_fullpipe->_gameProjectVersion >= 8)
+ _field_50 = file.readUint32LE();
+
+ if (g_fullpipe->_gameProjectVersion < 12)
+ _counterMax = 83;
+ else
+ _counterMax = file.readUint32LE();
+
+ _counter = 0;
+ updateCurrDynamicPhase();
+
return true;
}
@@ -111,4 +257,72 @@ Common::Point *Movement::getCurrDynamicPhaseXY(Common::Point &p) {
return &p;
}
+void Movement::initStatics(StaticANIObject *ani) {
+ warning("STUB: Movement::initStatics");
+}
+
+void Movement::updateCurrDynamicPhase() {
+ if (_dynamicPhases.size() == 0)
+ return;
+
+ if (_dynamicPhases[_currDynamicPhaseIndex]) {
+ _currDynamicPhase = (DynamicPhase *)_dynamicPhases[_currDynamicPhaseIndex];
+ }
+}
+
+DynamicPhase::DynamicPhase() {
+ _someX = 0;
+ _rect = 0;
+ _field_7C = 0;
+ _flags = 0;
+ _someY = 0;
+}
+
+bool DynamicPhase::load(MfcArchive &file) {
+ StaticPhase::load(file);
+
+ _field_7C = file.readUint16LE();
+ _rect = new Common::Rect();
+ _rect->left = file.readUint32LE();
+ _rect->top = file.readUint32LE();
+ _rect->right = file.readUint32LE();
+ _rect->bottom = file.readUint32LE();
+
+ assert (g_fullpipe->_gameProjectVersion >= 1);
+
+ _someX = file.readUint32LE();
+ _someY = file.readUint32LE();
+
+ assert (g_fullpipe->_gameProjectVersion >= 12);
+
+ _flags = file.readUint32LE();
+
+ return true;
+}
+
+StaticPhase::StaticPhase() {
+ _field_6A = 1;
+ _initialCountdown = 0;
+ _countdown = 0;
+ _field_68 = 0;
+ _exCommand = 0;
+}
+
+bool StaticPhase::load(MfcArchive &file) {
+ Picture::load(file);
+
+ _initialCountdown = file.readUint16LE();
+ _field_6A = file.readUint16LE();
+
+ if (g_fullpipe->_gameProjectVersion >= 12) {
+ _exCommand = (ExCommand *)file.readClass();
+
+ return true;
+ }
+
+ assert (g_fullpipe->_gameProjectVersion >= 12);
+
+ return true;
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index 82c24eb095..7c52e18d33 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -38,25 +38,41 @@ class StaticPhase : public Picture {
int16 _countdown;
int16 _field_68;
int16 _field_6A;
- int _exCommand;
+ ExCommand *_exCommand;
+
+ public:
+ StaticPhase();
+ virtual bool load(MfcArchive &file);
};
class DynamicPhase : public StaticPhase {
friend class Movement;
- int _x;
- int _y;
- Common::Rect *_rectPtr;
+ int _someX;
+ int _someY;
+ Common::Rect *_rect;
int16 _field_7C;
int16 _field_7E;
int _flags;
+
+ public:
+ DynamicPhase();
+ virtual bool load(MfcArchive &file);
};
class Statics : public DynamicPhase {
+ friend class StaticANIObject;
+ friend class Movement;
+
int16 _staticsId;
int16 _field_86;
char *_stringObj;
- int _picture;
+ Picture *_picture;
+
+ public:
+ Statics();
+ virtual bool load(MfcArchive &file);
+ Statics *getStaticsById(int itemId);
};
class StaticANIObject;
@@ -78,8 +94,8 @@ class Movement : public GameObject {
int _counter;
CPtrList _dynamicPhases;
int _field_78;
- Common::Point *_framePosOffsets;
- int _currMovementObj;
+ Common::Point **_framePosOffsets;
+ Movement *_currMovementObj;
int _field_84;
DynamicPhase *_currDynamicPhase;
int _field_8C;
@@ -92,6 +108,9 @@ class Movement : public GameObject {
bool load(MfcArchive &file, StaticANIObject *ani);
Common::Point *getCurrDynamicPhaseXY(Common::Point &p);
+
+ void initStatics(StaticANIObject *ani);
+ void updateCurrDynamicPhase();
};
class StaticANIObject : public GameObject {
@@ -120,7 +139,12 @@ class StaticANIObject : public GameObject {
public:
StaticANIObject();
virtual bool load(MfcArchive &file);
+
void setOXY(int x, int y);
+ Statics *getStaticsById(int id);
+ Movement *getMovementById(int id);
+
+ Statics *addStatics(Statics *ani);
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 0462c4ec3e..5b6c972a0a 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -358,6 +358,8 @@ char *genFileName(int superId, int sceneId, const char *ext) {
snprintf(s, 255, "%04d.%s", sceneId, ext);
}
+ debug(7, "genFileName: %s", s);
+
return s;
}