From 2873bdb6af09dc76a49287a98ec7df0d8132408e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 2 Jan 2014 10:29:04 +0200 Subject: FULLPIPE: Implement sceneHandler21() --- engines/fullpipe/constants.h | 2 ++ engines/fullpipe/scenes/scene21.cpp | 69 +++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 0dafd6f138..53c69771fc 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -725,6 +725,8 @@ namespace Fullpipe { // Scene 21 #define ANI_GIRAFFE_BOTTOM 1633 +#define MSG_SC21_UPDATEASS 4211 +#define ST_GRFB_SIT 1687 #define ST_GRFB_HANG 1638 // Scene 24 diff --git a/engines/fullpipe/scenes/scene21.cpp b/engines/fullpipe/scenes/scene21.cpp index 017716d46b..2656a5f8c0 100644 --- a/engines/fullpipe/scenes/scene21.cpp +++ b/engines/fullpipe/scenes/scene21.cpp @@ -61,4 +61,73 @@ void scene21_initScene(Scene *sc) { g_fp->initArcadeKeys("SC_21"); } +void sceneHandler21_doWiggle() { + warning("STUB: sceneHandler21_doWiggle()"); +} + +int sceneHandler21(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC21_UPDATEASS: + if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) { + g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_HANG); + g_vars->scene21_giraffeBottom->setOXY(g_vars->scene21_giraffeBottomX, g_vars->scene21_giraffeBottomY); + g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_SIT); + + g_vars->scene21_var05 = 0; + + g_fp->setObjectState(sO_LowerPipe_21, g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsClosed)); + } + + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode) ) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) + g_fp->processArcade(cmd); + } + } + + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x <= g_fp->_sceneWidth - 460) { + if (x < g_fp->_sceneRect.left + g_vars->scene21_var01) + g_fp->_currentScene->_x = x - g_vars->scene21_var03 - g_fp->_sceneRect.left; + } else { + g_fp->_currentScene->_x = g_fp->_sceneWidth - x; + } + + if (x > g_fp->_sceneRect.right - g_vars->scene21_var01) + g_fp->_currentScene->_x = x + g_vars->scene21_var03 - g_fp->_sceneRect.right; + } + + if (g_vars->scene21_var05 && !g_vars->scene21_var07) + sceneHandler21_doWiggle(); + + g_vars->scene21_var07 = g_vars->scene21_var07 == 0; + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + } // End of namespace Fullpipe -- cgit v1.2.3