diff options
Diffstat (limited to 'engines/fullpipe')
83 files changed, 4300 insertions, 279 deletions
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp index 75cb027d7a..2e3a4e2e44 100644 --- a/engines/fullpipe/behavior.cpp +++ b/engines/fullpipe/behavior.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/behavior.h b/engines/fullpipe/behavior.h index 90bb38dc9b..1ec98d5bf2 100644 --- a/engines/fullpipe/behavior.h +++ b/engines/fullpipe/behavior.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/console.cpp b/engines/fullpipe/console.cpp index 2d27fc2ddd..cb76345d66 100644 --- a/engines/fullpipe/console.cpp +++ b/engines/fullpipe/console.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/console.h b/engines/fullpipe/console.h index af2b5114ac..24f213a50f 100644 --- a/engines/fullpipe/console.h +++ b/engines/fullpipe/console.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 408f765fce..e670645431 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -39,12 +39,17 @@ namespace Fullpipe { #define MSG_MANSHADOWSOFF 5196 #define MSG_MANSHADOWSON 5197 #define MV_FLY_FLY 4917 +#define MV_LFT_CLOSE 1053 +#define MV_LFT_OPEN 1048 #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 #define MV_MAN_TOLADDER2 2841 +#define MV_MAN_STARTD 478 #define MV_MAN_STARTLADDER 452 #define MV_MAN_STARTLADDER2 2842 #define MV_MAN_STOPLADDER 454 @@ -83,6 +88,7 @@ namespace Fullpipe { #define PIC_CSR_ITN_RED 5329 #define PIC_CSR_LIFT 5176 #define PIC_CSR_MAP 5339 +#define PIC_HLP_BGR 3562 #define PIC_IN1_GAMETITLE 5169 #define PIC_IN1_PIPETITLE 5167 #define PIC_INV_MENU 991 @@ -210,9 +216,11 @@ namespace Fullpipe { #define SC_INTRO2 3907 #define SC_INV 858 #define SC_LDR 635 +#define SC_MAINMENU 4620 #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 @@ -249,6 +257,8 @@ namespace Fullpipe { #define ST_LBN_7P 2772 #define ST_LBN_8P 2775 #define ST_LBN_9P 2778 +#define ST_LFT_CLOSED 1049 +#define ST_LFT_OPEN_NEW 1071 #define ST_MAN_EMPTY 476 #define ST_MAN_GOU 459 #define ST_MAN_RIGHT 325 @@ -575,6 +585,37 @@ namespace Fullpipe { #define ST_MAN8_STAND 774 #define ST_VMT_MIN 766 +// Scene 9 +#define ANI_BALL9 933 +#define ANI_GLOTATEL 924 +#define ANI_GRIT_9 2719 +#define ANI_PLEVATEL 919 +#define ANI_VISUNCHIK 904 +#define MSG_SC9_EATBALL 941 +#define MSG_SC9_FLOWN 943 +#define MSG_SC9_FROMLADDER 4207 +#define MSG_SC9_PLVCLICK 965 +#define MSG_SC9_SETSCROLL 964 +#define MSG_SC9_SHOWBALL 936 +#define MSG_SC9_STARTTIOTIA 4942 +#define MSG_SC9_TOLADDER 4206 +#define MV_BALL9_EXPLODE 939 +#define MV_GLT_FLYAWAY 931 +#define MV_MAN9_SHOOT 922 +#define MV_VSN_CYCLE2 2987 +#define PIC_SC9_LADDER_R 2700 +#define QU_SC9_BALLEXPLODE 938 +#define QU_SC9_EATBALL 942 +#define QU_TTA9_GOL 4937 +#define SND_9_006 3650 +#define SND_9_018 4200 +#define SND_9_019 4201 +#define ST_GLT_SIT 926 +#define ST_GRT9_GRIT 2722 +#define ST_GRT9_NORM 2721 +#define ST_PLV_SIT 921 +#define ST_VSN_NORMAL 906 + // Scene 10 #define ANI_GUM 978 #define ANI_NADUVATEL 944 @@ -831,10 +872,70 @@ namespace Fullpipe { #define ST_SMG_SIT 1399 // Scene 18 +#define ANI_BOY18 1477 +#define ANI_DOMINO_18 3174 +#define ANI_GIRL18 1484 +#define ANI_KRESLO 1459 +#define ANI_WHIRLIGIG_18 829 +#define MSG_SC18_CLICKBOARD 3297 +#define MSG_SC18_MANCLIMBEDDOWN 1540 +#define MSG_SC18_MANCLIMBEDUP 1539 +#define MSG_SC18_MANREADY 1507 +#define MSG_SC18_SHOWBOYJUMP 1495 +#define MSG_SC18_SHOWBOYJUMPTO 1497 +#define MSG_SC18_SHOWGIRLJUMP 1496 +#define MSG_SC18_SHOWGIRLJUMPTO 1499 +#define MSG_SC18_SHOWMANJUMP 1510 +#define MSG_SC18_SHOWMANJUMPTO 1508 +#define MV_BOY18_JUMPFROM 1478 +#define MV_BOY18_JUMPTO 1481 +#define MV_GRL18_JUMPFROM 1485 +#define MV_GRL18_JUMPTO 1488 +#define MV_KSL_CALMDOWN 1476 +#define MV_KSL_INBOY 1491 +#define MV_KSL_INGIRL 1493 +#define MV_KSL_INMAN 1504 +#define MV_KSL_JUMPBOY 1473 +#define MV_KSL_JUMPGIRL 1475 +#define MV_KSL_JUMPMAN 1509 +#define MV_KSL_SWING 1460 +#define MV_KSL_SWINGBOY 1462 +#define MV_KSL_SWINGGIRL 1464 +#define MV_KSL_SWINGMAN 1502 +#define MV_MAN18_JUMPTOTRUBA 1511 +#define MV_MAN18_STANDKRESLO 1500 +#define MV_WHR18_SPIN 1300 +#define PIC_SC18_DOMIN 5184 +#define PIC_SC18_LADDER1 1471 +#define PIC_SC18_LADDER2 1472 +#define PIC_SC18_LADDER3 3299 #define PIC_SC18_RTRUBA 1520 +#define QU_SC19_MANJUMP1 1516 +#define QU_SC19_MANJUMP2 1517 +#define QU_SC19_MANJUMP3 1518 +#define SND_18_006 3906 +#define SND_18_010 4994 +#define ST_KSL_BOY 1463 +#define ST_KSL_GIRL 1465 +#define ST_KSL_JUMPBOY 1492 +#define ST_KSL_JUMPGIRL 1494 +#define ST_KSL_JUMPMAN 1505 +#define ST_KSL_MAN 1503 +#define ST_KSL_REACT 1474 // Scene 19 +#define ANI_CORDIE 1529 +#define ANI_WHIRLGIG_19 1302 +#define MSG_SC19_UPDATENUMRIDES 5203 +#define MV_WHR19_SPIN 1317 +#define PIC_SC19_RTRUBA1 1513 +#define PIC_SC19_RTRUBA2 1514 #define PIC_SC19_RTRUBA3 1515 +#define PIC_SC19_RTRUBA31 5320 +#define SND_19_015 3928 +#define SND_19_016 4995 +#define ST_CDI_EMPTY2 1543 +#define ST_KSL_NORM 1461 // Scene 20 #define ANI_GRANDMA_20 2427 @@ -1073,6 +1174,52 @@ namespace Fullpipe { #define ST_VNT26_RIGHT2 3348 #define ST_VNT26_UP2 1948 +// Scene 27 +#define ANI_BITA 2026 +#define ANI_BITAHANDLER 3349 +#define ANI_MAID 2015 +#define ANI_VODILLA 1994 +#define MSG_SC27_CLICKBET 2048 +#define MSG_SC27_HANDLERTOBACK 3372 +#define MSG_SC27_HANDLERTOFRONT 3371 +#define MSG_SC27_SHOWNEXTBET 3369 +#define MSG_SC27_STARTBET 2047 +#define MSG_SC27_STARTWIPE 2057 +#define MSG_SC27_TAKEVENT 4584 +#define MV_BTA_FALL 2049 +#define MV_BTH_1_0 3366 +#define MV_BTH_2_1 3364 +#define MV_BTH_3_2 3362 +#define MV_BTH_4_3 3360 +#define MV_BTH_5_4 3358 +#define MV_MAN27_FLOW 1990 +#define MV_MAN27_THROWBET 1989 +#define PIC_SC27_HITZONE2 4756 +#define QU_DRV_GIVEVENT 2040 +#define QU_DRV_PUSHBUTTON 2056 +#define QU_DRV_PUSHBUTTON_NOVENT 4578 +#define QU_MID_CLEANVENT 4583 +#define QU_MID_SWITCHBACK 2044 +#define QU_SC27_RESTARTBETS 3370 +#define QU_SC27_SHOWBET 3368 +#define SND_27_026 4127 +#define SND_27_027 4128 +#define SND_27_044 4687 +#define ST_BTA_FALL 2054 +#define ST_BTA_HILITE 2052 +#define ST_BTA_NORM 2028 +#define ST_BTH_1 3365 +#define ST_BTH_2 3363 +#define ST_BTH_3 3361 +#define ST_BTH_4 3359 +#define ST_BTH_5 3357 +#define ST_DRV_SITNOVENT 1999 +#define ST_DRV_VENT 1996 +#define ST_MID_BROOM 2022 +#define ST_MID_SPADE 3489 +#define ST_MID_SWAB 2017 +#define ST_MID_SWAB2 2019 + // Scene 28 #define ANI_LIFT 982 #define ANI_LIFT_28 4238 @@ -1129,6 +1276,49 @@ namespace Fullpipe { #define QU_SC28_WMN_START 3452 #define ST_MAN28_RIGHT 4249 +// Scene 29 +#define ANI_ASS 2120 +#define ANI_PORTER 2082 +#define ANI_SHELL_GREEN 2116 +#define ANI_SHELL_RED 2130 +#define ANI_SHOOTER1 2108 +#define ANI_SHOOTER2 2111 +#define MSG_SC29_DISABLEPORTER 2097 +#define MSG_SC29_DISABLERIDEBACK 2106 +#define MSG_SC29_ENABLEPORTER 2096 +#define MSG_SC29_ENABLERIDEBACK 2105 +#define MSG_SC29_LAUGH 4760 +#define MSG_SC29_SHOOTGREEN 2119 +#define MSG_SC29_SHOOTRED 2137 +#define MSG_SC29_SHOWLASTGREEN 2730 +#define MSG_SC29_SHOWLASTRED 2731 +#define MSG_SC29_STOPRIDE 2107 +#define MV_ASS_HITGREEN 2138 +#define MV_ASS_HITRED 2139 +#define MV_MAN29_BEND 2091 +#define MV_MAN29_JUMP 2090 +#define MV_MAN29_RUN 2095 +#define MV_MAN29_STANDUP 2092 +#define MV_PTR_MOVEFAST 2102 +#define MV_SHG_HITASS 2151 +#define MV_SHR_HITASS 2152 +#define MV_STR1_SHOOT 2109 +#define MV_STR2_SHOOT 2112 +#define PIC_SC29_LTRUBA 2081 +#define QU_SC29_ESCAPE 2129 +#define QU_SC29_MANFROM_L 2101 +#define QU_SC29_MANFROM_R 2104 +#define QU_SC29_MANTO_L 2103 +#define QU_SC29_MANTO_R 2100 +#define SND_29_028 4758 +#define SND_29_029 4759 +#define ST_ASS_NORM 2122 +#define ST_MAN29_RUNR 2140 +#define ST_STR1_RIGHT 2143 +#define ST_STR2_RIGHT 2144 +#define ST_STR1_STAND 2110 +#define ST_STR2_STAND 2113 + // Scene 30 #define ANI_LEG 2322 #define MSG_SC30_UPDATEPATH 2358 diff --git a/engines/fullpipe/detection.cpp b/engines/fullpipe/detection.cpp index 8c4a422333..62c5dd3b80 100644 --- a/engines/fullpipe/detection.cpp +++ b/engines/fullpipe/detection.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/floaters.cpp b/engines/fullpipe/floaters.cpp index 9e5ca7b3f1..eb29706f72 100644 --- a/engines/fullpipe/floaters.cpp +++ b/engines/fullpipe/floaters.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/floaters.h b/engines/fullpipe/floaters.h index 3ecbbeea9c..bd7b7ffd2c 100644 --- a/engines/fullpipe/floaters.h +++ b/engines/fullpipe/floaters.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index b1e366c3a1..4446af7b60 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 1e583279f5..17a771bd5d 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -288,10 +288,11 @@ 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); + void lift_hoverButton(ExCommand *ex); bool lift_checkButton(const char *varname); + void lift_openLift(); GameVar *_musicGameVar; Audio::SoundHandle _sceneTrackHandle; diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 845655dded..d9f7327a6b 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -272,7 +272,7 @@ bool preloadCallback(PreloadItem &pre, int flag) { g_fp->_currSoundList1[0] = g_fp->accessScene(SC_COMMON)->_soundList; } - g_vars->scene18_var01 = 0; + g_vars->scene18_inScene18p1 = false; if ((pre.preloadId1 != SC_18 || pre.sceneId != SC_19) && (pre.preloadId1 != SC_19 || (pre.sceneId != SC_18 && pre.sceneId != SC_19))) { if (g_fp->_scene3) { @@ -282,9 +282,9 @@ bool preloadCallback(PreloadItem &pre, int flag) { g_fp->_scene3 = 0; } } else { - scene19_preload(g_fp->accessScene(pre.preloadId1), pre.keyCode); + scene19_setMovements(g_fp->accessScene(pre.preloadId1), pre.keyCode); - g_vars->scene18_var01 = 1; + g_vars->scene18_inScene18p1 = true; if (pre.preloadId1 == SC_18) { g_fp->_gameLoader->saveScenePicAniInfos(SC_18); diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index 85bd6ab0fb..a79c0e11b4 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 2d68600dbb..137af86f48 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -979,6 +979,9 @@ void Bitmap::putDibCB(int32 *palette) { byte *srcPtr = &_pixels[pitch * (endy - _y)]; + if (endy - _y < _height) + srcPtr = &_pixels[pitch * (_height - 1)]; + int starty = _y; if (starty < 0) { starty = 0; @@ -992,7 +995,7 @@ void Bitmap::putDibCB(int32 *palette) { } if (_flags & 0x1000000) { - for (int y = starty; y < endy; srcPtr -= pitch, y++) { + for (int y = starty; y <= endy; srcPtr -= pitch, y++) { curDestPtr = (uint16 *)g_fp->_backgroundSurface.getBasePtr(startx, y); copierKeyColor(curDestPtr, srcPtr, endx - startx + 1, _flags & 0xff, (int32 *)palette, cb05_format); } diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index d640decc80..b3e22b610b 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/init.cpp b/engines/fullpipe/init.cpp index 8de37b5c9e..9602803010 100644 --- a/engines/fullpipe/init.cpp +++ b/engines/fullpipe/init.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -96,7 +96,7 @@ void FullpipeEngine::initObjectStates() { setObjectState(sO_Pool, getObjectEnumState(sO_Pool, sO_Overfull)); setObjectState(sO_Board_25, getObjectEnumState(sO_Board_25, sO_NearDudesStairs)); setObjectState(sO_Driver, getObjectEnumState(sO_Driver, sO_WithSteering)); - setObjectState(sO_Janitress, getObjectEnumState(sO_Janitress, sO_WithMop)); + setObjectState(sO_Maid, getObjectEnumState(sO_Maid, sO_WithSwab)); setObjectState(sO_LeftPipe_29, getObjectEnumState(sO_LeftPipe_29, sO_IsClosed)); setObjectState(sO_LeftPipe_30, getObjectEnumState(sO_LeftPipe_30, sO_IsClosed)); setObjectState(sO_Leg, getObjectEnumState(sO_Leg, sO_ShowingHeel)); diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index 5294c4b4ea..0678d15368 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/input.h b/engines/fullpipe/input.h index bfd547ae2f..6a1d0f8b07 100644 --- a/engines/fullpipe/input.h +++ b/engines/fullpipe/input.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp index 59b01a1777..6b6ceb6eeb 100644 --- a/engines/fullpipe/interaction.cpp +++ b/engines/fullpipe/interaction.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/interaction.h b/engines/fullpipe/interaction.h index 7d9ee0bd51..cb1eac002a 100644 --- a/engines/fullpipe/interaction.h +++ b/engines/fullpipe/interaction.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index f5af0611cb..cfe8adf86f 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -31,7 +31,7 @@ namespace Fullpipe { Inventory::~Inventory() { - warning("STUB: Inventory::~Inventory()"); + _itemsPool.clear(); } bool Inventory::load(MfcArchive &file) { @@ -90,7 +90,7 @@ Inventory2::Inventory2() { } Inventory2::~Inventory2() { - warning("STUB: Inventory2::~Inventory2()"); + removeMessageHandler(125, -1); } bool Inventory2::loadPartial(MfcArchive &file) { // Inventory2_SerializePartially @@ -123,7 +123,25 @@ void Inventory2::removeItem(int itemId, int count) { } void Inventory2::removeItem2(Scene *sceneObj, int itemId, int x, int y, int priority) { - warning("STUB: void removeItem2(sc, %d, %d, %d, %d)", itemId, x, y, priority); + int idx = getInventoryItemIndexById(itemId); + + if (idx >= 0) { + if (_inventoryItems[idx]->itemId >> 16) { + removeItem(itemId, 1); + + Scene *sc = g_fp->accessScene(_sceneId); + + if (sc) { + StaticANIObject *ani = new StaticANIObject(sc->getStaticANIObject1ById(itemId, -1)); + + sceneObj->addStaticANIObject(ani, 1); + + ani->_statics = (Statics *)ani->_staticsList[0]; + ani->setOXY(x, y); + ani->_priority = priority; + } + } + } } int Inventory2::getCountItemsWithId(int itemId) { @@ -201,7 +219,7 @@ void Inventory2::rebuildItemRects() { InventoryIcon *icn = new InventoryIcon(); icn->inventoryItemId = _itemsPool[idx]->id; - + icn->pictureObjectNormal = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectNormal, 0); icn->pictureObjectHover = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectHover, 0); icn->pictureObjectSelected = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectSelected, 0); @@ -334,7 +352,7 @@ bool Inventory2::handleLeftClick(ExCommand *cmd) { bool res = false; for (uint i = 0; i < _inventoryIcons.size(); i++) { - if (cmd->_x >= _inventoryIcons[i]->x1 && cmd->_x <= _inventoryIcons[i]->x2 && + if (cmd->_x >= _inventoryIcons[i]->x1 && cmd->_x <= _inventoryIcons[i]->x2 && cmd->_y >= _inventoryIcons[i]->y1 && cmd->_y <= _inventoryIcons[i]->y2) { if (getSelectedItemId()) { if (getSelectedItemId() != _inventoryIcons[i]->inventoryItemId) diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index bc5847312b..833cccc355 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp index aa0c19e475..9a3d91540a 100644 --- a/engines/fullpipe/lift.cpp +++ b/engines/fullpipe/lift.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -29,6 +29,8 @@ #include "fullpipe/scene.h" #include "fullpipe/statics.h" #include "fullpipe/messages.h" +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" namespace Fullpipe { @@ -217,16 +219,172 @@ void FullpipeEngine::lift_init(Scene *sc, int enterSeq, int exitSeq) { } } -void FullpipeEngine::lift_exitSeq(ExCommand *ex) { - warning("STUB: FullpipeEngine::lift_exitSeq()"); +void FullpipeEngine::lift_exitSeq(ExCommand *cmd) { + if (cmd) { + MessageQueue *mq = _globalMessageQueueList->getMessageQueueById(cmd->_parId); + + if (mq) + mq->activateExCommandsByKind(34); + } + + _lift->changeStatics2(ST_LFT_CLOSED); + + MessageQueue *mq = new MessageQueue(_globalMessageQueueList->compact()); + + ExCommand *ex = new ExCommand(_aniMan->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0); + + ex->_field_14 = 256; + ex->_messageNum = 256; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + + if (!cmd) { + ex = new ExCommand(_aniMan->_id, 2, 40, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = _aniMan->_okeyCode; + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + } + + ex = new ExCommand(_lift->_id, 1, MV_LFT_OPEN, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = _lift->_okeyCode; + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(_aniMan->_id, 1, MV_MAN_STARTD, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = _aniMan->_okeyCode; + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(_aniMan->_id, 5, -1, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = _aniMan->_okeyCode; + ex->_field_14 = 10; + ex->_x = -1; + ex->_y = -1; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(_aniMan->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + ex->_field_14 = 256; + ex->_messageNum = 0; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(0, 17, MSG_LIFT_STARTEXITQUEUE, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(_lift->_id, 1, MV_LFT_CLOSE, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = _lift->_okeyCode; + ex->_excFlags |= 2; + + mq->addExCommandToEnd(ex); + + mq->chain(0); } void FullpipeEngine::lift_closedoorSeq() { - warning("STUB: FullpipeEngine::lift_closedoorSeq()"); + if (_lift->_movement) { + if (_lift->_movement->_id == MV_LFT_CLOSE) { + _lift->queueMessageQueue(0); + } else if (_lift->_movement->_id == MV_LFT_OPEN) { + int ph = _lift->_movement->_currDynamicPhaseIndex; + + _lift->changeStatics2(ST_LFT_OPEN_NEW); + _lift->startAnim(MV_LFT_CLOSE, 0, -1); + + if (_lift->_movement->_currMovement) + _lift->_movement->setDynamicPhaseIndex(_lift->_movement->_currMovement->_dynamicPhases.size() - ph); + else + _lift->_movement->setDynamicPhaseIndex(_lift->_movement->_dynamicPhases.size() - ph); + } else { + _lift->changeStatics2(ST_LFT_OPEN_NEW); + + _lift->startAnim(MV_LFT_CLOSE, 0, -1); + } + } else { + if (_lift->_statics->_staticsId == ST_LFT_CLOSED ) { + _lift->changeStatics2(ST_LFT_CLOSED); + } else { + _lift->startAnim(MV_LFT_CLOSE, 0, -1); + } + } + + MessageQueue *mq = new MessageQueue(_globalMessageQueueList->compact()); + ExCommand *ex = new ExCommand(0, 17, MSG_LIFT_GO, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + + if (!mq->chain(_lift)) + delete mq; } void FullpipeEngine::lift_walkAndGo() { - warning("STUB: FullpipeEngine::lift_walkAndGo()"); + MessageQueue *mq; + ExCommand *ex; + + if (abs(_liftX - _aniMan->_ox) > 1 || abs(_liftY - _aniMan->_oy) > 1 || _aniMan->_movement || _aniMan->_statics->_staticsId != ST_MAN_UP) { + mq = getCurrSceneSc2MotionController()->method34(_aniMan, _liftX, _liftY, 1, ST_MAN_UP); + + if (mq) { + ex = new ExCommand(0, 17, MSG_LIFT_CLICKBUTTON, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + + mq->addExCommandToEnd(ex); + } + } else { + lift_openLift(); + + mq = new MessageQueue(_liftEnterMQ, 0, 0); + + mq->setFlags(mq->getFlags() | 1); + + ex = new ExCommand(_aniMan->_id, 2, 15, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = _aniMan->_okeyCode; + ex->_excFlags |= 2; + mq->addExCommand(ex); + + ex = new ExCommand(_aniMan->_id, 5, -1, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = _aniMan->_okeyCode; + ex->_field_14 = _lift->_priority + 1; + ex->_x = -1; + ex->_y = -1; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(0, 17, MSG_LIFT_CLOSEDOOR, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + + mq->chain(0); + + _aniMan->_flags |= 1; + } +} + +void FullpipeEngine::lift_openLift() { + if (_lift->_movement) { + if (_lift->_movement->_id == MV_LFT_OPEN) { + _lift->queueMessageQueue(0); + } else if (_lift->_movement->_id == MV_LFT_CLOSE) { + int idx = _lift->_movement->_currDynamicPhaseIndex; + + _lift->changeStatics2(ST_LFT_CLOSED); + _lift->startAnim(MV_LFT_OPEN, 0, -1); + + if (_lift->_movement->_currMovement) + _lift->_movement->setDynamicPhaseIndex(_lift->_movement->_currMovement->_dynamicPhases.size() - idx); + else + _lift->_movement->setDynamicPhaseIndex(_lift->_movement->_dynamicPhases.size() - idx); + } else { + _lift->changeStatics2(ST_LFT_CLOSED); + _lift->startAnim(MV_LFT_OPEN, 0, -1); + } + } else if (_lift->_statics->_staticsId == ST_LFT_OPEN_NEW) { + _lift->changeStatics2(ST_LFT_OPEN_NEW); + } else { + _lift->startAnim(MV_LFT_OPEN, 0, -1); + } } void FullpipeEngine::lift_clickButton() { @@ -234,12 +392,89 @@ 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) { - 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() { @@ -248,12 +483,20 @@ void FullpipeEngine::lift_startExitQueue() { mq->chain(0); } -void FullpipeEngine::lift_sub05(ExCommand *ex) { - warning("STUB: FullpipeEngine::lift_sub05()"); +void FullpipeEngine::lift_hoverButton(ExCommand *cmd) { + if (_lastLiftButton) { + if (!(cmd->_keyCode & 2) || _liftX != cmd->_x || _liftY != cmd->_y) { + _lastLiftButton->_statics = _lastLiftButton->getStaticsById(lift_getButtonIdN(_lastLiftButton->_statics->_staticsId)); + _lastLiftButton = 0; + } + } } -bool FullpipeEngine::lift_checkButton(const char *varname) { - warning("STUB: FullpipeEngine::lift_checkButton(%s)", varname); +bool FullpipeEngine::lift_checkButton(const char *varName) { + GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName(sO_LiftButtons); + + if (var) + return lift_getButtonIdP(var->getSubVarByName(varName)->_value.intValue) > 0; return false; } diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp index 44a3e4cb60..b8e7b5c1db 100644 --- a/engines/fullpipe/messagehandlers.cpp +++ b/engines/fullpipe/messagehandlers.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -151,7 +151,7 @@ int global_messageHandler1(ExCommand *cmd) { if (g_fp->_updateFlag && (invItem = g_fp->_inventory->getHoveredItem(&g_fp->_mouseScreenPos))) { g_fp->_cursorId = PIC_CSR_ITN; - if (!g_fp->_currSelectedInventoryItemId && !g_fp->_aniMan->_movement && + if (!g_fp->_currSelectedInventoryItemId && !g_fp->_aniMan->_movement && !(g_fp->_aniMan->_flags & 0x100) && g_fp->_aniMan->isIdle()) { int st = g_fp->_aniMan->_statics->_staticsId; ExCommand *newex = 0; diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index 7dfdd06fc8..9c8f5ac4e2 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -47,7 +47,7 @@ ExCommand *ExCommand::createClone() { return new ExCommand(this); } -ExCommand::ExCommand(int16 parentId, int messageKind, int messageNum, int x, int y, int a7, int a8, int sceneClickX, int sceneClickY, int a11) : +ExCommand::ExCommand(int16 parentId, int messageKind, int messageNum, int x, int y, int a7, int a8, int sceneClickX, int sceneClickY, int a11) : Message(parentId, messageKind, x, y, a7, a8, sceneClickX, sceneClickY, a11) { _field_3C = 1; _messageNum = messageNum; @@ -182,7 +182,7 @@ ExCommand2 *ExCommand2::createClone() { Message::Message() { _messageKind = 0; - _parentId = 0; + _parentId = 0; _x = 0; _y = 0; @@ -610,6 +610,23 @@ void MessageQueue::changeParam28ForObjectId(int objId, int oldParam28, int newPa } } +int MessageQueue::activateExCommandsByKind(int kind) { + int res = 0; + + for (uint i = 0; i < getCount(); i++) { + ExCommand *ex = getExCommandByIndex(i); + + if (ex->_messageKind == kind) { + ex->_messageKind = 0; + ex->_excFlags |= 1; + + res++; + } + } + + return res; +} + MessageQueue *GlobalMessageQueueList::getMessageQueueById(int id) { for (Common::Array<MessageQueue *>::iterator s = begin(); s != end(); ++s) { if ((*s)->_id == id) @@ -883,7 +900,7 @@ void processMessages() { } void updateGlobalMessageQueue(int id, int objid) { - MessageQueue *m = g_fp->_globalMessageQueueList->getMessageQueueById(id); + MessageQueue *m = g_fp->_globalMessageQueueList->getMessageQueueById(id); if (m) { m->update(); } diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index 33bb827888..da579d58c0 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -158,6 +158,8 @@ class MessageQueue : public CObject { int calcDuration(StaticANIObject *obj); void changeParam28ForObjectId(int objId, int oldParam28, int newParam28); + + int activateExCommandsByKind(int kind); }; class GlobalMessageQueueList : public Common::Array<MessageQueue *> { diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index f52dc95a7c..603aaff026 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -755,8 +755,75 @@ ModalMainMenu::ModalMainMenu() { _field_34 = 0; } +ModalHelp::ModalHelp() { + _mainMenuScene = 0; + _bg = 0; + _isRunning = false; + _rect = g_fp->_sceneRect; + _hx = g_fp->_currentScene->_x; + _hy = g_fp->_currentScene->_y; + + g_fp->_sceneRect.left = 0; + g_fp->_sceneRect.bottom = 600; + g_fp->_sceneRect.top = 0; + g_fp->_sceneRect.right = 800; +} + +ModalHelp::~ModalHelp() { + g_fp->_gameLoader->unloadScene(SC_MAINMENU); + + g_fp->_sceneRect = _rect; + + g_fp->_currentScene->_x = _hx; + g_fp->_currentScene->_y = _hy; +} + +bool ModalHelp::handleMessage(ExCommand *cmd) { + if (cmd->_messageKind == 17) { + int msg = cmd->_messageNum; + + if (msg == 29 || msg == 36 || msg == 107) { + _isRunning = 0; + + return true; + } + } + + return false; +} + +bool ModalHelp::init(int counterdiff) { + g_fp->setCursor(PIC_CSR_DEFAULT); + + return _isRunning; +} + +void ModalHelp::update() { + g_fp->_sceneRect.left = 0; + g_fp->_sceneRect.top = 0; + g_fp->_sceneRect.right = 800; + g_fp->_sceneRect.bottom = 600; + + _bg->draw(0, 0, 0, 0); +} + +void ModalHelp::launch() { + _mainMenuScene = g_fp->accessScene(SC_MAINMENU); + + if (_mainMenuScene) { + _bg = _mainMenuScene->getPictureObjectById(PIC_HLP_BGR, 0)->_picture; + _isRunning = 1; + } +} + void FullpipeEngine::openHelp() { - warning("STUB: FullpipeEngine::openHelp()"); + if (!_modalObject) { + ModalHelp *help = new ModalHelp; + + _modalObject = help; + + help->launch(); + } } void FullpipeEngine::openMainMenu() { diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 438e341c1c..7ed433b125 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -26,6 +26,7 @@ namespace Fullpipe { class PictureObject; +class Picture; class BaseModalObject { public: @@ -161,6 +162,52 @@ public: virtual void saveload() {} }; +class ModalHelp : public BaseModalObject { +public: + Scene *_mainMenuScene; + Picture *_bg; + bool _isRunning; + Common::Rect _rect; + int _hx; + int _hy; + +public: + ModalHelp(); + virtual ~ModalHelp(); + + virtual bool pollEvent() { return true; } + virtual bool handleMessage(ExCommand *message); + virtual bool init(int counterdiff); + virtual void update(); + virtual void saveload() {} + + void launch(); +}; + +class ModalQuery : public BaseModalObject { +public: + ModalQuery(); + virtual ~ModalQuery() {} + + virtual bool pollEvent() { return true; } + virtual bool handleMessage(ExCommand *message) { return false; } + virtual bool init(int counterdiff) { return true; } + virtual void update() {} + virtual void saveload() {} +}; + +class ModalSaveGame : public BaseModalObject { +public: + ModalSaveGame(); + virtual ~ModalSaveGame() {} + + virtual bool pollEvent() { return true; } + virtual bool handleMessage(ExCommand *message) { return false; } + virtual bool init(int counterdiff) { return true; } + virtual void update() {} + virtual void saveload() {} +}; + } // End of namespace Fullpipe diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk index f6a94de421..3962fe64ba 100644 --- a/engines/fullpipe/module.mk +++ b/engines/fullpipe/module.mk @@ -33,6 +33,7 @@ MODULE_OBJS = \ scenes/scene06.o \ scenes/scene07.o \ scenes/scene08.o \ + scenes/scene09.o \ scenes/scene10.o \ scenes/scene11.o \ scenes/scene12.o \ @@ -49,7 +50,9 @@ MODULE_OBJS = \ scenes/scene24.o \ scenes/scene25.o \ scenes/scene26.o \ + scenes/scene27.o \ scenes/scene28.o \ + scenes/scene29.o \ scenes/scene30.o \ scenes/scene31.o \ scenes/scene32.o \ diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index f0318581f1..0881a19692 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -255,7 +255,7 @@ int MctlLadder::collisionDetection(StaticANIObject *man) { if ((double)(man->_oy - _ladderY) / (double)_height < 0.0) delta = -0.5; - else + else delta = 0.5; int res = (int)((double)(man->_oy - _ladderY) / (double)_height + delta); @@ -269,7 +269,7 @@ int MctlLadder::collisionDetection(StaticANIObject *man) { void MctlLadder::addObject(StaticANIObject *obj) { if (findObjectPos(obj) < 0) { MctlLadderMovement *movement = new MctlLadderMovement; - + if (initMovement(obj, movement)) { _mgm.addItem(obj->_id); _movements.push_back(movement); @@ -1693,7 +1693,7 @@ double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, } else if (linkInfoSource->link) { linkInfoWorkSource.node = linkInfoSource->link->_movGraphNode1; linkInfoWorkSource.link = 0; - + Common::Array<MovGraphLink *> tmpList; double newDistance = findMinPath(&linkInfoWorkSource, linkInfoDest, &tmpList); @@ -1709,9 +1709,9 @@ double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, linkInfoWorkSource.link = 0; linkInfoWorkSource.node = linkInfoSource->link->_movGraphNode2; - + tmpList.clear(); - + newDistance = findMinPath(&linkInfoWorkSource, linkInfoDest, &tmpList); if (newDistance >= 0 && (minDistance < 0.0 || newDistance < minDistance)) { @@ -1814,6 +1814,204 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { warning("STUB: MGM::genMovement()"); return 0; + +#if 0 + if (!mgminfo->ani) + return 0; + + mov = mgminfo->ani->_movement; + + if (!mov && !mgminfo->ani->_statics) + return 0; + + if (!(mgminfo->flags & 1)) { + if (mov) + mgminfo->staticsId1 = mov->_staticsObj2->_staticsId; + else + mgminfo->staticsId1 = mgminfo->ani->_statics->_staticsId; + } + + if (!(mgminfo->flags & 0x10) || !(mgminfo->flags & 0x20)) { + int nx = mgminfo->ani->_ox; + int ny = mgminfo->ani->_oy; + + if (mgminfo->ani->_movement) { + mgminfo->ani->calcNextStep(&point2); + nx += point2.x; + ny += point2.y; + } + + if (!(mgminfo->flags & 0x10)) + mgminfo->x2 = nx; + + if (!(mgminfo->flags & 0x20)) + mgminfo->y2 = ny; + } + + mov = mgminfo->ani->getMovementById(mgminfo->movementId); + + if (!mov) + return 0; + + itemIdx = getItemIndexById(mgminfo->ani->_id); + subIdx = getStaticsIndexById(itemIdx, mgminfo->staticsId1); + st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId); + st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId); + subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2); + + clearMovements2(itemIdx); + recalcOffsets(itemIdx, subIdx, st2idx, 0, 1); + clearMovements2(itemIdx); + recalcOffsets(itemIdx, st1idx, subOffset, 0, 1); + + v71 = (Message *)(28 * itemIdx); + v16 = items[itemIdx].objId; + v17 = *(_DWORD *)(v16 + offsetof(MGMItem, staticsListCount)); + off = *(_DWORD *)(v16 + offsetof(MGMItem, subItems)); + v18 = (MGMSubItem *)(off + 24 * (subIdx + st2idx * v17)); + x1 = (int)&v18->movement->go.CObject.vmt; + v19 = (MGMSubItem *)(off + 24 * (st1idx + subOffset * v17)); + v69 = (LONG)&v19->movement->go.CObject.vmt; + + if (subIdx != st2idx && !x1) + return 0; + + if (st1idx != subOffset && !v69) + return 0; + + int n1x = mgminfo->x1 - mgminfo->x2 - v18->x - v19->x; + int n1y = mgminfo->y1 - mgminfo->y2 - v18->y - v19->y; + + mov->calcSomeXY(&point1, 0); + + int n2x = point1.x; + int n2y = point1.y; + int mult; + + if (mgminfo->flags & 0x40) { + mult = mgminfo->field_10; + len = -1; + n2x *= mult; + n2y *= mult; + } else { + calcLength(&point, mov, n1x, n1y, &mult, &len, 1); + n2x = point.x; + n2y = point.y; + } + + if (!(mgminfo->flags & 2)) { + len = -1; + n2x = mult * point1.x; + n1x = mult * point1.x; + mgminfo->x1 = mgminfo->x2 + mult * point1.x + v18->x + v19->x; + } + + if (!(mgminfo->flags & 4)) { + n2y = mult * point1.y; + n1y = mult * point1.y; + len = -1; + mgminfo->y1 = mgminfo->y2 + mult * point1.y + v18->y + v19->y; + } + + int px = 0; + int py = 0; + + if (x1) { + px = countPhases(itemIdx, subIdx, st2idx, 1); + py = countPhases(itemIdx, subIdx, st2idx, 2); + } + + if (mult > 1) { + px += (mult - 1) * mov->countPhasesWithFlag(-1, 1); + py += (mult - 1) * mov->countPhasesWithFlag(-1, 2); + } + + if (mult > 0) { + px += mov->countPhasesWithFlag(len, 1); + py += mov->countPhasesWithFlag(len, 2); + } + + if (v69) { + px += countPhases(itemIdx, st1idx, subOffset, 1); + py += countPhases(itemIdx, st1idx, subOffset, 2); + } + + int dx1 = n1x - n2x; + int dy1 = n1y - n2y; + + if (px) { + x1 = (int)((double)dx1 / (double)px); + } else { + x1 = 0; + } + + if (py) { + y1 = (int)((double)dy1 / (double)py); + } else { + y1 = 0; + } + + y2.x = dx1 - px * x1; + y2.y = dy1 - py * y1; + + if (n1x - n2x == px * x1) + x2.x = 0; + else + x2.x = (dx1 - px * x1) / abs(dx1 - px * x1); + + if (dy1 == py * y1) + x2.y = 0; + else + x2.y = (dy1 - py * y1) / abs(dy1 - py * y1); + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand2 *ex2; + + for (v42 = subIdx; v42 != st2idx; v42 = v43->staticsIndex) { + v43 = &(*(MGMSubItem **)((char *)&this->items->subItems + (unsigned int)v71))[v42 + st2idx * *(int *)((char *)&this->items->staticsListCount + (unsigned int)v71)]; + ex2 = buildExCommand2(v43->movement, mgminfo->ani->go._id, x1, y1, &x2, &y2, -1); + ex2->_parId = mq->_id; + ex2->_keyCode = mgminfo->ani->_okeyCode; + + mq->addExCommandToEnd(ex2); + } + + for (i = 0; i < mult; ++i) { + int plen; + + if (i == mult - 1) + plen = len; + else + plen = -1; + + ex2 = buildExCommand2(mov, mgminfo->ani->_id, x1, y1, &x2, &y2, plen); + ex2->_parId = mq->_id; + ex2->_keyCode = mgminfo->ani->_okeyCode; + + mq->addExCommandToEnd(ex2); + } + + for (j = st1idx; j != subOffset; j = v50->staticsIndex) { + v50 = &(*(MGMSubItem **)((char *)&this->items->subItems + (unsigned int)v71))[j + subOffset * *(int *)((char *)&this->items->staticsListCount + (unsigned int)v71)]; + + ex2 = buildExCommand2(v50->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1); + ex2->_parId = mq->_id; + ex2->_keyCode = mgminfo->ani->_okeyCode; + + mq->addExCommandToEnd(ex2); + } + + ExCommand *ex = new ExCommand(mgminfo->ani->_id, 5, -1, mgminfo->x1, mgminfo->y1, 0, 1, 0, 0, 0); + + ex->_field_14 = mgminfo->field_1C; + ex->_keyCode = mgminfo->ani->_okeyCode; + ex->_field_24 = 0; + ex->_excFlags |= 3; + + mq->addExCommandToEnd(ex); + + return mq; +#endif } void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) { @@ -1919,34 +2117,34 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { return 0; } -Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *x1, int *y1, int flag) { +Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) { Common::Point point; mov->calcSomeXY(point, 0); int p1x = point.x; int p1y = point.y; - int newx1 = 0; - int oldy1 = *y1; + int newmult = 0; + int oldlen = *len; if (abs(p1y) > abs(p1x)) { if (mov->calcSomeXY(point, 0)->y) - newx1 = (int)((double)y / point.y); + newmult = (int)((double)y / point.y); } else if (mov->calcSomeXY(point, 0)->x) { - newx1 = (int)((double)x / point.y); + newmult = (int)((double)x / point.y); } - if (newx1 < 0) - newx1 = 0; + if (newmult < 0) + newmult = 0; - *x1 = newx1; + *mult = newmult; int phase = 1; int sz; if (flag) { if (abs(p1y) > abs(p1x)) { - while (abs(p1y * newx1 + mov->calcSomeXY(point, 0)->y) < abs(y)) { + while (abs(p1y * newmult + mov->calcSomeXY(point, 0)->y) < abs(y)) { sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); if (phase >= sz) { @@ -1958,7 +2156,7 @@ Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, phase++; } } else { - while (abs(p1x * newx1 + mov->calcSomeXY(point, 0)->x) < abs(x)) { + while (abs(p1x * newmult + mov->calcSomeXY(point, 0)->x) < abs(x)) { sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); if (phase >= sz) { @@ -1971,19 +2169,19 @@ Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, } } - *y1 = phase - 1; + *len = phase - 1; } else { - *y1 = -1; + *len = -1; } int p2x = 0; int p2y = 0; - if (!oldy1) - oldy1 = -1; + if (!oldlen) + oldlen = -1; - if (oldy1 > 0) { - ++*x1; + if (oldlen > 0) { + ++*mult; mov->calcSomeXY(point, 0); p2x = point.x; @@ -1995,8 +2193,8 @@ Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, p2y = p1y; } - pRes->x = p2x + p1x * newx1; - pRes->y = p2y + p1y * newx1; + pRes->x = p2x + p1x * newmult; + pRes->y = p2y + p1y * newmult; return pRes; } diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 6ad46e719a..a9695e8094 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -176,7 +176,7 @@ public: int getStaticsIndex(int idx, Statics *st); void clearMovements2(int idx); int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop); - Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *x1, int *y1, int flag); + Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag); ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len); }; diff --git a/engines/fullpipe/objectnames.h b/engines/fullpipe/objectnames.h index eafdb2a8e7..0baf83b175 100644 --- a/engines/fullpipe/objectnames.h +++ b/engines/fullpipe/objectnames.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -192,7 +192,7 @@ namespace Fullpipe { #define sO_WithPlunger "\xd1 \xe2\xe0\xed\xf2\xf3\xe7\xee\xec" // "С вантузом" #define sO_WithJug "\xd1 \xe3\xee\xf0\xf8\xea\xee\xec" // "С горшком" #define sO_WithGum "\xd1 \xe6\xe2\xe0\xf7\xea\xee\xe9" // "С жвачкой" -#define sO_WithShovel "\xd1 \xeb\xee\xef\xe0\xf2\xee\xe9" // "С лопатой" +#define sO_WithSpade "\xd1 \xeb\xee\xef\xe0\xf2\xee\xe9" // "С лопатой" #define sO_WithSmall "\xd1 \xec\xe0\xeb\xfb\xec" // "С малым" #define sO_WithHammer "\xd1 \xec\xee\xeb\xee\xf2\xea\xee\xec" // "С молотком" #define sO_WithCoin "\xd1 \xec\xee\xed\xe5\xf2\xee\xe9" // "С монетой" @@ -208,9 +208,9 @@ namespace Fullpipe { #define sO_IsSitting "\xd1\xe8\xe4\xe8\xf2" // "Сидит" #define sO_IsLaughing "\xd1\xec\xe5\xe5\xf2\xf1\xff" // "Смеется" #define sO_WithAll "\xd1\xee \xe2\xf1\xe5\xec\xe8" // "Со всеми" -#define sO_WithMop "\xd1\xee \xf8\xe2\xe0\xe1\xf0\xee\xe9" // "Со шваброй" +#define sO_WithSwab "\xd1\xee \xf8\xe2\xe0\xe1\xf0\xee\xe9" // "Со шваброй" #define sO_WithHose "\xd1\xee \xf8\xeb\xe0\xed\xe3\xee\xec" // "Со шлангом" -#define sO_WithBrush "\xd1\xee \xf9\xe5\xf2\xea\xee\xe9" // "Со щеткой" +#define sO_WithBroom "\xd1\xee \xf9\xe5\xf2\xea\xee\xe9" // "Со щеткой" #define sO_IsSleeping "\xd1\xef\xe8\xf2" // "Спит" #define sO_OnRight "\xd1\xef\xf0\xe0\xe2\xe0" // "Справа" #define sO_IsStandingInBoots "\xd1\xf2\xee\xe8\xf2 \xe2 \xe1\xee\xf2\xe8\xed\xea\xe0\xf5" // "Стоит в ботинках" @@ -229,7 +229,7 @@ namespace Fullpipe { #define sO_NearPipeWithStool "\xd3 \xf2\xf0\xf3\xe1\xfb \xf1 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xee\xe9" // "У трубы с табуреткой" #define sO_NearPipe "\xd3 \xf2\xf0\xf3\xe1\xfb" // "У трубы" #define sO_Janitors "\xd3\xe1\xee\xf0\xf9\xe8\xea\xe8" // "Уборщики" -#define sO_Janitress "\xd3\xe1\xee\xf0\xf9\xe8\xf6\xe0" // "Уборщица" +#define sO_Maid "\xd3\xe1\xee\xf0\xf9\xe8\xf6\xe0" // "Уборщица" #define sO_IsGone "\xd3\xe5\xf5\xe0\xeb\xe0" // "Уехала" #define sO_FallenTwice "\xd3\xef\xe0\xeb \xe4\xe2\xe0" // "Упал два" #define sO_FallenOnce "\xd3\xef\xe0\xeb \xf0\xe0\xe7" // "Упал раз" diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h index d13559429a..1849bcb96e 100644 --- a/engines/fullpipe/objects.h +++ b/engines/fullpipe/objects.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 997d92ae1c..462401b3b2 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -334,6 +334,10 @@ void Scene::setPictureObjectsFlag4() { } } +void Scene::stopAllSounds() { + warning("STUB: Scene:stopAllSounds()"); +} + PictureObject *Scene::getPictureObjectById(int objId, int flags) { for (uint i = 0; i < _picObjList.size(); i++) { if (((PictureObject *)_picObjList[i])->_id == objId && ((PictureObject *)_picObjList[i])->_okeyCode == flags) diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index fc04a877f5..8306974f7b 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -78,6 +78,8 @@ class Scene : public Background { void initObjectCursors(const char *name); + void stopAllSounds(); + private: static bool compareObjPriority(const void *p1, const void *p2); void objectList_sortByPriority(PtrList &list, bool skipFirst = false); diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 71c8b1efb5..3fe8704d3b 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -31,6 +31,7 @@ #include "fullpipe/behavior.h" #include "fullpipe/constants.h" +#include "fullpipe/objectnames.h" #include "fullpipe/scenes.h" #include "fullpipe/interaction.h" @@ -155,6 +156,28 @@ Vars::Vars() { scene08_stairsVisible = true; scene08_manOffsetY = 0; + scene09_flyingBall = 0; + scene09_numSwallenBalls = 0; + scene09_gulper = 0; + scene09_spitter = 0; + scene09_grit = 0; + scene09_dudeY = 0; + scene09_gulperIsPresent = true; + scene09_dudeIsOnLadder = false; + scene09_interactingHanger = -1; + scene09_intHangerPhase = -1; + scene09_intHangerMaxPhase = -1000; + scene09_numMovingHangers = 0; + scene09_clickY = 0; + scene09_hangerOffsets[0].x = 0; + scene09_hangerOffsets[0].y = -15; + scene09_hangerOffsets[1].x = 15; + scene09_hangerOffsets[1].y = 0; + scene09_hangerOffsets[2].x = 0; + scene09_hangerOffsets[2].y = 0; + scene09_hangerOffsets[3].x = 0; + scene09_hangerOffsets[3].y = 0; + scene10_gum = 0; scene10_packet = 0; scene10_packet2 = 0; @@ -247,7 +270,38 @@ Vars::Vars() { scene17_handPhase = false; scene17_sceneEdgeX = 0; - scene18_var01 = 0; + scene18_inScene18p1 = false; + scene18_whirlgig = 0; + scene18_wheelCenterX = 0; + scene18_wheelCenterY = 0; + scene18_bridgeIsConvoluted = false; + scene18_whirlgigMovMum = 0; + scene18_girlIsSwinging = false; + scene18_rotationCounter = 0; + scene18_manY = 0; + scene18_wheelFlipper = false; + scene18_wheelIsTurning = true; + scene18_kidIsOnWheel = -1; + scene18_boyIsOnWheel = 0; + scene18_girlIsOnWheel = 0; + scene18_boyJumpedOff = true; + scene18_jumpDistance = -1; + scene18_jumpAngle = -1; + scene18_manIsReady = false; + scene18_enteredTrubaRight = false; + scene18_manWheelPos = 0; + scene18_manWheelPosTo = -1; + scene18_kidWheelPos = 0; + scene18_kidWheelPosTo = 0; + scene18_boy = 0; + scene18_girl = 0; + scene18_domino = 0; + scene18_boyJumpX = 290; + scene18_boyJumpY = -363; + scene18_girlJumpX = 283; + scene18_girlJumpY = -350; + + scene19_enteredTruba3 = false; scene20_fliesCountdown = 0; scene20_grandma = 0; @@ -300,6 +354,22 @@ Vars::Vars() { scene26_sock = 0; scene26_activeVent = 0; + scene27_hitZone = 0; + scene27_driver = 0; + scene27_maid = 0; + scene27_batHandler = 0; + scene27_driverHasVent = true; + scene27_bat = 0; + scene27_dudeIsAiming = false; + scene27_maxPhaseReached = false; + scene27_wipeIsNeeded = false; + scene27_driverPushedButton = false; + scene27_numLostBats = 0; + scene27_knockCount = 0; + scene27_aimStartX = 0; + scene27_aimStartY = 0; + scene27_launchPhase = 0; + scene28_fliesArePresent = true; scene28_beardedDirection = true; scene28_darkeningObject = 0; @@ -308,6 +378,27 @@ Vars::Vars() { scene28_headBeardedFlipper = false; scene28_lift6inside = false; + scene29_var01 = 0; + scene29_var02 = 0; + scene29_var03 = 0; + scene29_var04 = 0; + scene29_porter = 0; + scene29_shooter1 = 0; + scene29_shooter2 = 0; + scene29_ass = 0; + scene29_var09 = 0; + scene29_var10 = 0; + scene29_var11 = 0; + scene29_var12 = 0; + scene29_var13 = 0; + scene29_var14 = 75; + scene29_var15 = 0; + scene29_var16 = 0; + scene29_var17 = 0; + scene29_var18 = 0; + scene29_var20 = 0; + scene29_var21 = 0; + scene30_leg = 0; scene30_liftFlag = 1; @@ -618,7 +709,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene08_updateCursor; break; -#if 0 case SC_9: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_9"); scene->preloadMovements(sceneVar); @@ -629,7 +719,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { insertMessageHandler(sceneHandler09, 2, 2); _updateCursorCallback = scene09_updateCursor; break; -#endif case SC_10: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_10"); @@ -722,16 +811,17 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene17_updateCursor; break; -#if 0 case SC_18: - sub_40E1B0(); + scene18_setupEntrance(); sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_18"); scene->preloadMovements(sceneVar); - sub_4062D0(); - if (dword_476C38) + g_fp->stopAllSounds(); + + if (g_vars->scene18_inScene18p1) scene18_initScene1(scene); else scene18_initScene2(scene); + _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_18"); setSceneMusicParameters(sceneVar); @@ -740,30 +830,34 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { break; case SC_19: - if (!g_scene3) { - g_scene3 = accessScene(SC_18); - getGameLoader()->loadScene(SC_18); - scene18_initScene2(g_scene3); - sub_40C5F0(); - scene19_sub_420B10(g_scene3, entrance->field_4); - dword_476C38 = 1; + if (!g_fp->_scene3) { + g_fp->_scene3 = accessScene(SC_18); + g_fp->_gameLoader->loadScene(SC_18); + + scene18_initScene2(g_fp->_scene3); + scene18_preload(); + scene19_setMovements(g_fp->_scene3, entrance->_field_4); + + g_vars->scene18_inScene18p1 = true; } - sub_40C650(); + + scene19_preload(); sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_19"); scene->preloadMovements(sceneVar); - sub_4062D0(); - if (dword_476C38) + g_fp->stopAllSounds(); + + if (g_vars->scene18_inScene18p1) scene18_initScene1(scene); else scene19_initScene2(); + _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_19"); setSceneMusicParameters(sceneVar); addMessageHandler(sceneHandler19, 2); - scene19_sub_4211D0(scene); + scene19_setSugarState(scene); _updateCursorCallback = scene19_updateCursor; break; -#endif case SC_20: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_20"); @@ -847,7 +941,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene26_updateCursor; break; -#if 0 case SC_27: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_27"); scene->preloadMovements(sceneVar); @@ -858,7 +951,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { addMessageHandler(sceneHandler27, 2); _updateCursorCallback = scene27_updateCursor; break; -#endif case SC_28: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_28"); @@ -871,7 +963,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene28_updateCursor; break; -#if 0 case SC_29: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_29"); scene->preloadMovements(sceneVar); @@ -882,7 +973,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { addMessageHandler(sceneHandler29, 2); _updateCursorCallback = scene29_updateCursor; break; -#endif case SC_30: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_30"); @@ -1211,7 +1301,7 @@ void FullpipeEngine::updateMap(PreloadItem *pre) { break; case SC_23: - if (getObjectState("Верхний люк_23") == getObjectEnumState("Верхний люк_23", "Открыт")) { + if (getObjectState(sO_UpperHatch_23) == getObjectEnumState(sO_UpperHatch_23, sO_Opened)) { updateMapPiece(PIC_MAP_S23_1, 0); updateMapPiece(PIC_MAP_S23_2, 1); updateMapPiece(PIC_MAP_P07, 1); @@ -1284,7 +1374,7 @@ void FullpipeEngine::updateMap(PreloadItem *pre) { case SC_31: updateMapPiece(PIC_MAP_S31_2, 1); - if (getObjectState("Кактус") == getObjectEnumState("Кактус", "Вырос")) + if (getObjectState(sO_Cactus) == getObjectEnumState(sO_Cactus, sO_HasGrown)) updateMapPiece(PIC_MAP_S31_1, 1); if (pre->keyCode == TrubaRight) @@ -1295,7 +1385,7 @@ void FullpipeEngine::updateMap(PreloadItem *pre) { case SC_32: updateMapPiece(PIC_MAP_S32_2, 1); - if (getObjectState("Кактус") == getObjectEnumState("Кактус", "Вырос")) + if (getObjectState(sO_Cactus) == getObjectEnumState(sO_Cactus, sO_HasGrown)) updateMapPiece(PIC_MAP_S32_1, 1); break; @@ -1356,5 +1446,28 @@ void FullpipeEngine::updateMap(PreloadItem *pre) { } } +void BallChain::init(Ball **ball) { + *ball = pTail; + pTail = (Ball *)ball; + numBalls--; + + if (!numBalls) { + for (Ball *i = pHead; i; i = i->p0 ) + ; + numBalls = 0; + pTail = 0; + field_8 = 0; + pHead = 0; + free(cPlex); + cPlex = 0; + } +} + +Ball *BallChain::sub04(Ball *ballP, Ball *ballN) { + warning("STUB: BallChain::sub04"); + + return pTail; +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h index 5f77f74706..ef6af54c0f 100644 --- a/engines/fullpipe/scenes.h +++ b/engines/fullpipe/scenes.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -25,11 +25,15 @@ namespace Fullpipe { +struct Bat; struct BehaviorEntryInfo; +struct Hanger; class MGM; class MctlLadder; struct Ring; class StaticANIObject; +struct Swinger; +struct WalkingBearder; int defaultUpdateCursor(); @@ -69,6 +73,10 @@ void scene08_setupMusic(); int sceneHandler08(ExCommand *cmd); int scene08_updateCursor(); +int scene09_updateCursor(); +void scene09_initScene(Scene *sc); +int sceneHandler09(ExCommand *cmd); + void scene10_initScene(Scene *sc); int sceneHandler10(ExCommand *cmd); int scene10_updateCursor(); @@ -103,7 +111,19 @@ int sceneHandler17(ExCommand *cmd); int scene17_updateCursor(); void scene18_preload(); -void scene19_preload(Scene *sc, int key); +void scene18_setupEntrance(); +void scene18_initScene1(Scene *sc); +void scene18_initScene2(Scene *sc); +int sceneHandler18(ExCommand *cmd); +int scene18_updateCursor(); + +void scene19_preload(); +void scene19_setMovements(Scene *sc, int entranceId); +void scene19_initScene2(); +void scene19_setMovements(Scene *sc, int key); +int sceneHandler19(ExCommand *cmd); +int scene19_updateCursor(); +void scene19_setSugarState(Scene *sc); void scene20_initScene(Scene *sc); int sceneHandler20(ExCommand *ex); @@ -136,10 +156,18 @@ void scene26_setupDrop(Scene *sc); int sceneHandler26(ExCommand *cmd); int scene26_updateCursor(); +void scene27_initScene(Scene *sc); +int sceneHandler27(ExCommand *ex); +int scene27_updateCursor(); + void scene28_initScene(Scene *sc); - int sceneHandler28(ExCommand *ex); +int sceneHandler28(ExCommand *ex); int scene28_updateCursor(); +int scene29_updateCursor(); +void scene29_initScene(Scene *sc); +int sceneHandler29(ExCommand *cmd); + int scene30_updateCursor(); void scene30_initScene(Scene *sc, int flag); int sceneHandler30(ExCommand *cmd); @@ -183,6 +211,30 @@ int sceneHandlerFinal(ExCommand *cmd); void sceneDbgMenu_initScene(Scene *sc); int sceneHandlerDbgMenu(ExCommand *cmd); +struct Ball { + Ball *p0; + Ball *p1; + StaticANIObject *ani; + + Ball() : p0(0), p1(0), ani(0) {} +}; + +struct BallChain { + Ball *pHead; + Ball *field_8; + int numBalls; + Ball *pTail; + byte *cPlex; + int cPlexLen; + + BallChain() : pHead(0), field_8(0), pTail(0), numBalls(0), cPlex(0), cPlexLen(0) {} + ~BallChain() { free(cPlex); } + + void init(Ball **ball); + Ball *sub04(Ball *ballP, Ball *ballN); + void reset() { pHead = 0; pTail = 0; field_8 = 0; numBalls = 0; free(cPlex); cPlex = 0; cPlexLen = 0; } +}; + class Vars { public: Vars(); @@ -314,6 +366,24 @@ public: bool scene08_stairsVisible; int scene08_manOffsetY; + int scene09_dudeY; + StaticANIObject *scene09_flyingBall; + int scene09_numSwallenBalls; + StaticANIObject *scene09_gulper; + StaticANIObject *scene09_spitter; + StaticANIObject *scene09_grit; + bool scene09_gulperIsPresent; + bool scene09_dudeIsOnLadder; + int scene09_interactingHanger; + int scene09_intHangerPhase; + int scene09_intHangerMaxPhase; + BallChain scene09_balls; + Common::Array<Hanger *> scene09_hangers; + BallChain scene09_flyingBalls; + int scene09_numMovingHangers; + int scene09_clickY; + Common::Point scene09_hangerOffsets[4]; + StaticANIObject *scene10_gum; StaticANIObject *scene10_packet; StaticANIObject *scene10_packet2; @@ -408,7 +478,39 @@ public: bool scene17_handPhase; int scene17_sceneEdgeX; - int scene18_var01; + bool scene18_inScene18p1; + StaticANIObject *scene18_whirlgig; + Common::Array<Swinger *> scene18_swingers; + int scene18_wheelCenterX; + int scene18_wheelCenterY; + bool scene18_bridgeIsConvoluted; + int scene18_whirlgigMovMum; + bool scene18_girlIsSwinging; + int scene18_rotationCounter; + int scene18_manY; + bool scene18_wheelFlipper; + bool scene18_wheelIsTurning; + int scene18_kidIsOnWheel; + int scene18_boyIsOnWheel; + int scene18_girlIsOnWheel; + bool scene18_boyJumpedOff; + int scene18_manWheelPos; + int scene18_manWheelPosTo; + int scene18_kidWheelPos; + int scene18_kidWheelPosTo; + int scene18_jumpDistance; + int scene18_jumpAngle; + bool scene18_manIsReady; + bool scene18_enteredTrubaRight; + StaticANIObject *scene18_boy; + StaticANIObject *scene18_girl; + StaticANIObject *scene18_domino; + int scene18_boyJumpX; + int scene18_boyJumpY; + int scene18_girlJumpX; + int scene18_girlJumpY; + + bool scene19_enteredTruba3; int scene20_fliesCountdown; StaticANIObject *scene20_grandma; @@ -461,6 +563,25 @@ public: StaticANIObject *scene26_sock; StaticANIObject *scene26_activeVent; + PictureObject *scene27_hitZone; + StaticANIObject *scene27_driver; + StaticANIObject *scene27_maid; + StaticANIObject *scene27_batHandler; + bool scene27_driverHasVent; + StaticANIObject *scene27_bat; + bool scene27_dudeIsAiming; + bool scene27_maxPhaseReached; + bool scene27_wipeIsNeeded; + bool scene27_driverPushedButton; + int scene27_numLostBats; + int scene27_knockCount; + int scene27_aimStartX; + int scene27_aimStartY; + int scene27_launchPhase; + BallChain scene27_balls; + Common::Array<Bat *> scene27_bats; + Common::Array<Bat *> scene27_var07; + bool scene28_fliesArePresent; bool scene28_beardedDirection; PictureObject *scene28_darkeningObject; @@ -469,6 +590,33 @@ public: bool scene28_headBeardedFlipper; bool scene28_lift6inside; + int scene29_var01; + int scene29_var02; + int scene29_var03; + int scene29_var04; + StaticANIObject *scene29_porter; + StaticANIObject *scene29_shooter1; + StaticANIObject *scene29_shooter2; + StaticANIObject *scene29_ass; + BallChain scene29_var05; + BallChain scene29_var06; + BallChain scene29_var07; + BallChain scene29_var08; + int scene29_var09; + int scene29_var10; + int scene29_var11; + int scene29_var12; + int scene29_var13; + int scene29_var14; + int scene29_var15; + int scene29_var16; + int scene29_var17; + int scene29_var18; + Common::Array<WalkingBearder *> scene29_var19; + int scene29_var20; + int scene29_var21; + MGM scene29_mgm; + StaticANIObject *scene30_leg; int scene30_liftFlag; diff --git a/engines/fullpipe/scenes/scene01.cpp b/engines/fullpipe/scenes/scene01.cpp index 6c8f26d209..e24eb1fa45 100644 --- a/engines/fullpipe/scenes/scene01.cpp +++ b/engines/fullpipe/scenes/scene01.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene02.cpp b/engines/fullpipe/scenes/scene02.cpp index 95cf1df7dd..109a20a07a 100644 --- a/engines/fullpipe/scenes/scene02.cpp +++ b/engines/fullpipe/scenes/scene02.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene03.cpp b/engines/fullpipe/scenes/scene03.cpp index 9ba84a540a..e6c9fa3bbd 100644 --- a/engines/fullpipe/scenes/scene03.cpp +++ b/engines/fullpipe/scenes/scene03.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -239,14 +239,14 @@ int sceneHandler03(ExCommand *ex) { break; case 64: - g_fp->lift_sub05(ex); + g_fp->lift_hoverButton(ex); break; case 29: { 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/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp index 332935072c..b47553ef6f 100644 --- a/engines/fullpipe/scenes/scene04.cpp +++ b/engines/fullpipe/scenes/scene04.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -263,8 +263,8 @@ void sceneHandler04_clickButton() { StaticANIObject *but = g_fp->_currentScene->getStaticANIObject1ById(ANI_BUTTON, -1); if (but) { - if (!g_vars->scene04_clock->_movement || - (g_vars->scene04_clock->_movement->_id == MV_CLK_GO && g_vars->scene04_clock->_movement->_currDynamicPhaseIndex > 3 && + if (!g_vars->scene04_clock->_movement || + (g_vars->scene04_clock->_movement->_id == MV_CLK_GO && g_vars->scene04_clock->_movement->_currDynamicPhaseIndex > 3 && g_vars->scene04_clock->_movement->_currDynamicPhaseIndex < 105)) { if (!g_vars->scene04_hand->_movement && !g_vars->scene04_bottleIsTaken) { but->startAnim(MV_BTN_CLICK, 0, -1); @@ -1196,7 +1196,7 @@ void sceneHandler04_takeBottle() { void sceneHandler04_takeKozyawka() { if (g_vars->scene04_kozyawkiAni.size() > 0) { - if (g_vars->scene04_kozyawkiAni.size() == 1) + if (g_vars->scene04_kozyawkiAni.size() == 1) g_vars->scene04_objectIsTaken = true; StaticANIObject *koz = g_vars->scene04_kozyawkiAni.front(); @@ -1284,7 +1284,7 @@ int sceneHandler04(ExCommand *ex) { case MSG_UPDATEBOTTLE: sceneHandler04_updateBottle(); break; - + case MSG_CLICKBOTTLE: sceneHandler04_clickBottle(); break; @@ -1486,7 +1486,7 @@ int sceneHandler04(ExCommand *ex) { case MSG_SC4_DROPBOTTLE: sceneHandler04_dropBottle(); break; - + case MSG_SC4_COINOUT: g_vars->scene04_clock->changeStatics2(ST_CLK_CLOSED); g_vars->scene04_coinPut = false; diff --git a/engines/fullpipe/scenes/scene05.cpp b/engines/fullpipe/scenes/scene05.cpp index c6e21daf1e..8864794691 100644 --- a/engines/fullpipe/scenes/scene05.cpp +++ b/engines/fullpipe/scenes/scene05.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -123,7 +123,7 @@ void sceneHandler05_makeWackoFeedback() { } void sceneHandler05_resetTicks() { - if (g_fp->_aniMan->_movement && (g_fp->_aniMan->_movement->_id == MV_MANHDL_HANDLEUP + if (g_fp->_aniMan->_movement && (g_fp->_aniMan->_movement->_id == MV_MANHDL_HANDLEUP || g_fp->_aniMan->_movement->_id == MV_MANHDL_HANDLEDOWN)) g_vars->scene05_wackoTicker = g_fp->_updateTicks; else @@ -312,7 +312,7 @@ int sceneHandler05(ExCommand *ex) { break; case MSG_SC5_MAKEOTMFEEDBACK: - if (!g_fp->_aniMan->_movement || (g_fp->_aniMan->_movement->_id != MV_MANHDL_HANDLEUP + if (!g_fp->_aniMan->_movement || (g_fp->_aniMan->_movement->_id != MV_MANHDL_HANDLEUP && g_fp->_aniMan->_movement->_id != MV_MANHDL_HANDLEDOWN)) { sceneHandler05_makeWackoFeedback(); g_vars->scene05_wackoTicker = 0; @@ -341,7 +341,7 @@ int sceneHandler05(ExCommand *ex) { sceneHandler05_testHatch(ex); break; - case 33: + case 33: { int res = 0; if (g_fp->_aniMan2) { @@ -356,7 +356,7 @@ int sceneHandler05(ExCommand *ex) { if (g_vars->scene05_wackoTicker) { if ((g_fp->_updateTicks - g_vars->scene05_wackoTicker) > 62) { - if (!g_fp->_aniMan->_movement || (g_fp->_aniMan->_movement->_id != MV_MANHDL_HANDLEUP + if (!g_fp->_aniMan->_movement || (g_fp->_aniMan->_movement->_id != MV_MANHDL_HANDLEUP && g_fp->_aniMan->_movement->_id != MV_MANHDL_HANDLEDOWN)) { if (g_vars->scene05_handleFlipper % 2) sceneHandler05_makeWackoFeedback(); diff --git a/engines/fullpipe/scenes/scene06.cpp b/engines/fullpipe/scenes/scene06.cpp index 7d637d8306..d54ebf4514 100644 --- a/engines/fullpipe/scenes/scene06.cpp +++ b/engines/fullpipe/scenes/scene06.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -622,7 +622,7 @@ int sceneHandler06(ExCommand *ex) { break; case 64: - g_fp->lift_sub05(ex); + g_fp->lift_hoverButton(ex); break; case MSG_SC6_TAKEBALL: @@ -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; } @@ -671,7 +671,7 @@ int sceneHandler06(ExCommand *ex) { if (!pic || !canInteractAny(g_fp->_aniMan, pic, ex->_keyCode)) { if ((g_fp->_sceneRect.right - ex->_sceneClickX < 47 - && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) || (ex->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) { g_fp->processArcade(ex); return 0; diff --git a/engines/fullpipe/scenes/scene07.cpp b/engines/fullpipe/scenes/scene07.cpp index 207189d151..6db8c30932 100644 --- a/engines/fullpipe/scenes/scene07.cpp +++ b/engines/fullpipe/scenes/scene07.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene08.cpp b/engines/fullpipe/scenes/scene08.cpp index 716ca1f593..a5f5a8b389 100644 --- a/engines/fullpipe/scenes/scene08.cpp +++ b/engines/fullpipe/scenes/scene08.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene09.cpp b/engines/fullpipe/scenes/scene09.cpp new file mode 100644 index 0000000000..99cf0b20fd --- /dev/null +++ b/engines/fullpipe/scenes/scene09.cpp @@ -0,0 +1,747 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +struct Hanger { + StaticANIObject *ani; + int field_4; + int field_8; + int phase; +}; + +void scene09_setupGrit(Scene *sc) { + if (g_vars->scene09_grit->_statics->_staticsId == ST_GRT9_GRIT) { + if (!getGameLoaderInventory()->getCountItemsWithId(ANI_INV_COIN)) { + if (g_fp->getObjectState(sO_CoinSlot_1) == g_fp->getObjectEnumState(sO_CoinSlot_1, sO_Empty) + && (g_vars->swallowedEgg1->_value.intValue == ANI_INV_EGGBOOT || g_vars->swallowedEgg2->_value.intValue == ANI_INV_EGGBOOT || g_vars->swallowedEgg3->_value.intValue == ANI_INV_EGGBOOT)) { + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + g_vars->scene09_grit->changeStatics2(ST_GRT9_NORM); + g_fp->_currentScene = oldsc; + } + } + } +} + +void scene09_initScene(Scene *sc) { + g_vars->scene09_flyingBall = 0; + g_vars->scene09_numSwallenBalls = 0; + g_vars->scene09_gulper = sc->getStaticANIObject1ById(ANI_GLOTATEL, -1); + g_vars->scene09_spitter = sc->getStaticANIObject1ById(ANI_PLEVATEL, -1); + g_vars->scene09_grit = sc->getStaticANIObject1ById(ANI_GRIT_9, -1); + g_vars->scene09_gulperIsPresent = true; + g_vars->scene09_dudeIsOnLadder = false; + g_vars->scene09_interactingHanger = -1; + g_vars->scene09_intHangerPhase = -1; + g_vars->scene09_intHangerMaxPhase = -1000; + + g_vars->scene09_balls.cPlexLen = 10; + g_vars->scene09_flyingBalls.cPlexLen = 10; + + while (g_vars->scene09_balls.numBalls) { + Ball *b = g_vars->scene09_balls.pHead->p0; + + g_vars->scene09_balls.pHead = g_vars->scene09_balls.pHead->p0; + + if (g_vars->scene09_balls.pHead) + g_vars->scene09_balls.pHead->p0->p1 = 0; + else + g_vars->scene09_balls.field_8 = 0; + + g_vars->scene09_balls.init(&b); + } + + g_vars->scene09_hangers.clear(); + g_vars->scene09_numMovingHangers = 4; + + StaticANIObject *hanger = sc->getStaticANIObject1ById(ANI_VISUNCHIK, -1); + Hanger *hng = new Hanger; + + hng->ani = hanger; + hng->phase = 0; + hng->field_4 = 0; + hng->field_8 = 0; + + g_vars->scene09_hangers.push_back(hng); + + int x = 75; + + for (int i = 1; x < 300; i++, x += 75) { + StaticANIObject *ani = new StaticANIObject(hanger); + + ani->show1(x + hanger->_ox, hanger->_oy, MV_VSN_CYCLE2, 0); + sc->addStaticANIObject(hanger, 1); + + hng = new Hanger; + + hng->ani = ani; + hng->phase = 0; + hng->field_4 = 0; + hng->field_8 = 0; + + g_vars->scene09_hangers.push_back(hng); + } + + while (g_vars->scene09_flyingBalls.numBalls) { + Ball *ohead = g_vars->scene09_flyingBalls.pHead; + + g_vars->scene09_flyingBalls.pHead = g_vars->scene09_flyingBalls.pHead->p0; + + if (g_vars->scene09_flyingBalls.pHead) + ohead->p0->p1 = 0; + else + g_vars->scene09_flyingBalls.field_8 = 0; + + ohead->p0 = g_vars->scene09_flyingBalls.pTail; + + g_vars->scene09_flyingBalls.pTail = ohead; + + g_vars->scene09_flyingBalls.numBalls--; + } + + g_vars->scene09_flyingBalls.reset(); + + Ball *b9 = g_vars->scene09_flyingBalls.sub04(g_vars->scene09_flyingBalls.field_8, 0); + + b9->ani = sc->getStaticANIObject1ById(ANI_BALL9, -1); + b9->ani->setAlpha(0xc8); + + if (g_vars->scene09_flyingBalls.field_8) { + g_vars->scene09_flyingBalls.field_8->p0 = b9; + g_vars->scene09_flyingBalls.field_8 = b9; + } else { + g_vars->scene09_flyingBalls.pHead = b9; + g_vars->scene09_flyingBalls.field_8 = b9; + } + + for (int i = 0; i < 4; i++) { + StaticANIObject *newball = new StaticANIObject(b9->ani); + + newball->setAlpha(0xc8); + + Ball *runPtr = g_vars->scene09_flyingBalls.pTail; + Ball *lastP = g_vars->scene09_flyingBalls.field_8; + + if (!g_vars->scene09_flyingBalls.pTail) { + g_vars->scene09_flyingBalls.cPlex = (byte *)calloc(g_vars->scene09_flyingBalls.cPlexLen, sizeof(Ball)); + + byte *p1 = g_vars->scene09_flyingBalls.cPlex + (g_vars->scene09_flyingBalls.cPlexLen - 1) * sizeof(Ball); + + if (g_vars->scene09_flyingBalls.cPlexLen - 1 < 0) { + runPtr = g_vars->scene09_flyingBalls.pTail; + } else { + runPtr = g_vars->scene09_flyingBalls.pTail; + + for (int j = 0; j < g_vars->scene09_flyingBalls.cPlexLen; j++) { + ((Ball *)p1)->p1 = runPtr; + runPtr = (Ball *)p1; + + p1 -= sizeof(Ball); + } + + g_vars->scene09_flyingBalls.pTail = runPtr; + } + } + + g_vars->scene09_flyingBalls.pTail = runPtr->p0; + runPtr->p1 = lastP; + runPtr->p0 = 0; + runPtr->ani = newball; + + g_vars->scene09_flyingBalls.numBalls++; + + if (g_vars->scene09_flyingBalls.field_8) + g_vars->scene09_flyingBalls.field_8->p0 = runPtr; + else + g_vars->scene09_flyingBalls.pHead = runPtr; + + g_vars->scene09_flyingBalls.field_8 = runPtr; + + sc->addStaticANIObject(newball, 1); + } + + g_fp->setObjectState(sO_RightStairs_9, g_fp->getObjectEnumState(sO_RightStairs_9, sO_IsClosed)); + + GameVar *eggvar = g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName(sO_GulpedEggs); + + g_vars->swallowedEgg1 = eggvar->getSubVarByName(sO_Egg1); + g_vars->swallowedEgg2 = eggvar->getSubVarByName(sO_Egg2); + g_vars->swallowedEgg3 = eggvar->getSubVarByName(sO_Egg3); + + scene09_setupGrit(sc); + + g_fp->initArcadeKeys("SC_9"); + + g_fp->lift_setButton(sO_Level1, ST_LBN_1N); + + g_fp->setArcadeOverlay(PIC_CSR_ARCADE4); +} + +int sceneHandler09_updateScreenCallback() { + int res = g_fp->drawArcadeOverlay(g_fp->_objectIdAtCursor == ANI_VISUNCHIK || g_vars->scene09_interactingHanger >= 0); + + if (!res) + g_fp->_updateScreenCallback = 0; + + return res; +} + +int scene09_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_vars->scene09_interactingHanger < 0) { + if (g_fp->_objectIdAtCursor == ANI_VISUNCHIK) { + if (g_fp->_cursorId == PIC_CSR_ITN) + g_fp->_updateScreenCallback = sceneHandler09_updateScreenCallback; + } else { + if (g_fp->_objectIdAtCursor == PIC_SC9_LADDER_R && g_fp->_cursorId == PIC_CSR_ITN) + g_fp->_cursorId = (g_vars->scene09_dudeY < 350) ? PIC_CSR_GOD : PIC_CSR_GOU; + } + } else { + g_fp->_cursorId = PIC_CSR_ITN; + } + + return g_fp->_cursorId; +} + +void sceneHandler09_winArcade() { + if (g_vars->scene09_gulper->_flags & 4) { + g_vars->scene09_gulper->changeStatics2(ST_GLT_SIT); + g_vars->scene09_gulper->startAnim(MV_GLT_FLYAWAY, 0, -1); + + g_fp->setObjectState(sO_Jug, g_fp->getObjectEnumState(sO_Jug, sO_Unblocked)); + g_fp->setObjectState(sO_RightStairs_9, g_fp->getObjectEnumState(sO_RightStairs_9, sO_IsOpened)); + + g_vars->scene09_gulperIsPresent = false; + } +} + +void sceneHandler09_startAuntie() { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_TTA9_GOL), 0, 1); + + mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.right + 30; + mq->chain(0); +} + +void sceneHandler09_spitterClick() { + if (g_vars->scene09_spitter->_flags & 4) { + PicAniInfo info; + + g_vars->scene09_spitter->getPicAniInfo(&info); + g_vars->scene09_spitter->_messageQueueId = 0; + g_vars->scene09_spitter->changeStatics2(ST_PLV_SIT); + + int x = g_vars->scene09_spitter->_ox - 10; + int y = g_vars->scene09_spitter->_oy + 145; + + g_vars->scene09_spitter->setPicAniInfo(&info); + + if (ABS(x - g_fp->_aniMan->_ox) > 1 || ABS(y - g_fp->_aniMan->_oy) > 1) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_UP); + + if (mq) { + ExCommand *ex = new ExCommand(0, 17, MSG_SC9_PLVCLICK, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags = 2; + mq->addExCommandToEnd(ex); + + postExCommand(g_fp->_aniMan->_id, 2, x, y, 0, -1); + } + } else { + if (!g_fp->_aniMan->_movement) { + g_vars->scene09_spitter->changeStatics2(ST_PLV_SIT); + g_vars->scene09_spitter->hide(); + + g_fp->_aniMan->startAnim(MV_MAN9_SHOOT, 0, -1); + + g_fp->stopAllSoundInstances(SND_9_006); + } + + g_fp->_aniMan2 = 0; + + if (g_fp->_sceneRect.left < 800) + g_fp->_currentScene->_x = 800 - g_fp->_sceneRect.left; + } + } +} + +void sceneHandler09_eatBall() { + if (g_vars->scene09_flyingBall) { + g_vars->scene09_flyingBall->hide(); + + Ball *ball = g_vars->scene09_balls.pHead; + + if (ball) { + while (ball && ball->ani != g_vars->scene09_flyingBall) + ball = ball->p0; + + if (ball) { + if (ball == g_vars->scene09_balls.pHead) + g_vars->scene09_balls.pHead = ball->p0; + else + ball->p1->p0 = ball->p0; + + if (ball == g_vars->scene09_balls.field_8) + g_vars->scene09_balls.field_8 = ball->p1; + else + ball->p0->p1 = ball->p1; + + ball->p0 = g_vars->scene09_balls.pTail; + g_vars->scene09_balls.pTail = ball; + + g_vars->scene09_balls.numBalls--; + + if (!g_vars->scene09_balls.numBalls) + g_vars->scene09_balls.reset(); + } + } + + ball = g_vars->scene09_flyingBalls.sub04(g_vars->scene09_flyingBalls.field_8, 0); + ball->ani = g_vars->scene09_flyingBall; + + if (g_vars->scene09_flyingBalls.field_8) + g_vars->scene09_flyingBalls.field_8->p0 = ball; + else + g_vars->scene09_flyingBalls.pHead = ball; + + g_vars->scene09_flyingBalls.field_8 = ball; + + g_vars->scene09_flyingBall = 0; + g_vars->scene09_numSwallenBalls++; + + if (g_vars->scene09_numSwallenBalls >= 3) { + MessageQueue *mq = g_vars->scene09_gulper->getMessageQueue(); + + if (mq) { + ExCommand *ex = new ExCommand(ANI_GLOTATEL, 1, MV_GLT_FLYAWAY, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + + mq->addExCommandToEnd(ex); + } + + g_fp->setObjectState(sO_Jug, g_fp->getObjectEnumState(sO_Jug, sO_Unblocked)); + g_fp->setObjectState(sO_RightStairs_9, g_fp->getObjectEnumState(sO_RightStairs_9, sO_IsOpened)); + + g_vars->scene09_gulperIsPresent = false; + } + } +} + +void sceneHandler09_showBall() { + if (g_vars->scene09_flyingBalls.numBalls) { + StaticANIObject *ani = g_vars->scene09_flyingBalls.pHead->ani; + Ball *ph = g_vars->scene09_flyingBalls.pHead; + g_vars->scene09_flyingBalls.pHead = ph->p0; + + if (g_vars->scene09_flyingBalls.pHead) + ph->p0->p1 = 0; + else + g_vars->scene09_flyingBalls.field_8 = 0; + + ph->p0 = g_vars->scene09_flyingBalls.pTail; + + g_vars->scene09_flyingBalls.pTail = ph; + g_vars->scene09_flyingBalls.numBalls--; + + if (!g_vars->scene09_flyingBalls.numBalls) { + g_vars->scene09_flyingBalls.numBalls = 0; + g_vars->scene09_flyingBalls.pTail = 0; + g_vars->scene09_flyingBalls.field_8 = 0; + g_vars->scene09_flyingBalls.pHead = 0; + + free(g_vars->scene09_flyingBalls.cPlex); + g_vars->scene09_flyingBalls.cPlex = 0; + } + + Ball *ball = g_vars->scene09_balls.sub04(g_vars->scene09_balls.field_8, 0); + ball->ani = ani; + + if (g_vars->scene09_balls.field_8) + g_vars->scene09_balls.field_8->p0 = ball; + else + g_vars->scene09_balls.pHead = ball; + + g_vars->scene09_balls.field_8 = ball; + + ani->show1(g_fp->_aniMan->_ox + 94, g_fp->_aniMan->_oy - 162, MV_BALL9_EXPLODE, 0); + } +} + +void sceneHandler09_cycleHangers() { + for (int i = 0; i < g_vars->scene09_numMovingHangers; i++) { + Movement *mov = g_vars->scene09_hangers[i]->ani->_movement; + + if (mov && mov->_id == MV_VSN_CYCLE2) { + int idx; + + if (g_vars->scene09_hangers[i]->phase >= 0) + idx = 18 - g_vars->scene09_hangers[i]->phase / 5; + else + idx = 18 - g_vars->scene09_hangers[i]->phase * 10 / 43; + + if (idx > 38) + idx = 38; + + if (idx < 1) + idx = 1; + + mov->setDynamicPhaseIndex(idx); + } + } +} + +void sceneHandler09_limitHangerPhase() { + for (int i = 0; i < g_vars->scene09_numMovingHangers; i++) { + if (i != g_vars->scene09_interactingHanger) { + g_vars->scene09_hangers[i]->phase += g_vars->scene09_hangers[i]->field_8; + + if (g_vars->scene09_hangers[i]->phase > 85) + g_vars->scene09_hangers[i]->phase = 85; + + if (g_vars->scene09_hangers[i]->phase < -85) + g_vars->scene09_hangers[i]->phase = -85; + + if (g_vars->scene09_hangers[i]->phase < 0) + g_vars->scene09_hangers[i]->field_8++; + + if (g_vars->scene09_hangers[i]->phase > 0) + g_vars->scene09_hangers[i]->field_8--; + } + } +} + +void sceneHandler09_collideBall(Ball *ball) { + if (g_vars->scene09_gulperIsPresent) { + g_vars->scene09_flyingBall = ball->ani; + + if (g_vars->scene09_gulper) { + g_vars->scene09_gulper->changeStatics2(ST_GLT_SIT); + + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC9_EATBALL), 0, 0); + + mq->setFlags(mq->getFlags() | 1); + + if (!mq->chain(g_vars->scene09_gulper)) + delete mq; + } + } +} + +void sceneHandler09_ballExplode(Ball *ball) { + if (ball == g_vars->scene09_balls.pHead) + g_vars->scene09_balls.pHead = ball->p0; + else + ball->p1->p0 = ball->p0; + + if (ball == g_vars->scene09_balls.field_8) + g_vars->scene09_balls.field_8 = ball->p1; + else + ball->p0->p1 = ball->p1; + + ball->p0 = g_vars->scene09_balls.pTail; + + g_vars->scene09_balls.pTail = ball; + g_vars->scene09_balls.numBalls--; + + if (!g_vars->scene09_balls.numBalls) { + g_vars->scene09_balls.pTail = 0; + g_vars->scene09_balls.field_8 = 0; + g_vars->scene09_balls.pHead = 0; + free(g_vars->scene09_balls.cPlex); + g_vars->scene09_balls.cPlex = 0; + } + + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC9_BALLEXPLODE), 0, 1); + + mq->replaceKeyCode(-1, ball->ani->_okeyCode); + + if (!mq->chain(ball->ani)) + delete mq; + + Ball *runPtr = g_vars->scene09_flyingBalls.pTail; + Ball *lastP = g_vars->scene09_flyingBalls.field_8; + + if (!g_vars->scene09_flyingBalls.pTail) { + g_vars->scene09_flyingBalls.cPlex = (byte *)calloc(g_vars->scene09_flyingBalls.cPlexLen, sizeof(Ball)); + + byte *p1 = g_vars->scene09_flyingBalls.cPlex + (g_vars->scene09_flyingBalls.cPlexLen - 1) * sizeof(Ball); + + if (g_vars->scene09_flyingBalls.cPlexLen - 1 < 0) { + runPtr = g_vars->scene09_flyingBalls.pTail; + } else { + runPtr = g_vars->scene09_flyingBalls.pTail; + + for (int j = 0; j < g_vars->scene09_flyingBalls.cPlexLen; j++) { + ((Ball *)p1)->p1 = runPtr; + runPtr = (Ball *)p1; + + p1 -= sizeof(Ball); + } + + g_vars->scene09_flyingBalls.pTail = runPtr; + } + } + + g_vars->scene09_flyingBalls.pTail = runPtr->p0; + runPtr->p1 = lastP; + runPtr->p0 = 0; + runPtr->ani = ball->ani; + + g_vars->scene09_flyingBalls.numBalls++; + + if (g_vars->scene09_flyingBalls.field_8) { + g_vars->scene09_flyingBalls.field_8->p0 = runPtr; + g_vars->scene09_flyingBalls.field_8 = runPtr; + } else { + g_vars->scene09_flyingBalls.pHead = runPtr; + g_vars->scene09_flyingBalls.field_8 = runPtr; + } +} + +void sceneHandler09_checkHangerCollide() { + for (Ball *ball = g_vars->scene09_balls.pHead; ball; ball = ball->p0) { + int newx = ball->ani->_ox + 5; + + ball->ani->setOXY(newx, ball->ani->_oy); + + if (newx <= 1398 || g_vars->scene09_flyingBall) { + if (g_vars->scene09_gulperIsPresent) + goto LABEL_11; + } else if (g_vars->scene09_gulperIsPresent) { + sceneHandler09_collideBall(ball); + continue; + } + + if (newx > 1600) { + sceneHandler09_ballExplode(ball); + continue; + } + + LABEL_11: + int pixel; + + for (int i = 0; i < g_vars->scene09_numMovingHangers; i++) { + for (int j = 0; j < 4; j++) { + g_vars->scene09_hangers[i]->ani->getPixelAtPos(newx + g_vars->scene09_hangerOffsets[j].x, ball->ani->_oy + g_vars->scene09_hangerOffsets[j].y, &pixel); + + if (pixel) { + sceneHandler09_ballExplode(ball); + break; + } + } + } + } +} + +void sceneHandler09_hangerStartCycle() { + StaticANIObject *ani = g_vars->scene09_hangers[g_vars->scene09_interactingHanger]->ani; + + if (ani->_movement) { + ani->startAnim(MV_VSN_CYCLE2, 0, -1); + g_vars->scene09_hangers[g_vars->scene09_interactingHanger]->field_8 = 0; + g_vars->scene09_hangers[g_vars->scene09_interactingHanger]->phase = g_vars->scene09_intHangerPhase + (g_fp->_mouseScreenPos.y - g_vars->scene09_clickY) / 2; + + if (g_vars->scene09_intHangerMaxPhase != -1000 && g_vars->scene09_hangers[g_vars->scene09_interactingHanger]->phase != g_vars->scene09_intHangerMaxPhase) { + ExCommand *ex = new ExCommand(0, 35, SND_9_019, 0, 0, 0, 1, 0, 0, 0); + + ex->_field_14 = 1; + ex->_excFlags |= 2; + ex->postMessage(); + + g_vars->scene09_intHangerMaxPhase = -1000; + } + } else { + g_vars->scene09_interactingHanger = -1; + } +} + +int sceneHandler09(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_CMN_WINARCADE: + sceneHandler09_winArcade(); + break; + + case MSG_SC9_STARTTIOTIA: + sceneHandler09_startAuntie(); + break; + + case MSG_SC9_FROMLADDER: + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + g_vars->scene09_dudeIsOnLadder = false; + break; + + case MSG_SC9_TOLADDER: + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + + g_vars->scene09_dudeIsOnLadder = true; + break; + + case MSG_SC9_PLVCLICK: + sceneHandler09_spitterClick(); + break; + + case MSG_SC9_FLOWN: + g_vars->scene09_gulperIsPresent = false; + break; + + case MSG_SC9_EATBALL: + sceneHandler09_eatBall(); + break; + + case MSG_SC9_SHOWBALL: + sceneHandler09_showBall(); + break; + + case 33: + { + int res = 0; + + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + g_vars->scene09_dudeY = g_fp->_aniMan2->_oy; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - g_fp->_sceneRect.left - 300; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 300; + + res = 1; + } else { + if (g_fp->_aniMan->_movement && g_fp->_aniMan->_movement->_id != MV_MAN9_SHOOT) + g_fp->_aniMan2 = g_fp->_aniMan; + } + + sceneHandler09_cycleHangers(); + sceneHandler09_limitHangerPhase(); + sceneHandler09_checkHangerCollide(); + + if (g_vars->scene09_interactingHanger >= 0) + sceneHandler09_hangerStartCycle(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + return res; + } + + case 30: + if (g_vars->scene09_interactingHanger >= 0) { + if (ABS(g_vars->scene09_hangers[g_vars->scene09_interactingHanger]->phase) < 15) { + g_vars->scene09_hangers[g_vars->scene09_interactingHanger]->ani->_callback2 = 0; + g_vars->scene09_hangers[g_vars->scene09_interactingHanger]->ani->changeStatics2(ST_VSN_NORMAL); + } + } + + g_vars->scene09_interactingHanger = -1; + + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y); + + if (ani) { + if (ani->_id == ANI_PLEVATEL) { + sceneHandler09_spitterClick(); + break; + } + + if (ani->_id == ANI_VISUNCHIK) { + if (g_vars->scene09_numMovingHangers > 0) { + int hng = 0; + + while (g_vars->scene09_hangers[hng]->ani != ani) { + ++hng; + + if (hng >= g_vars->scene09_numMovingHangers) + break; + } + + g_vars->scene09_interactingHanger = hng; + g_vars->scene09_intHangerPhase = g_vars->scene09_hangers[hng]->phase; + g_vars->scene09_intHangerMaxPhase = g_vars->scene09_hangers[hng]->phase; + + g_vars->scene09_clickY = cmd->_y; + + if (!g_vars->scene09_hangers[hng]->ani->_movement || g_vars->scene09_hangers[hng]->ani->_movement->_id != MV_VSN_CYCLE2) { + g_vars->scene09_hangers[hng]->ani->changeStatics2(ST_VSN_NORMAL); + g_vars->scene09_hangers[hng]->ani->startAnim(MV_VSN_CYCLE2, 0, -1); + g_vars->scene09_hangers[hng]->ani->_callback2 = 0; + } + + ExCommand *ex = new ExCommand(0, 35, SND_9_018, 0, 0, 0, 1, 0, 0, 0); + + ex->_field_14 = 1; + ex->_excFlags |= 2; + ex->postMessage(); + } + + break; + } + } + + if (g_vars->scene09_dudeIsOnLadder && g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) == PIC_SC9_LADDER_R + && !cmd->_keyCode && !g_fp->_aniMan->_movement) { + handleObjectInteraction(g_fp->_aniMan, g_fp->_currentScene->getPictureObjectById(PIC_SC9_LADDER_R, 0), 0); + } + + 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; + } + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene10.cpp b/engines/fullpipe/scenes/scene10.cpp index 9c00902bba..8c9e0b67d0 100644 --- a/engines/fullpipe/scenes/scene10.cpp +++ b/engines/fullpipe/scenes/scene10.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -170,7 +170,7 @@ int sceneHandler10(ExCommand *ex) { break; case 64: - g_fp->lift_sub05(ex); + g_fp->lift_hoverButton(ex); break; case 29: @@ -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/scene11.cpp b/engines/fullpipe/scenes/scene11.cpp index e7ed947a00..0ce82f5d5f 100644 --- a/engines/fullpipe/scenes/scene11.cpp +++ b/engines/fullpipe/scenes/scene11.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene12.cpp b/engines/fullpipe/scenes/scene12.cpp index 0295efcaf5..f63bb9a9fd 100644 --- a/engines/fullpipe/scenes/scene12.cpp +++ b/engines/fullpipe/scenes/scene12.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene13.cpp b/engines/fullpipe/scenes/scene13.cpp index 0a0c2f3906..c7b3c96b93 100644 --- a/engines/fullpipe/scenes/scene13.cpp +++ b/engines/fullpipe/scenes/scene13.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene14.cpp b/engines/fullpipe/scenes/scene14.cpp index ab0487974a..21dbe8101f 100644 --- a/engines/fullpipe/scenes/scene14.cpp +++ b/engines/fullpipe/scenes/scene14.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -749,7 +749,7 @@ int sceneHandler14(ExCommand *cmd) { break; case 64: - g_fp->lift_sub05(cmd); + g_fp->lift_hoverButton(cmd); break; case 33: @@ -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..452f2edeca 100644 --- a/engines/fullpipe/scenes/scene15.cpp +++ b/engines/fullpipe/scenes/scene15.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -156,7 +156,7 @@ int sceneHandler15(ExCommand *cmd) { break; case 64: - g_fp->lift_sub05(cmd); + g_fp->lift_hoverButton(cmd); break; case 29: @@ -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/scene16.cpp b/engines/fullpipe/scenes/scene16.cpp index b1e261287a..9ed355fdd9 100644 --- a/engines/fullpipe/scenes/scene16.cpp +++ b/engines/fullpipe/scenes/scene16.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene17.cpp b/engines/fullpipe/scenes/scene17.cpp index 73bf7ab1c0..d40f8cf816 100644 --- a/engines/fullpipe/scenes/scene17.cpp +++ b/engines/fullpipe/scenes/scene17.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene18and19.cpp b/engines/fullpipe/scenes/scene18and19.cpp index a965cfb98e..4f6677876b 100644 --- a/engines/fullpipe/scenes/scene18and19.cpp +++ b/engines/fullpipe/scenes/scene18and19.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -36,14 +36,897 @@ namespace Fullpipe { +struct Swinger { + StaticANIObject *ani; + int sfield_4; + double angle; + int sx; + int sy; + int ix; + int iy; + int sflags; + int sfield_24; +}; + + +#define ANGLE(x) ((x) * M_PI / 180) + void scene18_preload() { - warning("WARNING: scene18_preload()"); + g_fp->_scene3 = 0; + + for (SceneTagList::iterator s = g_fp->_gameProject->_sceneTagList->begin(); s != g_fp->_gameProject->_sceneTagList->end(); ++s) { + if (s->_sceneId == SC_18) { + g_fp->_scene3 = s->_scene; + s->_scene = 0; + + g_fp->_scene3->getStaticANIObject1ById(ANI_WHIRLIGIG_18, -1)->freeMovementsPixelData(); + + break; + } + } +} + +void scene18_setupEntrance() { + GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName("SAVEGAME"); + + if (var->getSubVarAsInt("Entrance") == TrubaRight) + var->setSubVarAsInt("Entrance", TrubaLeft); +} + +void scene19_setSugarState(Scene *sc) { + if (g_fp->getObjectState(sO_Sugar) != g_fp->getObjectEnumState(sO_Sugar, sO_Present)) { + Scene *oldsc = g_fp->_currentScene; + + g_fp->_currentScene = sc; + sc->getStaticANIObject1ById(ANI_CORDIE, -1)->changeStatics2(ST_CDI_EMPTY2); + g_fp->_currentScene = oldsc; + } +} + +void scene19_setMovements(Scene *sc, int entranceId) { + if (entranceId == TrubaRight) { + g_vars->scene18_enteredTrubaRight = true; + } else { + g_vars->scene18_enteredTrubaRight = false; + g_vars->scene19_enteredTruba3 = (entranceId == PIC_SC19_RTRUBA3); + } + + for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) { + if (!g_vars->scene18_enteredTrubaRight && (g_vars->scene18_swingers[i]->sflags & 0x20)) { + Scene *oldsc = g_fp->_currentScene; + + g_vars->scene18_swingers[i]->sflags = 1; + + g_fp->_currentScene = sc; + g_vars->scene18_swingers[i]->ani->changeStatics2(ST_KSL_NORM); + g_vars->scene18_swingers[i]->ani->_priority = 30; + g_fp->_currentScene = oldsc; + } + + sc->deleteStaticANIObject(g_vars->scene18_swingers[i]->ani); + } + + if (g_vars->scene18_whirlgig->_movement) { + g_vars->scene18_whirlgigMovMum = g_vars->scene18_whirlgig->_movement->_currDynamicPhaseIndex + 1; + + int mx; + + if (g_vars->scene18_whirlgig->_movement->_currMovement) + mx = g_vars->scene18_whirlgig->_movement->_currMovement->_dynamicPhases.size(); + else + mx = g_vars->scene18_whirlgig->_movement->_dynamicPhases.size(); + + if (g_vars->scene18_whirlgigMovMum > mx - 1) + g_vars->scene18_whirlgigMovMum = -1; + } else { + g_vars->scene18_whirlgigMovMum = 0; + } + + sc->deleteStaticANIObject(g_vars->scene18_boy); + sc->deleteStaticANIObject(g_vars->scene18_girl); + sc->stopAllSounds(); +} + +void scene19_preload() { + for (SceneTagList::iterator s = g_fp->_gameProject->_sceneTagList->begin(); s != g_fp->_gameProject->_sceneTagList->end(); ++s) { + if (s->_sceneId == SC_18) { + s->_scene = g_fp->_scene3; + + break; + } + } } -void scene19_preload(Scene *sc, int key) { - warning("WARNING: scene19_preload()"); +void scene18_setupSwingers(StaticANIObject *ani, Scene *sc) { + Swinger *swinger; + + g_vars->scene18_swingers.clear(); + + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + + for (int i = 0; i < 8; i++) { + swinger = new Swinger; + + swinger->angle = (double)i * ANGLE(45); + swinger->sx = g_vars->scene18_wheelCenterX - (int)(cos(swinger->angle) * -575.0); + swinger->sy = g_vars->scene18_wheelCenterY - (int)(sin(swinger->angle) * -575.0) + 87; + swinger->ix = swinger->sx; + swinger->iy = swinger->sy; + + if (i) { + StaticANIObject *newani = new StaticANIObject(ani); + + ani = newani; + + swinger->ani = newani; + swinger->sflags = 2; + + sc->addStaticANIObject(newani, 1); + } else { + swinger->ani = ani; + swinger->sflags = g_vars->scene18_girlIsSwinging ? 4 : 1; + } + + ani->_statics = ani->getStaticsById(ST_KSL_NORM); + //ani->_movement = 0; + ani->setOXY(swinger->sx, swinger->sy); + ani->_priority = 30; + ani->_flags |= 4; + + if (swinger->sflags & 2) + ani->startAnim(MV_KSL_SWINGBOY, 0, -1); + else if (swinger->sflags & 4) + ani->startAnim(MV_KSL_SWINGGIRL, 0, -1); + else + ani->startAnim(MV_KSL_SWING, 0, -1); + + ani->_movement->setDynamicPhaseIndex(g_fp->_rnd->getRandomNumber(17)); + + g_vars->scene18_swingers.push_back(swinger); + } + + g_fp->_currentScene = oldsc; } +void scene18_initScene1(Scene *sc) { + PicAniInfo info; + + int oldx = g_vars->scene18_wheelCenterX; + int oldy = g_vars->scene18_wheelCenterY; + + g_vars->scene18_girlIsSwinging = (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging)); + + if (sc->_sceneId == SC_18) { + g_vars->scene18_whirlgig = sc->getStaticANIObject1ById(ANI_WHIRLIGIG_18, -1); + g_vars->scene18_wheelCenterX = 1032; + g_vars->scene18_wheelCenterY = -318; + } else { + g_vars->scene18_whirlgig = sc->getStaticANIObject1ById(ANI_WHIRLGIG_19, -1); + g_vars->scene18_wheelCenterX = 1024; + g_vars->scene18_wheelCenterY = 242; + } + + int newx = g_vars->scene18_wheelCenterX - oldx; + int newy = g_vars->scene18_wheelCenterY - oldy; + + g_vars->scene18_boyJumpX += newx; + g_vars->scene18_boyJumpY += newy; + g_vars->scene18_girlJumpX += newx; + g_vars->scene18_girlJumpY += newy; + + for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) { + g_vars->scene18_swingers[i]->ani->getPicAniInfo(&info); + sc->addStaticANIObject(g_vars->scene18_swingers[i]->ani, 1); + g_vars->scene18_swingers[i]->ani->setPicAniInfo(&info); + + g_vars->scene18_swingers[i]->sx += newx; + g_vars->scene18_swingers[i]->sy += newy; + g_vars->scene18_swingers[i]->ix += newx; + g_vars->scene18_swingers[i]->iy += newy; + + GameObject *go; + + if (g_vars->scene18_swingers[i]->ani->_movement) + go = g_vars->scene18_swingers[i]->ani->_movement; + else + go = g_vars->scene18_swingers[i]->ani; + + go->setOXY(newx + go->_ox, newy + go->_oy); + } + + if (g_vars->scene18_bridgeIsConvoluted && g_vars->scene18_whirlgigMovMum != -1) { + g_vars->scene18_whirlgig->startAnim(sc->_sceneId != SC_18 ? MV_WHR19_SPIN : MV_WHR18_SPIN, 0, -1); + g_vars->scene18_whirlgig->_movement->setDynamicPhaseIndex(g_vars->scene18_whirlgigMovMum); + } + + int sndid; + + if (sc->_sceneId == SC_19) { + if (g_vars->scene18_bridgeIsConvoluted) + sndid = SND_19_015; + else + sndid = SND_19_016; + } else { + if (g_vars->scene18_bridgeIsConvoluted) + sndid = SND_18_006; + else + sndid = SND_18_010; + } + + g_fp->playSound(sndid, 1); + + g_vars->scene18_boy->getPicAniInfo(&info); + sc->addStaticANIObject(g_vars->scene18_boy, 1); + g_vars->scene18_boy->setPicAniInfo(&info); + + int x, y; + + if (g_vars->scene18_boy->_movement) { + x = g_vars->scene18_boy->_movement->_ox; + y = g_vars->scene18_boy->_movement->_oy; + } else { + x = g_vars->scene18_boy->_ox; + y = g_vars->scene18_boy->_oy; + } + + g_vars->scene18_boy->setOXY(newx + x, newy + y); + + g_vars->scene18_girl->getPicAniInfo(&info); + sc->addStaticANIObject(g_vars->scene18_girl, 1); + g_vars->scene18_girl->setPicAniInfo(&info); + + if (g_vars->scene18_girl->_movement) { + x = g_vars->scene18_girl->_movement->_ox; + y = g_vars->scene18_girl->_movement->_oy; + } else { + x = g_vars->scene18_girl->_ox; + y = g_vars->scene18_girl->_oy; + } + + g_vars->scene18_girl->setOXY(newx + x, newy + y); + + g_vars->scene18_wheelFlipper = false; + g_vars->scene18_jumpDistance = -1; + g_vars->scene18_jumpAngle = -1; + + if (g_vars->scene18_enteredTrubaRight) { + if (sc->_sceneId == SC_19) + g_fp->_aniMan2 = 0; + else + g_fp->_aniMan2 = g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani; + } else { + g_fp->_aniMan2 = g_fp->_aniMan; + } +} + +void scene18_initScene2(Scene *sc) { + g_vars->scene18_whirlgig = sc->getStaticANIObject1ById(ANI_WHIRLIGIG_18, -1); + g_vars->scene18_wheelCenterX = 1032; + g_vars->scene18_wheelCenterY = -318; + + StaticANIObject *armchair = sc->getStaticANIObject1ById(ANI_KRESLO, -1); + + armchair->loadMovementsPixelData(); + + g_vars->scene18_girlIsSwinging = (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging)); + + if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Convoluted)) { + g_vars->scene18_bridgeIsConvoluted = true; + g_fp->playSound(SND_18_006, 1); + } else { + g_vars->scene18_bridgeIsConvoluted = false; + g_fp->playSound(SND_18_010, 1); + } + + scene18_setupSwingers(armchair, sc); + + g_vars->scene18_rotationCounter = 0; + g_vars->scene18_wheelFlipper = false; + g_vars->scene18_wheelIsTurning = true; + g_vars->scene18_kidIsOnWheel = -1; + g_vars->scene18_boyIsOnWheel = 0; + g_vars->scene18_girlIsOnWheel = 0; + g_vars->scene18_boyJumpedOff = true; + g_vars->scene18_manWheelPosTo = -1; + g_vars->scene18_jumpDistance = -1; + g_vars->scene18_jumpAngle = -1; + g_vars->scene18_manIsReady = false; + g_vars->scene18_enteredTrubaRight = 0; + g_vars->scene18_boy = sc->getStaticANIObject1ById(ANI_BOY18, -1); + g_vars->scene18_girl = sc->getStaticANIObject1ById(ANI_GIRL18, -1); + g_vars->scene18_domino = sc->getStaticANIObject1ById(ANI_DOMINO_18, -1); + g_vars->scene18_boyJumpX = 290; + g_vars->scene18_boyJumpY = -363; + g_vars->scene18_girlJumpX = 283; + g_vars->scene18_girlJumpY = -350; + + g_fp->initArcadeKeys("SC_18"); +} + +void scene19_initScene2() { + g_fp->_aniMan2 = 0; +} + +int scene18_updateCursor() { + if (g_vars->scene18_enteredTrubaRight) { + g_fp->_cursorId = PIC_CSR_DEFAULT; + } else { + g_fp->updateCursorCommon(); + + if (g_fp->_cursorId == PIC_CSR_ITN) { + if (g_fp->_objectIdAtCursor == PIC_SC18_LADDER1) { + g_fp->_cursorId = (g_vars->scene18_manY <= 250) ? PIC_CSR_GOD : PIC_CSR_GOU; + } else if (g_fp->_objectIdAtCursor == PIC_SC18_LADDER2 || g_fp->_objectIdAtCursor == PIC_SC18_LADDER3) { + g_fp->_cursorId = PIC_CSR_GOU; + } + } else if (g_fp->_cursorId == PIC_CSR_DEFAULT && g_fp->_objectIdAtCursor == PIC_SC18_DOMIN && g_vars->scene18_domino && (g_vars->scene18_domino->_flags & 4)) { + g_fp->_cursorId = PIC_CSR_ITN; + } + } + + return g_fp->_cursorId; +} + +int scene19_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor == PIC_SC19_RTRUBA31) + g_fp->_cursorId = g_vars->scene19_enteredTruba3 ? PIC_CSR_GOR : PIC_CSR_DEFAULT; + + return g_fp->_cursorId; +} + +void sceneHandler18_clickBoard() { + if (ABS(967 - g_fp->_aniMan->_ox) > 1 || ABS(379 - g_fp->_aniMan->_oy) > 1 || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 967, 379, 1, ST_MAN_RIGHT); + ExCommand *ex = new ExCommand(0, 17, MSG_SC18_MANREADY, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags = 2; + + mq->addExCommandToEnd(ex); + + postExCommand(g_fp->_aniMan->_id, 2, 967, 379, 0, -1); + } else { + g_vars->scene18_manIsReady = true; + } +} + +void sceneHandler18_showManJumpTo() { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + g_fp->_aniMan->_flags &= 0xFFFB; + g_fp->_aniMan->_flags &= 0xFEFF; + g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->sflags = 0x20; + + g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani->changeStatics2(ST_KSL_JUMPMAN); + g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani->startAnim(MV_KSL_INMAN, 0, -1); + g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani->_priority = 20; + + g_vars->scene18_manIsReady = false; + g_vars->scene18_enteredTrubaRight = true; + + g_fp->_aniMan2 = g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani; +} + +void sceneHandler18and19_showManJump() { + int x, y; + + if (g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_movement) { + x = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_movement->_ox; + y = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_movement->_oy; + } else { + x = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_ox; + y = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_oy; + } + + g_fp->_aniMan->show1(x + 62, y + 5, MV_MAN18_JUMPTOTRUBA, 0); + g_fp->_aniMan->_priority = 35; + + int mqid = 0; + + if (g_vars->scene18_jumpDistance == 1) { + mqid = QU_SC19_MANJUMP1; + } else if (g_vars->scene18_jumpDistance == 2) { + mqid = QU_SC19_MANJUMP2; + } else if (g_vars->scene18_jumpDistance == 3) { + mqid = QU_SC19_MANJUMP3; + } + + if (mqid) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(mqid), 0, 0); + + g_fp->_aniMan2 = g_fp->_aniMan; + g_vars->scene18_enteredTrubaRight = false; + + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + } + + g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->sflags = 1; + + g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->changeStatics2(ST_KSL_NORM); + g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_priority = 30; +} + +void sceneHandler18and19_showGirlJumpTo() { + g_vars->scene18_girl->stopAnim_maybe(); + g_vars->scene18_girl->hide(); + + g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->sflags = 4; + + g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->ani->changeStatics2(ST_KSL_JUMPGIRL); + g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->ani->startAnim(MV_KSL_INGIRL, 0, -1); + + g_vars->scene18_kidIsOnWheel--; + g_vars->scene18_girlIsOnWheel--; +} + +void sceneHandler18and19_showGirlJump() { + StaticANIObject *ani = g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani; + int x, y; + + if (ani->_movement) { + x = ani->_movement->_ox; + y = ani->_movement->_oy; + } else { + x = ani->_ox; + y = ani->_oy; + } + + g_vars->scene18_girl->show1(x - 62, y - 10, MV_GRL18_JUMPFROM, 0); + g_vars->scene18_girl->_priority = 50; + g_vars->scene18_girl->startAnim(MV_GRL18_JUMPFROM, 0, -1); + g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->sflags = 1; + + g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani->changeStatics2(ST_KSL_REACT); + g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani->startAnim(MV_KSL_CALMDOWN, 0, -1); + + g_vars->scene18_kidIsOnWheel = 1; + g_vars->scene18_girlIsOnWheel++; +} + +void sceneHandler18and19_showBoyJumpTo() { + g_vars->scene18_boy->stopAnim_maybe(); + g_vars->scene18_boy->hide(); + + g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->sflags = 2; + g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->ani->changeStatics2(ST_KSL_JUMPBOY); + g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->ani->startAnim(MV_KSL_INBOY, 0, -1); + + g_vars->scene18_kidIsOnWheel--; + g_vars->scene18_boyIsOnWheel--; +} + +void sceneHandler18and19_showBoyJump() { + StaticANIObject *ani = g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani; + int x, y; + + if (ani->_movement) { + x = ani->_movement->_ox; + y = ani->_movement->_oy; + } else { + x = ani->_ox; + y = ani->_oy; + } + + g_vars->scene18_boy->show1(x - 48, y + 8, MV_BOY18_JUMPFROM, 0); + g_vars->scene18_boy->_priority = 50; + g_vars->scene18_boy->startAnim(MV_BOY18_JUMPFROM, 0, -1); + + g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->sflags = 1; + + g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani->changeStatics2(ST_KSL_REACT); + g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani->startAnim(MV_KSL_CALMDOWN, 0, -1); + + g_vars->scene18_boyJumpedOff = true; +} + +void sceneHandler18and19_boyJumpTo() { + g_vars->scene18_boy->stopAnim_maybe(); + g_vars->scene18_boy->show1(g_vars->scene18_boyJumpX, g_vars->scene18_boyJumpY, MV_BOY18_JUMPTO, 0); + g_vars->scene18_boy->_priority = 50; + g_vars->scene18_boy->startAnim(MV_BOY18_JUMPTO, 0, -1); +} + +void sceneHandler18and19_girlJumpTo() { + g_vars->scene18_girl->stopAnim_maybe(); + g_vars->scene18_girl->show1(g_vars->scene18_girlJumpX, g_vars->scene18_girlJumpY, MV_GRL18_JUMPTO, 0); + g_vars->scene18_girl->_priority = 50; + g_vars->scene18_girl->startAnim(MV_GRL18_JUMPTO, 0, -1); +} + +void sceneHandler18and19_manStandArmchair() { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + g_fp->_aniMan->_flags |= 1; + g_fp->_aniMan->_priority = 35; + g_fp->_aniMan->startAnim(MV_MAN18_STANDKRESLO, 0, -1); +} + +void sceneHandler18and19_drawRiders() { + g_vars->scene18_rotationCounter++; + + if (g_vars->scene18_rotationCounter >= 359) + g_vars->scene18_rotationCounter = 0; + + for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) { + Swinger *swinger = g_vars->scene18_swingers[i]; + + double oldangle = swinger->angle; + + swinger->angle += ANGLE(1); + + if (swinger->angle > ANGLE(360)) { + swinger->angle -= ANGLE(360); + oldangle -= ANGLE(360); + } + + int ix = g_vars->scene18_wheelCenterX - (int)(cos(swinger->angle) * -575.0); + int iy = g_vars->scene18_wheelCenterY - (int)(sin(swinger->angle) * -575.0) + 87; + + if (!g_vars->scene18_rotationCounter) { + ix = swinger->sx; + iy = swinger->sy; + swinger->angle = (double)i * ANGLE(45); + } + + if (swinger->ani->_movement) + swinger->ani->setOXY(ix - swinger->ix + swinger->ani->_movement->_ox, iy - swinger->iy + swinger->ani->_movement->_oy); + else + swinger->ani->setOXY(ix - swinger->ix + swinger->ani->_ox, iy - swinger->iy + swinger->ani->_oy); + + swinger->ix = ix; + swinger->iy = iy; + + if (!swinger->ani->_movement) { + int mv = 0; + + if (swinger->sflags & 2) { + mv = MV_KSL_SWINGBOY; + } else if (swinger->sflags & 4) { + mv = MV_KSL_SWINGGIRL; + } else if (swinger->sflags & 0x20) { + mv = MV_KSL_SWINGMAN; + } else if (swinger->sflags & 1) { + mv = MV_KSL_SWING; + } + + if (mv) + swinger->ani->startAnim(mv, 0, -1); + + if (swinger->ani->_movement) + swinger->ani->_movement->_counter = 0; + } + + if (g_vars->scene18_wheelIsTurning) { + if ((swinger->sflags & 2) && swinger->angle >= ANGLE(160) && oldangle < ANGLE(160)) { + swinger->sflags = 8; + swinger->ani->changeStatics2(ST_KSL_BOY); + swinger->ani->startAnim(MV_KSL_JUMPBOY, 0, -1); + g_vars->scene18_kidWheelPos = i; + } else if ((swinger->sflags & 4) && swinger->angle >= ANGLE(162) && oldangle < ANGLE(162)) { + swinger->sflags = 16; + swinger->ani->changeStatics2(ST_KSL_GIRL); + swinger->ani->startAnim(MV_KSL_JUMPGIRL, 0, -1); + g_vars->scene18_kidWheelPos = i; + } else if (g_vars->scene18_kidIsOnWheel) { + if (g_vars->scene18_boyIsOnWheel > 0 && (swinger->sflags & 1) && swinger->angle >= ANGLE(185) && oldangle < ANGLE(185)) { + g_vars->scene18_kidWheelPosTo = i; + sceneHandler18and19_boyJumpTo(); + } + } else if (g_vars->scene18_girlIsOnWheel > 0 && (swinger->sflags & 1) && swinger->angle >= ANGLE(187) && oldangle < ANGLE(187)) { + g_vars->scene18_kidWheelPosTo = i; + sceneHandler18and19_girlJumpTo(); + } + + if (swinger->angle >= ANGLE(200) && oldangle < ANGLE(200)) { + if (g_vars->scene18_boyJumpedOff) + g_vars->scene18_boyIsOnWheel++; + + g_vars->scene18_boyJumpedOff = false; + } + } + + if (g_vars->scene18_manIsReady && (swinger->sflags & 1) && swinger->angle >= ANGLE(83) && oldangle < ANGLE(83)) { + g_vars->scene18_manWheelPosTo = i; + sceneHandler18and19_manStandArmchair(); + } + + if (!g_vars->scene18_enteredTrubaRight) + continue; + + if ((int)i == g_vars->scene18_manWheelPosTo) { + if (swinger->angle >= ANGLE(170) && oldangle < ANGLE(170)) { + g_fp->_gameLoader->preloadScene(SC_18, TrubaRight); + } else if (swinger->angle >= ANGLE(25) && oldangle < ANGLE(25)) { + g_fp->_gameLoader->preloadScene(SC_19, TrubaRight); + } else if (swinger->angle >= ANGLE(270) && oldangle < ANGLE(270)) { + g_fp->_sceneRect.translate(1200, 0); + } + } + + if (g_vars->scene18_jumpDistance > 0) { + if (swinger->sflags & 0x20) { + double newa = (double)g_vars->scene18_jumpAngle * ANGLE(1); + + if (newa <= swinger->angle && oldangle < newa) { + swinger->ani->changeStatics2(ST_KSL_MAN); + swinger->ani->startAnim(MV_KSL_JUMPMAN, 0, -1); + swinger->ani->_priority = 35; + + g_vars->scene18_manWheelPos = i; + } + } + } + } +} + +void sceneHandler18and19_animateRiders() { + for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) { + Swinger *swinger = g_vars->scene18_swingers[i]; + + if (!swinger->ani->_movement) { + int mv = 0; + + if (swinger->sflags & 2) + mv = MV_KSL_SWINGBOY; + else if (swinger->sflags & 4) + mv = MV_KSL_SWINGGIRL; + else if (swinger->sflags & 0x20) + mv = MV_KSL_SWINGMAN; + + if (mv) + swinger->ani->startAnim(mv, 0, -1); + + if (swinger->ani->_movement) + swinger->ani->_movement->_counter = 0; + } + } +} + +int sceneHandler18(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC18_CLICKBOARD: + sceneHandler18_clickBoard(); + break; + + case MSG_SC3_HIDEDOMINO: + g_vars->scene18_domino->_flags &= 0xFFFB; + break; + + case MSG_SC18_SHOWMANJUMP: + sceneHandler18and19_showManJump(); + break; + + case MSG_SC18_MANREADY: + g_vars->scene18_manIsReady = true; + break; + + case MSG_SC18_SHOWMANJUMPTO: + sceneHandler18_showManJumpTo(); + break; + + case MSG_SC18_SHOWGIRLJUMPTO: + sceneHandler18and19_showGirlJumpTo(); + break; + + case MSG_SC18_SHOWGIRLJUMP: + sceneHandler18and19_showGirlJump(); + break; + + case MSG_SC18_SHOWBOYJUMPTO: + sceneHandler18and19_showBoyJumpTo(); + break; + + case MSG_SC18_SHOWBOYJUMP: + sceneHandler18and19_showBoyJump(); + break; + + case 29: + { + if (g_vars->scene18_enteredTrubaRight) { + cmd->_messageKind = 0; + + break; + } + + 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 && pic->_id == PIC_SC18_DOMIN && g_vars->scene18_domino + && (g_vars->scene18_domino->_flags & 4) && g_fp->_aniMan->isIdle()) { + if (!(g_fp->_aniMan->_flags & 0x100) && g_fp->_msgObjectId2 != g_vars->scene18_domino->_id) { + handleObjectInteraction(g_fp->_aniMan, g_vars->scene18_domino, cmd->_keyCode); + cmd->_messageKind = 0; + + break; + } + } + + 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); + + g_vars->scene18_manIsReady = false; + + break; + } + } + } + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + g_vars->scene18_manY = g_fp->_aniMan2->_oy; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene18_manIsReady && g_fp->_aniMan->_movement) + g_vars->scene18_manIsReady = false; + + if (g_vars->scene18_bridgeIsConvoluted) { + if (!g_vars->scene18_wheelFlipper) + sceneHandler18and19_drawRiders(); + + g_vars->scene18_wheelFlipper = !g_vars->scene18_wheelFlipper; + + if (!g_vars->scene18_whirlgig->_movement) { + g_vars->scene18_whirlgig->startAnim(MV_WHR18_SPIN, 0, -1); + g_fp->_behaviorManager->updateBehaviors(); + + break; + } + } else { + sceneHandler18and19_animateRiders(); + } + + g_fp->_behaviorManager->updateBehaviors(); + + break; + } + + return 0; +} + +void sceneHandler19_updateNumRides() { + int numRides = g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarAsInt(sO_DudeSwinged) + 1; + + if (numRides > 1) { + g_fp->setObjectState(sO_Girl, g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging)); + + g_vars->scene18_kidIsOnWheel = 1; + g_vars->scene18_girlIsOnWheel++; + + numRides = 0; + } + + g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->setSubVarAsInt(sO_DudeSwinged, numRides); +} + +int sceneHandler19(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC18_SHOWMANJUMP: + sceneHandler18and19_showManJump(); + break; + + case MSG_SC19_UPDATENUMRIDES: + sceneHandler19_updateNumRides(); + break; + + case MSG_SC18_SHOWGIRLJUMPTO: + sceneHandler18and19_showGirlJumpTo(); + break; + + case MSG_SC18_SHOWBOYJUMPTO: + sceneHandler18and19_showBoyJumpTo(); + break; + + case MSG_SC18_SHOWGIRLJUMP: + sceneHandler18and19_showGirlJump(); + break; + + case MSG_SC18_SHOWBOYJUMP: + sceneHandler18and19_showBoyJump(); + break; + + case 29: + if (g_vars->scene18_enteredTrubaRight) { + switch (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY)) { + case PIC_SC19_RTRUBA1: + g_vars->scene18_jumpDistance = 1; + g_vars->scene18_jumpAngle = 331; + cmd->_messageKind = 0; + break; + + case PIC_SC19_RTRUBA2: + g_vars->scene18_jumpDistance = 2; + g_vars->scene18_jumpAngle = 350; + cmd->_messageKind = 0; + break; + + case PIC_SC19_RTRUBA3: + g_vars->scene18_jumpDistance = 3; + g_vars->scene18_jumpAngle = 9; + cmd->_messageKind = 0; + break; + + default: + g_vars->scene18_jumpDistance = -1; + g_vars->scene18_jumpAngle = -1; + cmd->_messageKind = 0; + break; + } + break; + } + + if (g_vars->scene19_enteredTruba3) { + if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) == PIC_SC19_RTRUBA3) { + if (g_fp->_aniMan->isIdle()) { + if (!(g_fp->_aniMan->_flags & 0x100)) { + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(PIC_SC19_RTRUBA31, 0); + + handleObjectInteraction(g_fp->_aniMan, pic, cmd->_keyCode); + break; + } + } + } + } + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + g_vars->scene18_manY = g_fp->_aniMan2->_oy; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene18_bridgeIsConvoluted) { + if (!g_vars->scene18_wheelFlipper) + sceneHandler18and19_drawRiders(); + + g_vars->scene18_wheelFlipper = !g_vars->scene18_wheelFlipper; + + if (!g_vars->scene18_whirlgig->_movement) { + g_vars->scene18_whirlgig->startAnim(MV_WHR19_SPIN, 0, -1); + + g_fp->_behaviorManager->updateBehaviors(); + + break; + } + } else { + sceneHandler18and19_animateRiders(); + } + + g_fp->_behaviorManager->updateBehaviors(); + + break; + } + + return 0; +} } // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene20.cpp b/engines/fullpipe/scenes/scene20.cpp index 5fed24aabd..7f19f175cc 100644 --- a/engines/fullpipe/scenes/scene20.cpp +++ b/engines/fullpipe/scenes/scene20.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene21.cpp b/engines/fullpipe/scenes/scene21.cpp index 5a6509964d..8918515431 100644 --- a/engines/fullpipe/scenes/scene21.cpp +++ b/engines/fullpipe/scenes/scene21.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene22.cpp b/engines/fullpipe/scenes/scene22.cpp index 13c9ab36e9..542834b51a 100644 --- a/engines/fullpipe/scenes/scene22.cpp +++ b/engines/fullpipe/scenes/scene22.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene23.cpp b/engines/fullpipe/scenes/scene23.cpp index 1f2587eba4..ccfbac9223 100644 --- a/engines/fullpipe/scenes/scene23.cpp +++ b/engines/fullpipe/scenes/scene23.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene24.cpp b/engines/fullpipe/scenes/scene24.cpp index 508f776573..2eb536df3f 100644 --- a/engines/fullpipe/scenes/scene24.cpp +++ b/engines/fullpipe/scenes/scene24.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene25.cpp b/engines/fullpipe/scenes/scene25.cpp index ba07c3e5b9..fae311efad 100644 --- a/engines/fullpipe/scenes/scene25.cpp +++ b/engines/fullpipe/scenes/scene25.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene26.cpp b/engines/fullpipe/scenes/scene26.cpp index 91679347e6..b9d9161e7d 100644 --- a/engines/fullpipe/scenes/scene26.cpp +++ b/engines/fullpipe/scenes/scene26.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene27.cpp b/engines/fullpipe/scenes/scene27.cpp new file mode 100644 index 0000000000..1431ceffba --- /dev/null +++ b/engines/fullpipe/scenes/scene27.cpp @@ -0,0 +1,759 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + +#define DBG 0 + +namespace Fullpipe { + +struct Bat { + StaticANIObject *ani; + int field_4; + double power; + double field_10; + double currX; + double currY; + double powerCos; + double powerSin; +}; + +void scene27_initScene(Scene *sc) { + g_vars->scene27_hitZone = sc->getPictureObjectById(PIC_SC27_HITZONE2, 0); + g_vars->scene27_driver = sc->getStaticANIObject1ById(ANI_VODILLA, -1); + g_vars->scene27_maid = sc->getStaticANIObject1ById(ANI_MAID, -1); + g_vars->scene27_batHandler = sc->getStaticANIObject1ById(ANI_BITAHANDLER, -1); + + g_vars->scene27_balls.numBalls = 0; + g_vars->scene27_balls.pTail = 0; + g_vars->scene27_balls.field_8 = 0; + g_vars->scene27_balls.pHead = 0; + g_vars->scene27_balls.cPlexLen = 10; + + free(g_vars->scene27_balls.cPlex); + g_vars->scene27_balls.cPlex = 0; + + g_vars->scene27_bats.clear(); + g_vars->scene27_var07.clear(); + + g_vars->scene27_driverHasVent = true; + g_vars->scene27_bat = sc->getStaticANIObject1ById(ANI_BITA, -1); + + for (int i = 0; i < 4; i++) { + StaticANIObject *newbat = new StaticANIObject(g_vars->scene27_bat); + + Ball *runPtr = g_vars->scene27_balls.pTail; + Ball *lastP = g_vars->scene27_balls.field_8; + + if (!g_vars->scene27_balls.pTail) { + g_vars->scene27_balls.cPlex = (byte *)calloc(g_vars->scene27_balls.cPlexLen, sizeof(Ball)); + + byte *p1 = g_vars->scene27_balls.cPlex + (g_vars->scene27_balls.cPlexLen - 1) * sizeof(Ball); + + if (g_vars->scene27_balls.cPlexLen - 1 < 0) { + runPtr = g_vars->scene27_balls.pTail; + } else { + runPtr = g_vars->scene27_balls.pTail; + + for (int j = 0; j < g_vars->scene27_balls.cPlexLen; j++) { + ((Ball *)p1)->p1 = runPtr; + runPtr = (Ball *)p1; + + p1 -= sizeof(Ball); + } + + g_vars->scene27_balls.pTail = runPtr; + } + } + + g_vars->scene27_balls.pTail = runPtr->p0; + runPtr->p1 = lastP; + runPtr->p0 = 0; + runPtr->ani = newbat; + + g_vars->scene27_balls.numBalls++; + + if (g_vars->scene27_balls.field_8) + g_vars->scene27_balls.field_8->p0 = runPtr; + else + g_vars->scene27_balls.pHead = runPtr; + + g_vars->scene27_balls.field_8 = runPtr; + + sc->addStaticANIObject(newbat, 1); + } + + g_vars->scene27_dudeIsAiming = false; + g_vars->scene27_maxPhaseReached = false; + g_vars->scene27_wipeIsNeeded = false; + g_vars->scene27_driverPushedButton = false; + g_vars->scene27_numLostBats = 0; + g_vars->scene27_knockCount = 0; + g_vars->scene27_launchPhase = 0; + + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_Maid) == g_fp->getObjectEnumState(sO_Maid, sO_WithSwab)) { + g_vars->scene27_maid->changeStatics2(ST_MID_SWAB2); + } else if (g_fp->getObjectState(sO_Maid) == g_fp->getObjectEnumState(sO_Maid, sO_WithBroom)) { + g_vars->scene27_maid->changeStatics2(ST_MID_BROOM); + } else if (g_fp->getObjectState(sO_Maid) == g_fp->getObjectEnumState(sO_Maid, sO_WithSpade)) { + g_vars->scene27_maid->changeStatics2(ST_MID_SPADE); + } + + g_fp->_currentScene = oldsc; + + g_fp->setArcadeOverlay(PIC_CSR_ARCADE7); +} + +int scene27_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_vars->scene27_dudeIsAiming) { + if (g_fp->_cursorId != PIC_CSR_DEFAULT_INV && g_fp->_cursorId != PIC_CSR_ITN_INV) + g_fp->_cursorId = PIC_CSR_ARCADE7_D; + + } else if (g_fp->_objectIdAtCursor == ANI_MAN) { + if (g_vars->scene27_maxPhaseReached) + if (g_fp->_cursorId == PIC_CSR_DEFAULT) + g_fp->_cursorId = PIC_CSR_ITN; + } + + return g_fp->_cursorId; +} + +void sceneHandler27_driverGiveVent() { + g_vars->scene27_driver->changeStatics2(ST_DRV_VENT); + g_vars->scene27_driver->startMQIfIdle(QU_DRV_GIVEVENT, 1); + + g_vars->scene27_driverHasVent = false; + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1); +} + +void sceneHandler27_winArcade() { + if (g_fp->getObjectState(sO_Driver) == g_fp->getObjectEnumState(sO_Driver, sO_WithSteering)) { + g_vars->scene27_dudeIsAiming = false; + + g_fp->_aniMan->_callback2 = 0; + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + + sceneHandler27_driverGiveVent(); + } +} + +void sceneHandler27_takeVent() { + if (g_fp->getObjectState(sO_Maid) == g_fp->getObjectEnumState(sO_Maid, sO_WithSwab)) { + if (g_vars->scene27_maid->isIdle()) { + if (g_vars->scene27_maid->_flags & 4) { + g_vars->scene27_maid->changeStatics2(ST_MID_SWAB2); + g_vars->scene27_maid->startMQIfIdle(QU_MID_CLEANVENT, 1); + } + } + } +} + +void sceneHandler27_showNextBat() { + if (g_vars->scene27_bat) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC27_SHOWBET), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene27_bat->_okeyCode); + mq->chain(0); + } + + g_vars->scene27_batHandler->_priority = 1045; +} + +int sceneHandler27_updateScreenCallback() { + int res; + + res = g_fp->drawArcadeOverlay(getGameLoaderInteractionController()->_flag24 == 0); + + if (!res) + g_fp->_updateScreenCallback = 0; + + return res; +} + +void sceneHandler27_aniManCallback(int *phase) { + if (!g_vars->scene27_maxPhaseReached) { + if (*phase >= 5) + g_vars->scene27_maxPhaseReached = true; + else + ++*phase; + } +} + +void sceneHandler27_throwBat() { + if (getGameLoaderInteractionController()->_flag24) + g_fp->_updateScreenCallback = sceneHandler27_updateScreenCallback; + + g_fp->_aniMan->_callback2 = sceneHandler27_aniManCallback; + + g_fp->_aniMan->startAnim(MV_MAN27_THROWBET, 0, -1); + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + + g_vars->scene27_maxPhaseReached = false; + + g_vars->scene27_bat->hide(); +} + +void sceneHandler27_clickBat(ExCommand *cmd) { + int bx = g_vars->scene27_bat->_ox - 5; + int by = g_vars->scene27_bat->_oy - 71; + +#if DBG + sceneHandler27_throwBat(); + return; +#endif + + if (ABS(bx - g_fp->_aniMan->_ox) > 1 || ABS(by - g_fp->_aniMan->_oy) > 1 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, bx, by, 1, ST_MAN_RIGHT); + + if (mq) { + mq->addExCommandToEnd(cmd->createClone()); + + postExCommand(g_fp->_aniMan->_id, 2, bx, by, 0, -1); + } + } else { + sceneHandler27_throwBat(); + } +} + +void sceneHandler27_maidSwab() { +#if DBG + return; +#endif + if (g_fp->getObjectState(sO_Maid) == g_fp->getObjectEnumState(sO_Maid, sO_WithSwab)) + g_vars->scene27_maid->changeStatics2(ST_MID_SWAB); +} + +void sceneHandler27_startBat(StaticANIObject *bat) { + Bat *newbat = new Bat; + + newbat->power = g_vars->scene27_launchPhase * 2.5 + 8.0; + newbat->field_10 = 0; + newbat->ani = bat; + newbat->powerCos = newbat->power * cos(0.0); + newbat->powerSin = newbat->power * sin(0.0); + newbat->currX = newbat->powerCos + (double)g_fp->_aniMan->_ox + 42.0; + newbat->currY = newbat->powerSin + (double)g_fp->_aniMan->_oy + 58.0; + + bat->_statics = (Statics *)bat->_staticsList[0]; + bat->setOXY((int)newbat->currX, (int)newbat->currY); + bat->_flags |= 4; + + g_vars->scene27_bats.push_back(newbat); + + sceneHandler27_maidSwab(); +} + +void sceneHandler27_startAiming() { + g_vars->scene27_dudeIsAiming = false; + g_vars->scene27_maxPhaseReached = false; + + g_fp->_aniMan->_callback2 = 0; + + g_vars->scene27_launchPhase = g_fp->_aniMan->_movement->_currDynamicPhaseIndex - 6; + + int phase = 21 - g_vars->scene27_launchPhase; + + if (phase < 14) + phase = 14; + + if (phase > 20) + phase = 20; + + g_fp->playSound(SND_27_044, 0); + + g_fp->_aniMan->_movement->setDynamicPhaseIndex(phase); +} + +void sceneHandler27_initAiming(ExCommand *cmd) { + g_vars->scene27_aimStartX = cmd->_x; + g_vars->scene27_aimStartY = cmd->_y; + g_vars->scene27_dudeIsAiming = true; + g_vars->scene27_maxPhaseReached = false; +} + +void sceneHandler27_aimDude() { + int phase = (g_vars->scene27_aimStartX - g_fp->_mouseScreenPos.x) / 20 + 6; + + if (phase < 6) + phase = 6; + + if (phase > 11) + phase = 11; + + if (g_fp->_aniMan->_movement) + g_fp->_aniMan->_movement->setDynamicPhaseIndex(phase); +} + +void sceneHandler27_wipeDo() { + for (uint i = 0; i < g_vars->scene27_bats.size(); i++) { + if (g_vars->scene27_bats[i]->currX < 800.0) { + g_vars->scene27_bats[i]->field_10 = atan2(800.0 - g_vars->scene27_bats[i]->currX, 520.0 - g_vars->scene27_bats[i]->currY); + g_vars->scene27_bats[i]->power += 1.0; + } + } +} + +bool sceneHandler27_batFallLogic(uint batn) { + Bat *bat = g_vars->scene27_bats[batn]; + + int y = (bat->currY - 458.0) * 0.4848484848484849 + 734.0; + + if (y >= bat->currX) + return false; + + if (bat->currX - y > 15.0 || bat->ani->_statics->_staticsId == ST_BTA_FALL) { + bat->ani->_priority = 2020; + + g_vars->scene27_var07.push_back(bat); + + if (batn != g_vars->scene27_var07.size() - 1) + g_vars->scene27_var07.remove_at(batn); + } else if (!bat->ani->_movement) { + bat->ani->startAnim(MV_BTA_FALL, 0, -1); + } + + return true; +} + +bool sceneHandler27_batCalcDistance(int bat1, int bat2) { + double at = atan2(g_vars->scene27_bats[bat1]->currX - g_vars->scene27_bats[bat2]->currX, g_vars->scene27_bats[bat1]->currY - g_vars->scene27_bats[bat2]->currY); + double dy = g_vars->scene27_bats[bat1]->currY - g_vars->scene27_bats[bat2]->currY; + double dx = g_vars->scene27_bats[bat1]->currX - g_vars->scene27_bats[bat2]->currX; + double ay = cos(at); + double ax = sin(at); + + return sqrt(ax * ax * 0.25 + ay * ay) * 54.0 > sqrt(dx * dx + dy * dy); +} + +void sceneHandler27_knockBats(int bat1n, int bat2n) { + Bat *bat1 = g_vars->scene27_bats[bat1n]; + Bat *bat2 = g_vars->scene27_bats[bat2n]; + + if (0.0 != bat1->power) { + double rndF = (double)g_fp->_rnd->getRandomNumber(32767) * 0.0000009155552842799158 - 0.015 + + atan2(bat2->currX - bat1->currX, bat2->currY - bat1->currY); + double rndCos = cos(rndF); + double rndSin = sin(rndF); + + double pow1x = cos(bat1->field_10 - rndF) * (double)((int)(bat2->currX - bat1->currX) >= 0 ? 1 : -1) * bat1->power; + double pow1y = sin(bat1->field_10 - rndF) * (double)((int)(bat2->currY - bat1->currY) >= 0 ? 1 : -1) * bat1->power; + + bat1->powerCos -= pow1x * 1.1; + bat1->powerSin -= pow1y * 1.1; + + rndF = ((double)g_fp->_rnd->getRandomNumber(32767) * 0.0000009155552842799158 - 0.015 + + atan2(bat1->currX - bat2->currX, bat1->currY - bat2->currY)); + double pow2x = cos(bat2->field_10 - rndF) * (double)((int)(bat1->currX - bat2->currX) >= 0 ? 1 : -1) * bat2->power; + double pow2y = sin(bat2->field_10 - rndF) * (double)((int)(bat1->currY - bat2->currY) >= 0 ? 1 : -1) * bat2->power; + + bat2->powerCos -= pow2x * 1.1; + bat2->powerSin -= pow2y * 1.1; + + double dy = bat1->currY - bat2->currY; + double dx = bat1->currX - bat2->currX; + double dist = (sqrt(rndSin * rndSin * 0.25 + rndCos * rndCos) * 54.0 - sqrt(dx * dx + dy * dy)) / cos(rndF - bat1->field_10); + bat1->currX -= cos(bat1->field_10) * (dist + 1.0); + bat1->currY -= sin(bat1->field_10) * (dist + 1.0); + bat1->powerCos += pow2x * 0.64; + + if (bat1->currX <= 500.0) + bat1->powerSin = 0.0; + else + bat1->powerSin += pow2y * 0.64; + + bat1->field_10 = atan2(bat1->powerCos, bat1->powerSin); + bat1->power = sqrt(bat1->powerCos * bat1->powerCos + bat1->powerSin * bat1->powerSin); + bat2->powerCos += pow1x * 0.64; + + if (bat2->currX <= 500.0) + bat2->powerSin = 0; + else + bat2->powerSin += pow1y * 0.64; + + bat2->field_10 = atan2(bat2->powerCos, bat2->powerSin); + bat2->power = sqrt(bat2->powerCos * bat2->powerCos + bat2->powerSin * bat2->powerSin); + + g_fp->playSound(SND_27_026, 0); + } +} + +void sceneHandler27_batSetColors(int batn) { + Bat *bat = g_vars->scene27_bats[batn]; + + if (g_vars->scene27_hitZone->isPixelHitAtPos((int)bat->currX, (int)bat->currY) ) { + if (bat->ani->_statics->_staticsId == ST_BTA_NORM) { + if (!bat->ani->_movement) + bat->ani->_statics = bat->ani->getStaticsById(ST_BTA_HILITE); + } + } else { + if (bat->ani->_statics->_staticsId == ST_BTA_HILITE) { + if (!bat->ani->_movement) + bat->ani->_statics = bat->ani->getStaticsById(ST_BTA_NORM); + } + } +} + +void sceneHandler27_driverPushButton() { + if (g_fp->getObjectState(sO_Driver) == g_fp->getObjectEnumState(sO_Driver, sO_WithSteering)) { + g_vars->scene27_driver->changeStatics2(ST_DRV_VENT); + chainQueue(QU_DRV_PUSHBUTTON, 1); + + g_vars->scene27_driverPushedButton = true; + } else { + g_vars->scene27_driver->changeStatics2(ST_DRV_SITNOVENT); + + + chainQueue(QU_DRV_PUSHBUTTON_NOVENT, 1); + + g_vars->scene27_driverPushedButton = true; + } +} + +void sceneHandler27_maidSwitchback() { +#ifndef DBG + if (g_fp->getObjectState(sO_Maid) == g_fp->getObjectEnumState(sO_Maid, sO_WithSwab)) { + g_vars->scene27_maid->changeStatics2(ST_MID_SWAB); + g_vars->scene27_maid->startMQIfIdle(QU_MID_SWITCHBACK, 1); + } +#endif +} + +void sceneHandler27_batLogic() { + if (g_vars->scene27_balls.numBalls) { + g_vars->scene27_bat = g_vars->scene27_balls.pHead->ani; + + g_vars->scene27_balls.pHead = g_vars->scene27_balls.pHead->p0; + + if (g_vars->scene27_balls.pHead) + g_vars->scene27_balls.pHead->p0->p1 = 0; + else + g_vars->scene27_balls.field_8 = 0; + + g_vars->scene27_balls.init(&g_vars->scene27_balls.pHead->p0); + + int mv; + + switch (g_vars->scene27_batHandler->_statics->_staticsId) { + case ST_BTH_5: + mv = MV_BTH_5_4; + break; + + case ST_BTH_4: + mv = MV_BTH_4_3; + break; + + case ST_BTH_3: + mv = MV_BTH_3_2; + break; + + case ST_BTH_2: + mv = MV_BTH_2_1; + break; + + case ST_BTH_1: + mv = MV_BTH_1_0; + break; + + default: + chainQueue(QU_SC27_RESTARTBETS, 1); + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1); + + return; + } + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + + mq->setFlags(mq->getFlags() | 1); + + ExCommand *ex = new ExCommand(g_vars->scene27_batHandler->_id, 1, mv, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(0, 17, MSG_SC27_CLICKBET, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + + mq->chain(0); + } else { + g_vars->scene27_bat = 0; + } +} + +void sceneHandler27_calcWinArcade() { + if (!g_vars->scene27_wipeIsNeeded && !g_vars->scene27_driverPushedButton) { + int numHilite = 0; + + for (uint i = 0; i < g_vars->scene27_bats.size(); i++) { + if (g_vars->scene27_bats[i]->ani->_statics->_staticsId == ST_BTA_HILITE) + numHilite++; + } + + if (numHilite >= 3) { + if (g_fp->getObjectState(sO_Driver) == g_fp->getObjectEnumState(sO_Driver, sO_WithSteering)) { + sceneHandler27_driverGiveVent(); + sceneHandler27_maidSwitchback(); + + return; + } + } + + if (!g_vars->scene27_balls.numBalls) { + sceneHandler27_driverPushButton(); + sceneHandler27_maidSwitchback(); + return; + } + + sceneHandler27_batLogic(); + } + + sceneHandler27_maidSwitchback(); +} + +void sceneHandler27_regenBats() { + g_vars->scene27_wipeIsNeeded = false; + + for (uint i = 0; i < g_vars->scene27_var07.size(); i++) { + g_vars->scene27_var07[i]->ani->hide(); + + Ball *runPtr = g_vars->scene27_balls.pTail; + Ball *lastP = g_vars->scene27_balls.field_8; + StaticANIObject *newbat = g_vars->scene27_var07[i]->ani; + + if (!g_vars->scene27_balls.pTail) { + g_vars->scene27_balls.cPlex = (byte *)calloc(g_vars->scene27_balls.cPlexLen, sizeof(Ball)); + + byte *p1 = g_vars->scene27_balls.cPlex + (g_vars->scene27_balls.cPlexLen - 1) * sizeof(Ball); + + if (g_vars->scene27_balls.cPlexLen - 1 < 0) { + runPtr = g_vars->scene27_balls.pTail; + } else { + runPtr = g_vars->scene27_balls.pTail; + + for (int j = 0; j < g_vars->scene27_balls.cPlexLen; j++) { + ((Ball *)p1)->p1 = runPtr; + runPtr = (Ball *)p1; + + p1 -= sizeof(Ball); + } + + g_vars->scene27_balls.pTail = runPtr; + } + } + + g_vars->scene27_balls.pTail = runPtr->p0; + runPtr->p1 = lastP; + runPtr->p0 = 0; + runPtr->ani = newbat; + + g_vars->scene27_balls.numBalls++; + + if (g_vars->scene27_balls.field_8) + g_vars->scene27_balls.field_8->p0 = runPtr; + else + g_vars->scene27_balls.pHead = runPtr; + + g_vars->scene27_balls.field_8 = runPtr; + } + + g_vars->scene27_var07.clear(); + + sceneHandler27_batLogic(); + + g_vars->scene27_driverPushedButton = false; +} + +void sceneHandler27_animateBats() { + int oldCount = g_vars->scene27_knockCount; + + g_vars->scene27_numLostBats = 0; + g_vars->scene27_knockCount = 0; + + for (uint i = 0; i < g_vars->scene27_bats.size(); i++) { + Bat *bat = g_vars->scene27_bats[i]; + + bat->currX = cos(bat->field_10) * bat->power + bat->currX; + bat->currY = sin(bat->field_10) * bat->power + bat->currY; + + bat->ani->setOXY((int)bat->currX, (int)bat->currY); + bat->ani->_priority = (int)(600.0 - bat->currY); + + double powerDelta; + + if (cos(bat->field_10) >= 0.0 || bat->currX >= 362.0) + powerDelta = bat->power * 0.035; + else + powerDelta = bat->power * 0.4; + + bat->power -= powerDelta; + bat->powerCos = cos(bat->field_10) * bat->power; + bat->powerSin = sin(bat->field_10) * bat->power; + + if (bat->power >= 0.5) + g_vars->scene27_knockCount++; + else + bat->power = 0; + + sceneHandler27_batSetColors(i); + + if (!sceneHandler27_batFallLogic(i) && !g_vars->scene27_wipeIsNeeded) { + for (uint j = 0; j < g_vars->scene27_bats.size(); j++) { + if (i != j && sceneHandler27_batCalcDistance(i, j)) + sceneHandler27_knockBats(i, j); + } + } + } + + for (uint i = 0; i < g_vars->scene27_var07.size(); i++) { + Bat *bat = g_vars->scene27_var07[i]; + + if (bat->currY >= 700.0) { + g_vars->scene27_numLostBats++; + } else { + bat->currX = bat->powerCos + bat->currX; + bat->currY = bat->powerSin + bat->currY; + bat->ani->setOXY((int)bat->currX, (int)bat->currY); + bat->powerSin = bat->powerSin + 1.0; + } + } + + if (oldCount != g_vars->scene27_knockCount && !g_vars->scene27_knockCount) + sceneHandler27_calcWinArcade(); + + if (g_vars->scene27_wipeIsNeeded) { + if (g_vars->scene27_numLostBats == 5) + sceneHandler27_regenBats(); + } +} + +int sceneHandler27(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_CMN_WINARCADE: + sceneHandler27_winArcade(); + break; + + case MSG_SC27_TAKEVENT: + sceneHandler27_takeVent(); + break; + + case MSG_SC27_SHOWNEXTBET: + sceneHandler27_showNextBat(); + break; + + case MSG_SC27_HANDLERTOFRONT: + g_vars->scene27_batHandler->_priority = 1005; + break; + + case MSG_SC27_STARTWIPE: + g_vars->scene27_wipeIsNeeded = true; + + g_fp->playSound(SND_27_027, 0); + + break; + + case MSG_SC27_CLICKBET: + sceneHandler27_clickBat(cmd); + break; + + case MSG_SC27_STARTBET: + if (g_vars->scene27_bat) + sceneHandler27_startBat(g_vars->scene27_bat); + + break; + + case 30: + if (g_vars->scene27_dudeIsAiming) + sceneHandler27_startAiming(); + + break; + + case 29: + if (g_fp->_aniMan == g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y) + && g_vars->scene27_maxPhaseReached) + sceneHandler27_initAiming(cmd); + + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene27_dudeIsAiming) + sceneHandler27_aimDude(); + + if (g_vars->scene27_wipeIsNeeded) { + sceneHandler27_wipeDo(); + + if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_RIGHT) + g_fp->_aniMan->startAnim(MV_MAN27_FLOW, 0, -1); + } + + sceneHandler27_animateBats(); + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene28.cpp b/engines/fullpipe/scenes/scene28.cpp index 62afd128c2..c21ce05502 100644 --- a/engines/fullpipe/scenes/scene28.cpp +++ b/engines/fullpipe/scenes/scene28.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene29.cpp b/engines/fullpipe/scenes/scene29.cpp new file mode 100644 index 0000000000..27fc09adce --- /dev/null +++ b/engines/fullpipe/scenes/scene29.cpp @@ -0,0 +1,571 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +struct WalkingBearder { + StaticANIObject *ani; + int wbflag; + int wbcounter; +}; + +void scene29_initScene(Scene *sc) { + g_vars->scene29_var01 = 300; + g_vars->scene29_var02 = 200; + g_vars->scene29_var03 = 400; + g_vars->scene29_var04 = 300; + g_vars->scene29_porter = sc->getStaticANIObject1ById(ANI_PORTER, -1); + g_vars->scene29_shooter1 = sc->getStaticANIObject1ById(ANI_SHOOTER1, -1); + g_vars->scene29_shooter2 = sc->getStaticANIObject1ById(ANI_SHOOTER2, -1); + g_vars->scene29_ass = sc->getStaticANIObject1ById(ANI_ASS, -1); + + g_vars->scene29_var05.numBalls = 0; + g_vars->scene29_var05.pTail = 0; + g_vars->scene29_var05.field_8 = 0; + g_vars->scene29_var05.pHead = 0; + + free(g_vars->scene29_var05.cPlex); + g_vars->scene29_var05.cPlex = 0; + + StaticANIObject *ani; + + g_vars->scene29_var08.numBalls = 0; + g_vars->scene29_var08.pTail = 0; + g_vars->scene29_var08.field_8 = 0; + g_vars->scene29_var08.pHead = 0; + + free(g_vars->scene29_var08.cPlex); + g_vars->scene29_var08.cPlex = 0; + + ani = sc->getStaticANIObject1ById(ANI_SHELL_GREEN, -1); + Ball *b = g_vars->scene29_var05.sub04(g_vars->scene29_var05.field_8, 0); + b->ani = ani; + + if (g_vars->scene29_var05.field_8) + g_vars->scene29_var05.field_8->p0 = b; + else + g_vars->scene29_var05.pHead = b; + + g_vars->scene29_var05.field_8 = b; + + for (int i = 0; i < 2; i++) { + StaticANIObject *newani = new StaticANIObject(ani); + + sc->addStaticANIObject(newani, 1); + + b = g_vars->scene29_var05.sub04(g_vars->scene29_var05.field_8, 0); + b->ani = ani; + + if (g_vars->scene29_var05.field_8) + g_vars->scene29_var05.field_8->p0 = b; + else + g_vars->scene29_var05.pHead = b; + + g_vars->scene29_var05.field_8 = b; + } + + g_vars->scene29_var06.numBalls = 0; + g_vars->scene29_var06.pTail = 0; + g_vars->scene29_var06.field_8 = 0; + g_vars->scene29_var06.pHead = 0; + + free(g_vars->scene29_var06.cPlex); + g_vars->scene29_var06.cPlex = 0; + + g_vars->scene29_var07.numBalls = 0; + g_vars->scene29_var07.pTail = 0; + g_vars->scene29_var07.field_8 = 0; + g_vars->scene29_var07.pHead = 0; + + free(g_vars->scene29_var07.cPlex); + g_vars->scene29_var07.cPlex = 0; + + ani = sc->getStaticANIObject1ById(ANI_SHELL_RED, -1); + + b = g_vars->scene29_var06.sub04(g_vars->scene29_var06.field_8, 0); + b->ani = ani; + + if (g_vars->scene29_var06.field_8) + g_vars->scene29_var06.field_8->p0 = b; + else + g_vars->scene29_var06.pHead = b; + + g_vars->scene29_var06.field_8 = b; + + for (int i = 0; i < 2; i++) { + StaticANIObject *newani = new StaticANIObject(ani); + + sc->addStaticANIObject(newani, 1); + + b = g_vars->scene29_var06.sub04(g_vars->scene29_var06.field_8, 0); + b->ani = ani; + + if (g_vars->scene29_var06.field_8) + g_vars->scene29_var06.field_8->p0 = b; + else + g_vars->scene29_var06.pHead = b; + + g_vars->scene29_var06.field_8 = b; + } + + g_vars->scene29_var19.clear(); + + ani = new StaticANIObject(g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_BEARDED_CMN, -1)); + + ani->_statics = ani->getStaticsById(ST_BRDCMN_EMPTY); + + sc->addStaticANIObject(ani, 1); + + WalkingBearder *wb = new WalkingBearder; + + wb->ani = ani; + wb->wbflag = 0; + wb->wbcounter = 0; + + g_vars->scene29_var19.push_back(wb); + + g_vars->scene29_var09 = 0; + g_vars->scene29_var10 = 0; + g_vars->scene29_var11 = 0; + g_vars->scene29_var12 = 0; + g_vars->scene29_var13 = 0; + g_vars->scene29_var14 = 75; + g_vars->scene29_var15 = 0; + g_vars->scene29_var16 = 0; + g_vars->scene29_var17 = 0; + g_vars->scene29_var18 = 0; + + g_fp->setArcadeOverlay(PIC_CSR_ARCADE8); +} + +void sceneHandler29_winArcade() { + warning("STUB: sceneHandler29_winArcade()"); +} + +void sceneHandler29_shootGreen() { + warning("STUB: sceneHandler29_shootGreen()"); +} + +void sceneHandler29_shootRed() { + warning("STUB: sceneHandler29_shootRed()"); +} + +void sceneHandler29_manJump() { + if (!g_fp->_aniMan->_movement || g_fp->_aniMan->_movement->_id == MV_MAN29_RUN || g_fp->_aniMan->_movement->_id == MV_MAN29_STANDUP) { + g_vars->scene29_var12 = 0; + g_vars->scene29_var15 = 0; + g_vars->scene29_var11 = 1; + + g_fp->_aniMan->changeStatics2(ST_MAN29_RUNR); + g_fp->_aniMan->startAnim(MV_MAN29_JUMP, 0, -1); + } + + g_vars->scene29_var20 = g_fp->_aniMan->_ox; + g_vars->scene29_var21 = g_fp->_aniMan->_oy; +} + +void sceneHandler29_manBend() { + if (!g_fp->_aniMan->_movement || g_fp->_aniMan->_movement->_id == MV_MAN29_RUN || g_fp->_aniMan->_movement->_id == MV_MAN29_STANDUP) { + g_vars->scene29_var12 = 0; + g_vars->scene29_var15 = 0; + g_vars->scene29_var11 = 1; + + g_fp->_aniMan->changeStatics2(ST_MAN29_RUNR); + g_fp->_aniMan->startAnim(MV_MAN29_BEND, 0, -1); + } + + g_vars->scene29_var20 = g_fp->_aniMan->_ox; + g_vars->scene29_var21 = g_fp->_aniMan->_oy; +} + +void sceneHandler29_sub03() { + warning("STUB: sceneHandler29_sub03()"); +} + +void sceneHandler29_manFromL() { + if (g_vars->scene29_var20 < 497 && !g_vars->scene29_var17) { + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000); + chainQueue(QU_SC29_MANFROM_L, 1); + + g_vars->scene29_var17 = 1; + + g_fp->_scrollSpeed = g_vars->scene29_var16; + } +} + +void sceneHandler29_manFromR() { + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + chainQueue(QU_SC29_MANFROM_R, 1); + + g_vars->scene29_var10 = 0; + g_vars->scene29_var12 = 0; +} + +int sceneHandler29_updateScreenCallback() { + int res; + + res = g_fp->drawArcadeOverlay(g_vars->scene29_var10); + + if (!res) + g_fp->_updateScreenCallback = 0; + + return res; +} + +void sceneHandler29_manToL() { + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + + chainQueue(QU_SC29_MANTO_L, 1); + + g_vars->scene29_var10 = 1; + + g_vars->scene29_mgm.addItem(g_fp->_aniMan->_id); + + g_fp->_updateScreenCallback = sceneHandler29_updateScreenCallback; + + g_fp->_msgY = -1; + g_fp->_msgX = -1; +} + +void sceneHandler29_manToR() { + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + + chainQueue(QU_SC29_MANTO_R, 1); + + g_vars->scene29_var09 = 1; + g_fp->_msgY = -1; + g_fp->_msgX = -1; + + g_vars->scene29_var17 = 0; + + g_vars->scene29_var16 = g_fp->_scrollSpeed; + g_fp->_scrollSpeed = 4; +} + +void sceneHandler29_clickPorter(ExCommand *cmd) { + if (!g_fp->_aniMan->isIdle() || g_fp->_aniMan->_flags & 0x100) { + cmd->_messageKind = 0; + + return; + } + + if (g_vars->scene29_var20 <= g_vars->scene29_porter->_ox) { + if (ABS(351 - g_vars->scene29_var20) > 1 || ABS(443 - g_vars->scene29_var21) > 1 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) { + if (g_fp->_msgX != 351 || g_fp->_msgY != 443) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 351, 443, 1, ST_MAN_RIGHT); + + if (mq) { + mq->addExCommandToEnd(cmd->createClone()); + + postExCommand(g_fp->_aniMan->_id, 2, 351, 443, 0, -1); + } + } + } else { + sceneHandler29_manToL(); + } + } else { + g_vars->scene29_var20 = g_fp->_aniMan->_ox; + g_vars->scene29_var21 = g_fp->_aniMan->_oy; + + if (ABS(1582 - g_vars->scene29_var20) > 1 || ABS(445 - g_fp->_aniMan->_oy) > 1 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != (0x4000 | ST_MAN_RIGHT)) { + if (g_fp->_msgX != 1582 || g_fp->_msgY != 445) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1582, 445, 1, (0x4000 | ST_MAN_RIGHT)); + + if (mq) { + mq->addExCommandToEnd(cmd->createClone()); + + postExCommand(g_fp->_aniMan->_id, 2, 1582, 445, 0, -1); + } + } + } else { + sceneHandler29_manToR(); + } + } +} + +void sceneHandler29_sub05() { + warning("STUB: sceneHandler29_sub05()"); +} + +void sceneHandler29_shootersEscape() { + if (g_vars->scene29_var10) { + g_vars->scene29_var20 += 2; + + g_fp->_aniMan->setOXY(g_vars->scene29_var20, g_vars->scene29_var21); + + if (g_vars->scene29_var20 > 1310 && !g_vars->scene29_shooter1->_movement && !g_vars->scene29_shooter2->_movement + && g_vars->scene29_shooter1->_statics->_staticsId == ST_STR1_RIGHT) { + g_vars->scene29_var13 = 0; + + g_vars->scene29_shooter1->changeStatics2(ST_STR1_STAND); + g_vars->scene29_shooter2->changeStatics2(ST_STR2_STAND); + + chainQueue(QU_SC29_ESCAPE, 1); + + g_vars->scene29_ass->queueMessageQueue(0); + g_vars->scene29_ass->hide(); + + g_fp->setObjectState(sO_LeftPipe_29, g_fp->getObjectEnumState(sO_LeftPipe_29, sO_IsOpened)); + } + } else if (g_vars->scene29_var09) { + g_vars->scene29_var20 -= 4; + + g_fp->_aniMan->setOXY(g_vars->scene29_var20, g_vars->scene29_var21); + } +} + +void sceneHandler29_sub07() { + warning("STUB: sceneHandler29_sub07()"); +} + +void sceneHandler29_assHitGreen() { + if (g_vars->scene29_ass->_statics->_staticsId == ST_ASS_NORM) { + g_vars->scene29_ass->changeStatics2(ST_ASS_NORM); + g_vars->scene29_ass->startAnim(MV_ASS_HITGREEN, 0, -1); + } +} + +void sceneHandler29_assHitRed() { + if (g_vars->scene29_ass->_statics->_staticsId == ST_ASS_NORM) { + g_vars->scene29_ass->changeStatics2(ST_ASS_NORM); + g_vars->scene29_ass->startAnim(MV_ASS_HITRED, 0, -1); + } +} + +void sceneHandler29_shoot() { + if (g_vars->scene29_var10 && g_vars->scene29_var20 < 1310) { + if (g_fp->_rnd->getRandomNumber(1) || g_vars->scene29_shooter1->_movement || g_vars->scene29_shooter1->_statics->_staticsId != ST_STR1_RIGHT) { + if (!g_vars->scene29_shooter2->_movement && g_vars->scene29_shooter2->_statics->_staticsId == ST_STR2_RIGHT) { + if (g_vars->scene29_shooter2->_flags & 4) { + g_vars->scene29_shooter2->startAnim(MV_STR2_SHOOT, 0, -1); + + g_vars->scene29_var13 = 0; + } + } + } else { + g_vars->scene29_shooter1->startAnim(MV_STR1_SHOOT, 0, -1); + + g_vars->scene29_var13 = 0; + } + } +} + +void sceneHandler29_animBearded() { + warning("STUB: sceneHandler29_animBearded()"); +} + + + +int sceneHandler29(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_CMN_WINARCADE: + sceneHandler29_winArcade(); + break; + + case MSG_SC29_LAUGH: + if (g_vars->scene29_var18 == ANI_SHELL_GREEN) { + g_fp->playSound(SND_29_028, 0); + break; + } + + g_fp->playSound(SND_29_029, 0); + + break; + + case MSG_SC29_SHOWLASTRED: + if (g_vars->scene29_var05.numBalls) { + g_vars->scene29_var06.field_8->ani->show1(-1, -1, -1, 0); + g_vars->scene29_var06.field_8->ani->startAnim(MV_SHR_HITASS, 0, -1); + } + + break; + + case MSG_SC29_SHOOTGREEN: + sceneHandler29_shootGreen(); + break; + + case MSG_SC29_SHOOTRED: + sceneHandler29_shootRed(); + break; + + case MSG_SC29_SHOWLASTGREEN: + if (g_vars->scene29_var05.numBalls) { + g_vars->scene29_var05.field_8->ani->show1(-1, -1, -1, 0); + g_vars->scene29_var05.field_8->ani->startAnim(MV_SHG_HITASS, 0, -1); + } + + break; + + case MSG_SC29_STOPRIDE: + g_vars->scene29_var09 = 0; + g_vars->scene29_var10 = 0; + g_vars->scene29_var11 = 0; + g_vars->scene29_var12 = 0; + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + break; + + case MSG_SC29_DISABLERIDEBACK: + g_vars->scene29_var12 = 0; + break; + + case MSG_SC29_ENABLERIDEBACK: + g_vars->scene29_var12 = 1; + g_vars->scene29_var11 = 0; + break; + + case MSG_SC29_DISABLEPORTER: + g_vars->scene29_var11 = 0; + break; + + case MSG_SC29_ENABLEPORTER: + g_vars->scene29_var11 = 1; + g_vars->scene29_var12 = 0; + g_vars->scene29_var15 = 0; + break; + + case 29: + if (!g_vars->scene29_var09 || g_vars->scene29_var10) { + if (!g_vars->scene29_var10) { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y); + + if (ani && ani == g_vars->scene29_porter) { + sceneHandler29_clickPorter(cmd); + + cmd->_messageKind = 0; + break; + } + break; + } + + sceneHandler29_manJump(); + + cmd->_messageKind = 0; + break; + } + break; + + case 107: + if (g_vars->scene29_var10) + sceneHandler29_manBend(); + + break; + + case 33: + if (g_vars->scene29_var10) { + if (g_vars->scene29_var20 > g_fp->_sceneRect.right - 500) + g_fp->_currentScene->_x = g_fp->_sceneRect.right - g_vars->scene29_var20 - 350; + + if (g_vars->scene29_var20 < g_fp->_sceneRect.left + 100) + g_fp->_currentScene->_x = g_vars->scene29_var20 - g_fp->_sceneRect.left - 100; + + } else if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + g_vars->scene29_var01) + g_fp->_currentScene->_x = x - g_vars->scene29_var03 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - g_vars->scene29_var01) + g_fp->_currentScene->_x = x + g_vars->scene29_var03 - g_fp->_sceneRect.right; + } + + g_vars->scene29_var20 = g_fp->_aniMan->_ox; + g_vars->scene29_var21 = g_fp->_aniMan->_oy; + + sceneHandler29_sub03(); + + if (!g_vars->scene29_porter->_movement) + g_vars->scene29_porter->startAnim(MV_PTR_MOVEFAST, 0, -1); + + if (g_vars->scene29_var09) + sceneHandler29_manFromL(); + else if (g_vars->scene29_var10 && !g_fp->_aniMan->_movement) + sceneHandler29_sub05(); + + if (g_vars->scene29_var11) + sceneHandler29_shootersEscape(); + else if (g_vars->scene29_var12) + sceneHandler29_sub07(); + + g_vars->scene29_var13++; + + if (g_vars->scene29_var13 > g_vars->scene29_var14) + sceneHandler29_shoot(); + + sceneHandler29_animBearded(); + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +int scene29_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_vars->scene29_var10) { + if (g_fp->_cursorId != PIC_CSR_DEFAULT_INV && g_fp->_cursorId != PIC_CSR_ITN_INV) + g_fp->_cursorId = -1; + } else if (g_vars->scene29_var09) { + if (g_fp->_cursorId != PIC_CSR_DEFAULT_INV && g_fp->_cursorId != PIC_CSR_ITN_INV) + g_fp->_cursorId = PIC_CSR_DEFAULT; + } else if (g_fp->_objectIdAtCursor == ANI_PORTER) { + if (g_fp->_cursorId == PIC_CSR_DEFAULT) + g_fp->_cursorId = PIC_CSR_ITN; + } else { + if (g_fp->_objectIdAtCursor == PIC_SC29_LTRUBA && g_fp->_cursorId == PIC_CSR_ITN) + g_fp->_cursorId = PIC_CSR_GOL; + } + return g_fp->_cursorId; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene30.cpp b/engines/fullpipe/scenes/scene30.cpp index a807e692a7..ca2324e647 100644 --- a/engines/fullpipe/scenes/scene30.cpp +++ b/engines/fullpipe/scenes/scene30.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -111,7 +111,7 @@ int sceneHandler30(ExCommand *cmd) { break; case 64: - g_fp->lift_sub05(cmd); + g_fp->lift_hoverButton(cmd); break; case MSG_LIFT_GO: @@ -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/scene31.cpp b/engines/fullpipe/scenes/scene31.cpp index 587fc6aaef..3f507e62b7 100644 --- a/engines/fullpipe/scenes/scene31.cpp +++ b/engines/fullpipe/scenes/scene31.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene32.cpp b/engines/fullpipe/scenes/scene32.cpp index 597d3422f6..9279db7513 100644 --- a/engines/fullpipe/scenes/scene32.cpp +++ b/engines/fullpipe/scenes/scene32.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -339,7 +339,7 @@ int sceneHandler32(ExCommand *cmd) { break; case 64: - g_fp->lift_sub05(cmd); + g_fp->lift_hoverButton(cmd); break; case MSG_SC6_INSTHANDLE: @@ -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/scene33.cpp b/engines/fullpipe/scenes/scene33.cpp index 209198c0f3..90ea0a4f3f 100644 --- a/engines/fullpipe/scenes/scene33.cpp +++ b/engines/fullpipe/scenes/scene33.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene34.cpp b/engines/fullpipe/scenes/scene34.cpp index b3e0db75af..1c8c8b4855 100644 --- a/engines/fullpipe/scenes/scene34.cpp +++ b/engines/fullpipe/scenes/scene34.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -216,7 +216,7 @@ void sceneHandler34_animateAction(ExCommand *cmd) { int qId = 0; if (ox == 887) { - if (oy != 370) + if (oy != 370) return; qId = QU_SC34_FROMSTOOL; @@ -392,7 +392,7 @@ int sceneHandler34(ExCommand *cmd) { break; case 64: - g_fp->lift_sub05(cmd); + g_fp->lift_hoverButton(cmd); break; case MSG_LIFT_GO: @@ -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..53381fd555 100644 --- a/engines/fullpipe/scenes/scene35.cpp +++ b/engines/fullpipe/scenes/scene35.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -199,7 +199,7 @@ int sceneHandler35(ExCommand *cmd) { break; case 64: - g_fp->lift_sub05(cmd); + g_fp->lift_hoverButton(cmd); break; case 29: @@ -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/scene36.cpp b/engines/fullpipe/scenes/scene36.cpp index 7d237fd395..44099faba0 100644 --- a/engines/fullpipe/scenes/scene36.cpp +++ b/engines/fullpipe/scenes/scene36.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene37.cpp b/engines/fullpipe/scenes/scene37.cpp index 8324e00af7..09da01f138 100644 --- a/engines/fullpipe/scenes/scene37.cpp +++ b/engines/fullpipe/scenes/scene37.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/scene38.cpp b/engines/fullpipe/scenes/scene38.cpp index 016dc83c1b..2bdae1ce66 100644 --- a/engines/fullpipe/scenes/scene38.cpp +++ b/engines/fullpipe/scenes/scene38.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -368,7 +368,7 @@ int sceneHandler38(ExCommand *cmd) { break; case 64: - g_fp->lift_sub05(cmd); + g_fp->lift_hoverButton(cmd); break; case 29: @@ -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; } diff --git a/engines/fullpipe/scenes/sceneDbg.cpp b/engines/fullpipe/scenes/sceneDbg.cpp index 4a3751940f..bd53f5749f 100644 --- a/engines/fullpipe/scenes/sceneDbg.cpp +++ b/engines/fullpipe/scenes/sceneDbg.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/sceneFinal.cpp b/engines/fullpipe/scenes/sceneFinal.cpp index e483e8bab7..d0040463ef 100644 --- a/engines/fullpipe/scenes/sceneFinal.cpp +++ b/engines/fullpipe/scenes/sceneFinal.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/scenes/sceneIntro.cpp b/engines/fullpipe/scenes/sceneIntro.cpp index c9f19f3724..5e69cf1d7a 100644 --- a/engines/fullpipe/scenes/sceneIntro.cpp +++ b/engines/fullpipe/scenes/sceneIntro.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index fd25e2c903..bb6aabd2b5 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h index ca64832c04..8ddfc753ce 100644 --- a/engines/fullpipe/sound.h +++ b/engines/fullpipe/sound.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index ccf77ff81a..e36b196517 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 10d9b4dfdf..75c1c7d1ea 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -503,12 +503,16 @@ void Movement::draw(bool flipFlag, int angle) { } } - void StaticANIObject::loadMovementsPixelData() { for (uint i = 0; i < _movements.size(); i++) ((Movement *)_movements[i])->loadPixelData(); } +void StaticANIObject::freeMovementsPixelData() { + for (uint i = 0; i < _movements.size(); i++) + ((Movement *)_movements[i])->freePixelData(); +} + Statics *StaticANIObject::addReverseStatics(Statics *st) { Statics *res = getStaticsById(st->_staticsId ^ 0x4000); diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index a620daa528..8328e7679b 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -224,6 +224,7 @@ public: void initMovements(); void loadMovementsPixelData(); + void freeMovementsPixelData(); void preloadMovements(MovTable *mt); void setSomeDynamicPhaseIndex(int val) { _someDynamicPhaseIndex = val; } diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp index b3668ea362..0cc8bd83f4 100644 --- a/engines/fullpipe/utils.cpp +++ b/engines/fullpipe/utils.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index 5714fd3b4c..72e746cd03 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |