aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-09-05 22:59:39 +0300
committerEugene Sandulenko2013-09-06 14:51:26 +0300
commit39e126f3c42b6326cb7b42759dc60289f7d2ff97 (patch)
treee04961376f7b09d15e1bad0bf722be7abf3c3fb8 /engines
parent6b242c0f9f02332697d36c6706df86cd674408ed (diff)
downloadscummvm-rg350-39e126f3c42b6326cb7b42759dc60289f7d2ff97.tar.gz
scummvm-rg350-39e126f3c42b6326cb7b42759dc60289f7d2ff97.tar.bz2
scummvm-rg350-39e126f3c42b6326cb7b42759dc60289f7d2ff97.zip
FULLPIPE: Implement CInteraction::canInteract()
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/interaction.cpp54
1 files changed, 53 insertions, 1 deletions
diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp
index 53dc50f2cf..b3cdeba63d 100644
--- a/engines/fullpipe/interaction.cpp
+++ b/engines/fullpipe/interaction.cpp
@@ -24,6 +24,7 @@
#include "fullpipe/interaction.h"
#include "fullpipe/gameloader.h"
+#include "fullpipe/statics.h"
namespace Fullpipe {
@@ -120,7 +121,58 @@ bool CInteraction::load(MfcArchive &file) {
}
bool CInteraction::canInteract(GameObject *obj1, GameObject *obj2, int invId) {
- warning("STUB: CInteraction::canInteract()");
+ if (_sceneId > 0 && g_fullpipe->_currentScene && g_fullpipe->_currentScene->_sceneId != _sceneId)
+ return false;
+
+ if (_flags & 0x20000)
+ return false;
+
+ if (!obj2)
+ return false;
+ if (obj2->_id != _objectId1)
+ return false;
+
+ if ((_flags & 8) && (_flags & 1)) {
+ if (!obj2->_objtype != kObjTypeStaticANIObject)
+ return false;
+
+ StaticANIObject *st = (StaticANIObject *)obj2;
+
+ if (!st->_statics)
+ return false;
+
+ if (st->_statics->_staticsId != _staticsId1) {
+ if (_staticsId1)
+ return false;
+ }
+ }
+
+ if ((_objectId3 != invId && _objectId3 != -1 && _objectId3 != -2) || (!invId && _objectId3 == -2))
+ return false;
+
+ if (_objectState1) {
+ if (_flags & 0x10) {
+ if ((g_fullpipe->getObjectState(obj1->getName()) & _objectState1) == 0)
+ return false;
+ } else {
+ if (g_fullpipe->getObjectState(obj1->getName()) != _objectState1)
+ return false;
+ }
+ }
+
+ if (_objectState2) {
+ if (_flags & 0x10) {
+ if ((g_fullpipe->getObjectState(obj2->getName()) & _objectState2) == 0)
+ return false;
+ } else {
+ if (g_fullpipe->getObjectState(obj2->getName()) != _objectState2)
+ return false;
+ }
+ }
+
+ if (_objectId2 && (!obj1 || _objectId2 != obj1->_id))
+ return false;
+
return true;
}