From 3dbd8817c35e155229888d9be81e241f8e99ad10 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 1 Feb 2014 13:09:55 +0200 Subject: FULLPIPE: Implement lift_animateButton() --- engines/fullpipe/constants.h | 1 + engines/fullpipe/fullpipe.h | 2 +- engines/fullpipe/lift.cpp | 37 +++++++++++++++++++++++++++++++++++-- engines/fullpipe/scenes/scene03.cpp | 2 +- engines/fullpipe/scenes/scene06.cpp | 2 +- engines/fullpipe/scenes/scene10.cpp | 2 +- engines/fullpipe/scenes/scene14.cpp | 2 +- engines/fullpipe/scenes/scene15.cpp | 2 +- engines/fullpipe/scenes/scene30.cpp | 2 +- engines/fullpipe/scenes/scene32.cpp | 2 +- engines/fullpipe/scenes/scene34.cpp | 2 +- engines/fullpipe/scenes/scene35.cpp | 2 +- engines/fullpipe/scenes/scene38.cpp | 2 +- 13 files changed, 47 insertions(+), 13 deletions(-) (limited to 'engines/fullpipe') diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 788ff84db7..47416f9560 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -218,6 +218,7 @@ namespace Fullpipe { #define SC_MAP 5222 #define SC_TITLES 5166 #define SND_CMN_031 3516 +#define SND_CMN_032 3517 #define SND_CMN_060 4921 #define SND_CMN_061 4922 #define SND_CMN_070 5199 diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 1e583279f5..ae03d2bd9e 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -288,7 +288,7 @@ public: void lift_clickButton(); void lift_walkAndGo(); void lift_goAnimation(); - void lift_sub1(StaticANIObject *ani); + void lift_animateButton(StaticANIObject *button); void lift_startExitQueue(); void lift_sub05(ExCommand *ex); bool lift_checkButton(const char *varname); diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp index 95cbaeb523..cb8be5ffa1 100644 --- a/engines/fullpipe/lift.cpp +++ b/engines/fullpipe/lift.cpp @@ -338,8 +338,41 @@ void FullpipeEngine::lift_goAnimation() { if (_lastLiftButton) { } } -void FullpipeEngine::lift_sub1(StaticANIObject *ani) { - warning("STUB: FullpipeEngine::lift_sub1()"); +void FullpipeEngine::lift_animateButton(StaticANIObject *button) { + int butId = lift_getButtonIdP(button->_statics->_staticsId); + + if (butId && butId != button->_statics->_staticsId) { + if (button == _lastLiftButton) { + playSound(SND_CMN_032, 0); + } else { + if (_lastLiftButton) { + int id = lift_getButtonIdN(_lastLiftButton->_statics->_staticsId); + + if (id) + _lastLiftButton->_statics = _lastLiftButton->getStaticsById(id); + + _lastLiftButton = 0; + } + + if (_aniMan->isIdle() && !(_aniMan->_flags & 0x100)) { + _lastLiftButton = button; + button->_statics = button->getStaticsById(butId); + + ExCommand *ex = new ExCommand(0, 35, SND_CMN_032, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + ex->_field_14 = 1; + ex->postMessage(); + + int id = lift_getButtonIdH(_lastLiftButton->_statics->_staticsId); + + if (id) { + _lastLiftButton->_statics = _lastLiftButton->getStaticsById(id); + + lift_walkAndGo(); + } + } + } + } } void FullpipeEngine::lift_startExitQueue() { diff --git a/engines/fullpipe/scenes/scene03.cpp b/engines/fullpipe/scenes/scene03.cpp index 9ba84a540a..b2b9180942 100644 --- a/engines/fullpipe/scenes/scene03.cpp +++ b/engines/fullpipe/scenes/scene03.cpp @@ -246,7 +246,7 @@ int sceneHandler03(ExCommand *ex) { { StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY); if (ani && ani->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(ani); + g_fp->lift_animateButton(ani); ex->_messageKind = 0; return 0; diff --git a/engines/fullpipe/scenes/scene06.cpp b/engines/fullpipe/scenes/scene06.cpp index 7d637d8306..fa2712d91e 100644 --- a/engines/fullpipe/scenes/scene06.cpp +++ b/engines/fullpipe/scenes/scene06.cpp @@ -647,7 +647,7 @@ int sceneHandler06(ExCommand *ex) { if (st) { if (!g_vars->scene06_arcadeEnabled && st->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(st); + g_fp->lift_animateButton(st); ex->_messageKind = 0; return 0; } diff --git a/engines/fullpipe/scenes/scene10.cpp b/engines/fullpipe/scenes/scene10.cpp index 9c00902bba..2a694e188c 100644 --- a/engines/fullpipe/scenes/scene10.cpp +++ b/engines/fullpipe/scenes/scene10.cpp @@ -185,7 +185,7 @@ int sceneHandler10(ExCommand *ex) { StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY); if (ani && ani->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(ani); + g_fp->lift_animateButton(ani); ex->_messageKind = 0; return 0; diff --git a/engines/fullpipe/scenes/scene14.cpp b/engines/fullpipe/scenes/scene14.cpp index ab0487974a..543522ee5b 100644 --- a/engines/fullpipe/scenes/scene14.cpp +++ b/engines/fullpipe/scenes/scene14.cpp @@ -820,7 +820,7 @@ int sceneHandler14(ExCommand *cmd) { StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); if (ani && ani->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(ani); + g_fp->lift_animateButton(ani); cmd->_messageKind = 0; break; } diff --git a/engines/fullpipe/scenes/scene15.cpp b/engines/fullpipe/scenes/scene15.cpp index 155897619f..588868a934 100644 --- a/engines/fullpipe/scenes/scene15.cpp +++ b/engines/fullpipe/scenes/scene15.cpp @@ -171,7 +171,7 @@ int sceneHandler15(ExCommand *cmd) { StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); if (ani && ani->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(ani); + g_fp->lift_animateButton(ani); cmd->_messageKind = 0; } diff --git a/engines/fullpipe/scenes/scene30.cpp b/engines/fullpipe/scenes/scene30.cpp index a807e692a7..d305da8eae 100644 --- a/engines/fullpipe/scenes/scene30.cpp +++ b/engines/fullpipe/scenes/scene30.cpp @@ -123,7 +123,7 @@ int sceneHandler30(ExCommand *cmd) { StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y); if (ani && ani->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(ani); + g_fp->lift_animateButton(ani); cmd->_messageKind = 0; } diff --git a/engines/fullpipe/scenes/scene32.cpp b/engines/fullpipe/scenes/scene32.cpp index 597d3422f6..383df0dc84 100644 --- a/engines/fullpipe/scenes/scene32.cpp +++ b/engines/fullpipe/scenes/scene32.cpp @@ -403,7 +403,7 @@ int sceneHandler32(ExCommand *cmd) { StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); if (ani && ani->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(ani); + g_fp->lift_animateButton(ani); cmd->_messageKind = 0; break; diff --git a/engines/fullpipe/scenes/scene34.cpp b/engines/fullpipe/scenes/scene34.cpp index b3e0db75af..82c6e6d43d 100644 --- a/engines/fullpipe/scenes/scene34.cpp +++ b/engines/fullpipe/scenes/scene34.cpp @@ -426,7 +426,7 @@ int sceneHandler34(ExCommand *cmd) { } if (ani->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(ani); + g_fp->lift_animateButton(ani); cmd->_messageKind = 0; diff --git a/engines/fullpipe/scenes/scene35.cpp b/engines/fullpipe/scenes/scene35.cpp index f10786b821..b800f9c602 100644 --- a/engines/fullpipe/scenes/scene35.cpp +++ b/engines/fullpipe/scenes/scene35.cpp @@ -208,7 +208,7 @@ int sceneHandler35(ExCommand *cmd) { if (ani) if (ani->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(ani); + g_fp->lift_animateButton(ani); cmd->_messageKind = 0; break; } diff --git a/engines/fullpipe/scenes/scene38.cpp b/engines/fullpipe/scenes/scene38.cpp index 016dc83c1b..4dc6f2142b 100644 --- a/engines/fullpipe/scenes/scene38.cpp +++ b/engines/fullpipe/scenes/scene38.cpp @@ -376,7 +376,7 @@ int sceneHandler38(ExCommand *cmd) { StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y); if (ani && ani->_id == ANI_LIFTBUTTON) { - g_fp->lift_sub1(ani); + g_fp->lift_animateButton(ani); cmd->_messageKind = 0; } -- cgit v1.2.3