From 00369347e03d801fad7be673f03512bc5ce5220c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 28 Jan 2014 21:30:08 +0200 Subject: [PATCH] FULLPIPE: Implement lift_goAnimation() --- engines/fullpipe/constants.h | 2 ++ engines/fullpipe/lift.cpp | 49 ++++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 408f765fced..b2ed962b07e 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -41,6 +41,8 @@ namespace Fullpipe { #define MV_FLY_FLY 4917 #define MV_MAN_GOLADDER 451 #define MV_MAN_GOLADDER2 2844 +#define MV_MAN_LIFTDOWN 1052 +#define MV_MAN_LIFTUP 1051 #define MV_MAN_LOOKUP 4773 #define rMV_MAN_LOOKUP 4775 #define MV_MAN_TOLADDER 448 diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp index aa0c19e4756..6484aca30ad 100644 --- a/engines/fullpipe/lift.cpp +++ b/engines/fullpipe/lift.cpp @@ -29,6 +29,7 @@ #include "fullpipe/scene.h" #include "fullpipe/statics.h" #include "fullpipe/messages.h" +#include "fullpipe/gameloader.h" namespace Fullpipe { @@ -234,8 +235,52 @@ void FullpipeEngine::lift_clickButton() { lift_walkAndGo(); } -void FullpipeEngine::lift_goAnimation() { - warning("STUB: FullpipeEngine::lift_goAnimation()"); +void FullpipeEngine::lift_goAnimation() { if (_lastLiftButton) { + int parentId = _currentScene->_sceneId; + int buttonId = lift_getButtonIdN(_lastLiftButton->_statics->_staticsId); + + if (!buttonId) + return; + + int numItems = _gameLoader->_preloadItems.size(); + + for (int i = 0; i < numItems; i++) { + PreloadItem *pre = _gameLoader->_preloadItems[i]; + + if (pre->preloadId2 == buttonId && pre->preloadId1 == _currentScene->_sceneId) { + MessageQueue *mq = new MessageQueue(_globalMessageQueueList->compact()); + + ExCommand *ex = new ExCommand(ANI_MAN, 1, (pre->keyCode != LiftDown ? MV_MAN_LIFTDOWN : MV_MAN_LIFTUP), 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = -1; + ex->_field_24 = 1; + ex->_excFlags |= 2; + + mq->addExCommandToEnd(ex); + + ex = new ExCommand(parentId, 17, 61, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = buttonId; + ex->_excFlags |= 3; + + mq->addExCommandToEnd(ex); + + _aniMan->_flags &= 0xFEFF; + + if (!mq->chain(_aniMan)) + delete mq; + + _aniMan->_flags |= 1; + } + } + } + + lift_exitSeq(0); + + if (_lastLiftButton) { + _lastLiftButton->_statics = _lastLiftButton->getStaticsById(lift_getButtonIdN(_lastLiftButton->_statics->_staticsId)); + _lastLiftButton = 0; + } } void FullpipeEngine::lift_sub1(StaticANIObject *ani) {