aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-08-26 22:17:20 +0300
committerEugene Sandulenko2013-09-06 14:51:20 +0300
commit028772d153b79b38e5dfa2d90ba5f01fb287b47e (patch)
treebc2dc9c5272f6cada248f29c4535a8b980d3215e /engines
parentd8bc218ce81ec7d24015bcb9a118e33aa244f225 (diff)
downloadscummvm-rg350-028772d153b79b38e5dfa2d90ba5f01fb287b47e.tar.gz
scummvm-rg350-028772d153b79b38e5dfa2d90ba5f01fb287b47e.tar.bz2
scummvm-rg350-028772d153b79b38e5dfa2d90ba5f01fb287b47e.zip
FULLPIPE: Finish global_messageHandler3()
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/gfx.cpp5
-rw-r--r--engines/fullpipe/gfx.h2
-rw-r--r--engines/fullpipe/messages.cpp2
-rw-r--r--engines/fullpipe/messages.h1
-rw-r--r--engines/fullpipe/motion.cpp16
-rw-r--r--engines/fullpipe/motion.h5
-rw-r--r--engines/fullpipe/scene.cpp6
-rw-r--r--engines/fullpipe/scene.h1
-rw-r--r--engines/fullpipe/scenes.cpp46
-rw-r--r--engines/fullpipe/statics.cpp7
-rw-r--r--engines/fullpipe/statics.h2
-rw-r--r--engines/fullpipe/utils.h8
12 files changed, 71 insertions, 30 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 6c22c2a493..d700fff15e 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -321,6 +321,11 @@ void GameObject::renumPictures(CPtrList *lst) {
free(buf);
}
+bool GameObject::canInteractAny(GameObject *obj2, int a3) {
+ warning("STUB: GameObject::canInteractAny()");
+ return false;
+}
+
Picture::Picture() {
_x = 0;
_y = 0;
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index eec32848ec..59edaf49e4 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -139,6 +139,8 @@ class GameObject : public CObject {
void setFlags(int16 flags) { _flags = flags; }
void clearFlags() { _flags = 0; }
const char *getName() { return _objectName; }
+
+ bool canInteractAny(GameObject *obj2, int a3);
};
class PictureObject : public GameObject {
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index c107933008..cc7cd2e942 100644
--- a/engines/fullpipe/messages.cpp
+++ b/engines/fullpipe/messages.cpp
@@ -177,6 +177,8 @@ CObjstateCommand::CObjstateCommand() {
bool CObjstateCommand::load(MfcArchive &file) {
debug(5, "CObjStateCommand::load()");
+ _objtype = kObjTypeObjstateCommand;
+
_cmd.load(file);
_value = file.readUint32LE();
diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h
index d202235f93..3611ae0127 100644
--- a/engines/fullpipe/messages.h
+++ b/engines/fullpipe/messages.h
@@ -83,6 +83,7 @@ class ExCommand2 : public ExCommand {
};
class CObjstateCommand : public CObject {
+ public:
ExCommand _cmd;
char *_objCommandName;
int _value;
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 3259653001..6d07747c9f 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -248,4 +248,20 @@ void CReactPolygonal::createRegion() {
}
}
+int startWalkTo(int objId, int objKey, int x, int y, int a5) {
+ warning("STUB: startWalkTo(%d, %d, %d, %d, %d)", objId, objKey, x, y, a5);
+
+ return 0;
+}
+
+int doSomeAnimation(int objId, int objKey, int a3) {
+ warning("STUB: doSomeAnimation(%d, %d, %d)", objId, objKey, a3);
+
+ return 0;
+}
+
+int doSomeAnimation2(int objId, int objKey) {
+ return doSomeAnimation(objId, objKey, 0);
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 28e4297337..318a6b383f 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -25,7 +25,12 @@
namespace Fullpipe {
+int startWalkTo(int objId, int objKey, int x, int y, int a5);
+int doSomeAnimation(int objId, int objKey, int a3);
+int doSomeAnimation2(int objId, int objKey);
+
class CMotionController : public CObject {
+ public:
int _field_4;
bool _isEnabled;
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index 0a7d035339..95d2876ca9 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -488,6 +488,12 @@ PictureObject *Scene::getPictureObjectAtPos(int x, int y) {
return 0;
}
+int Scene::getPictureObjectIdAtPos(int x, int y) {
+ warning("STUB: Scene::getPictureObjectIdAtPos(%d, %d)", x, y);
+
+ return 0;
+}
+
void Scene::update(int counterdiff) {
debug(0, "Scene::update(%d)", counterdiff);
diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h
index 0f0854b059..c1c8d47ba8 100644
--- a/engines/fullpipe/scene.h
+++ b/engines/fullpipe/scene.h
@@ -73,6 +73,7 @@ class Scene : public Background {
StaticANIObject *getStaticANIObjectAtPos(int x, int y);
PictureObject *getPictureObjectAtPos(int x, int y);
+ int getPictureObjectIdAtPos(int x, int y);
void initObjectCursors(const char *name);
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index 7f9e6bfacf..6a8b78a9a8 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -926,9 +926,9 @@ int global_messageHandler3(ExCommand *cmd) {
case 17:
switch (cmd->_messageNum) {
case 61:
- return gameLoaderPreloadScene(cmd->_parentId, cmd->_keyCode);
+ return g_fullpipe->_gameLoader->preloadScene(cmd->_parentId, cmd->_keyCode);
case 62:
- return gameLoaderGotoScene(cmd->_parentId, cmd->_keyCode);
+ return g_fullpipe->_gameLoader->gotoScene(cmd->_parentId, cmd->_keyCode);
case 64:
if (g_fullpipe->_currentScene && g_fullpipe->_msgObjectId2
&& (!(cmd->_keyCode & 4) || g_fullpipe->_msgObjectId2 != cmd->_field_14 || g_fullpipe->_msgId != cmd->_field_20)) {
@@ -955,39 +955,39 @@ int global_messageHandler3(ExCommand *cmd) {
case 29:
if (g_fullpipe->_gameLoader->_interactionController->_flag24 && g_fullpipe->_currentScene) {
ani = g_fullpipe->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
- ani2 = g_fullpipe->_currentScene->getStaticANIObject1ById(getGameLoaderFieldFA(), -1);
+ ani2 = g_fullpipe->_currentScene->getStaticANIObject1ById(g_fullpipe->_gameLoader->_field_FA, -1);
if (ani) {
if (g_fullpipe->_msgObjectId2 == ani->_id && g_fullpipe->_msgId == ani->_okeyCode) {
cmd->_messageKind = 0;
return result;
}
if (ani2->canInteractAny(ani, cmd->_keyCode)) {
- ani2->handleObjectInteraction(ani, cmd->_keyCode);
+ handleObjectInteraction(ani2, ani, cmd->_keyCode);
return 1;
}
} else {
int id = g_fullpipe->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
- ani = g_fullpipe->_currentScene->getPictureObjectById(id, 0);
- if (ani) {
- if (g_fullpipe->_msgObjectId2 == ani->_id && g_fullpipe->_msgId == ani->_okeyCode) {
+ PictureObject *pic = g_fullpipe->_currentScene->getPictureObjectById(id, 0);
+ if (pic) {
+ if (g_fullpipe->_msgObjectId2 == pic->_id && g_fullpipe->_msgId == pic->_okeyCode) {
cmd->_messageKind = 0;
return result;
}
- if (ani2->canInteractAny(ani, cmd->_keyCode)) {
- if (!ani2 || ani->isIdle() && !(ani2->_flags & 0x80) && !(ani2->_flags & 0x100))
- ani2->handleObjectInteraction(ani, cmd->_keyCode);
+ if (ani2->canInteractAny(pic, cmd->_keyCode)) {
+ if (!ani2 || ani2->isIdle() && !(ani2->_flags & 0x80) && !(ani2->_flags & 0x100))
+ handleObjectInteraction(ani2, pic, cmd->_keyCode);
return 1;
}
}
}
}
- if (getCurrSceneSc2MotionController()->_isEnabled && cmd->_keyCode <= 0) {
+ if (getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->_isEnabled && cmd->_keyCode <= 0) {
if (g_fullpipe->_msgX != cmd->_sceneClickX || g_fullpipe->_msgY != cmd->_sceneClickY) {
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(getGameLoaderFieldFA(), -1);
+ ani = g_fullpipe->_currentScene->getStaticANIObject1ById(g_fullpipe->_gameLoader->_field_FA, -1);
if (!ani || ani->isIdle() && !(ani->_flags & 0x80) && !(ani->_flags & 0x100)) {
- result = startWalkTo(getGameLoaderFieldFA(), -1, cmd->_sceneClickX, cmd->_sceneClickY, 0);
+ result = startWalkTo(g_fullpipe->_gameLoader->_field_FA, -1, cmd->_sceneClickX, cmd->_sceneClickY, 0);
if (result) {
- ExCommand *ex = new ExCommand(getGameLoaderFieldFA(), 17, 64, 0, 0, 0, 1, 0, 0, 0);
+ ExCommand *ex = new ExCommand(g_fullpipe->_gameLoader->_field_FA, 17, 64, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = 1;
ex->_excFlags |= 3;
@@ -1033,7 +1033,7 @@ int global_messageHandler3(ExCommand *cmd) {
getGameLoaderInventory()->rebuildItemRects();
return 1;
}
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(getGameLoaderFieldFA(), -1);
+ ani = g_fullpipe->_currentScene->getStaticANIObject1ById(g_fullpipe->_gameLoader->_field_FA, -1);
if (ani) {
getGameLoaderInventory()->removeItem2(g_fullpipe->_currentScene, cmd->_parentId, ani->_ox + cmd->_x, ani->_oy + cmd->_y, ani->_priority + cmd->_field_14);
getGameLoaderInventory()->rebuildItemRects();
@@ -1046,24 +1046,26 @@ int global_messageHandler3(ExCommand *cmd) {
return 1;
case 55:
if (g_fullpipe->_currentScene) {
+ GameObject *obj;
if (cmd->_field_14)
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_x, cmd->_y);
+ obj = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_x, cmd->_y);
else
- ani = g_fullpipe->_currentScene->getPictureObjectById(cmd->_x, cmd->_y);
- g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode)->handleObjectInteraction(ani, cmd->_field_20);
+ obj = g_fullpipe->_currentScene->getPictureObjectById(cmd->_x, cmd->_y);
+ handleObjectInteraction(g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode), obj, cmd->_field_20);
result = 1;
}
return result;
case 51:
return startWalkTo(cmd->_parentId, cmd->_keyCode, cmd->_x, cmd->_y, cmd->_field_20);
case 52:
- return sub_457F60(cmd->_parentId, cmd->_keyCode, cmd->_field_20);
+ return doSomeAnimation(cmd->_parentId, cmd->_keyCode, cmd->_field_20);
case 53:
- return sub_457FA0(cmd->_parentId, cmd->_keyCode);
+ return doSomeAnimation2(cmd->_parentId, cmd->_keyCode);
case 63:
- if (CObject::IsKindOf(cmd, &RTCObjstateCommand)) {
+ if (cmd->_objtype == kObjTypeObjstateCommand) {
+ CObjstateCommand *c = (CObjstateCommand *)cmd;
result = 1;
- g_fullpipe->setObjectState(cmd->_objCommandName, cmd->_value);
+ g_fullpipe->setObjectState(c->_objCommandName, c->_value);
}
return result;
default:
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 9706a456ca..53111e82d4 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -26,6 +26,7 @@
#include "fullpipe/ngiarchive.h"
#include "fullpipe/statics.h"
#include "fullpipe/messages.h"
+#include "fullpipe/interaction.h"
#include "fullpipe/constants.h"
#include "fullpipe/objectnames.h"
@@ -312,12 +313,6 @@ int StaticANIObject::getMovementIdById(int itemId) {
return 0;
}
-bool StaticANIObject::canInteractAny(GameObject *obj2, int a3) {
- warning("STUB: StaticANIObject::canInteractAny()");
- return false;
-}
-
-
Movement *StaticANIObject::getMovementByName(char *name) {
for (uint i = 0; i < _movements.size(); i++)
if (!strcmp(((Movement *)_movements[i])->_objectName, name))
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index e4e2c1f602..95030180c3 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -230,8 +230,6 @@ class StaticANIObject : public GameObject {
MessageQueue *changeStatics1(int msgNum);
void changeStatics2(int objId);
-
- bool canInteractAny(GameObject *obj2, int a3);
};
struct MovTable {
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index cfe9d93a74..9ebbe887f0 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -64,8 +64,16 @@ class MfcArchive : public Common::SeekableReadStream {
virtual bool seek(int32 offset, int whence = SEEK_SET) { return _stream->seek(offset, whence); }
};
+enum ObjType {
+ kObjTypeDefault,
+ kObjTypeObjstateCommand
+};
+
class CObject {
public:
+ ObjType _objtype;
+
+ CObject() : _objtype(kObjTypeDefault) {}
virtual bool load(MfcArchive &in) { return true; }
virtual ~CObject() {}