diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 788ff84db77..47416f9560c 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 1e583279f52..ae03d2bd9ef 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 95cbaeb5234..cb8be5ffa19 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 9ba84a540a1..b2b91809425 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 7d637d83065..fa2712d91ec 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 9c00902bba2..2a694e188cc 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 ab0487974ae..543522ee5bf 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 155897619fa..588868a934d 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 a807e692a7f..d305da8eaed 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 597d3422f62..383df0dc84c 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 b3e0db75af3..82c6e6d43d9 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 f10786b8211..b800f9c6029 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 016dc83c1b0..4dc6f2142b9 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; }