diff options
-rw-r--r-- | engines/fullpipe/constants.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/messages.cpp | 13 | ||||
-rw-r--r-- | engines/fullpipe/messages.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/scenes/scene04.cpp | 49 |
4 files changed, 63 insertions, 1 deletions
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index c7969daf90..4d9718b7b8 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -299,6 +299,7 @@ namespace Fullpipe { #define ST_MAN_RIGHT 325 #define ST_MAN_SIT 1164 #define ST_MAN_STANDLADDER 453 +#define ST_MAN_UP 449 #define ST_PNK_WEIGHTLEFT 503 #define ST_SPR_UP 544 #define TrubaDown 697 diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index c2f5ca3f7e..742b023ec3 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -809,4 +809,17 @@ bool chainQueue(int queueId, int flags) { return true; } +void postExCommand(int parentId, int keyCode, int x, int y, int f20, int f14) { + ExCommand *ex = new ExCommand(parentId, 17, 64, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = keyCode; + ex->_excFlags |= 3; + ex->_x = x; + ex->_y = y; + ex->_field_20 = f20; + ex->_field_14 = f14; + + ex->postMessage(); +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index 4109b3ec47..ca61dad007 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -178,6 +178,7 @@ void updateGlobalMessageQueue(int id, int objid); void clearGlobalMessageQueueList1(); bool chainQueue(int queueId, int flags); +void postExCommand(int parentId, int keyCode, int x, int y, int f20, int f16); } // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp index 0c55673089..610b21b04b 100644 --- a/engines/fullpipe/scenes/scene04.cpp +++ b/engines/fullpipe/scenes/scene04.cpp @@ -274,8 +274,55 @@ void sceneHandler04_clickButton() { } } +void sceneHandler04_downLadder(int x, int y) { + warning("STUB: sceneHandler04_downLadder()"); +} + +void sceneHandler04_walkClimbLadder(ExCommand *ex) { + warning("STUB: sceneHandler04_walkClimbLadder()"); +} + void sceneHandler04_clickLadder() { - warning("STUB: sceneHandler04_clickLadder()"); + g_vars->scene04_dudePosX = g_fullpipe->_aniMan->_ox; + g_vars->scene04_dudePosY = g_fullpipe->_aniMan->_oy; + + if (g_vars->scene04_needJumping) { + if (!g_fullpipe->_aniMan->isIdle() || (g_fullpipe->_aniMan->_flags & 0x100)) { + g_vars->scene04_var08 = 1; + } else { + int h3 = 3 * g_vars->scene04_ladder->_height; + int half = abs(g_vars->scene04_ladder->_height) / 2; + int start = g_vars->scene04_ladder->_ladderY - g_vars->scene04_ladder->_ladder_field_24; + int min = 2 * h3 + start + half + 1; + int max = h3 + start - half - 1; + + if (g_vars->scene04_sceneClickY > max) + g_vars->scene04_sceneClickY = max; + + if (g_vars->scene04_sceneClickY < min) + g_vars->scene04_sceneClickY = min; + + sceneHandler04_downLadder(g_vars->scene04_sceneClickX, g_vars->scene04_sceneClickY); + + g_vars->scene04_var08 = 0; + } + } else { + if (g_fullpipe->_aniMan->isIdle() && !(g_fullpipe->_aniMan->_flags & 0x100)) { + if (abs(1095 - g_vars->scene04_dudePosX) > 1 || abs(434 - g_vars->scene04_dudePosY) > 1) { + MessageQueue *mq = getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->method34(g_fullpipe->_aniMan, 1095, 434, 1, ST_MAN_UP); + if (mq) { + ExCommand *ex = new ExCommand(0, 17, MSG_SC4_CLICKLADDER, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags = 3; + mq->addExCommandToEnd(ex); + + postExCommand(g_fullpipe->_aniMan->_id, 2, 1095, 434, 0, -1); + } + } else { + sceneHandler04_walkClimbLadder(0); + } + } + } } void sceneHandler04_jumpOnLadder() { |