aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe
diff options
context:
space:
mode:
Diffstat (limited to 'engines/fullpipe')
-rw-r--r--engines/fullpipe/fullpipe.cpp14
-rw-r--r--engines/fullpipe/fullpipe.h8
-rw-r--r--engines/fullpipe/gfx.cpp13
-rw-r--r--engines/fullpipe/gfx.h3
-rw-r--r--engines/fullpipe/messagequeue.cpp90
-rw-r--r--engines/fullpipe/messagequeue.h67
-rw-r--r--engines/fullpipe/module.mk1
-rw-r--r--engines/fullpipe/objects.h21
-rw-r--r--engines/fullpipe/scene.cpp38
-rw-r--r--engines/fullpipe/scene.h3
-rw-r--r--engines/fullpipe/scenes.cpp179
-rw-r--r--engines/fullpipe/stateloader.cpp42
-rw-r--r--engines/fullpipe/statics.cpp69
-rw-r--r--engines/fullpipe/statics.h14
-rw-r--r--engines/fullpipe/utils.cpp1
15 files changed, 396 insertions, 167 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 305443249f..fb8a141646 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -30,6 +30,7 @@
#include "fullpipe/fullpipe.h"
#include "fullpipe/objectnames.h"
#include "fullpipe/objects.h"
+#include "fullpipe/messagequeue.h"
namespace Fullpipe {
@@ -58,21 +59,32 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_needQuit = false;
+ _aniMan = 0;
+ _scene2 = 0;
+
+ _globalMessageQueueList = 0;
+
g_fullpipe = this;
}
FullpipeEngine::~FullpipeEngine() {
delete _rnd;
+ delete _globalMessageQueueList;
}
-Common::Error FullpipeEngine::run() {
+void FullpipeEngine::initialize() {
+ _globalMessageQueueList = new GlobalMessageQueueList;
+}
+Common::Error FullpipeEngine::run() {
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
// Initialize backend
initGraphics(800, 600, true, &format);
_backgroundSurface.create(800, 600, format);
+ initialize();
+
_isSaveAllowed = false;
loadGam("fullpipe.gam");
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 26a5a62693..31f44fda76 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -49,6 +49,8 @@ class CGameVar;
class CInventory2;
class Scene;
class NGIArchive;
+class StaticANIObject;
+class GlobalMessageQueueList;
class FullpipeEngine : public ::Engine {
protected:
@@ -59,6 +61,8 @@ public:
FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc);
virtual ~FullpipeEngine();
+ void initialize();
+
// Detection related functions
const ADGameDescription *_gameDescription;
const char *getGameId() const;
@@ -87,6 +91,10 @@ public:
bool _flgSoundList;
Common::Rect _sceneRect;
+ Scene *_scene2;
+ StaticANIObject *_aniMan;
+
+ GlobalMessageQueueList *_globalMessageQueueList;
bool _needQuit;
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 9cef7e1408..241b799168 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -162,6 +162,12 @@ bool PictureObject::load(MfcArchive &file, bool bigPicture) {
return true;
}
+Common::Point *PictureObject::getDimensions(Common::Point *p) {
+ _picture->getDimensions(p);
+
+ return p;
+}
+
GameObject::GameObject() {
_field_4 = 0;
_flags = 0;
@@ -273,6 +279,13 @@ void Picture::init() {
_bitmap->_flags |= 0x1000000;
}
+Common::Point *Picture::getDimensions(Common::Point *p) {
+ p->x = _width;
+ p->y = _height;
+
+ return p;
+}
+
void Picture::getDibInfo() {
int off = _dataSize & ~0xf;
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index a4f9d8fe2c..c420ffe9a2 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -82,6 +82,8 @@ class Picture : public MemoryObject {
byte getAlpha() { return (byte)_alpha; }
void setAlpha(byte alpha) { _alpha = alpha; }
+
+ Common::Point *getDimensions(Common::Point *p);
};
class BigPicture : public Picture {
@@ -118,6 +120,7 @@ class PictureObject : public GameObject {
public:
PictureObject();
bool load(MfcArchive &file, bool bigPicture);
+ Common::Point *getDimensions(Common::Point *p);
};
class Background : public CObject {
diff --git a/engines/fullpipe/messagequeue.cpp b/engines/fullpipe/messagequeue.cpp
new file mode 100644
index 0000000000..3c9e0889fc
--- /dev/null
+++ b/engines/fullpipe/messagequeue.cpp
@@ -0,0 +1,90 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "fullpipe/fullpipe.h"
+
+#include "fullpipe/objects.h"
+#include "fullpipe/messagequeue.h"
+
+namespace Fullpipe {
+
+MessageQueue::MessageQueue() {
+ _field_14 = 0;
+ _parId = 0;
+ _dataId = 0;
+ _id = 0;
+ _isFinished = 0;
+ _flags = 0;
+}
+
+bool MessageQueue::load(MfcArchive &file) {
+ debug(5, "MessageQueue::load()");
+
+ _dataId = file.readUint16LE();
+
+ int count = file.readUint16LE();
+
+ assert(g_fullpipe->_gameProjectVersion >= 12);
+
+ _queueName = file.readPascalString();
+
+ for (int i = 0; i < count; i++) {
+ CObject *tmp = file.readClass();
+
+ _exCommands.push_back(tmp);
+ }
+
+ _id = -1;
+ _field_14 = 0;
+ _parId = 0;
+ _isFinished = 0;
+
+ return true;
+}
+
+MessageQueue *GlobalMessageQueueList::getMessageQueueById(int id) {
+ for (CPtrList::iterator s = begin(); s != end(); ++s) {
+ if (((MessageQueue *)s)->_id == id)
+ return (MessageQueue *)s;
+ }
+
+ return 0;
+}
+
+void GlobalMessageQueueList::deleteQueueById(int id) {
+ for (uint i = 0; i < size(); i++)
+ if (((MessageQueue *)((*this).operator[](i)))->_id == id) {
+ delete (MessageQueue *)remove_at(i);
+
+ disableQueueById(id);
+ return;
+ }
+}
+
+void GlobalMessageQueueList::disableQueueById(int id) {
+ for (CPtrList::iterator s = begin(); s != end(); ++s) {
+ if (((MessageQueue *)s)->_parId == id)
+ ((MessageQueue *)s)->_parId = 0;
+ }
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/messagequeue.h b/engines/fullpipe/messagequeue.h
new file mode 100644
index 0000000000..1f4cf02bfc
--- /dev/null
+++ b/engines/fullpipe/messagequeue.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FULLPIPE_MESSAGEQUEUE_H
+#define FULLPIPE_MESSAGEQUEUE_H
+
+#include "fullpipe/utils.h"
+#include "fullpipe/inventory.h"
+#include "fullpipe/gfx.h"
+#include "fullpipe/sound.h"
+#include "fullpipe/scene.h"
+
+namespace Fullpipe {
+
+class MessageQueue : public CObject {
+ friend class GlobalMessageQueueList;
+
+ protected:
+ int _id;
+ int _flags;
+ char *_queueName;
+ int16 _dataId;
+ int16 _field_12;
+ int _field_14;
+ CPtrList _exCommands;
+ int _counter;
+ int _field_38;
+ int _isFinished;
+ int _parId;
+ int _flag1;
+
+ public:
+ MessageQueue();
+ virtual bool load(MfcArchive &file);
+
+ int getFlags() { return _flags; }
+};
+
+class GlobalMessageQueueList : public CPtrList {
+ public:
+ MessageQueue *getMessageQueueById(int id);
+ void deleteQueueById(int id);
+ void disableQueueById(int id);
+};
+
+} // End of namespace Fullpipe
+
+#endif /* FULLPIPE_MESSAGEQUEUE_H */
diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk
index 1b115a3463..02a56269e4 100644
--- a/engines/fullpipe/module.mk
+++ b/engines/fullpipe/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS = \
fullpipe.o \
gfx.o \
inventory.o \
+ messagequeue.o \
motion.o \
ngiarchive.o \
scene.o \
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 1d84305a96..6afab022f9 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -31,6 +31,8 @@
namespace Fullpipe {
+class MessageQueue;
+
class GameProject : public CObject {
public:
int _field_4;
@@ -44,25 +46,6 @@ class GameProject : public CObject {
virtual bool load(MfcArchive &file);
};
-class MessageQueue : public CObject {
- int _id;
- int _flags;
- char *_queueName;
- int16 _dataId;
- int16 _field_12;
- int _field_14;
- CPtrList _exCommands;
- int _counter;
- int _field_38;
- int _isFinished;
- int _parId;
- int _flag1;
-
- public:
- MessageQueue();
- virtual bool load(MfcArchive &file);
-};
-
class CInteraction : public CObject {
int16 _objectId1;
int16 _objectId2;
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index 717eb0cdd5..dec89119bf 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -25,6 +25,9 @@
#include "fullpipe/objects.h"
#include "fullpipe/ngiarchive.h"
#include "fullpipe/statics.h"
+#include "fullpipe/messagequeue.h"
+
+#include "fullpipe/gameobj.h"
namespace Fullpipe {
@@ -234,6 +237,38 @@ void Scene::init() {
warning("STUB: Scene::init()");
}
+StaticANIObject *Scene::getAniMan() {
+ StaticANIObject *aniMan = getStaticANIObject1ById(ANI_MAN, -1);
+
+ deleteStaticANIObject(aniMan);
+
+ return aniMan;
+}
+
+StaticANIObject *Scene::getStaticANIObject1ById(int obj, int a3) {
+ for (CPtrList::iterator s = _staticANIObjectList1.begin(); s != _staticANIObjectList1.end(); ++s) {
+ StaticANIObject *o = (StaticANIObject *)s;
+ if (o->_id == obj && (a3 == -1 || o->_field_4 == a3))
+ return o;
+ }
+
+ return 0;
+}
+
+void Scene::deleteStaticANIObject(StaticANIObject *obj) {
+ for (uint n = 0; n < _staticANIObjectList1.size(); n++)
+ if ((StaticANIObject *)_staticANIObjectList1[n] == obj) {
+ _staticANIObjectList1.remove_at(n);
+ break;
+ }
+
+ for (uint n = 0; n < _staticANIObjectList2.size(); n++)
+ if ((StaticANIObject *)_staticANIObjectList2[n] == obj) {
+ _staticANIObjectList2.remove_at(n);
+ break;
+ }
+}
+
void Scene::draw(int par) {
updateScrolling(par);
@@ -257,9 +292,10 @@ void Scene::draw(int par) {
}
void Scene::updateScrolling(int par) {
+ warning("STUB Scene::updateScrolling()");
}
-void Scene::drawContent(int minPri, int maxPri, bool drawBG) {
+void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
if (!_picObjList.size() && !_bigPictureArray1Count)
return;
diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h
index 639bff0c93..8d1ea7ceb7 100644
--- a/engines/fullpipe/scene.h
+++ b/engines/fullpipe/scene.h
@@ -45,6 +45,9 @@ class Scene : public Background {
void draw(int par);
void drawContent(int minPri, int maxPri, bool drawBG);
void updateScrolling(int par);
+ StaticANIObject *getAniMan();
+ StaticANIObject *getStaticANIObject1ById(int obj, int a3);
+ void deleteStaticANIObject(StaticANIObject * obj);
};
class SceneTag : public CObject {
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index f04291b2b9..2dbe503e93 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -24,11 +24,8 @@
namespace Fullpipe {
-signed int sceneSwitcher(EntranceInfo *a1, int a2) {
- EntranceInfo *entrance; // ebx@1
- Scene *scene; // esi@1
+bool FullPipeEngine::sceneSwitcher(EntranceInfo *entrance) {
CGameVar *sceneVar; // eax@21
- signed int result; // eax@2
POINT *v6; // eax@3
int v7; // eax@3
CInventory2 *v8; // eax@4
@@ -46,37 +43,41 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
CNode *v20; // eax@17
Scene *v21; // eax@18
PictureObject *v22; // eax@18
- POINT point; // [sp+Ch] [bp-8h]@3
+ Common::Point sceneDim;
- entrance = a1;
- scene = accessScene(a1->_sceneId);
+ Scene *scene = accessScene(entrance->_sceneId);
if (!scene)
return 0;
- v6 = PictureObject_getDimensions((PictureObject *)scene->bg.picObjList.m_pNodeHead->data, &point);
- g_sceneWidth = v6->x;
- v7 = v6->y;
- g_sceneHeight = v7;
- g_sceneRect.top = 0;
- g_sceneRect.left = 0;
- g_sceneRect.right = 799;
- g_sceneRect.bottom = 599;
- scene->bg.x = 0;
- scene->bg.y = 0;
- (*(void (__stdcall **)(_DWORD, _DWORD, int))(g_aniMan->GameObject.CObject.vmt + offsetof(GameObjectVmt, setOXY)))(0, 0, a2);
- (*(void (**)(void))(g_aniMan->GameObject.CObject.vmt + offsetof(GameObjectVmt, clearFlags)))();
- g_aniMan->callback2 = 0;
- g_aniMan->callback1 = 0;
- g_aniMan->shadowsOn = 1;
- g_scrollSpeed = 8;
- savesEnabled = 1;
- updateFlag = 1;
- flgCanOpenMap = 1;
+ ((PictureObject *)_picObjList.front())->getDimensions(&sceneDim);
+ _sceneWidth = sceneDim.x;
+ _sceneHeight = sceneDim.y;
+
+ _sceneRect.top = 0;
+ _sceneRect.left = 0;
+ _sceneRect.right = 799;
+ _sceneRect.bottom = 599;
+
+ scene->_x = 0;
+ scene->_y = 0;
+
+ _aniMan->setOXY(0, 0);
+ _aniMan->clearFlags();
+ _aniMan->callback1 = 0;
+ _aniMan->callback2 = 0;
+ _aniMan->shadowsOn = 1;
+
+ _scrollSpeed = 8;
+
+ _savesEnabled = 1;
+ _updateFlag = 1;
+ _flgCanOpenMap = 1;
+
if (entrance->sceneId == SC_DBGMENU) {
- g_inventoryScene = 0;
+ _inventoryScene = 0;
} else {
- CGameLoader_loadScene(g_gameLoader, SC_INV);
+ _gameLoader->loadScene(SC_INV);
v8 = getGameLoaderInventory();
CInventory2_rebuildItemRects(v8);
v9 = getGameLoaderInventory();
@@ -146,7 +147,6 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandlerIntro, 2);
_updateCursorCallback = sceneIntro_updateCursor;
- result = 1;
break;
case SC_1:
@@ -158,8 +158,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_1");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler01, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_2:
@@ -170,8 +169,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_2");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler02, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_3:
@@ -183,8 +181,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler03, 2);
j_Scene_sc03_sub_40F160(scene);
- g_updateCursorCallback = scene03_updateCursor;
- result = 1;
+ _updateCursorCallback = scene03_updateCursor;
break;
case SC_4:
@@ -195,8 +192,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_4");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler04, 2, 2);
- g_updateCursorCallback = scene04_updateCursor;
- result = 1;
+ _updateCursorCallback = scene04_updateCursor;
break;
case SC_5:
@@ -207,8 +203,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_5");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler05, 2, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_6:
@@ -220,8 +215,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
sub_415300();
insertMessageHandler(sceneHandler06, 2, 2);
- g_updateCursorCallback = scene06_updateCursor;
- result = 1;
+ _updateCursorCallback = scene06_updateCursor;
break;
case SC_7:
@@ -232,8 +226,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_7");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler07, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_8:
@@ -245,8 +238,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
sub_416890();
addMessageHandler(sceneHandler08, 2);
- g_updateCursorCallback = scene08_updateCursor;
- result = 1;
+ _updateCursorCallback = scene08_updateCursor;
break;
case SC_9:
@@ -257,8 +249,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_9");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler09, 2, 2);
- g_updateCursorCallback = scene09_updateCursor;
- result = 1;
+ _updateCursorCallback = scene09_updateCursor;
break;
case SC_10:
@@ -269,8 +260,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_10");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler10, 2, 2);
- g_updateCursorCallback = scene10_updateCursor;
- result = 1;
+ _updateCursorCallback = scene10_updateCursor;
break;
case SC_11:
@@ -282,8 +272,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler11, 2, 2);
scene11_sub_41A980();
- g_updateCursorCallback = scene11_updateCursor;
- result = 1;
+ _updateCursorCallback = scene11_updateCursor;
break;
case SC_12:
@@ -294,8 +283,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_12");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler12, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_13:
@@ -306,8 +294,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_13");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler13, 2, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_14:
@@ -319,8 +306,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler14, 2, 2);
scene14_sub_41D2B0();
- g_updateCursorCallback = scene14_updateCursor;
- result = 1;
+ _updateCursorCallback = scene14_updateCursor;
break;
case SC_15:
@@ -331,8 +317,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_15");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler15, 2, 2);
- g_updateCursorCallback = scene15_updateCursor;
- result = 1;
+ _updateCursorCallback = scene15_updateCursor;
break;
case SC_16:
@@ -343,8 +328,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_16");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler16, 2);
- g_updateCursorCallback = scene16_updateCursor;
- result = 1;
+ _updateCursorCallback = scene16_updateCursor;
break;
case SC_17:
@@ -356,8 +340,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler17, 2);
scene17_sub_41F060();
- g_updateCursorCallback = scene17_updateCursor;
- result = 1;
+ _updateCursorCallback = scene17_updateCursor;
break;
case SC_18:
@@ -373,8 +356,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_18");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler18, 2, 2);
- g_updateCursorCallback = scene18_updateCursor;
- result = 1;
+ _updateCursorCallback = scene18_updateCursor;
break;
case SC_19:
@@ -399,8 +381,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler19, 2);
scene19_sub_4211D0(scene);
- g_updateCursorCallback = scene19_updateCursor;
- result = 1;
+ _updateCursorCallback = scene19_updateCursor;
break;
case SC_20:
@@ -411,8 +392,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_20");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler20, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_21:
@@ -423,8 +403,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_21");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler21, 2, 2);
- g_updateCursorCallback = scene21_updateCursor;
- result = 1;
+ _updateCursorCallback = scene21_updateCursor;
break;
case SC_22:
@@ -436,8 +415,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
scene22_sub_4228A0();
insertMessageHandler(sceneHandler22, 2, 2);
- g_updateCursorCallback = scene22_updateCursor;
- result = 1;
+ _updateCursorCallback = scene22_updateCursor;
break;
case SC_23:
@@ -449,8 +427,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler23, 2, 2);
scene23_sub_423B00();
- g_updateCursorCallback = scene23_updateCursor;
- result = 1;
+ _updateCursorCallback = scene23_updateCursor;
break;
case SC_24:
@@ -462,8 +439,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler24, 2);
scene24_sub_423DD0();
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_25:
@@ -475,8 +451,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler25, 2);
scene25_sub_4253B0(scene, entrance->field_4);
- g_updateCursorCallback = scene25_updateCursor;
- result = 1;
+ _updateCursorCallback = scene25_updateCursor;
break;
case SC_26:
@@ -488,8 +463,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler26, 2, 2);
scene26_sub_426140(scene);
- g_updateCursorCallback = scene26_updateCursor;
- result = 1;
+ _updateCursorCallback = scene26_updateCursor;
break;
case SC_27:
@@ -500,8 +474,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_27");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler27, 2);
- g_updateCursorCallback = scene27_updateCursor;
- result = 1;
+ _updateCursorCallback = scene27_updateCursor;
break;
case SC_28:
@@ -512,8 +485,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_28");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler28, 2, 2);
- g_updateCursorCallback = scene28_updateCursor;
- result = 1;
+ _updateCursorCallback = scene28_updateCursor;
break;
case SC_29:
@@ -524,8 +496,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_29");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler29, 2);
- g_updateCursorCallback = scene29_updateCursor;
- result = 1;
+ _updateCursorCallback = scene29_updateCursor;
break;
case SC_30:
@@ -536,8 +507,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_30");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler30, 2);
- g_updateCursorCallback = scene30_updateCursor;
- result = 1;
+ _updateCursorCallback = scene30_updateCursor;
break;
case SC_31:
@@ -548,8 +518,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_31");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler31, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_32:
@@ -561,8 +530,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler32, 2, 2);
scene32_sub_42C5C0();
- g_updateCursorCallback = scene32_updateCursor;
- result = 1;
+ _updateCursorCallback = scene32_updateCursor;
break;
case SC_33:
@@ -574,8 +542,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler33, 2, 2);
scene33_sub_42CEF0();
- g_updateCursorCallback = scene33_updateCursor;
- result = 1;
+ _updateCursorCallback = scene33_updateCursor;
break;
case SC_34:
@@ -587,8 +554,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler34, 2, 2);
scene34_sub_42DEE0();
- g_updateCursorCallback = scene34_updateCursor;
- result = 1;
+ _updateCursorCallback = scene34_updateCursor;
break;
case SC_35:
@@ -599,8 +565,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_35");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler35, 2, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_36:
@@ -611,8 +576,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_36");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler36, 2);
- g_updateCursorCallback = scene36_updateCursor;
- result = 1;
+ _updateCursorCallback = scene36_updateCursor;
break;
case SC_37:
@@ -623,8 +587,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_37");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler37, 2, 2);
- g_updateCursorCallback = scene37_updateCursor;
- result = 1;
+ _updateCursorCallback = scene37_updateCursor;
break;
case SC_38:
@@ -635,8 +598,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_38");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler38, 2);
- g_updateCursorCallback = defaultUpdateCursorCallback;
- result = 1;
+ _updateCursorCallback = defaultUpdateCursorCallback;
break;
case SC_FINAL1:
@@ -647,8 +609,7 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
scene->initObjectCursors("SC_FINAL1");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandlerFinal1, 2);
- g_updateCursorCallback = sceneFinal1_updateCursor;
- result = 1;
+ _updateCursorCallback = sceneFinal1_updateCursor;
break;
case SC_DBGMENU:
@@ -658,16 +619,14 @@ signed int sceneSwitcher(EntranceInfo *a1, int a2) {
_behaviorManager->initBehavior(scene, sceneVar);
scene->initObjectCursors("SC_DBGMENU");
addMessageHandler(sceneHandlerDbgMenu, 2);
- result = 1;
break;
default:
_behaviorManager->initBehavior(0, 0);
- result = 1;
break;
}
- return result;
+ return true;
}
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index f3cf644b9a..4e9b0a3e42 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -101,10 +101,16 @@ bool FullpipeEngine::loadGam(const char *fname) {
_inventory->rebuildItemRects();
- warning("STUB: loadGam()");
//for (CPtrList::iterator s = _inventory->getScene()->_picObjList.begin(); s != _inventory->getScene()->_picObjList.end(); ++s) {
//}
+
+ //_sceneSwitcher = sceneSwitcher;
+ //_preloadCallback = gameLoaderPreloadCallback
+ //_readSavegameCallback = gameLoaderReadSavegameCallback;
+ _aniMan = accessScene(SC_COMMON)->getAniMan();
+ _scene2 = 0;
+ warning("STUB: loadGam()");
} else
return false;
@@ -314,40 +320,6 @@ bool CInteraction::load(MfcArchive &file) {
return true;
}
-MessageQueue::MessageQueue() {
- _field_14 = 0;
- _parId = 0;
- _dataId = 0;
- _id = 0;
- _isFinished = 0;
- _flags = 0;
-}
-
-bool MessageQueue::load(MfcArchive &file) {
- debug(5, "MessageQueue::load()");
-
- _dataId = file.readUint16LE();
-
- int count = file.readUint16LE();
-
- assert(g_fullpipe->_gameProjectVersion >= 12);
-
- _queueName = file.readPascalString();
-
- for (int i = 0; i < count; i++) {
- CObject *tmp = file.readClass();
-
- _exCommands.push_back(tmp);
- }
-
- _id = -1;
- _field_14 = 0;
- _parId = 0;
- _isFinished = 0;
-
- return true;
-}
-
ExCommand::ExCommand() {
_field_3C = 1;
_messageNum = 0;
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index cc51691a44..d0abbb87e6 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -25,10 +25,42 @@
#include "fullpipe/objects.h"
#include "fullpipe/ngiarchive.h"
#include "fullpipe/statics.h"
+#include "fullpipe/messagequeue.h"
+
#include "fullpipe/gameobj.h"
namespace Fullpipe {
+CStepArray::CStepArray() {
+ _points = 0;
+ _maxPointIndex = 0;
+ _currPointIndex = 0;
+ _pointsCount = 0;
+ _isEos = 0;
+}
+
+CStepArray::~CStepArray() {
+ if (_pointsCount) {
+ for (int i = 0; i < _pointsCount; i++)
+ delete _points[i];
+
+ delete _points;
+
+ _points = 0;
+ }
+}
+
+void CStepArray::clear() {
+ _currPointIndex = 0;
+ _maxPointIndex = 0;
+ _isEos = 0;
+
+ for (int i = 0; i < _pointsCount; i++) {
+ _points[i]->x = 0;
+ _points[i]->y = 0;
+ }
+}
+
StaticANIObject::StaticANIObject() {
_shadowsOn = 1;
_field_30 = 0;
@@ -102,6 +134,43 @@ void StaticANIObject::setOXY(int x, int y) {
_movementObj->setOXY(x, y);
}
+void StaticANIObject::clearFlags() {
+ _flags = 0;
+
+ deleteFromGlobalMessageQueue();
+ _messageQueueId = 0;
+ _movementObj = 0;
+ _staticsObj = 0;
+ _animExFlag = 0;
+ _counter = 0;
+ _messageNum = 0;
+ _stepArray.clear();
+}
+
+void StaticANIObject::deleteFromGlobalMessageQueue() {
+ while (_messageQueueId) {
+ if (g_fullpipe->_globalMessageQueueList->getMessageQueueById(_messageQueueId)) {
+ if (!isIdle())
+ return;
+
+ g_fullpipe->_globalMessageQueueList->deleteQueueById(_messageQueueId);
+ } else {
+ _messageQueueId = 0;
+ }
+ }
+}
+
+bool StaticANIObject::isIdle() {
+ if (_messageQueueId) {
+ MessageQueue *m = g_fullpipe->_globalMessageQueueList->getMessageQueueById(_messageQueueId);
+
+ if (m && m->getFlags() & 1)
+ return false;
+ }
+
+ return true;
+}
+
Statics *StaticANIObject::getStaticsById(int itemId) {
for (uint i = 0; i < _staticsList.size(); i++)
if (((Statics *)_staticsList[i])->_staticsId == itemId)
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index 5b27b547c5..d96435960a 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -27,10 +27,17 @@ namespace Fullpipe {
class CStepArray : public CObject {
int _currPointIndex;
- int _points;
+ Common::Point **_points;
int _maxPointIndex;
int _pointsCount;
int _isEos;
+
+ public:
+ CStepArray();
+ ~CStepArray();
+ void clear();
+
+ int getCurrPointIndex() { return _currPointIndex; }
};
class StaticPhase : public Picture {
@@ -144,6 +151,11 @@ class StaticANIObject : public GameObject {
Statics *getStaticsById(int id);
Movement *getMovementById(int id);
+ void clearFlags();
+ bool isIdle();
+
+ void deleteFromGlobalMessageQueue();
+
Statics *addStatics(Statics *ani);
void draw();
void draw2();
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index f6e19256c1..3e153c1801 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -28,6 +28,7 @@
#include "fullpipe/objects.h"
#include "fullpipe/motion.h"
#include "fullpipe/ngiarchive.h"
+#include "fullpipe/messagequeue.h"
namespace Fullpipe {