aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/fullpipe/gameloader.cpp47
-rw-r--r--engines/fullpipe/gfx.cpp42
-rw-r--r--engines/fullpipe/gfx.h7
-rw-r--r--engines/fullpipe/objects.h2
-rw-r--r--engines/fullpipe/stateloader.cpp2
-rw-r--r--engines/fullpipe/statics.cpp43
-rw-r--r--engines/fullpipe/statics.h6
7 files changed, 145 insertions, 4 deletions
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index 7ae591911b..46cd557396 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -251,7 +251,52 @@ int CGameLoader::getSceneTagBySceneId(int sceneId, SceneTag **st) {
}
void CGameLoader::applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAniInfoCount) {
- warning("STUB: CGameLoader::applyPicAniInfo()");
+ if (picAniInfoCount <= 0)
+ return;
+
+ PictureObject *pict;
+ StaticANIObject *ani;
+
+ for (int i = 0; i < picAniInfoCount; i++) {
+ if (picAniInfo[i]->type & 2) {
+ pict = sc->getPictureObjectById(picAniInfo[i]->objectId, picAniInfo[i]->field_8);
+ if (pict) {
+ pict->setPicAniInfo(picAniInfo[i]);
+ continue;
+ }
+ pict = sc->getPictureObjectById(picAniInfo[i]->objectId, 0);
+ if (pict) {
+ PictureObject *pictNew = new PictureObject(pict);
+
+ sc->_picObjList.push_back(pictNew);
+ pictNew->setPicAniInfo(picAniInfo[i]);
+ continue;
+ }
+ } else {
+ if (!(picAniInfo[i]->type & 1))
+ continue;
+
+ Scene *scNew = g_fullpipe->accessScene(picAniInfo[i]->sceneId);
+ if (!scNew)
+ continue;
+
+ ani = sc->getStaticANIObject1ById(picAniInfo[i]->objectId, picAniInfo[i]->field_8);
+ if (ani) {
+ ani->setPicAniInfo(picAniInfo[i]);
+ continue;
+ }
+
+ ani = scNew->getStaticANIObject1ById(picAniInfo[i]->objectId, 0);
+ if (ani) {
+ StaticANIObject *aniNew = new StaticANIObject(ani);
+
+ sc->addStaticANIObject(aniNew, 1);
+
+ aniNew->setPicAniInfo(picAniInfo[i]);
+ continue;
+ }
+ }
+ }
}
void CGameLoader::updateSystems(int counterdiff) {
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 997c0b620b..c677d0e378 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -119,6 +119,13 @@ PictureObject::PictureObject() {
_picture = 0;
}
+PictureObject::PictureObject(PictureObject *src) : GameObject(src) {
+ _picture = src->_picture;
+ _ox2 = _ox;
+ _oy2 = _oy;
+ _pictureObject2List = src->_pictureObject2List;
+}
+
bool PictureObject::load(MfcArchive &file, bool bigPicture) {
debug(5, "PictureObject::load()");
GameObject::load(file);
@@ -164,6 +171,26 @@ void PictureObject::draw() {
_picture->draw(_ox, _oy, 0, 0);
}
+bool PictureObject::setPicAniInfo(PicAniInfo *picAniInfo) {
+ if (!(picAniInfo->type & 2) || (picAniInfo->type & 1)) {
+ error("Picture::setPicAniInfo(): Wrong type: %d", picAniInfo->type);
+
+ return false;
+ }
+
+ if (picAniInfo->type & 2) {
+ setOXY(picAniInfo->ox, picAniInfo->oy);
+ _priority = picAniInfo->priority;
+ _field_4 = picAniInfo->field_8;
+ setFlags(picAniInfo->flags);
+ _field_8 = picAniInfo->field_24;
+
+ return true;
+ }
+
+ return false;
+}
+
GameObject::GameObject() {
_field_4 = 0;
_flags = 0;
@@ -175,6 +202,21 @@ GameObject::GameObject() {
_field_8 = 0;
}
+GameObject::GameObject(GameObject *src) {
+ _field_4 = 1;
+ _flags = 0;
+ _id = src->_id;
+
+ _objectName = (char *)calloc(strlen(src->_objectName) + 1, 1);
+ strncpy(_objectName, src->_objectName, strlen(src->_objectName));
+
+ _ox = src->_ox;
+ _oy = src->_oy;
+ _priority = src->_priority;
+ _field_20 = 1;
+ _field_8 = src->_field_8;
+}
+
bool GameObject::load(MfcArchive &file) {
debug(5, "GameObject::load()");
_field_4 = 0;
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 1dbdd28b44..2ee34e1a1a 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -29,6 +29,7 @@ namespace Fullpipe {
class DynamicPhase;
class Movement;
+struct PicAniInfo;
struct Bitmap {
int _x;
@@ -121,6 +122,8 @@ class GameObject : public CObject {
public:
GameObject();
+ GameObject(GameObject *src);
+
virtual bool load(MfcArchive &file);
void setOXY(int x, int y);
void renumPictures(CPtrList *lst);
@@ -138,9 +141,13 @@ class PictureObject : public GameObject {
public:
PictureObject();
+ PictureObject(PictureObject *src);
+
bool load(MfcArchive &file, bool bigPicture);
Common::Point *getDimensions(Common::Point *p);
void draw();
+
+ bool setPicAniInfo(PicAniInfo *picAniInfo);
};
class Background : public CObject {
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index ba65181cf8..133320f326 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -86,7 +86,7 @@ struct PicAniInfo {
int16 objectId;
int16 field_6;
int32 field_8;
- int16 field_C;
+ int16 sceneId;
int16 field_E;
int32 ox;
int32 oy;
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index c49dafc947..cd931b136c 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -420,7 +420,7 @@ bool PicAniInfo::load(MfcArchive &file) {
objectId = file.readUint16LE();
field_6 = file.readUint16LE();
field_8 = file.readUint32LE();
- field_C = file.readUint16LE();
+ sceneId = file.readUint16LE();
field_E = file.readUint16LE();
ox = file.readUint32LE();
oy = file.readUint32LE();
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index d54b1d1c89..72a10807f5 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -79,6 +79,10 @@ StaticANIObject::StaticANIObject() {
_someDynamicPhaseIndex = -1;
}
+StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) {
+ warning("STUB: StaticANIObject(src)");
+}
+
bool StaticANIObject::load(MfcArchive &file) {
debug(5, "StaticANIObject::load()");
@@ -269,7 +273,7 @@ void StaticANIObject::draw() {
angle = _field_30 ^ 0x4000;
}
- if (!_movement || _flags & 0x20) {
+ if (!_movement || (_flags & 0x20)) {
_statics->getSomeXY(point);
_statics->_x = _ox - point.x;
_statics->_y = _oy - point.y;
@@ -356,6 +360,43 @@ void StaticANIObject::update(int counterdiff) {
warning("STUB: StaticANIObject::update(%d)", counterdiff);
}
+bool StaticANIObject::setPicAniInfo(PicAniInfo *picAniInfo) {
+ if (!(picAniInfo->type & 3)) {
+ warning("StaticANIObject::setPicAniInfo(): Wrong type: %d", picAniInfo->type);
+
+ return false;
+ }
+
+ if (picAniInfo->type & 3) {
+ setOXY(picAniInfo->ox, picAniInfo->oy);
+ _priority = picAniInfo->priority;
+ _field_4 = picAniInfo->field_8;
+ setFlags(picAniInfo->flags);
+ _field_8 = picAniInfo->field_24;
+ }
+
+ if (picAniInfo->type & 1) {
+ _messageQueueId = picAniInfo->type >> 16;
+
+ if (picAniInfo->staticsId)
+ _statics = getStaticsById(picAniInfo->staticsId);
+ else
+ _statics = 0;
+
+ if (picAniInfo->movementId) {
+ _movement = getMovementById(picAniInfo->movementId);
+ if (_movement)
+ _movement->setDynamicPhaseIndex(picAniInfo->dynamicPhaseIndex);
+ } else {
+ _movement = 0;
+ }
+
+ setSomeDynamicPhaseIndex(picAniInfo->someDynamicPhaseIndex);
+ }
+
+ return true;
+}
+
Statics::Statics() {
_staticsId = 0;
_picture = 0;
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index c80956cf74..e21f06666d 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -184,6 +184,8 @@ class StaticANIObject : public GameObject {
public:
StaticANIObject();
+ StaticANIObject(StaticANIObject *src);
+
virtual bool load(MfcArchive &file);
void setOXY(int x, int y);
@@ -200,6 +202,10 @@ class StaticANIObject : public GameObject {
void initMovements();
void loadMovementsPixelData();
+ bool setPicAniInfo(PicAniInfo *picAniInfo);
+
+ void setSomeDynamicPhaseIndex(int val) { _someDynamicPhaseIndex = val; }
+
void update(int counterdiff);
Statics *addReverseStatics(Statics *ani);