From 0bd2e53cd49f21f3db4b6c8b762033ce1320172f Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 25 Nov 2017 08:19:57 +0100 Subject: FULLPIPE: Fix handleInteraction for non static ani objects cce851d1af introduced a check to allow only static ani objects. However after this change, only part of the pipes for vertical movement were interactive. This change aims to restore functionality for the other object types while still preventing the invalid casts. --- engines/fullpipe/interaction.cpp | 73 ++++++++++++++++++++-------------------- engines/fullpipe/statics.cpp | 3 +- 2 files changed, 38 insertions(+), 38 deletions(-) (limited to 'engines/fullpipe') diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp index 08c8c8fe47..38ca73b539 100644 --- a/engines/fullpipe/interaction.cpp +++ b/engines/fullpipe/interaction.cpp @@ -168,50 +168,51 @@ bool InteractionController::handleInteraction(StaticANIObject *subj, GameObject return false; if (!inter->_objectId2) { - if (obj->_objtype != kObjTypeStaticANIObject) - return false; - - StaticANIObject *ani = static_cast(obj); - - if (!ani->isIdle()) - return false; + if (obj->_objtype == kObjTypeStaticANIObject) { + StaticANIObject *ani = static_cast(obj); - if (ani->_flags & 0x100) - return false; + if (inter->_flags & 1) { + if (!ani->isIdle()) + return false; - if (!inter->_staticsId1 || !(inter->_flags & 1)) - goto LABEL_38; + if (ani->_flags & 0x100) + return false; + } else if (inter->_staticsId1 != 0) { + if (ani->_movement || ani->_statics == 0 || ani->_statics->_staticsId != inter->_staticsId1) { + mq = ani->changeStatics1(inter->_staticsId1); + if (!mq) + return false; - if (ani->_movement || ani->_statics == 0 || ani->_statics->_staticsId != inter->_staticsId1) { - mq = ani->changeStatics1(inter->_staticsId1); - if (!mq) - return false; + ex = new ExCommand((subj ? subj->_id : 0), 55, 0, 0, 0, 0, 1, 0, 0, 0); + ex->_x = obj->_id; + ex->_y = obj->_odelay; + ex->_param = subj ? subj->_odelay : 0; + ex->_excFlags = 3; + ex->_field_14 = (obj->_objtype != kObjTypePictureObject); + ex->_field_20 = invId; + mq->addExCommandToEnd(ex); - ex = new ExCommand((subj ? subj->_id : 0), 55, 0, 0, 0, 0, 1, 0, 0, 0); - ex->_x = obj->_id; - ex->_y = obj->_odelay; - ex->_param = subj ? subj->_odelay : 0; - ex->_excFlags = 3; - ex->_field_14 = (obj->_objtype != kObjTypePictureObject); - ex->_field_20 = invId; - mq->addExCommandToEnd(ex); + if (mq->_isFinished) { + mq->_isFinished = 0; + ani->queueMessageQueue(mq); + } - if (mq->_isFinished) { - mq->_isFinished = 0; - ani->queueMessageQueue(mq); + return true; + } else { + if (ani->getMessageQueue()) + ani->queueMessageQueue(0); + } } - } else { - if (ani->getMessageQueue()) - ani->queueMessageQueue(0); -LABEL_38: - if (inter->_messageQueue) { - mq = new MessageQueue(inter->_messageQueue, 0, 1); - mq->changeParam28ForObjectId(ani->_id, -1, ani->_odelay); + } - if (!mq->chain(0)) - return false; - } + if (inter->_messageQueue) { + mq = new MessageQueue(inter->_messageQueue, 0, 1); + mq->changeParam28ForObjectId(obj->_id, -1, obj->_odelay); + + if (!mq->chain(0)) + return false; } + return true; } diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 524eeff5d9..a1252a75af 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -348,8 +348,7 @@ void StaticANIObject::startMQIfIdle(int qId, int flag) { } bool StaticANIObject::isIdle() { - if (_objtype != kObjTypeStaticANIObject) - return true; + assert(_objtype == kObjTypeStaticANIObject); if (_messageQueueId) { MessageQueue *m = g_fp->_globalMessageQueueList->getMessageQueueById(_messageQueueId); -- cgit v1.2.3