aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe
diff options
context:
space:
mode:
Diffstat (limited to 'engines/fullpipe')
-rw-r--r--engines/fullpipe/behavior.cpp50
-rw-r--r--engines/fullpipe/behavior.h4
-rw-r--r--engines/fullpipe/configure.engine3
-rw-r--r--engines/fullpipe/console.cpp52
-rw-r--r--engines/fullpipe/console.h42
-rw-r--r--engines/fullpipe/constants.h1351
-rw-r--r--engines/fullpipe/floaters.cpp220
-rw-r--r--engines/fullpipe/floaters.h12
-rw-r--r--engines/fullpipe/fullpipe.cpp42
-rw-r--r--engines/fullpipe/fullpipe.h38
-rw-r--r--engines/fullpipe/gameloader.cpp159
-rw-r--r--engines/fullpipe/gameloader.h5
-rw-r--r--engines/fullpipe/gfx.cpp146
-rw-r--r--engines/fullpipe/gfx.h11
-rw-r--r--engines/fullpipe/init.cpp20
-rw-r--r--engines/fullpipe/input.cpp78
-rw-r--r--engines/fullpipe/interaction.cpp44
-rw-r--r--engines/fullpipe/interaction.h3
-rw-r--r--engines/fullpipe/inventory.cpp26
-rw-r--r--engines/fullpipe/inventory.h4
-rw-r--r--engines/fullpipe/lift.cpp13
-rw-r--r--engines/fullpipe/messagehandlers.cpp243
-rw-r--r--engines/fullpipe/messages.cpp262
-rw-r--r--engines/fullpipe/messages.h29
-rw-r--r--engines/fullpipe/modal.cpp375
-rw-r--r--engines/fullpipe/modal.h31
-rw-r--r--engines/fullpipe/module.mk35
-rw-r--r--engines/fullpipe/motion.cpp825
-rw-r--r--engines/fullpipe/motion.h116
-rw-r--r--engines/fullpipe/ngiarchive.cpp4
-rw-r--r--engines/fullpipe/objectnames.h65
-rw-r--r--engines/fullpipe/objects.h2
-rw-r--r--engines/fullpipe/scene.cpp151
-rw-r--r--engines/fullpipe/scene.h5
-rw-r--r--engines/fullpipe/scenes.cpp740
-rw-r--r--engines/fullpipe/scenes.h473
-rw-r--r--engines/fullpipe/scenes/scene01.cpp23
-rw-r--r--engines/fullpipe/scenes/scene02.cpp53
-rw-r--r--engines/fullpipe/scenes/scene03.cpp75
-rw-r--r--engines/fullpipe/scenes/scene04.cpp1263
-rw-r--r--engines/fullpipe/scenes/scene05.cpp386
-rw-r--r--engines/fullpipe/scenes/scene06.cpp770
-rw-r--r--engines/fullpipe/scenes/scene07.cpp175
-rw-r--r--engines/fullpipe/scenes/scene08.cpp546
-rw-r--r--engines/fullpipe/scenes/scene10.cpp220
-rw-r--r--engines/fullpipe/scenes/scene11.cpp786
-rw-r--r--engines/fullpipe/scenes/scene12.cpp85
-rw-r--r--engines/fullpipe/scenes/scene13.cpp380
-rw-r--r--engines/fullpipe/scenes/scene14.cpp849
-rw-r--r--engines/fullpipe/scenes/scene15.cpp209
-rw-r--r--engines/fullpipe/scenes/scene16.cpp484
-rw-r--r--engines/fullpipe/scenes/scene17.cpp285
-rw-r--r--engines/fullpipe/scenes/scene18and19.cpp49
-rw-r--r--engines/fullpipe/scenes/scene20.cpp155
-rw-r--r--engines/fullpipe/scenes/scene21.cpp148
-rw-r--r--engines/fullpipe/scenes/scene22.cpp395
-rw-r--r--engines/fullpipe/scenes/scene23.cpp555
-rw-r--r--engines/fullpipe/scenes/scene24.cpp129
-rw-r--r--engines/fullpipe/scenes/scene25.cpp723
-rw-r--r--engines/fullpipe/scenes/scene26.cpp355
-rw-r--r--engines/fullpipe/scenes/scene28.cpp474
-rw-r--r--engines/fullpipe/scenes/scene30.cpp152
-rw-r--r--engines/fullpipe/scenes/scene31.cpp126
-rw-r--r--engines/fullpipe/scenes/scene32.cpp431
-rw-r--r--engines/fullpipe/scenes/scene33.cpp314
-rw-r--r--engines/fullpipe/scenes/scene34.cpp479
-rw-r--r--engines/fullpipe/scenes/scene35.cpp264
-rw-r--r--engines/fullpipe/scenes/scene36.cpp94
-rw-r--r--engines/fullpipe/scenes/scene37.cpp316
-rw-r--r--engines/fullpipe/scenes/scene38.cpp417
-rw-r--r--engines/fullpipe/scenes/sceneDbg.cpp27
-rw-r--r--engines/fullpipe/scenes/sceneIntro.cpp15
-rw-r--r--engines/fullpipe/sound.cpp70
-rw-r--r--engines/fullpipe/sound.h14
-rw-r--r--engines/fullpipe/stateloader.cpp30
-rw-r--r--engines/fullpipe/statics.cpp234
-rw-r--r--engines/fullpipe/statics.h20
-rw-r--r--engines/fullpipe/utils.cpp21
-rw-r--r--engines/fullpipe/utils.h3
79 files changed, 17263 insertions, 1015 deletions
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp
index c7b526d2c1..75cb027d7a 100644
--- a/engines/fullpipe/behavior.cpp
+++ b/engines/fullpipe/behavior.cpp
@@ -132,7 +132,7 @@ void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *
mq->sendNextCommand();
bhi->_flags &= 0xFFFFFFFD;
- } else if (behaviorInfo->_counter >= bhi->_delay && bhi->_percent && g_fullpipe->_rnd->getRandomNumber(32767) <= entry->_items[i]->_percent) {
+ } else if (behaviorInfo->_counter >= bhi->_delay && bhi->_percent && g_fp->_rnd->getRandomNumber(32767) <= entry->_items[i]->_percent) {
MessageQueue *mq = new MessageQueue(bhi->_messageQueue, 0, 1);
mq->sendNextCommand();
@@ -149,7 +149,7 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B
MessageQueue *mq = 0;
if (bhe->_flags & 1) {
- uint rnd = g_fullpipe->_rnd->getRandomNumber(32767);
+ uint rnd = g_fp->_rnd->getRandomNumber(32767);
uint runPercent = 0;
for (int i = 0; i < bhe->_itemsCount; i++) {
if (!(bhe->_items[i]->_flags & 1) && bhe->_items[i]->_percent) {
@@ -164,7 +164,7 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B
for (int i = 0; i < bhe->_itemsCount; i++) {
if (!(bhe->_items[i]->_flags & 1) && delay >= bhe->_items[i]->_delay) {
if (bhe->_items[i]->_percent) {
- if (g_fullpipe->_rnd->getRandomNumber(32767) <= bhe->_items[i]->_percent) {
+ if (g_fp->_rnd->getRandomNumber(32767) <= bhe->_items[i]->_percent) {
mq = new MessageQueue(bhe->_items[i]->_messageQueue, 0, 1);
break;
}
@@ -180,11 +180,49 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B
}
bool BehaviorManager::setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag) {
- warning("STUB: BehaviorManager::setBehaviorEnabled()");
+ BehaviorEntryInfo *entry = getBehaviorEntryInfoByMessageQueueDataId(obj, aniId, quId);
+
+ if (entry) {
+ if (flag)
+ entry->_flags &= 0xFFFFFFFE;
+ else
+ entry->_flags |= 1;
+ } else
+ return false;
return true;
}
+void BehaviorManager::setFlagByStaticAniObject(StaticANIObject *ani, int flag) {
+ for (uint i = 0; i < _behaviors.size(); i++) {
+ BehaviorInfo *beh = _behaviors[i];
+
+ if (ani == beh->_ani) {
+ if (flag)
+ beh->_flags &= 0xfe;
+ else
+ beh->_flags |= 1;
+ }
+ }
+}
+
+BehaviorEntryInfo *BehaviorManager::getBehaviorEntryInfoByMessageQueueDataId(StaticANIObject *ani, int id1, int id2) {
+ for (uint i = 0; i < _behaviors.size(); i++) {
+ if (_behaviors[i]->_ani == ani) {
+ for (uint j = 0; j < _behaviors[i]->_bheItems.size(); j++) {
+ if (_behaviors[i]->_bheItems[j]->_staticsId == id1) {
+ for (int k = 0; k < _behaviors[i]->_bheItems[j]->_itemsCount; k++) {
+ if (_behaviors[i]->_bheItems[j]->_items[k]->_messageQueue->_dataId == id2)
+ return _behaviors[i]->_bheItems[j]->_items[k];
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
void BehaviorInfo::clear() {
_ani = 0;
_staticsId = 0;
@@ -233,11 +271,11 @@ void BehaviorInfo::initObjectBehavior(GameVar *var, Scene *sc, StaticANIObject *
if (strcmp(var->_value.stringValue, "ROOT"))
break;
- GameVar *v1 = g_fullpipe->getGameLoaderGameVar()->getSubVarByName("BEHAVIOR")->getSubVarByName(ani->getName());
+ GameVar *v1 = g_fp->getGameLoaderGameVar()->getSubVarByName("BEHAVIOR")->getSubVarByName(ani->getName());
if (v1 == var)
return;
- sc = g_fullpipe->accessScene(ani->_sceneId);
+ sc = g_fp->accessScene(ani->_sceneId);
clear();
var = v1;
_itemsCount = var->getSubVarsCount();
diff --git a/engines/fullpipe/behavior.h b/engines/fullpipe/behavior.h
index 4fd1454351..90bb38dc9b 100644
--- a/engines/fullpipe/behavior.h
+++ b/engines/fullpipe/behavior.h
@@ -79,6 +79,10 @@ class BehaviorManager : public CObject {
void updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *beh);
bool setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag);
+
+ void setFlagByStaticAniObject(StaticANIObject *ani, int flag);
+
+ BehaviorEntryInfo *getBehaviorEntryInfoByMessageQueueDataId(StaticANIObject *ani, int id1, int id2);
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/configure.engine b/engines/fullpipe/configure.engine
new file mode 100644
index 0000000000..fce5951e26
--- /dev/null
+++ b/engines/fullpipe/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine fullpipe "Full Pipe" no
diff --git a/engines/fullpipe/console.cpp b/engines/fullpipe/console.cpp
new file mode 100644
index 0000000000..2d27fc2ddd
--- /dev/null
+++ b/engines/fullpipe/console.cpp
@@ -0,0 +1,52 @@
+/* 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/constants.h"
+#include "fullpipe/fullpipe.h"
+#include "fullpipe/gameloader.h"
+#include "fullpipe/scene.h"
+
+namespace Fullpipe {
+
+Console::Console(FullpipeEngine *vm) : GUI::Debugger(), _vm(vm) {
+ DCmd_Register("scene", WRAP_METHOD(Console, Cmd_Scene));
+}
+
+bool Console::Cmd_Scene(int argc, const char **argv) {
+ if (argc != 2) {
+ int sceneTag = _vm->_currentScene->_sceneId;
+ DebugPrintf("Current scene: %d (scene tag: %d)\n", _vm->getSceneFromTag(sceneTag), sceneTag);
+ DebugPrintf("Use %s <scene> to change the current scene\n", argv[0]);
+ return true;
+ } else {
+ int scene = _vm->convertScene(atoi(argv[1]));
+ _vm->_gameLoader->loadScene(726);
+ _vm->_gameLoader->gotoScene(726, TrubaLeft);
+
+ if (scene != 726)
+ _vm->_gameLoader->preloadScene(726, _vm->getSceneEntrance(scene));
+
+ return false;
+ }
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/console.h b/engines/fullpipe/console.h
new file mode 100644
index 0000000000..af2b5114ac
--- /dev/null
+++ b/engines/fullpipe/console.h
@@ -0,0 +1,42 @@
+/* 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.
+ *
+ */
+
+#ifndef FULLPIPE_CONSOLE_H
+#define FULLPIPE_CONSOLE_H
+
+namespace Fullpipe {
+
+class FullpipeEngine;
+
+class Console : public GUI::Debugger {
+public:
+ Console(FullpipeEngine *vm);
+
+private:
+ FullpipeEngine *_vm;
+
+ bool Cmd_Scene(int argc, const char **argv);
+};
+
+} // End of namespace Fullpipe
+
+#endif /* FULLPIPE_CONSOLE_H */
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h
index 087a768156..1d1dbeece8 100644
--- a/engines/fullpipe/constants.h
+++ b/engines/fullpipe/constants.h
@@ -25,107 +25,32 @@
namespace Fullpipe {
-#define ANI_BOOT_1 4231
-#define ANI_CLOCK 588
-#define ANI_DOMINO_3 2732
-#define ANI_DADAYASHIK 306
-#define ANI_EGGEATER 334
-#define ANI_HAND 601
-#define ANI_IN1MAN 5110
-#define ANI_INV_COIN 875
-#define ANI_INV_EGGAPL 1564
-#define ANI_INV_EGGBOOT 1570
-#define ANI_INV_EGGCOIN 1567
-#define ANI_INV_EGGDOM 1561
-#define ANI_INV_EGGGLS 1573
+// Common
+#define ANI_FLY 4916
#define ANI_INV_MAP 5321
-#define ANI_KOZAWKA 495
#define ANI_LIFTBUTTON 2751
-#define ANI_MAMASHA_4 660
#define ANI_MAN 322
-#define ANI_PLANK 501
-#define ANI_SC2_BOX 1020
-#define ANI_SC4_BOOT 1035
-#define ANI_SC4_COIN 690
-#define ANI_SPEAKER_4 3275
-#define ANI_SPRING 542
-#define MSG_CLICKBOTTLE 569
-#define MSG_CLICKBUTTON 609
-#define MSG_CLICKPLANK 549
+#define ANI_PBAR 896
#define MSG_CMN_WINARCADE 4778
#define MSG_DISABLESAVES 5201
#define MSG_ENABLESAVES 5202
#define MSG_HMRKICK_METAL 4764
#define MSG_HMRKICK_STUCCO 4765
-#define MSG_INTR_ENDINTRO 5139
-#define MSG_INTR_GETUPMAN 5135
-#define MSG_INTR_SWITCHTO1 5145
-#define MSG_INTR_SWITCHTO2 5134
-#define MSG_KOZAWRESTART 546
-#define MSG_LIFT_CLICKBUTTON 2780
-#define MSG_LIFT_CLOSEDOOR 5194
-#define MSG_LIFT_EXITLIFT 5187
-#define MSG_LIFT_GO 1065
-#define MSG_LIFT_STARTEXITQUEUE 5186
-#define MSG_LOWERPLANK 540
#define MSG_MANSHADOWSOFF 5196
#define MSG_MANSHADOWSON 5197
-#define MSG_RAISEPLANK 547
-#define MSG_RESTARTGAME 4767
-#define MSG_SC1_SHOWOSK 1019
-#define MSG_SC1_SHOWOSK2 468
-#define MSG_SC1_UTRUBACLICK 1100
-#define MSG_SC2_HIDELADDER 1023
-#define MSG_SC2_LADDERCLICK 1101
-#define MSG_SC2_PUTMANUP 1026
-#define MSG_SC2_SHOWLADDER 1027
-#define MSG_SC3_HIDEDOMINO 3177
-#define MSG_SC3_ONTAKECOIN 5338
-#define MSG_SC3_RELEASEEGG 2681
-#define MSG_SC3_TAKEEGG 1583
-#define MSG_SC3_TESTFAT 1582
-#define MSG_SC3_UTRUBACLICK 1103
-#define MSG_SC4_COINOUT 2895
-#define MSG_SC4_COINPUT 1032
-#define MSG_SC4_CLICKLADDER 1439
-#define MSG_SC4_DROPBOTTLE 2896
-#define MSG_SC4_HANDOVER 2960
-#define MSG_SC4_HIDEBOOT 4563
-#define MSG_SC4_KOZAWFALL 2858
-#define MSG_SC4_MANFROMBOTTLE 2854
-#define MSG_SC4_MANTOBOTTLE 2852
-#define PIC_SC4_LADDER 1438
-#define MSG_GOTOLADDER 618
-#define MSG_SHAKEBOTTLE 584
-#define MSG_SHOOTKOZAW 557
-#define MSG_SHOWCOIN 1033
-#define MSG_STARTHAND 612
-#define MSG_TAKEBOTTLE 614
-#define MSG_TAKEKOZAW 611
-#define MSG_TESTPLANK 538
-#define MSG_UPDATEBOTTLE 613
-#define MV_EGTR_FATASK 5332
-#define MV_IN1MAN_SLEEP 5111
-#define MV_KZW_JUMP 558
-#define MV_KZW_JUMPROTATE 561
-#define MV_BDG_OPEN 1379
-#define MV_MAN_GOD 481
+#define MV_FLY_FLY 4917
#define MV_MAN_GOLADDER 451
#define MV_MAN_GOLADDER2 2844
-#define MV_MAN_GOU 460
#define MV_MAN_LOOKUP 4773
+#define rMV_MAN_LOOKUP 4775
+#define MV_MAN_TOLADDER 448
+#define MV_MAN_TOLADDER2 2841
#define MV_MAN_STARTLADDER 452
#define MV_MAN_STARTLADDER2 2842
#define MV_MAN_STOPLADDER 454
#define MV_MAN_STOPLADDER2 2845
-#define MV_MAN_TOLADDER 448
-#define MV_MAN_TOLADDER2 2841
#define MV_MAN_TURN_LU 486
-#define MV_PNK_WEIGHTLEFT 541
-#define MV_PNK_WEIGHTRIGHT 502
-#define MV_SC4_COIN_default 1029
-#define MV_SPK4_PLAY 3276
-#define PIC_CMN_EVAL 3468
+#define MV_PBAR_RUN 897
#define PIC_CSR_DEFAULT 4891
#define PIC_CSR_DEFAULT_INV 4892
#define PIC_CSR_ITN 4893
@@ -161,35 +86,90 @@ namespace Fullpipe {
#define PIC_IN1_GAMETITLE 5169
#define PIC_IN1_PIPETITLE 5167
#define PIC_INV_MENU 991
+#define PIC_MAP_A01 5263
+#define PIC_MAP_A02 5264
+#define PIC_MAP_A03 5265
+#define PIC_MAP_A04 5266
+#define PIC_MAP_A05 5267
+#define PIC_MAP_A06 5268
+#define PIC_MAP_A07 5269
+#define PIC_MAP_A08 5270
+#define PIC_MAP_A09 5271
+#define PIC_MAP_A10 5272
+#define PIC_MAP_A11 5273
+#define PIC_MAP_A12 5274
#define PIC_MAP_A13 5275
+#define PIC_MAP_A14 5276
+#define PIC_MAP_I01 5295
+#define PIC_MAP_I02 5296
+#define PIC_MAP_P01 5277
+#define PIC_MAP_P02 5278
+#define PIC_MAP_P03 5279
+#define PIC_MAP_P04 5280
+#define PIC_MAP_P05 5281
+#define PIC_MAP_P06 5282
+#define PIC_MAP_P07 5283
+#define PIC_MAP_P08 5284
+#define PIC_MAP_P09 5285
+#define PIC_MAP_P10 5286
+#define PIC_MAP_P11 5287
+#define PIC_MAP_P12 5288
+#define PIC_MAP_P13 5289
+#define PIC_MAP_P14 5290
+#define PIC_MAP_P15 5291
+#define PIC_MAP_P16 5292
+#define PIC_MAP_P17 5293
+#define PIC_MAP_P18 5294
#define PIC_MAP_S01 5223
-#define PIC_SC1_KUCHKA 1321
-#define PIC_SC1_LADDER 1091
-#define PIC_SC1_OSK 1018
-#define PIC_SC1_OSK2 2932
-#define PIC_SC2_DTRUBA 841
-#define PIC_SC2_LADDER 412
-#define PIC_SC3_DOMIN 5182
-#define PIC_SC3_LADDER 1102
-#define PIC_SC4_BOTTLE 568
-#define PIC_SC4_BOTTLE2 2936
-#define PIC_SC4_DOWNTRUBA 619
-#define PIC_SC4_LADDER 1438
-#define PIC_SC4_LRTRUBA 616
-#define PIC_SC4_MASK 585
-#define PIC_SC4_PLANK 5183
-#define PIC_SCD_SEL 734
-#define QU_EGTR_MD2_SHOW 4698
-#define QU_EGTR_MD1_SHOW 4697
-#define QU_EGTR_SLIMSHOW 4883
-#define QU_IN2_DO 5144
-#define QU_INTR_FINISH 5138
-#define QU_INTR_GETUPMAN 5136
+#define PIC_MAP_S02 5224
+#define PIC_MAP_S03 5225
+#define PIC_MAP_S04 5226
+#define PIC_MAP_S05 5227
+#define PIC_MAP_S06 5228
+#define PIC_MAP_S07 5229
+#define PIC_MAP_S08 5231
+#define PIC_MAP_S09 5230
+#define PIC_MAP_S10 5232
+#define PIC_MAP_S11 5233
+#define PIC_MAP_S12 5234
+#define PIC_MAP_S13 5235
+#define PIC_MAP_S14 5236
+#define PIC_MAP_S15 5237
+#define PIC_MAP_S16 5238
+#define PIC_MAP_S17 5239
+#define PIC_MAP_S1819 5240
+#define PIC_MAP_S20 5241
+#define PIC_MAP_S21 5242
+#define PIC_MAP_S22 5243
+#define PIC_MAP_S23_1 5244
+#define PIC_MAP_S23_2 5245
+#define PIC_MAP_S24 5246
+#define PIC_MAP_S25 5247
+#define PIC_MAP_S26 5248
+#define PIC_MAP_S27 5249
+#define PIC_MAP_S28 5250
+#define PIC_MAP_S29 5251
+#define PIC_MAP_S30 5252
+#define PIC_MAP_S31_1 5253
+#define PIC_MAP_S31_2 5254
+#define PIC_MAP_S32_1 5255
+#define PIC_MAP_S32_2 5256
+#define PIC_MAP_S33 5257
+#define PIC_MAP_S34 5258
+#define PIC_MAP_S35 5259
+#define PIC_MAP_S36 5260
+#define PIC_MAP_S37 5261
+#define PIC_MAP_S38 5262
#define QU_INTR_STARTINTRO 5133
-#define QU_PNK_CLICK 550
-#define QU_SC3_ENTERLIFT 2779
-#define QU_SC3_EXITLIFT 2808
#define SC_1 301
+#define SC_2 302
+#define SC_3 303
+#define SC_4 304
+#define SC_5 305
+#define SC_6 649
+#define SC_7 650
+#define SC_8 651
+#define SC_9 652
#define SC_10 653
#define SC_11 654
#define SC_12 655
@@ -200,7 +180,6 @@ namespace Fullpipe {
#define SC_17 1141
#define SC_18 1142
#define SC_19 1143
-#define SC_2 302
#define SC_20 1144
#define SC_21 1546
#define SC_22 1547
@@ -211,7 +190,6 @@ namespace Fullpipe {
#define SC_27 1552
#define SC_28 2062
#define SC_29 2063
-#define SC_3 303
#define SC_30 2064
#define SC_31 2065
#define SC_32 2066
@@ -221,12 +199,6 @@ namespace Fullpipe {
#define SC_36 2070
#define SC_37 2071
#define SC_38 2072
-#define SC_4 304
-#define SC_5 305
-#define SC_6 649
-#define SC_7 650
-#define SC_8 651
-#define SC_9 652
#define SC_COMMON 321
#define SC_DBGMENU 726
#define SC_FINAL1 4999
@@ -237,23 +209,14 @@ namespace Fullpipe {
#define SC_INTRO2 3907
#define SC_INV 858
#define SC_LDR 635
-#define SC_MAINMENU 4620
#define SC_MAP 5222
-#define SC_TEST 903
-#define SC_TITLES 5166
-#define SND_4_010 3125
-#define SND_4_012 3127
-#define SND_4_033 4990
#define SND_CMN_031 3516
+#define SND_CMN_060 4921
+#define SND_CMN_061 4922
#define SND_CMN_070 5199
#define SND_INTR_019 5220
-#define ST_CLK_CLOSED 590
-#define ST_DYAS_LIES 318
-#define ST_EGTR_MID1 2863
-#define ST_EGTR_MID2 2869
-#define ST_EGTR_SLIM 336
-#define ST_IN1MAN_SLEEP 5112
-#define ST_KZW_EMPTY 498
+#define ST_EGTR_SLIMSORROW 340
+#define ST_FLY_FLY 4918
#define ST_LBN_0N 2832
#define ST_LBN_0P 2833
#define ST_LBN_1N 2753
@@ -275,12 +238,1138 @@ namespace Fullpipe {
#define ST_LBN_9N 2777
#define ST_LBN_9P 2778
#define ST_MAN_EMPTY 476
+#define ST_MAN_GOU 459
#define ST_MAN_RIGHT 325
#define TrubaDown 697
#define TrubaLeft 474
-#define TrubaRight 696
#define TrubaUp 680
-#define rMV_MAN_LOOKUP 4775
+
+// Intro
+#define ANI_IN1MAN 5110
+#define MSG_INTR_ENDINTRO 5139
+#define MSG_INTR_GETUPMAN 5135
+#define MSG_INTR_SWITCHTO1 5145
+#define MSG_INTR_SWITCHTO2 5134
+#define MV_IN1MAN_SLEEP 5111
+#define QU_IN2_DO 5144
+#define QU_INTR_FINISH 5138
+#define QU_INTR_GETUPMAN 5136
+#define ST_IN1MAN_SLEEP 5112
+
+// Scene 1
+#define ANI_BOOT_1 4231
+#define MSG_SC1_SHOWOSK 1019
+#define MSG_SC1_SHOWOSK2 468
+#define MSG_SC1_UTRUBACLICK 1100
+#define PIC_SC1_KUCHKA 1321
+#define PIC_SC1_LADDER 1091
+#define PIC_SC1_OSK 1018
+#define PIC_SC1_OSK2 2932
+#define TrubaRight 696
+
+// Scene 2
+#define ANI_SC2_BOX 1020
+#define ANI_DADAYASHIK 306
+#define MSG_SC2_HIDELADDER 1023
+#define MSG_SC2_LADDERCLICK 1101
+#define MSG_SC2_PUTMANUP 1026
+#define MSG_SC2_SHOWLADDER 1027
+#define PIC_SC2_DTRUBA 841
+#define PIC_SC2_LADDER 412
+#define ST_DYAS_LIES 318
+
+// Scene 3
+#define ANI_DOMINO_3 2732
+#define ANI_EGGEATER 334
+#define ANI_INV_COIN 875
+#define ANI_INV_EGGAPL 1564
+#define ANI_INV_EGGBOOT 1570
+#define ANI_INV_EGGCOIN 1567
+#define ANI_INV_EGGDOM 1561
+#define ANI_INV_EGGGLS 1573
+#define MSG_LIFT_CLICKBUTTON 2780
+#define MSG_LIFT_CLOSEDOOR 5194
+#define MSG_LIFT_EXITLIFT 5187
+#define MSG_LIFT_GO 1065
+#define MSG_LIFT_STARTEXITQUEUE 5186
+#define MSG_SC3_HIDEDOMINO 3177
+#define MSG_SC3_ONTAKECOIN 5338
+#define MSG_SC3_RELEASEEGG 2681
+#define MSG_SC3_TAKEEGG 1583
+#define MSG_SC3_TESTFAT 1582
+#define MSG_SC3_UTRUBACLICK 1103
+#define MV_EGTR_FATASK 5332
+#define PIC_SC3_DOMIN 5182
+#define PIC_SC3_LADDER 1102
+#define ST_EGTR_MID1 2863
+#define ST_EGTR_MID2 2869
+#define ST_EGTR_SLIM 336
+#define QU_EGTR_MD2_SHOW 4698
+#define QU_EGTR_MD1_SHOW 4697
+#define QU_EGTR_SLIMSHOW 4883
+#define QU_SC3_ENTERLIFT 2779
+#define QU_SC3_EXITLIFT 2808
+
+// Scene 4
+#define ANI_BIGBALL 4923
+#define ANI_BUTTON 598
+#define ANI_CLOCK 588
+#define ANI_HAND 601
+#define ANI_KOZAWKA 495
+#define ANI_MAMASHA_4 660
+#define ANI_PLANK 501
+#define ANI_SC4_BOOT 1035
+#define ANI_SC4_COIN 690
+#define ANI_SPEAKER_4 3275
+#define ANI_SPRING 542
+#define MSG_GOTOLADDER 618
+#define MSG_KOZAWRESTART 546
+#define MSG_SC4_COINOUT 2895
+#define MSG_SC4_COINPUT 1032
+#define MSG_SC4_CLICKLADDER 1439
+#define MSG_SC4_DROPBOTTLE 2896
+#define MSG_SC4_HANDOVER 2960
+#define MSG_SC4_HIDEBOOT 4563
+#define MSG_SC4_KOZAWFALL 2858
+#define MSG_SC4_MANFROMBOTTLE 2854
+#define MSG_SC4_MANTOBOTTLE 2852
+#define MSG_SHAKEBOTTLE 584
+#define MSG_SHOOTKOZAW 557
+#define MSG_STARTHAND 612
+#define MSG_CLICKBOTTLE 569
+#define MSG_CLICKBUTTON 609
+#define MSG_CLICKPLANK 549
+#define MSG_LOWERPLANK 540
+#define MSG_RAISEPLANK 547
+#define MSG_SHOWCOIN 1033
+#define MSG_TAKEBOTTLE 614
+#define MSG_TAKEKOZAW 611
+#define MSG_TESTPLANK 538
+#define MSG_UPDATEBOTTLE 613
+#define MV_BTN_CLICK 599
+#define MV_CLK_GO 589
+#define MV_HND_POINT 602
+#define MV_KZW_GOR 564
+#define rMV_KZW_GOR 566
+#define MV_KZW_JUMP 558
+#define MV_KZW_JUMPROTATE 561
+#define MV_KZW_TOHOLERV 537
+#define MV_KZW_WALKPLANK 500
+#define MV_KZW_JUMPHIT 2857
+#define MV_KZW_JUMPOUT 586
+#define MV_KZW_RAISEHEAD 577
+#define MV_KZW_STANDUP 563
+#define MV_KZW_TURN 562
+#define MV_MAN_FROMLADDER 493
+#define MV_MAN_GOD 481
+#define MV_MAN_GOU 460
+#define MV_MAN_JUMPONPLANK 551
+#define MV_MAN_LOOKLADDER 520
+#define MV_MAN_PLANKTOLADDER 553
+#define MV_MAN_STARTLADDERD 457
+#define MV_PNK_WEIGHTLEFT 541
+#define MV_PNK_WEIGHTRIGHT 502
+#define MV_SC4_COIN_default 1029
+#define MV_SPK4_PLAY 3276
+#define MV_SPR_LOWER 543
+#define PIC_MAP_P03 5279
+#define PIC_SC4_BOTTLE 568
+#define PIC_SC4_BOTTLE2 2936
+#define PIC_SC4_DOWNTRUBA 619
+#define PIC_SC4_LADDER 1438
+#define PIC_SC4_LRTRUBA 616
+#define PIC_SC4_MASK 585
+#define PIC_SC4_PLANK 5183
+#define QU_BALL_WALKL 4920
+#define QU_BALL_WALKR 4919
+#define QU_HND_TAKE0 1440
+#define QU_HND_TAKE1 1441
+#define QU_HND_TAKE2 1442
+#define QU_HND_TAKEBOTTLE 1443
+#define QU_KOZAW_WALK 505
+#define QU_PNK_CLICK 550
+#define QU_SC4_GOCLOCK 595
+#define QU_SC4_MANFROMBOTTLE 2851
+#define QU_SC4_MANTOBOTTLE 2850
+#define SND_4_010 3125
+#define SND_4_012 3127
+#define SND_4_033 4990
+#define ST_CLK_CLOSED 590
+#define ST_HND_EMPTY 603
+#define ST_KZW_EMPTY 498
+#define ST_KZW_JUMPOUT 587
+#define ST_KZW_RIGHT 559
+#define ST_KZW_SIT 560
+#define ST_MAN_GOLADDER 450
+#define ST_MAN_GOLADDER2 2843
+#define MV_MAN_LOOKLADDERRV 556
+#define ST_MAN_LADDERDOWN 521
+#define ST_MAN_LOOKPLANK 555
+#define ST_MAN_ONPLANK 552
+#define ST_MAN_SIT 1164
+#define ST_MAN_STANDLADDER 453
+#define ST_MAN_UP 449
+#define ST_PNK_WEIGHTLEFT 503
+#define ST_PNK_WEIGHTRIGHT 504
+#define ST_SPR_UP 544
+
+// Scene 5
+#define ANI_BIGLUK 909
+#define ANI_HANDLE 622
+#define ANI_OTMOROZ 419
+#define MSG_SC5_BGRSOUNDOFF 5315
+#define MSG_SC5_BGRSOUNDON 5314
+#define MSG_SC5_HANDLEDOWN 916
+#define MSG_SC5_HANDLEUP 915
+#define MSG_SC5_HIDEHANDLE 917
+#define MSG_SC5_MAKEMANFLIGHT 1136
+#define MSG_SC5_MAKEOTMFEEDBACK 1169
+#define MSG_SC5_SHOWHANDLE 918
+#define MSG_SC5_TESTLUK 914
+#define MV_BLK_CLOSE 911
+#define MV_BLK_OPEN 910
+#define MV_MANHDL_HANDLEDOWN 630
+#define MV_MANHDL_HANDLEUP 631
+#define MV_OTM_BOXHANDLEDOWN 626
+#define MV_OTM_BOXHANDLEUP 627
+#define MV_OTM_HANDLEDOWN 620
+#define MV_OTM_HANDLEUP 621
+#define QU_SC5_MANBUMP 1167
+#define QU_SC5_MANFLY 1168
+#define SND_5_026 5316
+#define ST_BLK_CLOSED 912
+#define ST_BLK_OPEN 913
+#define ST_HDL_BROKEN 3342
+#define ST_HDL_DOWN 625
+#define ST_HDL_UP 624
+#define ST_OTM_BOX_LEFT 429
+#define ST_OTM_GLS_LEFT 421
+#define ST_OTM_VNT_LEFT 434
+
+// Scene 6
+#define ANI_BALLDROP 2685
+#define ANI_BUTTON_6 2988
+#define ANI_EGGIE 4929
+#define ANI_INV_HANDLE 893
+#define ANI_MAMASHA 656
+#define ANI_NEWBALL 1073
+#define MSG_SC6_BTNPUSH 1017
+#define MSG_SC6_ENABLEDROPS 687
+#define MSG_SC6_INSTHANDLE 1012
+#define MSG_SC6_JUMPBK 2900
+#define MSG_SC6_JUMPFW 2901
+#define MSG_SC6_RESTORESCROLL 2906
+#define MSG_SC6_SHOWNEXTBALL 790
+#define MSG_SC6_STARTDROPS 2897
+#define MSG_SC6_TAKEBALL 682
+#define MSG_SC6_TESTNUMBALLS 2904
+#define MSG_SC6_UTRUBACLICK 1105
+#define MSG_SPINHANDLE 2398
+#define MV_MAN6_TAKEBALL 2691
+#define MV_MAN6_THROWBALL 2692
+#define MV_MOM_CYCLEBK 3012
+#define MV_MOM_JUMPBK 662
+#define MV_MOM_JUMPFW 661
+#define MV_MOM_STARTBK 3010
+#define MV_MOM_STOPBK 3013
+#define MV_MOM_TAKE1 2885
+#define MV_MOM_TAKE2 2886
+#define MV_MOM_TAKE3 2887
+#define MV_MOM_TAKE4 2888
+#define MV_MOM_TAKE5 2889
+#define PIC_SC6_LADDER 1104
+#define QU_EGG6_GOL 4936
+#define QU_EGG6_GOR 4935
+#define QU_MOM_JUMPBK 671
+#define QU_MOM_JUMPFW 670
+#define QU_MOM_PUTBALL 2903
+#define QU_MOM_SITDOWN 685
+#define QU_MOM_STANDUP 2899
+#define QU_MOM_TOLIFT 2902
+#define QU_SC6_DROPS 2898
+#define QU_SC6_DROPS3 2955
+#define QU_SC6_ENTERLIFT 1054
+#define QU_SC6_EXITLIFT 1055
+#define QU_SC6_FALLBALL 2690
+#define QU_SC6_FALLHANDLE 2995
+#define QU_SC6_SHOWHANDLE 1689
+#define QU_SC6_SHOWNEXTBALL 2689
+#define ST_HDL_PLUGGED 2397
+#define ST_MAN6_BALL 2688
+#define ST_MOM_SITS 659
+#define ST_MOM_STANDS 658
+#define ST_NBL_NORM 1076
+
+// Scene 7
+#define ANI_CORNERSITTER 71
+#define ANI_HOOLIGAN 808
+#define ANI_LUKE 803
+#define ANI_PLUSMINUS 2938
+#define ANI_SC7_BOX 791
+#define MSG_SC7_CLOSELUKE 822
+#define MSG_SC7_HIDEBOX 817
+#define MSG_SC7_HIDELUKE 821
+#define MSG_SC7_OPENLUKE 823
+#define MSG_SC7_PULL 2943
+#define MSG_SC7_SHOWBOX 816
+#define MV_CST_CLOSELUKE 807
+#define MV_SC7_BOX_default 792
+#define QU_CST_CLOSELUKE 820
+#define ST_CST_HANDLELESS 794
+#define ST_HGN_LOOK 811
+#define ST_HGN_LUKE 810
+#define ST_LUK_CLOSED 805
+#define ST_LUK_OPEN 806
+#define ST_PMS_MINUS 2942
+#define ST_PMS_PLUS 2941
+
+// Scene 8
+#define ANI_BATUTA 737
+#define ANI_CLOCK_8 2989
+#define ANI_VMYATS 764
+#define MSG_SC8_ARCADENOW 1044
+#define MSG_SC8_ENTERUP 3037
+#define MSG_SC8_GETHIMUP 789
+#define MSG_SC8_HIDELADDER_D 1107
+#define MSG_SC8_RESUMEFLIGHT 784
+#define MSG_SC8_STANDUP 2976
+#define MSG_STARTARCADE 781
+#define MV_CLK8_GO 2990
+#define MV_MAN_FROMLADDERUP 1522
+#define MV_MAN_TOLADDERD 1524
+#define MV_MAN8_BADLUCK 783
+#define MV_MAN8_DRYGDOWN 770
+#define MV_MAN8_DRYGUP 768
+#define MV_MAN8_HANDSDOWN 772
+#define MV_MAN8_HANDSUP 777
+#define MV_MAN8_JUMP 775
+#define MV_MAN8_JUMPOFF 2969
+#define MV_MAN8_SITDOWN 2968
+#define MV_VMT_DEF 765
+#define PIC_SC8_ARCADENOW 1043
+#define PIC_SC8_LADDER 754
+#define PIC_SC8_LADDER_D 755
+#define PIC_SC8_LADDERD 1106
+#define QU_SC8_FINISH 788
+#define QU_SC8_STANDUP 2975
+#define SND_8_014 3624
+#define ST_BTT_CHESHET 746
+#define ST_BTT_NOSPOON 739
+#define ST_BTT_SLEEPS 748
+#define ST_BTT_SPOON 741
+#define ST_MAN8_FLYDOWN 771
+#define ST_MAN8_FLYUP 769
+#define ST_MAN8_HANDSUP 773
+#define ST_MAN8_STAND 774
+#define ST_VMT_MIN 766
+
+// Scene 10
+#define ANI_GUM 978
+#define ANI_NADUVATEL 944
+#define ANI_PACHKA 975
+#define ANI_PACHKA2 3008
+#define MSG_SC10_CLICKGUM 992
+#define MSG_SC10_HIDEGUM 993
+#define MSG_SC10_LADDERTOBACK 3002
+#define MSG_SC10_LADDERTOFORE 3004
+#define MSG_SC10_SHOWGUM 994
+#define MV_NDV_BLOW2 2855
+#define MV_NDV_DENIES 952
+#define MV_NDV_DENY_NOGUM 3022
+#define PIC_SC10_DTRUBA 974
+#define PIC_SC10_LADDER 995
+#define QU_SC10_ENTERLIFT 1067
+#define QU_SC10_EXITLIFT 2809
+#define QU_SC10_TAKEGUM 3026
+#define ST_NDV_SIT 946
+
+// Scene 11
+#define ANI_BOOTS_11 2704
+#define ANI_KACHELI 1094
+#define ANI_MAN11 1108
+#define ANI_SWINGER 1113
+#define MSG_SC11_HITMAN 3019
+#define MSG_SC11_MANCRY 4691
+#define MSG_SC11_MANTOSWING 1128
+#define MSG_SC11_PUTBOOT 1117
+#define MSG_SC11_RESTARTMAN 1133
+#define MSG_SC11_SHOWSWING 1124
+#define MSG_SC11_SITSWINGER 5198
+#define MV_KCH_MOVE2 1099
+#define MV_KCH_START 1121
+#define MV_MAN11_JUMPHIT 1129
+#define MV_MAN11_JUMPFROMSWING 5209
+#define MV_MAN11_JUMPOVER 1131
+#define MV_MAN11_SWING_0 1109
+#define MV_MAN11_SWING_1 1111
+#define MV_MAN11_SWING_2 1112
+#define PIC_SC11_HINT 5170
+#define QU_SC11_MANFALL 3017
+#define QU_SC11_PUTBOOT1 2709
+#define QU_SC11_PUTBOOT2 2710
+#define QU_SC11_RESTARTMAN 1134
+#define QU_SWR_JUMPDOWN 1123
+#define SND_11_020 3704
+#define SND_11_022 3706
+#define SND_11_024 3708
+#define SND_11_031 5171
+#define ST_BTS11_2 2707
+#define ST_BTS11_ONE 2706
+#define ST_KCH_0 1096
+#define ST_KCH_EMPTY 1132
+#define ST_KCH_STATIC 1122
+#define ST_MAN_1PIX 518
+#define ST_MAN11_EMPTY 1110
+#define ST_MAN11_SWING 1127
+#define ST_SWR_SIT 1147
+#define ST_SWR_SITBALD 1153
+#define ST_SWR_STAND3 3014
+
+// Scene 13
+#define ANI_BRIDGE 1378
+#define ANI_HANDLE_L 1209
+#define ANI_HANDLE_R 1196
+#define ANI_STOROZH 1172
+#define ANI_WHIRLGIG_13 1383
+#define MSG_SC13_CHEW 1220
+#define MSG_SC13_CLOSEBRIDGE 3046
+#define MSG_SC13_CLOSEFAST 1267
+#define MSG_SC13_EATGUM 1219
+#define MSG_SC13_OPENBRIDGE 3064
+#define MSG_SC13_OPENFAST 1266
+#define MSG_SC13_SHOWGUM 1215
+#define MSG_SC13_STARTWHIRLGIG 1388
+#define MSG_SC13_STOPWHIRLGIG 1387
+#define MSG_SC13_TESTCLOSE 3065
+#define MSG_SC13_TESTOPEN 3048
+#define MSG_SC13_UNEATGUM 1218
+#define MSG_SC13_UPDATEBRIDGE 1217
+#define MV_BDG_CLOSE 1382
+#define MV_BDG_OPEN 1379
+#define MV_WHR13_SPIN 1384
+#define QU_SC13_CLOSEFAIL 3063
+#define QU_SC13_CLOSESUCCESS 3062
+#define QU_SC13_OPENFAIL 3042
+#define QU_SC13_OPENSUCCESS 3047
+#define QU_SC13_SHOWGUM 1216
+#define QU_STR_CHEW 1190
+#define QU_STR_LTOR 3054
+#define QU_STR_PLUU 1189
+#define QU_STR_RTOL 3053
+#define QU_STR_TURNR 1186
+#define QU_STR_TURNR_L 3059
+#define SND_13_018 3763
+#define SND_13_033 4685
+#define SND_13_034 4686
+#define SND_13_037 5335
+#define ST_BDG_CLOSED 1380
+#define ST_BDG_OPEN2 1381
+#define ST_HDLL_FIRECAN 1310
+#define ST_HDLL_HAMMER 3205
+#define ST_HDLL_UP 1211
+#define ST_HDLR_DOWN 1199
+#define ST_HDLR_DOWN_GUM 3044
+#define ST_HDLR_GUM 1201
+#define ST_STR_LEFT 1175
+#define ST_STR_RIGHT 1174
+
+// Scene 14
+#define ANI_BALL14 1246
+#define ANI_GRANDMA 1227
+#define MSG_SC14_ENDARCADE 3250
+#define MSG_SC14_GMAJUMP 1250
+#define MSG_SC14_GMATOTRUBA 3249
+#define MSG_SC14_HIDEBALLLAST 3251
+#define MSG_SC14_HIDEPINK 3248
+#define MSG_SC14_MANKICKBALL 1257
+#define MSG_SC14_RESTORESCROLL 4769
+#define MSG_SC14_SCROLLLEFT 4768
+#define MSG_SC14_SHOWBALLFLY 1253
+#define MSG_SC14_SHOWBALLGMADIVE 1260
+#define MSG_SC14_SHOWBALLGMAHIT 1259
+#define MSG_SC14_SHOWBALLGMAHIT2 3245
+#define MSG_SC14_SHOWBALLLAST 3246
+#define MSG_SC14_SHOWBALLMAN 1254
+#define MSG_SC14_STARTARCADE 3252
+#define MV_BAL14_FALL 1258
+#define MV_BAL14_SPIN 1247
+#define MV_BAL14_TOGMA 3214
+#define MV_GMA_BACKOFF 1233
+#define MV_GMA_BACKOFF2 3217
+#define MV_GMA_JUMPFW 1230
+#define MV_GMA_THROW 1232
+#define MV_MAN14_DECLINE 1239
+#define MV_MAN14_FALL 1236
+#define MV_MAN14_KICK 1237
+#define MV_MAN14_KICKAIR 1256
+#define MV_MAN14_STEPFW 1240
+#define PIC_SC14_RTRUBA 1221
+#define ST_GMA_SIT 1229
+#define QU_GMA_BLINK 1252
+#define QU_GMA_JUMPBK 1251
+#define QU_GMA_JUMPFW 1249
+#define QU_GMA_THROW 1255
+#define QU_SC14_ENDARCADE 1391
+#define QU_SC14_ENTERLIFT 1225
+#define QU_SC14_EXITLIFT 1226
+#define QU_SC14_STARTARCADE 1390
+#define QU_SC14_WINARCADE 3247
+
+// Scene 15
+#define ANI_BOOT_15 4779
+#define ANI_INV_BOOT 881
+#define ANI_GRANDMA_ASS 1265
+#define MSG_SC15_ASSDRYG 4755
+#define MSG_SC15_LADDERTOBACK 3259
+#define MSG_SC15_PULL 2940
+#define MSG_SC15_STOPCHANTING 4753
+#define MV_SWR_SWING 1114
+#define PIC_SC15_DTRUBA 1263
+#define PIC_SC15_LADDER 3253
+#define PIC_SC15_LTRUBA 1261
+#define QU_SC15_ENTERLIFT 2811
+#define QU_SC15_EXITLIFT 2812
+#define SND_15_001 3798
+#define SND_15_006 3808
+#define SND_15_011 4754
+#define ST_GMS_BOOT 1270
+#define ST_GMS_BOOTLESS2 3316
+
+// Scene 16
+#define ANI_BEARDED_CMN 3420
+#define ANI_BOOT_16 3285
+#define ANI_BOY 1327
+#define ANI_GIRL 1328
+#define ANI_JETTIE 1392
+#define ANI_MUG 1296
+#define ANI_WIRE16 1344
+#define MSG_SC16_FILLMUG 1363
+#define MSG_SC16_HIDEMAN 1357
+#define MSG_SC16_HIDEMUG 1351
+#define MSG_SC16_HIDEWIRE 1349
+#define MSG_SC16_LAUGHSOUND 4993
+#define MSG_SC16_MUGCLICK 1366
+#define MSG_SC16_SHOWBEARDED 4956
+#define MSG_SC16_SHOWMAN 1358
+#define MSG_SC16_SHOWMUG 1352
+#define MSG_SC16_SHOWMUGFULL 1396
+#define MSG_SC16_SHOWWIRE 1350
+#define MSG_SC16_STARTLAUGH 1374
+#define MV_BOY_DRINK 1333
+#define MV_BT16_FILL 3286
+#define MV_GRL_DRINK 1339
+#define MV_GRL_FALL 3115
+#define MV_GRL_LAUGH_POPA 3278
+#define MV_JTI_FLOWBY 1393
+#define MV_JTI_FLOWIN 1394
+#define MV_MAN16_TAKEMUG 1362
+#define PIC_SC16_TUMBA 1368
+#define QU_BRD16_STARTBEARDED 4948
+#define QU_SC16_BOYKICK 1367
+#define QU_SC16_BOYOUT 1364
+#define QU_SC16_GIRLLAUGH 1375
+#define QU_SC16_GIRLOUT 1365
+#define QU_SC16_GOBOY 1347
+#define QU_SC16_GOGIRL 1348
+#define QU_SC16_MANDRINK 5200
+#define QU_SC16_SHOWMUG 1361
+#define QU_SC16_TAKEMUG 1435
+#define SND_16_034 3854
+#define SND_16_035 3855
+#define SND_16_037 3857
+#define ST_BOY_STAND 1331
+#define ST_GRL_LAUGH 1342
+#define ST_GRL_STAND 1337
+#define ST_MUG_EMPTY 1298
+#define ST_MUG_FULL 1360
+
+// Scene 17
+#define ANI_BOOT_17 4220
+#define ANI_HAND17 1446
+#define ANI_INV_BOTTLE 1418
+#define ANI_INV_SUGAR 1410
+#define ANI_JET_17 2746
+#define ANI_MUG_17 2737
+#define ANI_SAMOGONSHCHIK 1397
+#define MSG_SC17_DROP 3414
+#define MSG_SC17_FILLBOTTLE 1436
+#define MSG_SC17_HIDESUGAR 1417
+#define MSG_SC17_SHOWBOTTLE 1432
+#define MSG_SC17_SHOWSUGAR 1416
+#define MSG_SC17_TESTTRUBA 1458
+#define MSG_SC17_UPDATEHAND 1560
+#define MV_HND17_FIGA 1449
+#define PIC_SC17_RTRUBA 1323
+#define PIC_SC17_RTRUBA2 5297
+#define QU_HND17_ASK 1456
+#define QU_HND17_ATTRACT 1455
+#define QU_HND17_TOCYCLE 1454
+#define QU_JET17_DROP 3295
+#define QU_JET17_FLOW 3294
+#define QU_SC17_FILLBOOT 4237
+#define QU_SC17_FILLBOTTLE 1437
+#define QU_SC17_FILLMUG 2750
+#define QU_SC17_FILLMUG_DROP 3415
+#define QU_SC17_SHOWBOTTLE 1429
+#define QU_SC17_SHOWSUGAR 1415
+#define QU_SMG_FILLBOTTLE 1433
+#define ST_HND17_ATTRACT 1451
+#define ST_HND17_EMPTY 1448
+#define ST_MUG17_EMPTY 2739
+#define ST_SMG_SIT 1399
+
+// Scene 18
+#define PIC_SC18_RTRUBA 1520
+
+// Scene 19
+#define PIC_SC19_RTRUBA3 1515
+
+// Scene 20
+#define ANI_GRANDMA_20 2427
+#define MSG_SC20_UPDATELOCKABLE 5217
+#define ST_GMA20_FLOOR 2429
+#define ST_GMA20_STAND 2436
+#define ST_GMA20_STOOL 2432
+
+// Scene 21
+#define ANI_GIRAFFE_BOTTOM 1633
+#define ANI_INV_BOX 890
+#define ANI_INV_STOOL 1780
+#define MSG_SC21_UPDATEASS 4211
+#define PIC_SC21_DTRUBA 1823
+#define ST_GRFB_SIT 1687
+#define ST_GRFB_HANG 1638
+
+// Scene 22
+#define ANI_GIRAFFE_MIDDLE 1981
+#define ANI_MESHOK 1754
+#define ANI_TABURETTE 1745
+#define MSG_SC22_CHECKGMABOOT 4782
+#define MSG_SC22_CRANEOUT_GMA 5218
+#define MSG_SC22_FROMSTOOL 1799
+#define MSG_SC22_HANDLEDOWN 1796
+#define MSG_SC22_HIDESTOOL 2503
+#define MSG_SC22_ONSTOOL 1798
+#define MSG_SC22_SHOWSTOOL 2495
+#define QU_MSH_CRANEOUT 1811
+#define QU_MSH_CRANEOUT_GMA 5219
+#define QU_SC22_FALLBROOM 1786
+#define QU_SC22_FALLSACK 1791
+#define QU_SC22_FALLSACK_GMA 2613
+#define QU_SC22_FROMSTOOL 1800
+#define QU_SC22_HANDLEDOWN 1804
+#define QU_SC22_PUTSTOOL 1803
+#define QU_SC22_SHOWSTOOL 1793
+#define QU_SC22_TOSTOOL 1801
+#define QU_SC22_TOSTOOL_R 3332
+#define QU_SC22_TRYBOX 5311
+#define QU_SC22_TRYHANDLE 1802
+#define QU_MSH_MOVE 1812
+#define rMV_MAN_TURN_SRL 1090
+#define ST_GRFM_AFTER 3472
+#define ST_GRFM_NORM 1983
+#define ST_MSH_SIT 1756
+
+// Scene 23
+#define ANI_CALENDWHEEL 1702
+#define ANI_GIRAFFE_TOP 1645
+#define ANI_GIRAFFEE 1672
+#define ANI_HANDLE23 1978
+#define ANI_INV_LEVERHANDLE 1777
+#define ANI_LUK23_D 1813
+#define ANI_LUK23_U 1817
+#define MSG_SC23_CLICKBTN1 1736
+#define MSG_SC23_CLICKBTN2 1737
+#define MSG_SC23_CLICKBTN3 1738
+#define MSG_SC23_CLICKBTN4 1739
+#define MSG_SC23_FROMSTOOL 3339
+#define MSG_SC23_HIDEGIRAFFEE 4650
+#define MSG_SC23_ONSTOOL 3334
+#define MSG_SC23_SPINWHEEL1 1740
+#define MSG_SC23_SPINWHEEL2 1741
+#define MSG_SC23_SPINWHEEL3 1742
+#define MSG_SC23_SPINWHEEL4 1743
+#define MV_CND_0_1 1703
+#define MV_CND_1_2 1706
+#define MV_CND_2_3 1708
+#define MV_CND_3_4 1710
+#define MV_CND_4_5 1712
+#define MV_CND_5_6 1714
+#define MV_CND_6_7 1716
+#define MV_CND_7_8 1718
+#define MV_CND_8_9 1720
+#define MV_CND_9_0 1722
+#define MV_MAN23_PUSH1 1724
+#define MV_MAN23_PUSH2 1725
+#define MV_MAN23_PUSH3 1726
+#define MV_MAN23_PUSH4 1727
+#define PIC_SC23_BOXCLOSED 1728
+#define PIC_SC23_BOXOPEN 1723
+#define PIC_SC23_BTN1 1729
+#define PIC_SC23_BTN2 1730
+#define PIC_SC23_BTN3 1731
+#define PIC_SC23_BTN4 1732
+#define PIC_SC23_LADDER 1628
+#define PIC_SC23_LADDERU 3411
+#define QU_GRFU_TURN_UD 1664
+#define QU_GRFU_TURN_UL 1662
+#define QU_SC23_FROMCALENDAR 1734
+#define QU_SC23_FROMCALENDAREXIT 1735
+#define QU_SC23_FROMSTOOL 3338
+#define QU_SC23_SHOWSTOOL 3335
+#define QU_SC23_STARTKISS 1822
+#define QU_SC23_TOCALENDAR 1733
+#define ST_CND_0 1704
+#define ST_CND_1 1705
+#define ST_CND_2 1707
+#define ST_CND_3 1709
+#define ST_CND_4 1711
+#define ST_CND_5 1713
+#define ST_CND_6 1715
+#define ST_CND_7 1717
+#define ST_CND_8 1719
+#define ST_CND_9 1721
+#define ST_GRFG_BALD 1675
+#define ST_GRFG_EMPTY 1674
+#define ST_GRFU_KISS 1681
+#define ST_GRFU_UP 1648
+#define ST_LUK23_OPEN 1816
+#define ST_LUK23_WHANDLE2 1977
+#define ST_LUK23U_CLOSED 1819
+#define ST_LUK23U_OPEN 1820
+
+// Scene 24
+#define ANI_DROP_24 3505
+#define ANI_INV_HAMMER 884
+#define ANI_JET24 1837
+#define ANI_WATER24 1834
+#define MV_MAN_TURN_RL 332
+#define MV_WTR24_FLOW 1835
+#define MV_WTR24_FLOWLOWER 1844
+#define MV_JET24_FLOW 1838
+#define QU_DRP24_TOFLOOR 3510
+#define QU_DRP24_TOWATER 3509
+#define QU_DRP24_TOWATER2 4046
+#define SND_24_006 4041
+#define SND_24_007 4042
+#define ST_DRP24_EMPTY 3507
+#define ST_WTR24_FLOWLOWER 1843
+
+// Scene 25
+#define ANI_BEARDED_CMN 3420
+#define ANI_BOARD25 1898
+#define ANI_DROP_25 3499
+#define ANI_INV_BOARD 1872
+#define ANI_INV_BROOM 1774
+#define ANI_INV_LOPAT 1920
+#define ANI_INV_SWAB 1917
+#define ANI_WATER25 1856
+#define MSG_BRD_TURN 4877
+#define MSG_SC25_ENTERMAN 1861
+#define MSG_SC25_ENTERTRUBA 4214
+#define MSG_SC25_STARTBEARDEDS 3423
+#define MSG_SC25_STOPBEARDEDS 3424
+#define MSG_SC25_TOLADDER 4215
+#define MV_MAN_GOLADDERDOWN 455
+#define MV_MAN25_CHIH 1886
+#define rMV_MAN25_CHIH 3343
+#define MV_BRD25_RIGHT 1899
+#define rMV_BRD25_RIGHT 1903
+#define MV_MAN25_ONBOARD 1885
+#define rMV_MAN25_ONBOARD 1966
+#define MV_WTR25_FLOW 1857
+#define PIC_SC25_LADDERDOWN 1855
+#define PIC_SC25_LADDERUP 1854
+#define PIC_SC25_RTRUBA 1853
+#define QU_DRP25_TOFLOOR 3502
+#define QU_DRP25_TOWATER 3504
+#define QU_SC25_BACKTOLADDER 1955
+#define QU_SC25_BACKTOTRUBA 2061
+#define QU_SC25_BEARDED 3425
+#define QU_SC25_BEARDED2 3426
+#define QU_SC25_BEARDED3 3427
+#define QU_SC25_BOARDTOLADDER 1911
+#define QU_SC25_ENTERUP_FLOOR 1904
+#define QU_SC25_ENTERUP_WATER 1895
+#define QU_SC25_LADDERUP 1925
+#define QU_SC25_MANTOTRUBA 1905
+#define QU_SC25_MANTOTRUBA_R 4218
+#define QU_SC25_PUTBOARD 1896
+#define QU_SC25_ROWTOLADDER 1910
+#define QU_SC25_ROWTOTRUBA 1897
+#define QU_SC25_TRUBATOBOARD 1909
+#define QU_SC25_TRYBROOM 1912
+#define QU_SC25_TRYHAND 4219
+#define QU_SC25_TRYROWHAND 3493
+#define QU_SC25_TRYROWHAND_R 3494
+#define QU_SC25_TRYSPADE 3498
+#define QU_SC25_TRYSWAB 1913
+#define QU_SC25_TRYWATER 1906
+#define SND_25_006 4059
+#define SND_25_025 4874
+#define SND_25_026 4875
+#define SND_25_027 4876
+#define SND_25_028 5173
+#define SND_25_029 5174
+#define SND_25_030 5175
+#define ST_BRD25_RIGHT2 1902
+#define ST_BRDCMN_EMPTY 3422
+#define ST_DRP25_EMPTY 3501
+#define ST_MAN_GOLADDERD 456
+#define ST_MAN_LADDERDOWN_R 3419
+#define ST_MAN25_ONBOARD 1879
+
+// Scene 26
+#define ANI_CHHI 1957
+#define ANI_DROP_26 3345
+#define ANI_INV_SOCK 1698
+#define ANI_INV_VENT 1968
+#define ANI_LUK26 1867
+#define ANI_SOCK_26 4553
+#define ANI_VENT 1927
+#define MSG_SC26_CLICKVENT 1947
+#define MSG_SC26_HIDECHI 1967
+#define MSG_SC26_HIDEVENT 1945
+#define MSG_SC26_SHOWCHI 3495
+#define MSG_SC26_SHOWVENT 1946
+#define MSG_SC26_TESTVENT 1952
+#define MSG_SC26_UPDATEDROP 3496
+#define MSG_SC26_UPDATEPOOL 1956
+#define PIC_SC26_LTRUBA 1864
+#define PIC_SC26_SOCK 5312
+#define QU_CHI_HIDE 1965
+#define QU_CHI_SHOW 1964
+#define QU_SC26_AUTOCLOSE1 1949
+#define QU_SC26_AUTOCLOSE2 1950
+#define QU_SC26_AUTOCLOSE3 1951
+#define QU_SC26_CLOSE1 1936
+#define QU_SC26_CLOSE2 1938
+#define QU_SC26_CLOSE3 1940
+#define QU_SC26_CLOSE4 1942
+#define QU_SC26_CLOSE5 1944
+#define QU_SC26_OPEN1 1935
+#define QU_SC26_OPEN2 1937
+#define QU_SC26_OPEN3 1939
+#define QU_SC26_OPEN4 1941
+#define QU_SC26_OPEN5 1943
+#define SND_26_003 4079
+#define SND_26_018 5340
+#define SND_26_019 5341
+#define SND_26_020 5342
+#define ST_CHI_EMPTY 1959
+#define ST_CHI_NORM 1960
+#define ST_VNT26_RIGHT2 3348
+#define ST_VNT26_UP2 1948
+
+// Scene 28
+#define ANI_LIFT 982
+#define ANI_LIFT_28 4238
+#define ANI_MAN_28 4247
+#define ANI_TIOTIA 4286
+#define MSG_SC28_CLICKLIFT 4258
+#define MSG_SC28_ENDCABIN 3456
+#define MSG_SC28_ENDLIFT1 4259
+#define MSG_SC28_ENDLIFT6 4244
+#define MSG_SC28_LIFT1_SHOWAFTER 4261
+#define MSG_SC28_LIFT6INSIDE 5354
+#define MSG_SC28_LIFT6MUSIC 5355
+#define MSG_SC28_MAKEFACES 4684
+#define MSG_SC28_STARTWORK1 4255
+#define MSG_SC28_TRYVTORPERS 4961
+#define MSG_SC28_TURNOFF_0 4678
+#define MSG_SC28_TURNOFF_1 4279
+#define MSG_SC28_TURNOFF_2 4277
+#define MSG_SC28_TURNOFF_3 4275
+#define MSG_SC28_TURNOFF_4 4282
+#define MSG_SC28_TURNOFF_6 4273
+#define MSG_SC28_TURNON4 4280
+#define MSG_SC28_TURNON_0 4677
+#define MSG_SC28_TURNON_1 4278
+#define MSG_SC28_TURNON_2 4276
+#define MSG_SC28_TURNON_3 4274
+#define MSG_SC28_TURNON_4 4281
+#define MSG_SC28_TURNON_6 4272
+#define MV_WMN28_IN_1 3443
+#define MV_WMN28_IN_2 3445
+#define MV_WMN28_IN_3 3446
+#define MV_WMN28_IN_4 3447
+#define MV_WMN28_IN_5 3448
+#define PIC_SC28_DARK0 4675
+#define PIC_SC28_DARK1 4266
+#define PIC_SC28_DARK2 4267
+#define PIC_SC28_DARK3 4268
+#define PIC_SC28_DARK4 4269
+#define PIC_SC28_DARK5 4270
+#define PIC_SC28_DARK6 4271
+#define QU_BRD28_GOL 4960
+#define QU_BRD28_GOR 4959
+#define QU_GLV28_GOL 4958
+#define QU_GLV28_GOR 4957
+#define QU_SC28_LIFT0_START 4676
+#define QU_SC28_LIFT1_START 4254
+#define QU_SC28_LIFT1_WORK 4256
+#define QU_SC28_LIFT2_START 4246
+#define QU_SC28_LIFT3_START 4245
+#define QU_SC28_LIFT5_START 4674
+#define QU_SC28_LIFT6_END 3563
+#define QU_SC28_LIFT6_START 4243
+#define QU_SC28_LIFT6_START2 4295
+#define QU_SC28_WMN_START 3452
+#define ST_MAN28_RIGHT 4249
+
+// Scene 30
+#define ANI_LEG 2322
+#define MSG_SC30_UPDATEPATH 2358
+#define PIC_SC30_LTRUBA 2354
+#define QU_SC30_ENTERLIFT 2823
+#define QU_SC30_EXITLIFT 2824
+#define ST_LEG_DOWN 2325
+#define ST_LEG_DOWN1 2330
+#define ST_LEG_DOWN2 2334
+#define ST_LEG_EMPTY 2338
+#define ST_LEG_UP 2324
+
+// Scene 31
+#define LiftDown 1058
+#define LiftUp 1057
+#define ANI_CACTUS_31 2456
+#define MSG_SC31_PULL 2944
+#define MSG_SC31_TESTCACTUS 5095
+#define SND_31_001 4377
+#define ST_CTS31_GROWN2 2472
+
+// Scene 32
+#define ANI_BUTTON_32 5347
+#define ANI_CACTUS 2267
+#define ANI_FLAG 2257
+#define ANI_KADKA 2670
+#define ANI_TESTO_BLUE 2659
+#define ANI_TESTO_GREEN 2662
+#define ANI_TESTO_ORANGE 2656
+#define MSG_SC32_ONLADDER 2270
+#define MSG_SC32_SPIN 2405
+#define MSG_SC32_STARTCACTUS 2414
+#define MSG_SC32_STARTFLAGLEFT 2310
+#define MSG_SC32_STARTFLAGRIGHT 2309
+#define MSG_SC32_STOPFLAG 2311
+#define MSG_SC32_TRUBATOBACK 5181
+#define MSG_SC32_TRUBATOFRONT 5180
+#define MSG_SC32_TRYSIT 2294
+#define MV_CTS_DEFAULT 4299
+#define MV_FLG_CYCLEL 2262
+#define MV_FLG_CYCLER 2266
+#define MV_FLG_STARTL 2258
+#define MV_FLG_STARTR 2263
+#define MV_FLG_STOPL 2261
+#define MV_FLG_STOPR 2265
+#define MV_MAN32_SITDOWN 2276
+#define MV_MAN32_STANDUP 2313
+#define MV_TSTG_FLOW 2663
+#define MV_TSTO_FLOW 2657
+#define PIC_SC32_LADDER 4296
+#define PIC_SC32_RTRUBA 2292
+#define QU_CTS_BACK 2415
+#define QU_CTS_GROW 2416
+#define QU_CTS_GROWMAN 2417
+#define QU_KBK32_GO 4977
+#define QU_KBK32_START 4982
+#define QU_KDK_DRIZZLE 4301
+#define QU_SC32_ENTERLIFT 2827
+#define QU_SC32_EXITLIFT 2828
+#define QU_SC32_FALLHANDLE 5351
+#define QU_SC32_FROMLADDER 4300
+#define QU_SC32_SHOWHANDLE 2399
+#define ST_BTN32_OFF 5349
+#define ST_BTN32_ON 5350
+#define ST_CTS_EMPTY 2269
+#define ST_CTS_GROWUP 2467
+#define ST_FLG_LEFT 2260
+#define ST_FLG_NORM 2259
+#define ST_FLG_RIGHT 2264
+#define ST_HDL_LAID 3039
+#define ST_MAN32_SIT 2277
+
+// Scene 33
+#define ANI_KUBIK 4963
+#define ANI_JETTIE_FLOW 2627
+#define ANI_MUG_33 2623
+#define ANI_VENT_33 2637
+#define MSG_SC33_HANDLEDOWN 2643
+#define MSG_SC33_POUR 2645
+#define MSG_SC33_TESTMUG 5185
+#define MSG_SC33_TRYKUBIK 4980
+#define MSG_SC33_UPDATEKUBIK 5346
+#define MV_JTI33_FLOW 2628
+#define MV_JTI33_POUR 2630
+#define MV_JTI33_POURFULL 4455
+#define MV_VNT33_TURND 2638
+#define MV_VNT33_TURNR 2641
+#define PIC_SC33_LTRUBA 2618
+#define PIC_SC33_ZONES 5298
+#define QU_KBK33_GO 4978
+#define QU_KBK33_START 4983
+#define QU_SC33_STARTWATER 2644
+#define ST_MUG33_EMPTY 2625
+#define ST_MUG33_FULL 2626
+#define ST_VNT33_DOWN 2640
+#define ST_VNT33_RIGHT 2639
+
+// Scene 34
+#define ANI_BOOT_34 4560
+#define ANI_BOX_34 2498
+#define ANI_CACTUS_34 2381
+#define ANI_LUK_34 2541
+#define ANI_STOOL_34 2486
+#define ANI_VENT_34 2473
+#define MSG_SC34_CLIMB 2490
+#define MSG_SC34_CLIMBBOX 4571
+#define MSG_SC34_FROMCACTUS 4313
+#define MSG_SC34_LEAVEBOARD 2576
+#define MSG_SC34_ONBOARD 2550
+#define MSG_SC34_ONBUMP 5313
+#define MSG_SC34_ONCACTUS 2482
+#define MSG_SC34_RETRYVENT 5210
+#define MSG_SC34_SHOWBOX 2497
+#define MSG_SC34_SHOWVENT 2481
+#define MSG_SC34_TESTVENT 2557
+#define MSG_SC34_UNCLIMB 2492
+#define MV_MAN34_TRY 2485
+#define MV_MAN34_TRYTABUR 2489
+#define MV_MAN34_TURNVENT_L 4307
+#define MV_MAN34_TURNVENT_R 2500
+#define QU_SC34_ENTERLIFT 2819
+#define QU_SC34_EXITLIFT 2820
+#define QU_SC34_FROMBOX 2494
+#define QU_SC34_FROMBOX_FLOOR 4572
+#define QU_SC34_FROMCACTUS 4312
+#define QU_SC34_FROMSTOOL 2491
+#define QU_SC34_LEAVEBOARD 2575
+#define QU_SC34_SHOWSTOOL 2496
+#define QU_CTS34_FALLEFT 4316
+#define QU_CTS34_FALLRIGHT 4317
+#define QU_LUK34_CLOSE 2547
+#define QU_LUK34_OPEN 2546
+#define ST_CTS34_EMPTY 2383
+#define ST_CTS34_GROWNEMPTY2 2475
+#define ST_LUK34_CLOSED 2543
+#define ST_LUK34_OPEN 2544
+#define ST_STL34_BOX2 4305
+#define ST_VNT34_RIGHT3 4318
+#define ST_VNT34_UP2 4310
+
+// Scene 35
+#define ANI_HOSE 2424
+#define ANI_PUZODUV 2418
+#define MSG_SC35_CHECKPIPESOUND 4761
+#define MSG_SC35_PLUGHOSE 2524
+#define MSG_SC35_SHRINK 2570
+#define MSG_SC35_STARTFLOW 2523
+#define MSG_SC35_STOPFLOW 4864
+#define MSG_SC35_TRYFLY 4985
+#define QU_PDV_SML_BLINK 2553
+#define QU_PDV_SML_TRY 2554
+#define QU_SC35_EATHOZE 2540
+#define QU_SC35_ENTERLIFT 2815
+#define QU_SC35_EXITLIFT 2816
+#define SND_35_011 4509
+#define SND_35_012 4510
+#define SND_35_026 4863
+#define ST_HZE_NORM 2426
+#define ST_PDV_LARGE 2421
+#define ST_PDV_SMALL 2420
+
+// Scene 36
+#define ANI_SCISSORS_36 2647
+#define ANI_ROTOHRUST 2360
+#define PIC_SC36_MASK 5221
+#define ST_RHT_OPEN 2362
+
+// Scene 37
+#define ANI_GUARD_37 2588
+#define ANI_RING 2604
+#define MSG_SC37_EXITLEFT 5006
+#define MSG_SC37_PULL 2945
+#define MV_GRD37_PULL 2589
+#define MV_RNG_CLOSE 2605
+#define MV_RNG_OPEN 4612
+#define PIC_SC37_MASK 2608
+#define SND_37_007 4547
+#define ST_GRD37_STAND 2590
+#define ST_RNG_CLOSED2 4865
+#define ST_RNG_OPEN 2606
+
+// Scene 38
+#define ANI_BOTTLE38 2188
+#define ANI_DOMINO38 2200
+#define ANI_DOMINOS 3317
+#define ANI_DYLDA 2169
+#define ANI_GLAVAR 2154
+#define ANI_MALYSH 2165
+#define MSG_SC38_DRINK 2225
+#define MSG_SC38_HMRKICK 2224
+#define MSG_SC38_POINT 2226
+#define MSG_SC38_POSTHMRKICK 2256
+#define MSG_SC38_PROPOSE 2287
+#define MSG_SC38_TRYTAKEBOTTLE 3179
+#define MV_DMS_FOUR 3322
+#define MV_DMS_THREE 3321
+#define MV_GLV_LOOKMAN 2167
+#define ST_DMS_3 3319
+#define ST_DMS_4 3320
+#define ST_GLV_HAMMER 2156
+#define ST_GLV_NOHAMMER 2159
+#define ST_MLS_LEFT2 2291
+#define QU_DLD_DENY 2218
+#define QU_GLV_TOSMALL 2208
+#define QU_GLV_TOSMALL_NOHMR 2209
+#define QU_MLS_TURNR 2221
+#define QU_SC38_SHOWBOTTLE 2199
+#define QU_SC38_SHOWBOTTLE_ONTABLE 2838
+#define QU_SC38_ENTERLIFT 2836
+#define QU_SC38_EXITLIFT 2837
+
+// Debug scene
+#define MSG_RESTARTGAME 4767
+#define PIC_SCD_1 727
+#define PIC_SCD_2 728
+#define PIC_SCD_3 729
+#define PIC_SCD_4 730
+#define PIC_SCD_5 731
+#define PIC_SCD_6 732
+#define PIC_SCD_7 733
+#define PIC_SCD_8 756
+#define PIC_SCD_9 907
+#define PIC_SCD_10 981
+#define PIC_SCD_11 1098
+#define PIC_SCD_12 857
+#define PIC_SCD_13 1195
+#define PIC_SCD_14 1224
+#define PIC_SCD_15 1278
+#define PIC_SCD_16 1299
+#define PIC_SCD_17 1305
+#define PIC_SCD_18 1306
+#define PIC_SCD_19 1319
+#define PIC_SCD_20 1622
+#define PIC_SCD_21 1623
+#define PIC_SCD_22 1624
+#define PIC_SCD_23 1625
+#define PIC_SCD_24 1845
+#define PIC_SCD_25 1846
+#define PIC_SCD_26 1847
+#define PIC_SCD_27 1916
+#define PIC_SCD_28 2098
+#define PIC_SCD_29 2099
+#define PIC_SCD_30 2359
+#define PIC_SCD_31 2566
+#define PIC_SCD_32 2312
+#define PIC_SCD_33 2636
+#define PIC_SCD_34 2389
+#define PIC_SCD_35 2412
+#define PIC_SCD_36 2567
+#define PIC_SCD_37 2568
+#define PIC_SCD_38 2228
+#define PIC_SCD_FIN 5026
+#define PIC_SCD_SEL 734
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/floaters.cpp b/engines/fullpipe/floaters.cpp
index 384bfa2150..9e5ca7b3f1 100644
--- a/engines/fullpipe/floaters.cpp
+++ b/engines/fullpipe/floaters.cpp
@@ -22,23 +22,233 @@
#include "fullpipe/fullpipe.h"
#include "fullpipe/floaters.h"
+#include "fullpipe/utils.h"
+#include "fullpipe/objects.h"
+#include "fullpipe/motion.h"
+#include "fullpipe/statics.h"
+#include "fullpipe/scene.h"
+#include "fullpipe/constants.h"
+#include "fullpipe/objectnames.h"
namespace Fullpipe {
+Floaters::~Floaters() {
+ delete _hRgn;
+}
+
void Floaters::init(GameVar *var) {
- warning("STUB: Floaters::init()");
+ _array1.clear();
+ _array2.clear();
+
+ GameVar *varFliers = var->getSubVarByName(sO_Fliers);
+
+ if (!varFliers)
+ return;
+
+ GameVar *sub = varFliers->getSubVarByName("flyIdleRegion");
+
+ if (sub) {
+ _hRgn = new ReactPolygonal();
+
+ _hRgn->_pointCount = sub->getSubVarsCount();
+ _hRgn->_points = (Common::Point **)malloc(sizeof(Common::Point *) * _hRgn->_pointCount);
+
+ sub = sub->_subVars;
+
+ int idx = 0;
+
+ while (sub) {
+ _hRgn->_points[idx] = new Common::Point;
+ _hRgn->_points[idx]->x = sub->_subVars->_value.intValue;
+ _hRgn->_points[idx]->y = sub->_subVars->_nextVarObj->_value.intValue;
+
+ idx++;
+ sub = sub->_nextVarObj;
+ }
+ }
+
+ sub = varFliers->getSubVarByName("flyIdlePath");
+
+ if (sub) {
+ _array1.reserve(sub->getSubVarsCount());
+
+ sub = sub->_subVars;
+
+ int idx = 0;
+
+ while (sub) {
+ FloaterArray1 *f = new FloaterArray1;
+
+ f->val1 = sub->_subVars->_value.intValue;
+ f->val2 = sub->_subVars->_nextVarObj->_value.intValue;
+
+ _array1.push_back(f);
+
+ idx++;
+ sub = sub->_nextVarObj;
+ }
+
+ }
}
-void Floaters::genFlies(Scene *sc, int x, int y, int a5, int a6) {
- warning("STUB: Floaters::genFlies()");
+void Floaters::genFlies(Scene *sc, int x, int y, int priority, int flags) {
+ StaticANIObject *ani = new StaticANIObject(g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_FLY, -1));
+
+ ani->_statics = ani->getStaticsById(ST_FLY_FLY);
+ ani->_movement = 0;
+ ani->setOXY(x, y);
+ ani->_flags |= 4;
+ ani->_priority = priority;
+
+ sc->addStaticANIObject(ani, 1);
+
+ ani->startAnim(MV_FLY_FLY, 0, -1);
+
+ int nummoves;
+
+ if (ani->_movement->_currMovement)
+ nummoves = ani->_movement->_currMovement->_dynamicPhases.size();
+ else
+ nummoves = ani->_movement->_dynamicPhases.size();
+
+ ani->_movement->setDynamicPhaseIndex(g_fp->_rnd->getRandomNumber(nummoves - 1));
+
+ FloaterArray2 *arr2 = new FloaterArray2;
+
+ arr2->ani = ani;
+ arr2->val11 = 15.0;
+ arr2->val3 = y;
+ arr2->val5 = y;
+ arr2->val2 = x;
+ arr2->val4 = x;
+ arr2->fflags = flags;
+
+ _array2.push_back(arr2);
}
void Floaters::update() {
- warning("STUB: Floaters::update()");
+ for (uint i = 0; i < _array2.size(); ++i) {
+ if (_array2[i]->val13 <= 0) {
+ if (_array2[i]->val4 != _array2[i]->val2 || _array2[i]->val5 != _array2[i]->val3) {
+ if (_array2[i]->val9 < 2.0)
+ _array2[i]->val9 = 2.0;
+
+ int dy = _array2[i]->val3 - _array2[i]->val5;
+ int dx = _array2[i]->val2 - _array2[i]->val4;
+ double dst = sqrt((double)(dy * dy + dx * dx));
+ double at = atan2((double)dx, (double)dy);
+ int newX = (int)(cos(at) * _array2[i]->val9);
+ int newY = (int)(sin(at) * _array2[i]->val9);
+
+ if (dst < _array2[i]->val9) {
+ newX = _array2[i]->val2 - _array2[i]->val4;
+ newY = _array2[i]->val3 - _array2[i]->val5;
+ }
+ if (dst <= 30.0) {
+ if (dst < 30.0) {
+ _array2[i]->val9 = _array2[i]->val9 - _array2[i]->val9 * 0.5;
+
+ if (_array2[i]->val9 < 2.0)
+ _array2[i]->val9 = 2.0;
+ }
+ } else {
+ _array2[i]->val9 = _array2[i]->val9 * 0.5 + _array2[i]->val9;
+
+ if (_array2[i]->val9 > _array2[i]->val11)
+ _array2[i]->val9 = _array2[i]->val11;
+ }
+
+ _array2[i]->val4 += newX;
+ _array2[i]->val5 += newY;
+ _array2[i]->ani->setOXY(newX + _array2[i]->ani->_ox, newY + _array2[i]->ani->_oy);
+
+ if (_array2[i]->val4 == _array2[i]->val2 && _array2[i]->val5 == _array2[i]->val3) {
+ _array2[i]->val9 = 0.0;
+
+ _array2[i]->val13 = g_fp->_rnd->getRandomNumber(200) + 20;
+
+ if (_array2[i]->fflags & 1) {
+ g_fp->_currentScene->deleteStaticANIObject(_array2[i]->ani);
+
+ if (_array2[i]->ani)
+ delete _array2[i]->ani;
+
+ _array2.remove_at(i);
+
+ i--;
+
+ if (!_array2.size())
+ g_fp->stopAllSoundInstances(SND_CMN_060);
+
+ continue;
+ }
+ }
+ } else {
+ if ((_array2[i]->fflags & 4) && _array2[i]->countdown < 1) {
+ _array2[i]->fflags |= 1;
+ _array2[i]->val2 = _array2[i]->val6;
+ _array2[i]->val3 = _array2[i]->val7;
+ } else {
+ if (_array2[i]->fflags & 2) {
+ int idx1 = g_fp->_rnd->getRandomNumber(_array1.size() - 1);
+
+ _array2[i]->val2 = _array1[idx1]->val1;
+ _array2[i]->val3 = _array1[idx1]->val2;
+ } else {
+ Common::Rect rect;
+
+ if (!_hRgn)
+ error("Floaters::update(): empty fliers region");
+
+ _hRgn->getBBox(&rect);
+
+ int x2 = rect.left + g_fp->_rnd->getRandomNumber(rect.right - rect.left);
+ int y2 = rect.top + g_fp->_rnd->getRandomNumber(rect.bottom - rect.top);
+
+ if (_hRgn->pointInRegion(x2, y2)) {
+ int dx = _array2[i]->val2 - x2;
+ int dy = _array2[i]->val3 - y2;
+ double dst = sqrt((double)(dy * dy + dx * dx));
+
+ if (dst < 300.0 || !_hRgn->pointInRegion(_array2[i]->val4, _array2[i]->val5)) {
+ _array2[i]->val2 = x2;
+ _array2[i]->val3 = y2;
+ }
+ }
+ }
+
+ g_fp->playSound(SND_CMN_061, 0);
+
+ if (_array2[i]->fflags & 4)
+ _array2[i]->countdown--;
+ }
+ }
+ } else {
+ _array2[i]->val13--;
+ }
+
+ if (!_array2[i]->ani->_movement && _array2[i]->ani->_statics->_staticsId == ST_FLY_FLY) {
+ if (!_array2[i]->val15) {
+ g_fp->playSound(SND_CMN_060, 1);
+
+ _array2[i]->val15 = 1;
+ }
+
+ _array2[i]->ani->startAnim(MV_FLY_FLY, 0, -1);
+ }
+ }
}
void Floaters::stopAll() {
- warning("STUB: Floaters::stopAll()");
+ for (uint i = 0; i < _array2.size(); i++) {
+ g_fp->_currentScene->deleteStaticANIObject(_array2[i]->ani);
+
+ delete _array2[i]->ani;
+ }
+
+ _array2.clear();
+
+ g_fp->stopAllSoundInstances(SND_CMN_060);
}
diff --git a/engines/fullpipe/floaters.h b/engines/fullpipe/floaters.h
index a4d64dd79d..3ecbbeea9c 100644
--- a/engines/fullpipe/floaters.h
+++ b/engines/fullpipe/floaters.h
@@ -27,10 +27,13 @@ namespace Fullpipe {
class StaticANIObject;
class Scene;
+class ReactPolygonal;
struct FloaterArray1 {
int val1;
int val2;
+
+ FloaterArray1() { val1 = 0; val2 = 0; }
};
struct FloaterArray2 {
@@ -48,16 +51,21 @@ struct FloaterArray2 {
int countdown;
int val15;
int fflags;
+
+ FloaterArray2() : ani(0), val2(0), val3(0), val4(0), val5(0), val6(0), val7(0), val8(0),
+ val9(0.0), val11(0.0), val13(0), countdown(0), val15(0), fflags(0) {}
};
class Floaters {
public:
- //HRGN hRgn;
+ ReactPolygonal *_hRgn;
Common::Array<FloaterArray1 *> _array1;
Common::Array<FloaterArray2 *> _array2;
+ Floaters() { _hRgn = 0; }
+ ~Floaters();
void init(GameVar *var);
- void genFlies(Scene *sc, int x, int y, int a5, int a6);
+ void genFlies(Scene *sc, int x, int y, int priority, int flags);
void update();
void stopAll();
};
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 7dedaf3109..1c319d3660 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -33,12 +33,14 @@
#include "fullpipe/behavior.h"
#include "fullpipe/modal.h"
#include "fullpipe/input.h"
+#include "fullpipe/motion.h"
#include "fullpipe/scenes.h"
#include "fullpipe/floaters.h"
+#include "fullpipe/console.h"
namespace Fullpipe {
-FullpipeEngine *g_fullpipe = 0;
+FullpipeEngine *g_fp = 0;
Vars *g_vars = 0;
FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
@@ -51,6 +53,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_rnd = new Common::RandomSource("fullpipe");
+ _console = 0;
_gameProjectVersion = 0;
_pictureScale = 8;
@@ -91,13 +94,17 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_isProcessingMessages = false;
_musicAllowed = -1;
+ _musicGameVar = 0;
_aniMan = 0;
_aniMan2 = 0;
_currentScene = 0;
+ _loaderScene = 0;
_scene2 = 0;
+ _scene3 = 0;
_movTable = 0;
_floaters = 0;
+ _mgm = 0;
_globalMessageQueueList = 0;
_messageHandlers = 0;
@@ -144,14 +151,22 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_objectAtCursor = 0;
_objectIdAtCursor = 0;
+ _arcadeOverlay = 0;
+ _arcadeOverlayHelper = 0;
+ _arcadeOverlayX = 0;
+ _arcadeOverlayY = 0;
+ _arcadeOverlayMidX = 0;
+ _arcadeOverlayMidY = 0;
+
_isSaveAllowed = true;
- g_fullpipe = this;
+ g_fp = this;
g_vars = new Vars;
}
FullpipeEngine::~FullpipeEngine() {
delete _rnd;
+ delete _console;
delete _globalMessageQueueList;
}
@@ -165,6 +180,7 @@ void FullpipeEngine::initialize() {
_sceneRect.bottom = 599;
_floaters = new Floaters;
+ _mgm = new MGM;
}
Common::Error FullpipeEngine::run() {
@@ -174,6 +190,8 @@ Common::Error FullpipeEngine::run() {
_backgroundSurface.create(800, 600, format);
+ _console = new Console(this);
+
initialize();
_isSaveAllowed = false;
@@ -272,6 +290,11 @@ void FullpipeEngine::updateEvents() {
return;
break;
default:
+ if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) {
+ // Start the debugger
+ getDebugger()->attach();
+ getDebugger()->onFrame();
+ }
ex = new ExCommand(0, 17, 36, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = event.kbd.keycode;
ex->_excFlags |= 3;
@@ -428,21 +451,6 @@ void FullpipeEngine::setObjectState(const char *name, int state) {
var->setSubVarAsInt(name, state);
}
-void FullpipeEngine::updateMapPiece(int mapId, int update) {
- for (int i = 0; i < 200; i++) {
- int hiWord = (_mapTable[i] >> 16) & 0xffff;
-
- if (hiWord == mapId) {
- _mapTable[i] |= update;
- return;
- }
- if (!hiWord) {
- _mapTable[i] = (mapId << 16) | update;
- return;
- }
- }
-}
-
void FullpipeEngine::disableSaves(ExCommand *ex) {
warning("STUB: FullpipeEngine::disableSaves()");
}
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 63dde5042b..aa6e0dac3a 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -36,6 +36,9 @@
#include "engines/engine.h"
+#include "gui/debugger.h"
+#include "fullpipe/console.h"
+
struct ADGameDescription;
namespace Fullpipe {
@@ -58,7 +61,10 @@ class GameObject;
class GlobalMessageQueueList;
struct MessageHandler;
struct MovTable;
+class MGM;
class NGIArchive;
+class PictureObject;
+struct PreloadItem;
class Scene;
class SoundList;
class StaticANIObject;
@@ -80,6 +86,9 @@ public:
FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc);
virtual ~FullpipeEngine();
+ Console *_console;
+ GUI::Debugger *getDebugger() { return _console; }
+
void initialize();
void setMusicAllowed(int val) { _musicAllowed = val; }
@@ -120,7 +129,9 @@ public:
int _sceneWidth;
int _sceneHeight;
Scene *_currentScene;
+ Scene *_loaderScene;
Scene *_scene2;
+ Scene *_scene3;
StaticANIObject *_aniMan;
StaticANIObject *_aniMan2;
byte *_globalPalette;
@@ -141,7 +152,11 @@ public:
void stopAllSounds();
void toggleMute();
void playSound(int id, int flag);
+ void playTrack(GameVar *sceneVar, const char *name, bool delayed);
void startSceneTrack();
+ void stopSoundStream2();
+ void stopAllSoundStreams();
+ void stopAllSoundInstances(int id);
int _sfxVolume;
@@ -165,8 +180,12 @@ public:
MovTable *_movTable;
Floaters *_floaters;
+ MGM *_mgm;
+
+ Common::Array<Common::Point *> _arcadeKeys;
void initMap();
+ void updateMap(PreloadItem *pre);
void updateMapPiece(int mapId, int update);
void updateScreen();
@@ -223,6 +242,8 @@ public:
Scene *accessScene(int sceneId);
void setSceneMusicParameters(GameVar *var);
int convertScene(int scene);
+ int getSceneEntrance(int scene);
+ int getSceneFromTag(int tag);
NGIArchive *_currArchive;
@@ -230,13 +251,25 @@ public:
void openHelp();
void openMainMenu();
+ PictureObject *_arcadeOverlay;
+ PictureObject *_arcadeOverlayHelper;
+ int _arcadeOverlayX;
+ int _arcadeOverlayY;
+ int _arcadeOverlayMidX;
+ int _arcadeOverlayMidY;
+
void initArcadeKeys(const char *varname);
+ void processArcade(ExCommand *ex);
void winArcade();
+ void setArcadeOverlay(int picId);
+ int drawArcadeOverlay(int adjust);
+
void getAllInventory();
int lift_getButtonIdP(int objid);
void lift_setButton(const char *name, int state);
void lift_sub5(Scene *sc, int qu1, int qu2);
+ void lift_sub7(Scene *sc, int buttonId);
void lift_exitSeq(ExCommand *ex);
void lift_closedoorSeq();
void lift_animation3();
@@ -244,7 +277,10 @@ public:
void lift_sub1(StaticANIObject *ani);
void lift_startExitQueue();
void lift_sub05(ExCommand *ex);
+ bool lift_checkButton(const char *varname);
+ GameVar *_musicGameVar;
+ Audio::SoundHandle _sceneTrackHandle;
public:
bool _isSaveAllowed;
@@ -254,7 +290,7 @@ public:
};
-extern FullpipeEngine *g_fullpipe;
+extern FullpipeEngine *g_fp;
extern Vars *g_vars;
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index a2ab71d7e3..845655dded 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -28,23 +28,26 @@
#include "fullpipe/statics.h"
#include "fullpipe/interaction.h"
#include "fullpipe/motion.h"
+#include "fullpipe/constants.h"
+#include "fullpipe/scenes.h"
+#include "fullpipe/floaters.h"
namespace Fullpipe {
Inventory2 *getGameLoaderInventory() {
- return &g_fullpipe->_gameLoader->_inventory;
+ return &g_fp->_gameLoader->_inventory;
}
MctlCompound *getSc2MctlCompoundBySceneId(int16 sceneId) {
- for (uint i = 0; i < g_fullpipe->_gameLoader->_sc2array.size(); i++)
- if (g_fullpipe->_gameLoader->_sc2array[i]._sceneId == sceneId)
- return (MctlCompound *)g_fullpipe->_gameLoader->_sc2array[i]._motionController;
+ for (uint i = 0; i < g_fp->_gameLoader->_sc2array.size(); i++)
+ if (g_fp->_gameLoader->_sc2array[i]._sceneId == sceneId)
+ return (MctlCompound *)g_fp->_gameLoader->_sc2array[i]._motionController;
return 0;
}
InteractionController *getGameLoaderInteractionController() {
- return g_fullpipe->_gameLoader->_interactionController;
+ return g_fp->_gameLoader->_interactionController;
}
GameLoader::GameLoader() {
@@ -68,10 +71,10 @@ GameLoader::GameLoader() {
_preloadEntranceId = 0;
_updateCounter = 0;
- g_fullpipe->_msgX = 0;
- g_fullpipe->_msgY = 0;
- g_fullpipe->_msgObjectId2 = 0;
- g_fullpipe->_msgId = 0;
+ g_fp->_msgX = 0;
+ g_fp->_msgY = 0;
+ g_fp->_msgObjectId2 = 0;
+ g_fp->_msgId = 0;
}
GameLoader::~GameLoader() {
@@ -79,6 +82,8 @@ GameLoader::~GameLoader() {
delete _gameProject;
delete _interactionController;
delete _inputController;
+
+ warning("STUB: GameLoader::~GameLoader()");
}
bool GameLoader::load(MfcArchive &file) {
@@ -91,10 +96,10 @@ bool GameLoader::load(MfcArchive &file) {
_gameProject->load(file);
- g_fullpipe->_gameProject = _gameProject;
+ g_fp->_gameProject = _gameProject;
- if (g_fullpipe->_gameProjectVersion < 12) {
- error("Old gameProjectVersion: %d", g_fullpipe->_gameProjectVersion);
+ if (g_fp->_gameProjectVersion < 12) {
+ error("Old gameProjectVersion: %d", g_fp->_gameProjectVersion);
}
_gameName = file.readPascalString();
@@ -167,7 +172,7 @@ bool GameLoader::gotoScene(int sceneId, int entranceId) {
return false;
if (_sc2array[sc2idx]._entranceDataCount < 1) {
- g_fullpipe->_currentScene = st->_scene;
+ g_fp->_currentScene = st->_scene;
return true;
}
@@ -186,20 +191,20 @@ bool GameLoader::gotoScene(int sceneId, int entranceId) {
if (sg || (sg = _gameVar->getSubVarByName("OBJSTATES")->addSubVarAsInt("SAVEGAME", 0)) != 0)
sg->setSubVarAsInt("Entrance", entranceId);
- if (!g_fullpipe->sceneSwitcher(_sc2array[sc2idx]._entranceData[entranceIdx]))
+ if (!g_fp->sceneSwitcher(_sc2array[sc2idx]._entranceData[entranceIdx]))
return false;
- g_fullpipe->_msgObjectId2 = 0;
- g_fullpipe->_msgY = -1;
- g_fullpipe->_msgX = -1;
+ g_fp->_msgObjectId2 = 0;
+ g_fp->_msgY = -1;
+ g_fp->_msgX = -1;
- g_fullpipe->_currentScene = st->_scene;
+ g_fp->_currentScene = st->_scene;
- MessageQueue *mq1 = g_fullpipe->_currentScene->getMessageQueueById(_sc2array[sc2idx]._entranceData[entranceIdx]->_messageQueueId);
+ MessageQueue *mq1 = g_fp->_currentScene->getMessageQueueById(_sc2array[sc2idx]._entranceData[entranceIdx]->_messageQueueId);
if (mq1) {
MessageQueue *mq = new MessageQueue(mq1, 0, 0);
- StaticANIObject *stobj = g_fullpipe->_currentScene->getStaticANIObject1ById(_field_FA, -1);
+ StaticANIObject *stobj = g_fp->_currentScene->getStaticANIObject1ById(_field_FA, -1);
if (stobj) {
stobj->_flags &= 0x100;
@@ -209,7 +214,7 @@ bool GameLoader::gotoScene(int sceneId, int entranceId) {
ex->_messageNum = 0;
ex->_excFlags |= 3;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
}
mq->setFlags(mq->getFlags() | 1);
@@ -220,7 +225,7 @@ bool GameLoader::gotoScene(int sceneId, int entranceId) {
return false;
}
} else {
- StaticANIObject *stobj = g_fullpipe->_currentScene->getStaticANIObject1ById(_field_FA, -1);
+ StaticANIObject *stobj = g_fp->_currentScene->getStaticANIObject1ById(_field_FA, -1);
if (stobj)
stobj->_flags &= 0xfeff;
}
@@ -228,8 +233,100 @@ bool GameLoader::gotoScene(int sceneId, int entranceId) {
return true;
}
-bool preloadCallback(const PreloadItem &pre, int flag) {
- warning("STUB: preloadCallback");
+bool preloadCallback(PreloadItem &pre, int flag) {
+ if (flag) {
+ if (flag == 50)
+ g_fp->_aniMan->preloadMovements(g_fp->_movTable);
+
+ StaticANIObject *pbar = g_fp->_loaderScene->getStaticANIObject1ById(ANI_PBAR, -1);
+
+ if (pbar) {
+ int sz;
+
+ if (pbar->_movement->_currMovement)
+ sz = pbar->_movement->_currMovement->_dynamicPhases.size();
+ else
+ sz = pbar->_movement->_dynamicPhases.size();
+
+ pbar->_movement->setDynamicPhaseIndex(flag * (sz - 1) / 100);
+ }
+
+ g_fp->updateMap(&pre);
+
+ g_fp->_currentScene = g_fp->_loaderScene;
+
+ g_fp->_loaderScene->draw();
+
+ g_fp->_system->updateScreen();
+ } else {
+ if (g_fp->_scene2) {
+ g_fp->_aniMan = g_fp->_scene2->getAniMan();
+ g_fp->_scene2 = 0;
+ setInputDisabled(1);
+ }
+
+ g_fp->_floaters->stopAll();
+
+ if (g_fp->_soundEnabled) {
+ g_fp->_currSoundListCount = 1;
+ g_fp->_currSoundList1[0] = g_fp->accessScene(SC_COMMON)->_soundList;
+ }
+
+ g_vars->scene18_var01 = 0;
+
+ 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) {
+ if (pre.preloadId1 != SC_18)
+ g_fp->_gameLoader->unloadScene(SC_18);
+
+ g_fp->_scene3 = 0;
+ }
+ } else {
+ scene19_preload(g_fp->accessScene(pre.preloadId1), pre.keyCode);
+
+ g_vars->scene18_var01 = 1;
+
+ if (pre.preloadId1 == SC_18) {
+ g_fp->_gameLoader->saveScenePicAniInfos(SC_18);
+
+ scene18_preload();
+ }
+ }
+
+ if (((pre.sceneId == SC_19 && pre.keyCode == TrubaRight) || (pre.sceneId == SC_18 && pre.keyCode == TrubaRight)) && !pre.preloadId2) {
+ pre.sceneId = SC_18;
+ pre.keyCode = TrubaLeft;
+ }
+
+ if (!g_fp->_loaderScene) {
+ g_fp->_gameLoader->loadScene(SC_LDR);
+ g_fp->_loaderScene = g_fp->accessScene(SC_LDR);;
+ }
+
+ StaticANIObject *pbar = g_fp->_loaderScene->getStaticANIObject1ById(ANI_PBAR, -1);
+
+ if (pbar) {
+ pbar->show1(ST_EGTR_SLIMSORROW, ST_MAN_GOU, MV_PBAR_RUN, 0);
+ pbar->startAnim(MV_PBAR_RUN, 0, -1);
+ }
+
+ g_fp->_inventoryScene = 0;
+ g_fp->_updateCursorCallback = 0;
+
+ g_fp->_sceneRect.translate(-g_fp->_sceneRect.left, -g_fp->_sceneRect.top);
+
+ g_fp->_system->delayMillis(10);
+
+ Scene *oldsc = g_fp->_currentScene;
+
+ g_fp->_currentScene = g_fp->_loaderScene;
+
+ g_fp->_loaderScene->draw();
+
+ g_fp->_system->updateScreen();
+
+ g_fp->_currentScene = oldsc;
+ }
return true;
}
@@ -262,8 +359,8 @@ bool GameLoader::preloadScene(int sceneId, int entranceId) {
return false;
}
- if (g_fullpipe->_currentScene && g_fullpipe->_currentScene->_sceneId == sceneId)
- g_fullpipe->_currentScene = 0;
+ if (g_fp->_currentScene && g_fp->_currentScene->_sceneId == sceneId)
+ g_fp->_currentScene = 0;
saveScenePicAniInfos(sceneId);
clearGlobalMessageQueueList1();
@@ -358,7 +455,7 @@ void GameLoader::applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAni
if (!(picAniInfo[i]->type & 1))
continue;
- Scene *scNew = g_fullpipe->accessScene(picAniInfo[i]->sceneId);
+ Scene *scNew = g_fp->accessScene(picAniInfo[i]->sceneId);
if (!scNew)
continue;
@@ -386,8 +483,8 @@ void GameLoader::saveScenePicAniInfos(int sceneId) {
}
void GameLoader::updateSystems(int counterdiff) {
- if (g_fullpipe->_currentScene) {
- g_fullpipe->_currentScene->update(counterdiff);
+ if (g_fp->_currentScene) {
+ g_fp->_currentScene->update(counterdiff);
_exCommand._messageKind = 17;
_updateCounter++;
@@ -510,4 +607,8 @@ InputController *FullpipeEngine::getGameLoaderInputController() {
return 0;
}
+MctlCompound *getCurrSceneSc2MotionController() {
+ return getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId);
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h
index 4f5462671d..85bd6ab0fb 100644
--- a/engines/fullpipe/gameloader.h
+++ b/engines/fullpipe/gameloader.h
@@ -65,7 +65,7 @@ struct PreloadItem {
int keyCode;
};
-bool preloadCallback(const PreloadItem &pre, int flag);
+bool preloadCallback(PreloadItem &pre, int flag);
class PreloadItems : public Common::Array<PreloadItem *>, public CObject {
public:
@@ -95,7 +95,7 @@ class GameLoader : public CObject {
Inventory2 _inventory;
Sc2Array _sc2array;
void *_sceneSwitcher;
- bool (*_preloadCallback)(const PreloadItem &pre, int flag);
+ bool (*_preloadCallback)(PreloadItem &pre, int flag);
void *_readSavegameCallback;
int16 _field_F8;
int16 _field_FA;
@@ -111,6 +111,7 @@ class GameLoader : public CObject {
Inventory2 *getGameLoaderInventory();
InteractionController *getGameLoaderInteractionController();
MctlCompound *getSc2MctlCompoundBySceneId(int16 sceneId);
+MctlCompound *getCurrSceneSc2MotionController();
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 2e89bd6003..a67a4d7b19 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -58,6 +58,8 @@ Bitmap::Bitmap(Bitmap *src) {
Bitmap::~Bitmap() {
if (_pixels)
free(_pixels);
+
+ _pixels = 0;
}
void Bitmap::load(Common::ReadStream *s) {
@@ -87,6 +89,10 @@ Background::Background() {
_palette = 0;
}
+Background::~Background() {
+ warning("STUB: Background::~Background()");
+}
+
bool Background::load(MfcArchive &file) {
debug(5, "Background::load()");
_bgname = file.readPascalString();
@@ -100,11 +106,11 @@ bool Background::load(MfcArchive &file) {
addPictureObject(pct);
}
- assert(g_fullpipe->_gameProjectVersion >= 4);
+ assert(g_fp->_gameProjectVersion >= 4);
_bigPictureArray1Count = file.readUint32LE();
- assert(g_fullpipe->_gameProjectVersion >= 5);
+ assert(g_fp->_gameProjectVersion >= 5);
_bigPictureArray2Count = file.readUint32LE();
@@ -129,8 +135,8 @@ void Background::addPictureObject(PictureObject *pct) {
pct->renumPictures(&_picObjList);
bool inserted = false;
- for (uint i = 0; i < _picObjList.size(); i++) {
- if (((PictureObject *)_picObjList[i])->_priority == pct->_priority) {
+ for (uint i = 1; i < _picObjList.size(); i++) {
+ if (((PictureObject *)_picObjList[i])->_priority <= pct->_priority) {
_picObjList.insert_at(i, pct);
inserted = true;
break;
@@ -152,6 +158,10 @@ PictureObject::PictureObject() {
_objtype = kObjTypePictureObject;
}
+PictureObject::~PictureObject() {
+ warning("STUB: PictureObject::~PictureObject()");
+}
+
PictureObject::PictureObject(PictureObject *src) : GameObject(src) {
_picture = src->_picture;
_ox2 = _ox;
@@ -222,7 +232,7 @@ void PictureObject::drawAt(int x, int y) {
bool PictureObject::setPicAniInfo(PicAniInfo *picAniInfo) {
if (!(picAniInfo->type & 2) || (picAniInfo->type & 1)) {
- error("Picture::setPicAniInfo(): Wrong type: %d", picAniInfo->type);
+ error("PictureObject::setPicAniInfo(): Wrong type: %d", picAniInfo->type);
return false;
}
@@ -269,6 +279,11 @@ bool PictureObject::isPixelHitAtPos(int x, int y) {
return res;
}
+void PictureObject::setOXY2() {
+ _ox2 = _ox;
+ _oy2 = _oy;
+}
+
GameObject::GameObject() {
_okeyCode = 0;
_flags = 0;
@@ -313,7 +328,7 @@ bool GameObject::load(MfcArchive &file) {
_oy = file.readUint32LE();
_priority = file.readUint16LE();
- if (g_fullpipe->_gameProjectVersion >= 11) {
+ if (g_fp->_gameProjectVersion >= 11) {
_field_8 = file.readUint32LE();
}
@@ -329,8 +344,8 @@ void GameObject::renumPictures(PtrList *lst) {
int *buf = (int *)calloc(lst->size() + 2, sizeof(int));
for (uint i = 0; i < lst->size(); i++) {
- if (_id == ((PictureObject *)((*lst)[i]))->_id)
- buf[((PictureObject *)((*lst)[i]))->_okeyCode] = 1;
+ if (_id == ((GameObject *)((*lst)[i]))->_id)
+ buf[((GameObject *)((*lst)[i]))->_okeyCode] = 1;
}
if (buf[_okeyCode]) {
@@ -464,10 +479,12 @@ Picture::~Picture() {
}
void Picture::freePicture() {
+ debug(5, "Picture::freePicture(): file: %s", _memfilename);
+
if (_bitmap) {
if (testFlags() && !_field_54) {
freeData();
- delete _bitmap;
+ free(_bitmap);
_bitmap = 0;
}
}
@@ -484,6 +501,11 @@ void Picture::freePicture() {
}
}
+void Picture::freePixelData() {
+ freePicture();
+ freeData();
+}
+
bool Picture::load(MfcArchive &file) {
debug(5, "Picture::load()");
MemoryObject::load(file);
@@ -492,7 +514,7 @@ bool Picture::load(MfcArchive &file) {
_y = file.readUint32LE();
_field_44 = file.readUint16LE();
- assert(g_fullpipe->_gameProjectVersion >= 2);
+ assert(g_fp->_gameProjectVersion >= 2);
_width = file.readUint32LE();
_height = file.readUint32LE();
@@ -506,7 +528,7 @@ bool Picture::load(MfcArchive &file) {
setAOIDs();
}
- assert (g_fullpipe->_gameProjectVersion >= 12);
+ assert (g_fp->_gameProjectVersion >= 12);
_alpha = file.readUint32LE() & 0xff;
@@ -519,14 +541,14 @@ bool Picture::load(MfcArchive &file) {
getData();
- debug(5, "Picture::load: <%s>", _memfilename);
+ debug(5, "Picture::load: loaded <%s>", _memfilename);
return true;
}
void Picture::setAOIDs() {
- int w = (g_fullpipe->_pictureScale + _width - 1) / g_fullpipe->_pictureScale;
- int h = (g_fullpipe->_pictureScale + _height - 1) / g_fullpipe->_pictureScale;
+ int w = (g_fp->_pictureScale + _width - 1) / g_fp->_pictureScale;
+ int h = (g_fp->_pictureScale + _height - 1) / g_fp->_pictureScale;
_memoryObject2->_rows = (byte **)malloc(w * sizeof(int *));
@@ -539,6 +561,10 @@ void Picture::setAOIDs() {
}
void Picture::init() {
+ debug(5, "Picture::init(), %s", _memfilename);
+
+ MemoryObject::getData();
+
_bitmap = new Bitmap();
getDibInfo();
@@ -567,6 +593,12 @@ void Picture::getDibInfo() {
warning("Uneven data size: 0x%x", _dataSize);
}
+ if (!_data) {
+ warning("Picture::getDibInfo: data is empty <%s>", _memfilename);
+
+ MemoryObject::load();
+ }
+
Common::MemoryReadStream *s = new Common::MemoryReadStream(_data + off - 32, 32);
_bitmap->load(s);
@@ -584,7 +616,7 @@ void Picture::draw(int x, int y, int style, int angle) {
int x1 = x;
int y1 = y;
- debug(0, "Picture::draw(%d, %d, %d, %d) (%s)", x, y, style, angle, _memfilename);
+ debug(7, "Picture::draw(%d, %d, %d, %d) (%s)", x, y, style, angle, _memfilename);
if (x != -1)
x1 = x;
@@ -599,14 +631,14 @@ void Picture::draw(int x, int y, int style, int angle) {
return;
if ((_alpha & 0xff) < 0xff) {
- debug(0, "Picture:draw: alpha = %0x", _alpha);
+ debug(7, "Picture:draw: alpha = %0x", _alpha);
}
byte *pal = _paletteData;
if (!pal) {
//warning("Picture:draw: using global palette");
- pal = g_fullpipe->_globalPalette;
+ pal = g_fp->_globalPalette;
}
Common::Point point;
@@ -638,7 +670,7 @@ void Picture::drawRotated(int x, int y, int angle) {
}
void Picture::displayPicture() {
- if (!g_fullpipe->_gameContinue)
+ if (!g_fp->_gameContinue)
return;
getData();
@@ -647,22 +679,22 @@ void Picture::displayPicture() {
if (!_dataSize)
return;
- g_fullpipe->_backgroundSurface.fillRect(Common::Rect(0, 0, 799, 599), 0);
- g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(0, 0), g_fullpipe->_backgroundSurface.pitch, 0, 0, 799, 599);
+ g_fp->_backgroundSurface.fillRect(Common::Rect(0, 0, 800, 600), 0);
+ g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(0, 0), g_fp->_backgroundSurface.pitch, 0, 0, 800, 600);
draw(0, 0, 0, 0);
- g_fullpipe->updateEvents();
- g_fullpipe->_system->delayMillis(10);
- g_fullpipe->_system->updateScreen();
+ g_fp->updateEvents();
+ g_fp->_system->delayMillis(10);
+ g_fp->_system->updateScreen();
- while (g_fullpipe->_gameContinue) {
- g_fullpipe->updateEvents();
- g_fullpipe->_system->delayMillis(10);
- g_fullpipe->_system->updateScreen();
+ while (g_fp->_gameContinue) {
+ g_fp->updateEvents();
+ g_fp->_system->delayMillis(10);
+ g_fp->_system->updateScreen();
- if (g_fullpipe->_keyState == ' ') {
- g_fullpipe->_keyState = Common::KEYCODE_INVALID;
+ if (g_fp->_keyState == ' ') {
+ g_fp->_keyState = Common::KEYCODE_INVALID;
break;
}
}
@@ -710,7 +742,7 @@ bool Picture::isPixelHitAtPos(int x, int y) {
}
int Picture::getPixelAtPos(int x, int y) {
- return getPixelAtPosEx(x / g_fullpipe->_pictureScale, y / g_fullpipe->_pictureScale);
+ return getPixelAtPosEx(x / g_fp->_pictureScale, y / g_fp->_pictureScale);
return false;
}
@@ -719,8 +751,8 @@ int Picture::getPixelAtPosEx(int x, int y) {
if (x < 0 || y < 0)
return 0;
- if (x < (g_fullpipe->_pictureScale + _width - 1) / g_fullpipe->_pictureScale &&
- y < (g_fullpipe->_pictureScale + _height - 1) / g_fullpipe->_pictureScale &&
+ if (x < (g_fp->_pictureScale + _width - 1) / g_fp->_pictureScale &&
+ y < (g_fp->_pictureScale + _height - 1) / g_fp->_pictureScale &&
_memoryObject2 != 0 && _memoryObject2->_rows != 0)
return _memoryObject2->_rows[x][2 * y];
@@ -771,10 +803,10 @@ bool Bitmap::isPixelAtHitPosRB(int x, int y) {
}
void Bitmap::putDib(int x, int y, int32 *palette) {
- debug(0, "Bitmap::putDib(%d, %d)", x, y);
+ debug(7, "Bitmap::putDib(%d, %d)", x, y);
- _x = x - g_fullpipe->_sceneRect.left;
- _y = y - g_fullpipe->_sceneRect.top;
+ _x = x - g_fp->_sceneRect.left;
+ _y = y - g_fp->_sceneRect.top;
if (_type == MKTAG('R', 'B', '\0', '\0'))
putDibRB(palette);
@@ -795,7 +827,7 @@ bool Bitmap::putDibRB(int32 *palette, int pX, int pY) {
uint16 *srcPtr;
if (!palette && pX == -1) {
- warning("Bitmap::putDibRB(): Both global and local palettes are empty");
+ debug(2, "Bitmap::putDibRB(): Both global and local palettes are empty");
return false;
}
@@ -867,7 +899,7 @@ bool Bitmap::putDibRB(int32 *palette, int pX, int pY) {
if (y <= endy) {
if (pX == -1) {
int bgcolor = palette[(pixel >> 8) & 0xff];
- curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start1, y);
+ curDestPtr = (uint16 *)g_fp->_backgroundSurface.getBasePtr(start1, y);
colorFill(curDestPtr, fillLen, bgcolor);
} else {
if (y == pY && pX >= start1 && pX < start1 + fillLen)
@@ -898,7 +930,7 @@ bool Bitmap::putDibRB(int32 *palette, int pX, int pY) {
if (y <= endy) {
if (pX == -1) {
- curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start1, y);
+ curDestPtr = (uint16 *)g_fp->_backgroundSurface.getBasePtr(start1, y);
paletteFill(curDestPtr, (byte *)srcPtr2, fillLen, (int32 *)palette);
} else {
if (y == pY && pX >= start1 && pX < start1 + fillLen)
@@ -910,7 +942,7 @@ bool Bitmap::putDibRB(int32 *palette, int pX, int pY) {
}
if (pX == -1)
- g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(startx, starty), g_fullpipe->_backgroundSurface.pitch, startx, starty, endx + 1 - startx, endy + 1 - starty);
+ g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(startx, starty), g_fp->_backgroundSurface.pitch, startx, starty, endx + 1 - startx, endy + 1 - starty);
return false;
}
@@ -961,17 +993,17 @@ void Bitmap::putDibCB(int32 *palette) {
if (_flags & 0x1000000) {
for (int y = starty; y < endy; srcPtr -= pitch, y++) {
- curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(startx, y);
+ curDestPtr = (uint16 *)g_fp->_backgroundSurface.getBasePtr(startx, y);
copierKeyColor(curDestPtr, srcPtr, endx - startx + 1, _flags & 0xff, (int32 *)palette, cb05_format);
}
} else {
for (int y = starty; y <= endy; srcPtr -= pitch, y++) {
- curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(startx, y);
+ curDestPtr = (uint16 *)g_fp->_backgroundSurface.getBasePtr(startx, y);
copier(curDestPtr, srcPtr, endx - startx + 1, (int32 *)palette, cb05_format);
}
}
- g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(startx, starty), g_fullpipe->_backgroundSurface.pitch, startx, starty, endx + 1 - startx, endy + 1 - starty);
+ g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(startx, starty), g_fp->_backgroundSurface.pitch, startx, starty, endx + 1 - startx, endy + 1 - starty);
}
void Bitmap::colorFill(uint16 *dest, int len, int32 color) {
@@ -1166,6 +1198,34 @@ bool BigPicture::load(MfcArchive &file) {
return true;
}
+void BigPicture::draw(int x, int y, int style, int angle) {
+ if (!_bitmap)
+ init();
+
+ if (_bitmap) {
+ _bitmap->_flags &= 0xFEFFFFFF;
+
+ int nx = _x;
+ int ny = _y;
+
+ if (x != -1)
+ nx = x;
+
+ if (y != -1)
+ ny = y;
+
+ if (_alpha < 0xFF) {
+ //vrtSetAlphaBlendMode(g_vrtDrawHandle, 1, v9);
+ }
+
+ _bitmap->putDib(nx, ny, 0);
+
+ if (_alpha < 0xFF) {
+ //vrtSetAlphaBlendMode(g_vrtDrawHandle, 0, 255);
+ }
+ }
+}
+
Shadows::Shadows() {
_staticAniObjectId = 0;
_movementId = 0;
@@ -1182,7 +1242,7 @@ bool Shadows::load(MfcArchive &file) {
}
void Shadows::init() {
- Scene *scene = g_fullpipe->accessScene(_sceneId);
+ Scene *scene = g_fp->accessScene(_sceneId);
StaticANIObject *st;
Movement *mov;
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 9d5c45de0b..d640decc80 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -88,13 +88,14 @@ class Picture : public MemoryObject {
virtual ~Picture();
void freePicture();
+ void freePixelData();
virtual bool load(MfcArchive &file);
void setAOIDs();
void init();
void getDibInfo();
Bitmap *getPixelData();
- void draw(int x, int y, int style, int angle);
+ virtual void draw(int x, int y, int style, int angle);
void drawRotated(int x, int y, int angle);
byte getAlpha() { return (byte)_alpha; }
@@ -115,7 +116,10 @@ class Picture : public MemoryObject {
class BigPicture : public Picture {
public:
BigPicture() {}
+ virtual ~BigPicture() {}
+
virtual bool load(MfcArchive &file);
+ virtual void draw(int x, int y, int style, int angle);
};
class GameObject : public CObject {
@@ -155,7 +159,9 @@ class PictureObject : public GameObject {
public:
PictureObject();
+
PictureObject(PictureObject *src);
+ virtual ~PictureObject();
virtual bool load(MfcArchive &file, bool bigPicture);
virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class
@@ -167,6 +173,7 @@ class PictureObject : public GameObject {
bool setPicAniInfo(PicAniInfo *picAniInfo);
bool isPointInside(int x, int y);
bool isPixelHitAtPos(int x, int y);
+ void setOXY2();
};
class Background : public CObject {
@@ -184,6 +191,8 @@ class Background : public CObject {
public:
Background();
+ virtual ~Background();
+
virtual bool load(MfcArchive &file);
void addPictureObject(PictureObject *pct);
diff --git a/engines/fullpipe/init.cpp b/engines/fullpipe/init.cpp
index 49bf72ac91..8de37b5c9e 100644
--- a/engines/fullpipe/init.cpp
+++ b/engines/fullpipe/init.cpp
@@ -45,27 +45,27 @@ void FullpipeEngine::initObjectStates() {
setSwallowedEggsState();
setObjectState(sO_WeirdWacko, getObjectEnumState(sO_WeirdWacko, sO_InGlasses));
- setObjectState(sO_TumyTrampie, getObjectEnumState(sO_TumyTrampie, sO_Drinking));
+ setObjectState(sO_TummyTrampie, getObjectEnumState(sO_TummyTrampie, sO_IsDrinking));
setObjectState(sO_StairsUp_8, getObjectEnumState(sO_StairsUp_8, sO_NotBroken));
setObjectState(sO_HareTheNooksiter, getObjectEnumState(sO_HareTheNooksiter, sO_WithHandle));
setObjectState(sO_Elephantine, getObjectEnumState(sO_Elephantine, sO_WithBoot));
setObjectState(sO_Fly_12, 0);
- setObjectState(sO_ClockAxis, getObjectEnumState(sO_ClockAxis, sO_NotAvailable));
+ setObjectState(sO_ClockAxis, getObjectEnumState(sO_ClockAxis, sO_IsNotAvailable));
setObjectState(sO_ClockHandle, getObjectEnumState(sO_ClockHandle, sO_In_7));
- setObjectState(sO_BigMumsy, getObjectEnumState(sO_BigMumsy, sO_Sleeping));
+ setObjectState(sO_BigMumsy, getObjectEnumState(sO_BigMumsy, sO_IsSleeping));
setObjectState(sO_CoinSlot_1, getObjectEnumState(sO_CoinSlot_1, sO_Empty));
setObjectState(sO_FriesPit, getObjectEnumState(sO_FriesPit, sO_WithApple));
setObjectState(sO_Jug, getObjectEnumState(sO_Jug, sO_Blocked));
setObjectState(sO_RightStairs_9, getObjectEnumState(sO_RightStairs_9, sO_IsClosed));
setObjectState(sO_Pipe_9, getObjectEnumState(sO_Pipe_9, sO_WithJug));
setObjectState(sO_Inflater, getObjectEnumState(sO_Inflater, sO_WithGum));
- setObjectState(sO_Swingie, getObjectEnumState(sO_Swingie, sO_Swinging));
- setObjectState(sO_DudeJumped, getObjectEnumState(sO_DudeJumped, sO_No));
+ setObjectState(sO_Swingie, getObjectEnumState(sO_Swingie, sO_IsSwinging));
+ setObjectState(sO_DudeHasJumped, getObjectEnumState(sO_DudeHasJumped, sO_No));
setObjectState(sO_Bridge, getObjectEnumState(sO_Bridge, sO_Convoluted));
setObjectState(sO_Guardian, getObjectEnumState(sO_Guardian, sO_OnRight));
setObjectState(sO_Grandma, getObjectEnumState(sO_Grandma, sO_In_14));
setObjectState(sO_Boot_15, getObjectEnumState(sO_Boot_15, sO_NotPresent));
- setObjectState(sO_LeftPipe_15, getObjectEnumState(sO_LeftPipe_15, sO_OpenedShe));
+ setObjectState(sO_LeftPipe_15, getObjectEnumState(sO_LeftPipe_15, sO_IsOpened));
setObjectState(sO_Pedestal_16, getObjectEnumState(sO_Pedestal_16, sO_IsFree));
setObjectState(sO_Cup, getObjectEnumState(sO_Cup, sO_InSmokeRoom));
setObjectState(sO_Pedestal_17, getObjectEnumState(sO_Pedestal_17, sO_IsFree));
@@ -73,7 +73,7 @@ void FullpipeEngine::initObjectStates() {
setObjectState(sO_RightPipe_17, getObjectEnumState(sO_RightPipe_17, sO_IsClosed));
setObjectState(sO_Fly_17, 1);
setObjectState(sO_DudeSwinged, 0);
- setObjectState(sO_Girl, getObjectEnumState(sO_Girl, sO_Swinging));
+ setObjectState(sO_Girl, getObjectEnumState(sO_Girl, sO_IsSwinging));
setObjectState(sO_Sugar, getObjectEnumState(sO_Sugar, sO_Present));
setObjectState(sO_Janitors, getObjectEnumState(sO_Janitors, sO_Together));
setObjectState(sO_Bag_22, getObjectEnumState(sO_Bag_22, sO_NotFallen));
@@ -84,7 +84,7 @@ void FullpipeEngine::initObjectStates() {
setObjectState(sO_Lever_23, getObjectEnumState(sO_Lever_23, sO_NotTaken));
setObjectState(sO_LeverHandle_23, getObjectEnumState(sO_LeverHandle_23, sO_WithoutStool));
setObjectState(sO_LowerPipe_21, getObjectEnumState(sO_LowerPipe_21, sO_IsClosed));
- setObjectState(sO_StarsDown_24, getObjectEnumState(sO_StarsDown_24, sO_OpenedShe));
+ setObjectState(sO_StairsDown_24, getObjectEnumState(sO_StairsDown_24, sO_IsOpened));
setObjectState(sO_Hatch_26, getObjectEnumState(sO_Hatch_26, sO_Closed));
setObjectState(sO_Sock_26, getObjectEnumState(sO_Sock_26, sO_NotHanging));
setObjectState(sO_LeftPipe_26, getObjectEnumState(sO_LeftPipe_26, sO_IsClosed));
@@ -94,7 +94,7 @@ void FullpipeEngine::initObjectStates() {
setObjectState(sO_Valve4_26, getObjectEnumState(sO_Valve4_26, sO_Closed));
setObjectState(sO_Valve5_26, getObjectEnumState(sO_Valve5_26, sO_Opened));
setObjectState(sO_Pool, getObjectEnumState(sO_Pool, sO_Overfull));
- setObjectState(sO_Plank_25, getObjectEnumState(sO_Plank_25, sO_NearDudesStairs));
+ 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_LeftPipe_29, getObjectEnumState(sO_LeftPipe_29, sO_IsClosed));
@@ -116,7 +116,7 @@ void FullpipeEngine::initObjectStates() {
setObjectState(sO_BellyInflater, getObjectEnumState(sO_BellyInflater, sO_WithCork));
setObjectState(sO_Jawcrucnher, getObjectEnumState(sO_Jawcrucnher, sO_WithoutCarpet));
setObjectState(sO_Guard_1, getObjectEnumState(sO_Guard_1, sO_On));
- setObjectState(sO_Gurad_2, getObjectEnumState(sO_Gurad_2, sO_On));
+ setObjectState(sO_Guard_2, getObjectEnumState(sO_Guard_2, sO_On));
setObjectState(sO_Guard_3, getObjectEnumState(sO_Guard_3, sO_On));
setObjectState(sO_Bottle_38, getObjectEnumState(sO_Bottle_38, sO_OnTheTable));
setObjectState(sO_Boss, getObjectEnumState(sO_Boss, sO_WithHammer));
diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp
index e98920c78a..5294c4b4ea 100644
--- a/engines/fullpipe/input.cpp
+++ b/engines/fullpipe/input.cpp
@@ -34,7 +34,7 @@
namespace Fullpipe {
InputController::InputController() {
- g_fullpipe->_inputController = this;
+ g_fp->_inputController = this;
_flag = 0;
_cursorHandle = 0;
@@ -55,16 +55,16 @@ InputController::InputController() {
InputController::~InputController() {
removeMessageHandler(126, -1);
- g_fullpipe->_inputController = 0;
+ g_fp->_inputController = 0;
}
void InputController::setInputDisabled(bool state) {
_flag = state;
- g_fullpipe->_inputDisabled = state;
+ g_fp->_inputDisabled = state;
}
void setInputDisabled(bool state) {
- g_fullpipe->_inputController->setInputDisabled(state);
+ g_fp->_inputController->setInputDisabled(state);
}
void InputController::addCursor(CursorInfo *cursor) {
@@ -93,8 +93,8 @@ void InputController::drawCursor(int x, int y) {
if (_cursorIndex == -1)
return;
- _cursorBounds.left = g_fullpipe->_sceneRect.left + x - _cursorsArray[_cursorIndex]->hotspotX;
- _cursorBounds.top = g_fullpipe->_sceneRect.top + y - _cursorsArray[_cursorIndex]->hotspotY;
+ _cursorBounds.left = g_fp->_sceneRect.left + x - _cursorsArray[_cursorIndex]->hotspotX;
+ _cursorBounds.top = g_fp->_sceneRect.top + y - _cursorsArray[_cursorIndex]->hotspotY;
_cursorBounds.right = _cursorBounds.left + _cursorsArray[_cursorIndex]->width;
_cursorBounds.bottom = _cursorBounds.top + _cursorsArray[_cursorIndex]->height;
@@ -274,4 +274,70 @@ void FullpipeEngine::updateCursorCommon() {
_cursorId = PIC_CSR_DEFAULT;
}
+void FullpipeEngine::initArcadeKeys(const char *varname) {
+ GameVar *var = getGameLoaderGameVar()->getSubVarByName(varname)->getSubVarByName("KEYPOS");
+
+ if (!var)
+ return;
+
+ int cnt = var->getSubVarsCount();
+
+ for (int i = 0; i < cnt; i++) {
+ Common::Point *point = new Common::Point;
+
+ GameVar *sub = var->getSubVarByIndex(i);
+
+ point->x = sub->getSubVarAsInt("X");
+ point->y = sub->getSubVarAsInt("Y");
+
+ _arcadeKeys.push_back(point);
+ }
+}
+
+void FullpipeEngine::setArcadeOverlay(int picId) {
+ Common::Point point;
+ Common::Point point2;
+
+ _arcadeOverlayX = 800;
+ _arcadeOverlayY = 545;
+
+ _arcadeOverlayHelper = accessScene(SC_INV)->getPictureObjectById(PIC_CSR_HELPERBGR, 0);
+ _arcadeOverlay = accessScene(SC_INV)->getPictureObjectById(picId, 0);
+
+ _arcadeOverlay->getDimensions(&point);
+ _arcadeOverlayHelper->getDimensions(&point2);
+
+ _arcadeOverlayMidX = (point2.x - point.x) / 2;
+ _arcadeOverlayMidY = abs(point2.y - point.y) / 2;
+}
+
+int FullpipeEngine::drawArcadeOverlay(int adjust) {
+ _arcadeOverlayHelper->drawAt(_sceneRect.left + _arcadeOverlayX, _sceneRect.top + _arcadeOverlayY);
+ _arcadeOverlay->drawAt(_sceneRect.left + _arcadeOverlayX + _arcadeOverlayMidX, _sceneRect.top + _arcadeOverlayY + _arcadeOverlayMidY);
+
+ if (adjust) {
+ if (_arcadeOverlayX > 745) {
+ _arcadeOverlayX -= 15;
+
+ if (_arcadeOverlayX < 745)
+ _arcadeOverlayX = 745;
+ }
+
+ return 1;
+ }
+
+ if (_arcadeOverlayX >= 800) {
+ return 0;
+ } else {
+ _arcadeOverlayX += 15;
+
+ if (_arcadeOverlayX <= 800)
+ return 1;
+
+ _arcadeOverlayX = 800;
+ }
+
+ return 1;
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp
index b513d2b8ee..59b01a1777 100644
--- a/engines/fullpipe/interaction.cpp
+++ b/engines/fullpipe/interaction.cpp
@@ -36,8 +36,8 @@ int handleObjectInteraction(StaticANIObject *subject, GameObject *object, int in
bool canInteractAny(GameObject *obj1, GameObject *obj2, int invId) {
int sceneId = 0;
- if (g_fullpipe->_currentScene)
- sceneId = g_fullpipe->_currentScene->_sceneId;
+ if (g_fp->_currentScene)
+ sceneId = g_fp->_currentScene->_sceneId;
InteractionController *intC = getGameLoaderInteractionController();
for (ObList::iterator i = intC->_interactions.begin(); i != intC->_interactions.end(); ++i) {
@@ -55,6 +55,10 @@ bool canInteractAny(GameObject *obj1, GameObject *obj2, int invId) {
return false;
}
+InteractionController::~InteractionController() {
+ warning("STUB: InteractionController::~InteractionController()");
+}
+
bool InteractionController::load(MfcArchive &file) {
debug(5, "InteractionController::load()");
@@ -137,7 +141,7 @@ bool InteractionController::handleInteraction(StaticANIObject *subj, GameObject
obj->setPicAniInfo(&aniInfo);
if (abs(xpos - subj->_ox) > 1 || abs(ypos - subj->_oy) > 1) {
- mq = getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->doWalkTo(subj, xpos, ypos, 1, cinter->_staticsId2);
+ mq = getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->doWalkTo(subj, xpos, ypos, 1, cinter->_staticsId2);
if (mq) {
dur = mq->calcDuration(subj);
delete mq;
@@ -186,7 +190,7 @@ bool InteractionController::handleInteraction(StaticANIObject *subj, GameObject
ex->_excFlags = 3;
ex->_field_14 = (obj->_objtype != kObjTypePictureObject);
ex->_field_20 = invId;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
if (mq->_isFinished) {
mq->_isFinished = 0;
@@ -255,7 +259,7 @@ LABEL_38:
ex->_field_14 = 0x100;
ex->_messageNum = 0;
ex->_excFlags = 3;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
}
ex = new ExCommand(obj->_id, 34, 0x100, 0, 0, 0, 1, 0, 0, 0);
@@ -263,19 +267,19 @@ LABEL_38:
ex->_field_14 = 0x100;
ex->_messageNum = 0;
ex->_excFlags = 3;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
ex = new ExCommand(subj->_id, 34, 0x100, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = subj->_okeyCode;
ex->_field_14 = 0x100;
ex->_messageNum = 0;
ex->_excFlags = 3;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
ex = new ExCommand(subj->_id, 17, 0x40, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags |= 3;
ex->_keyCode = 0;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
if (!mq->chain(subj)) {
delete mq;
@@ -305,7 +309,7 @@ LABEL_38:
if (abs(xpos - subj->_ox) > 1 || abs(ypos - subj->_oy) > 1
|| (inter->_staticsId2 != 0 && (subj->_statics == 0 || subj->_statics->_staticsId != inter->_staticsId2))) {
- mq = getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->method34(subj, xpos, ypos, 1, inter->_staticsId2);
+ mq = getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->method34(subj, xpos, ypos, 1, inter->_staticsId2);
if (!mq)
return false;
@@ -317,7 +321,7 @@ LABEL_38:
ex->_excFlags = 3;
ex->_field_20 = invId;
ex->_field_14 = (obj->_objtype != kObjTypePictureObject);
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
someFlag = true;
@@ -357,14 +361,14 @@ LABEL_38:
ex->_field_14 = 0x80;
ex->_keyCode = ani->_okeyCode;
ex->_excFlags = 3;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
}
}
ex = new ExCommand(ani->_id, 34, 0x100, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = ani->_okeyCode;
ex->_field_14 = 0x100;
ex->_excFlags = 3;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
} else {
ex = new ExCommand(subj->_id, 55, 0, 0, 0, 0, 1, 0, 0, 0);
ex->_x = ani->_id;
@@ -373,7 +377,7 @@ LABEL_38:
ex->_excFlags = 2;
ex->_field_14 = (obj->_objtype != kObjTypePictureObject);
ex->_field_20 = invId;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
if (!mq->_isFinished)
return true;
@@ -422,6 +426,10 @@ Interaction::Interaction() {
_actionName = 0;
}
+Interaction::~Interaction() {
+ warning("STUB: Interaction::~Interaction()");
+}
+
bool Interaction::load(MfcArchive &file) {
debug(5, "Interaction::load()");
@@ -444,7 +452,7 @@ bool Interaction::load(MfcArchive &file) {
}
bool Interaction::canInteract(GameObject *obj1, GameObject *obj2, int invId) {
- if (_sceneId > 0 && g_fullpipe->_currentScene && g_fullpipe->_currentScene->_sceneId != _sceneId)
+ if (_sceneId > 0 && g_fp->_currentScene && g_fp->_currentScene->_sceneId != _sceneId)
return false;
if (_flags & 0x20000)
@@ -476,20 +484,20 @@ bool Interaction::canInteract(GameObject *obj1, GameObject *obj2, int invId) {
if (_objectState1) {
if (_flags & 0x10) {
- if ((g_fullpipe->getObjectState(obj1->getName()) & _objectState1) == 0)
+ if ((g_fp->getObjectState(obj1->getName()) & _objectState1) == 0)
return false;
} else {
- if (g_fullpipe->getObjectState(obj1->getName()) != _objectState1)
+ if (g_fp->getObjectState(obj1->getName()) != _objectState1)
return false;
}
}
if (_objectState2) {
if (_flags & 0x10) {
- if ((g_fullpipe->getObjectState(obj2->getName()) & _objectState2) == 0)
+ if ((g_fp->getObjectState(obj2->getName()) & _objectState2) == 0)
return false;
} else {
- if (g_fullpipe->getObjectState(obj2->getName()) != _objectState2)
+ if (g_fp->getObjectState(obj2->getName()) != _objectState2)
return false;
}
}
diff --git a/engines/fullpipe/interaction.h b/engines/fullpipe/interaction.h
index 456b35458b..7d9ee0bd51 100644
--- a/engines/fullpipe/interaction.h
+++ b/engines/fullpipe/interaction.h
@@ -54,6 +54,8 @@ class Interaction : public CObject {
public:
Interaction();
+ virtual ~Interaction();
+
virtual bool load(MfcArchive &file);
bool canInteract(GameObject *obj1, GameObject *obj2, int invId);
bool isOverlapping(StaticANIObject *subj, GameObject *obj);
@@ -70,6 +72,7 @@ class InteractionController : public CObject {
public:
InteractionController() : _field_20(0), _flag24(true) {}
+ virtual ~InteractionController();
virtual bool load(MfcArchive &file);
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index 18ef3c4d97..f5af0611cb 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -30,6 +30,10 @@
namespace Fullpipe {
+Inventory::~Inventory() {
+ warning("STUB: Inventory::~Inventory()");
+}
+
bool Inventory::load(MfcArchive &file) {
debug(5, "Inventory::load()");
@@ -85,6 +89,10 @@ Inventory2::Inventory2() {
_topOffset = -65;
}
+Inventory2::~Inventory2() {
+ warning("STUB: Inventory2::~Inventory2()");
+}
+
bool Inventory2::loadPartial(MfcArchive &file) { // Inventory2_SerializePartially
int numInvs = file.readUint32LE();
@@ -161,7 +169,7 @@ int Inventory2::getItemFlags(int itemId) {
}
void Inventory2::rebuildItemRects() {
- _scene = g_fullpipe->accessScene(_sceneId);
+ _scene = g_fp->accessScene(_sceneId);
if (!_scene)
return;
@@ -226,11 +234,11 @@ void Inventory2::draw() {
if (!_scene)
return;
- int oldScLeft = g_fullpipe->_sceneRect.left;
- int oldScTop = g_fullpipe->_sceneRect.top;
+ int oldScLeft = g_fp->_sceneRect.left;
+ int oldScTop = g_fp->_sceneRect.top;
- g_fullpipe->_sceneRect.top = -_topOffset;
- g_fullpipe->_sceneRect.left = 0;
+ g_fp->_sceneRect.top = -_topOffset;
+ g_fp->_sceneRect.left = 0;
_picture->draw(-1, -1, 0, 0);
@@ -290,8 +298,8 @@ LABEL_25:
reset:
- g_fullpipe->_sceneRect.top = oldScTop;
- g_fullpipe->_sceneRect.left = oldScLeft;
+ g_fp->_sceneRect.top = oldScTop;
+ g_fp->_sceneRect.left = oldScLeft;
}
@@ -365,7 +373,7 @@ int Inventory2::selectItem(int itemId) {
int idx = getInventoryPoolItemIndexById(itemId);
Picture *pic = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectId1, 0)->_picture;
- g_fullpipe->getGameLoaderInputController()->setCursorItemPicture(pic);
+ g_fp->getGameLoaderInputController()->setCursorItemPicture(pic);
}
return _selectedId;
@@ -382,7 +390,7 @@ bool Inventory2::unselectItem(bool flag) {
_inventoryIcons[i]->isSelected = false;
}
- g_fullpipe->getGameLoaderInputController()->setCursorItemPicture(0);
+ g_fp->getGameLoaderInputController()->setCursorItemPicture(0);
return true;
}
diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h
index 6d07f069bd..bc5847312b 100644
--- a/engines/fullpipe/inventory.h
+++ b/engines/fullpipe/inventory.h
@@ -49,6 +49,8 @@ class Inventory : public CObject {
public:
Inventory() { _sceneId = 0; }
+ virtual ~Inventory();
+
virtual bool load(MfcArchive &file);
int getInventoryPoolItemIndexById(int itemId);
@@ -96,6 +98,8 @@ class Inventory2 : public Inventory {
public:
Inventory2();
+ virtual ~Inventory2();
+
bool loadPartial(MfcArchive &file);
void addItem(int itemId, int count);
void addItem2(StaticANIObject *obj);
diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp
index 1d6d986977..e5c566ebcf 100644
--- a/engines/fullpipe/lift.cpp
+++ b/engines/fullpipe/lift.cpp
@@ -67,7 +67,7 @@ int FullpipeEngine::lift_getButtonIdP(int objid) {
}
void FullpipeEngine::lift_setButton(const char *name, int state) {
- GameVar *var = g_fullpipe->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName(sO_LiftButtons);
+ GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName(sO_LiftButtons);
if (var)
var->setSubVarAsInt(name, state);
@@ -105,4 +105,15 @@ void FullpipeEngine::lift_sub05(ExCommand *ex) {
warning("STUB: FullpipeEngine::lift_sub05()");
}
+bool FullpipeEngine::lift_checkButton(const char *varname) {
+ warning("STUB: FullpipeEngine::lift_checkButton(%s)", varname);
+
+ return false;
+}
+
+void FullpipeEngine::lift_sub7(Scene *sc, int buttonId) {
+ warning("STUB: lift_sub7()");
+}
+
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp
index fc57109f07..44a3e4cb60 100644
--- a/engines/fullpipe/messagehandlers.cpp
+++ b/engines/fullpipe/messagehandlers.cpp
@@ -42,7 +42,7 @@ void global_messageHandler_KickMetal() {
}
int global_messageHandler1(ExCommand *cmd) {
- debug(0, "global_messageHandler1: %d %d", cmd->_messageKind, cmd->_messageNum);
+ debug(5, "global_messageHandler1: %d %d", cmd->_messageKind, cmd->_messageNum);
if (cmd->_excFlags & 0x10000) {
if (cmd->_messageNum == MV_MAN_TOLADDER)
@@ -55,7 +55,7 @@ int global_messageHandler1(ExCommand *cmd) {
cmd->_messageNum = MV_MAN_STOPLADDER2;
}
- if (g_fullpipe->_inputDisabled) {
+ if (g_fp->_inputDisabled) {
if (cmd->_messageKind == 17) {
switch (cmd->_messageNum) {
case 29:
@@ -71,25 +71,25 @@ int global_messageHandler1(ExCommand *cmd) {
} else if (cmd->_messageKind == 17) {
switch (cmd->_messageNum) {
case MSG_MANSHADOWSON:
- g_fullpipe->_aniMan->_shadowsOn = 1;
+ g_fp->_aniMan->_shadowsOn = 1;
break;
case MSG_HMRKICK_STUCCO:
global_messageHandler_KickStucco();
break;
case MSG_MANSHADOWSOFF:
- g_fullpipe->_aniMan->_shadowsOn = 0;
+ g_fp->_aniMan->_shadowsOn = 0;
break;
case MSG_DISABLESAVES:
- g_fullpipe->disableSaves(cmd);
+ g_fp->disableSaves(cmd);
break;
case MSG_ENABLESAVES:
- g_fullpipe->enableSaves();
+ g_fp->enableSaves();
break;
case MSG_HMRKICK_METAL:
global_messageHandler_KickMetal();
break;
case 29: // left mouse
- if (g_fullpipe->_inventoryScene) {
+ if (g_fp->_inventoryScene) {
if (getGameLoaderInventory()->handleLeftClick(cmd))
cmd->_messageKind = 0;
}
@@ -101,22 +101,22 @@ int global_messageHandler1(ExCommand *cmd) {
}
break;
case 36: // keydown
- g_fullpipe->defHandleKeyDown(cmd->_keyCode);
+ g_fp->defHandleKeyDown(cmd->_keyCode);
switch (cmd->_keyCode) {
case '\x1B': // ESC
- if (g_fullpipe->_currentScene) {
+ if (g_fp->_currentScene) {
getGameLoaderInventory()->unselectItem(0);
- g_fullpipe->openMainMenu();
+ g_fp->openMainMenu();
cmd->_messageKind = 0;
}
break;
case 't':
- g_fullpipe->stopAllSounds();
+ g_fp->stopAllSounds();
cmd->_messageKind = 0;
break;
case 'u':
- g_fullpipe->toggleMute();
+ g_fp->toggleMute();
cmd->_messageKind = 0;
break;
case ' ':
@@ -130,13 +130,13 @@ int global_messageHandler1(ExCommand *cmd) {
}
break;
case '\t':
- if (g_fullpipe->_flgCanOpenMap)
- g_fullpipe->openMap();
+ if (g_fp->_flgCanOpenMap)
+ g_fp->openMap();
cmd->_messageKind = 0;
break;
case 'p':
- if (g_fullpipe->_flgCanOpenMap)
- g_fullpipe->openHelp();
+ if (g_fp->_flgCanOpenMap)
+ g_fp->openHelp();
cmd->_messageKind = 0;
break;
default:
@@ -144,47 +144,47 @@ int global_messageHandler1(ExCommand *cmd) {
}
break;
case 33:
- if (!g_fullpipe->_inventoryScene)
+ if (!g_fp->_inventoryScene)
break;
int invItem;
- if (g_fullpipe->_updateFlag && (invItem = g_fullpipe->_inventory->getHoveredItem(&g_fullpipe->_mouseScreenPos))) {
- g_fullpipe->_cursorId = PIC_CSR_ITN;
- if (!g_fullpipe->_currSelectedInventoryItemId && !g_fullpipe->_aniMan->_movement &&
- !(g_fullpipe->_aniMan->_flags & 0x100) && g_fullpipe->_aniMan->isIdle()) {
- int st = g_fullpipe->_aniMan->_statics->_staticsId;
+ 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 &&
+ !(g_fp->_aniMan->_flags & 0x100) && g_fp->_aniMan->isIdle()) {
+ int st = g_fp->_aniMan->_statics->_staticsId;
ExCommand *newex = 0;
if (st == ST_MAN_RIGHT) {
- newex = new ExCommand(g_fullpipe->_aniMan->_id, 1, rMV_MAN_LOOKUP, 0, 0, 0, 1, 0, 0, 0);
+ newex = new ExCommand(g_fp->_aniMan->_id, 1, rMV_MAN_LOOKUP, 0, 0, 0, 1, 0, 0, 0);
} else if (st == (0x4000 | ST_MAN_RIGHT)) {
- newex = new ExCommand(g_fullpipe->_aniMan->_id, 1, MV_MAN_LOOKUP, 0, 0, 0, 1, 0, 0, 0);
+ newex = new ExCommand(g_fp->_aniMan->_id, 1, MV_MAN_LOOKUP, 0, 0, 0, 1, 0, 0, 0);
}
if (newex) {
- newex->_keyCode = g_fullpipe->_aniMan->_okeyCode;
+ newex->_keyCode = g_fp->_aniMan->_okeyCode;
newex->_excFlags |= 3;
newex->postMessage();
}
}
- if (g_fullpipe->_currSelectedInventoryItemId != invItem)
- g_fullpipe->playSound(SND_CMN_070, 0);
+ if (g_fp->_currSelectedInventoryItemId != invItem)
+ g_fp->playSound(SND_CMN_070, 0);
- g_fullpipe->_currSelectedInventoryItemId = invItem;
- g_fullpipe->setCursor(g_fullpipe->_cursorId);
+ g_fp->_currSelectedInventoryItemId = invItem;
+ g_fp->setCursor(g_fp->_cursorId);
break;
}
- if (g_fullpipe->_updateCursorCallback)
- g_fullpipe->_updateCursorCallback();
+ if (g_fp->_updateCursorCallback)
+ g_fp->_updateCursorCallback();
- g_fullpipe->_currSelectedInventoryItemId = 0;
- g_fullpipe->setCursor(g_fullpipe->_cursorId);
+ g_fp->_currSelectedInventoryItemId = 0;
+ g_fp->setCursor(g_fp->_cursorId);
break;
case 65: // open map
- if (cmd->_field_2C == 11 && cmd->_field_14 == ANI_INV_MAP && g_fullpipe->_flgCanOpenMap)
- g_fullpipe->openMap();
+ if (cmd->_field_2C == 11 && cmd->_field_14 == ANI_INV_MAP && g_fp->_flgCanOpenMap)
+ g_fp->openMap();
break;
default:
break;
@@ -228,13 +228,13 @@ int global_messageHandler2(ExCommand *cmd) {
break;
case 28:
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (ani)
ani->_priority = cmd->_field_14;
break;
case 25:
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (ani) {
if (cmd->_field_14) {
ani->setFlags40(true);
@@ -247,7 +247,7 @@ int global_messageHandler2(ExCommand *cmd) {
break;
case 26:
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (ani) {
Movement *mov = ani->_movement;
if (mov)
@@ -258,7 +258,7 @@ int global_messageHandler2(ExCommand *cmd) {
default:
#if 0
// We never put anything into _defMsgArray
- while (::iterator it = g_fullpipe->_defMsgArray.begin(); it != g_fullpipe->_defMsgArray.end(); ++it)
+ while (::iterator it = g_fp->_defMsgArray.begin(); it != g_fp->_defMsgArray.end(); ++it)
if (((ExCommand *)*it)->_field_24 == _messageNum) {
((ExCommand *)*it)->firef34(v13);
res = 1;
@@ -267,11 +267,11 @@ int global_messageHandler2(ExCommand *cmd) {
//debug_msg(_messageNum);
- if (!g_fullpipe->_soundEnabled || cmd->_messageNum != 33 || g_fullpipe->_currSoundListCount <= 0)
+ if (!g_fp->_soundEnabled || cmd->_messageNum != 33 || g_fp->_currSoundListCount <= 0)
return res;
- for (int snd = 0; snd < g_fullpipe->_currSoundListCount; snd++) {
- SoundList *s = g_fullpipe->_currSoundList1[snd];
+ for (int snd = 0; snd < g_fp->_currSoundListCount; snd++) {
+ SoundList *s = g_fp->_currSoundList1[snd];
int ms = s->getCount();
for (int i = 0; i < ms; i++) {
s->getSoundByIndex(i)->setPanAndVolumeByStaticAni();
@@ -292,7 +292,7 @@ int global_messageHandler3(ExCommand *cmd) {
case 31:
case 32:
case 36:
- if (g_fullpipe->_inputDisabled)
+ if (g_fp->_inputDisabled)
cmd->_messageKind = 0;
break;
default:
@@ -306,41 +306,42 @@ int global_messageHandler3(ExCommand *cmd) {
case 17:
switch (cmd->_messageNum) {
case 61:
- return g_fullpipe->_gameLoader->preloadScene(cmd->_parentId, cmd->_keyCode);
+ debug(0, "preload: { %d, %d },", cmd->_parentId, cmd->_keyCode);
+ return g_fp->_gameLoader->preloadScene(cmd->_parentId, cmd->_keyCode);
case 62:
- return g_fullpipe->_gameLoader->gotoScene(cmd->_parentId, cmd->_keyCode);
+ return g_fp->_gameLoader->gotoScene(cmd->_parentId, cmd->_keyCode);
case 64:
- if (g_fullpipe->_currentScene && g_fullpipe->_msgObjectId2
- && (!(cmd->_keyCode & 4) || g_fullpipe->_msgObjectId2 != cmd->_field_14 || g_fullpipe->_msgId != cmd->_field_20)) {
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(g_fullpipe->_msgObjectId2, g_fullpipe->_msgId);
+ if (g_fp->_currentScene && g_fp->_msgObjectId2
+ && (!(cmd->_keyCode & 4) || g_fp->_msgObjectId2 != cmd->_field_14 || g_fp->_msgId != cmd->_field_20)) {
+ ani = g_fp->_currentScene->getStaticANIObject1ById(g_fp->_msgObjectId2, g_fp->_msgId);
if (ani) {
ani->_flags &= 0xFF7F;
ani->_flags &= 0xFEFF;
ani->deleteFromGlobalMessageQueue();
}
}
- g_fullpipe->_msgX = 0;
- g_fullpipe->_msgY = 0;
- g_fullpipe->_msgObjectId2 = 0;
- g_fullpipe->_msgId = 0;
+ g_fp->_msgX = 0;
+ g_fp->_msgY = 0;
+ g_fp->_msgObjectId2 = 0;
+ g_fp->_msgId = 0;
if ((cmd->_keyCode & 1) || (cmd->_keyCode & 2)) {
- g_fullpipe->_msgX = cmd->_x;
- g_fullpipe->_msgY = cmd->_y;
+ g_fp->_msgX = cmd->_x;
+ g_fp->_msgY = cmd->_y;
}
if (cmd->_keyCode & 4) {
- g_fullpipe->_msgObjectId2 = cmd->_field_14;
- g_fullpipe->_msgId = cmd->_field_20;
+ g_fp->_msgObjectId2 = cmd->_field_14;
+ g_fp->_msgId = cmd->_field_20;
}
return result;
case 29:
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
return result;
- if (g_fullpipe->_gameLoader->_interactionController->_flag24) {
- ani = g_fullpipe->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
- ani2 = g_fullpipe->_currentScene->getStaticANIObject1ById(g_fullpipe->_gameLoader->_field_FA, -1);
+ if (g_fp->_gameLoader->_interactionController->_flag24) {
+ ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+ ani2 = g_fp->_currentScene->getStaticANIObject1ById(g_fp->_gameLoader->_field_FA, -1);
if (ani) {
- if (g_fullpipe->_msgObjectId2 == ani->_id && g_fullpipe->_msgId == ani->_okeyCode) {
+ if (g_fp->_msgObjectId2 == ani->_id && g_fp->_msgId == ani->_okeyCode) {
cmd->_messageKind = 0;
return result;
}
@@ -349,10 +350,10 @@ int global_messageHandler3(ExCommand *cmd) {
return 1;
}
} else {
- int id = g_fullpipe->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
- PictureObject *pic = g_fullpipe->_currentScene->getPictureObjectById(id, 0);
+ int id = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+ PictureObject *pic = g_fp->_currentScene->getPictureObjectById(id, 0);
if (pic) {
- if (g_fullpipe->_msgObjectId2 == pic->_id && g_fullpipe->_msgId == pic->_okeyCode) {
+ if (g_fp->_msgObjectId2 == pic->_id && g_fp->_msgId == pic->_okeyCode) {
cmd->_messageKind = 0;
return result;
}
@@ -364,13 +365,13 @@ int global_messageHandler3(ExCommand *cmd) {
}
}
}
- if (getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->_isEnabled && cmd->_keyCode <= 0) {
- if (g_fullpipe->_msgX != cmd->_sceneClickX || g_fullpipe->_msgY != cmd->_sceneClickY) {
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(g_fullpipe->_gameLoader->_field_FA, -1);
+ if (getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->_isEnabled && cmd->_keyCode <= 0) {
+ if (g_fp->_msgX != cmd->_sceneClickX || g_fp->_msgY != cmd->_sceneClickY) {
+ ani = g_fp->_currentScene->getStaticANIObject1ById(g_fp->_gameLoader->_field_FA, -1);
if (!ani || (ani->isIdle() && !(ani->_flags & 0x80) && !(ani->_flags & 0x100))) {
- result = startWalkTo(g_fullpipe->_gameLoader->_field_FA, -1, cmd->_sceneClickX, cmd->_sceneClickY, 0);
+ result = startWalkTo(g_fp->_gameLoader->_field_FA, -1, cmd->_sceneClickX, cmd->_sceneClickY, 0);
if (result) {
- ExCommand *ex = new ExCommand(g_fullpipe->_gameLoader->_field_FA, 17, 64, 0, 0, 0, 1, 0, 0, 0);
+ ExCommand *ex = new ExCommand(g_fp->_gameLoader->_field_FA, 17, 64, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = 1;
ex->_excFlags |= 3;
@@ -388,7 +389,7 @@ int global_messageHandler3(ExCommand *cmd) {
return result;
}
case 58:
- g_fullpipe->setCursor(cmd->_keyCode);
+ g_fp->setCursor(cmd->_keyCode);
return result;
case 59:
setInputDisabled(1);
@@ -398,7 +399,7 @@ int global_messageHandler3(ExCommand *cmd) {
return result;
case 56:
if (cmd->_field_2C) {
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (ani) {
getGameLoaderInventory()->addItem2(ani);
result = 1;
@@ -412,13 +413,13 @@ int global_messageHandler3(ExCommand *cmd) {
case 57:
if (cmd->_field_2C) {
if (!cmd->_field_20) {
- getGameLoaderInventory()->removeItem2(g_fullpipe->_currentScene, cmd->_parentId, cmd->_x, cmd->_y, cmd->_field_14);
+ getGameLoaderInventory()->removeItem2(g_fp->_currentScene, cmd->_parentId, cmd->_x, cmd->_y, cmd->_field_14);
getGameLoaderInventory()->rebuildItemRects();
return 1;
}
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(g_fullpipe->_gameLoader->_field_FA, -1);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(g_fp->_gameLoader->_field_FA, -1);
if (ani) {
- getGameLoaderInventory()->removeItem2(g_fullpipe->_currentScene, cmd->_parentId, ani->_ox + cmd->_x, ani->_oy + cmd->_y, ani->_priority + cmd->_field_14);
+ getGameLoaderInventory()->removeItem2(g_fp->_currentScene, cmd->_parentId, ani->_ox + cmd->_x, ani->_oy + cmd->_y, ani->_priority + cmd->_field_14);
getGameLoaderInventory()->rebuildItemRects();
return 1;
}
@@ -428,13 +429,13 @@ int global_messageHandler3(ExCommand *cmd) {
getGameLoaderInventory()->rebuildItemRects();
return 1;
case 55:
- if (g_fullpipe->_currentScene) {
+ if (g_fp->_currentScene) {
GameObject *obj;
if (cmd->_field_14)
- obj = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_x, cmd->_y);
+ obj = g_fp->_currentScene->getStaticANIObject1ById(cmd->_x, cmd->_y);
else
- obj = g_fullpipe->_currentScene->getPictureObjectById(cmd->_x, cmd->_y);
- handleObjectInteraction(g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode), obj, cmd->_field_20);
+ obj = g_fp->_currentScene->getPictureObjectById(cmd->_x, cmd->_y);
+ handleObjectInteraction(g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode), obj, cmd->_field_20);
result = 1;
}
return result;
@@ -448,7 +449,7 @@ int global_messageHandler3(ExCommand *cmd) {
if (cmd->_objtype == kObjTypeObjstateCommand) {
ObjstateCommand *c = (ObjstateCommand *)cmd;
result = 1;
- g_fullpipe->setObjectState(c->_objCommandName, c->_value);
+ g_fp->setObjectState(c->_objCommandName, c->_value);
}
return result;
default:
@@ -461,7 +462,7 @@ int global_messageHandler4(ExCommand *cmd) {
switch (cmd->_messageKind) {
case 18: {
- MessageQueue *mq = new MessageQueue(g_fullpipe->_currentScene->getMessageQueueById(cmd->_messageNum), cmd->_parId, 0);
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(cmd->_messageNum), cmd->_parId, 0);
if (cmd->_excFlags & 1)
mq->_flag1 = 1;
@@ -472,10 +473,10 @@ int global_messageHandler4(ExCommand *cmd) {
break;
}
case 2:
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -483,10 +484,10 @@ int global_messageHandler4(ExCommand *cmd) {
break;
case 1: {
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -502,10 +503,10 @@ int global_messageHandler4(ExCommand *cmd) {
break;
}
case 8:
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -513,10 +514,10 @@ int global_messageHandler4(ExCommand *cmd) {
break;
case 20: {
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -534,10 +535,10 @@ int global_messageHandler4(ExCommand *cmd) {
break;
}
case 21:
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -548,17 +549,17 @@ int global_messageHandler4(ExCommand *cmd) {
// Nop in original
break;
case 3:
- g_fullpipe->_currentScene->_y = cmd->_messageNum - cmd->_messageNum % g_fullpipe->_scrollSpeed;
+ g_fp->_currentScene->_y = cmd->_messageNum - cmd->_messageNum % g_fp->_scrollSpeed;
break;
case 4:
- g_fullpipe->_currentScene->_x = cmd->_messageNum - cmd->_messageNum % g_fullpipe->_scrollSpeed;
+ g_fp->_currentScene->_x = cmd->_messageNum - cmd->_messageNum % g_fp->_scrollSpeed;
break;
case 19: {
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -573,10 +574,10 @@ int global_messageHandler4(ExCommand *cmd) {
break;
}
case 22:
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -585,10 +586,10 @@ int global_messageHandler4(ExCommand *cmd) {
break;
case 6:
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -596,18 +597,18 @@ int global_messageHandler4(ExCommand *cmd) {
break;
case 27:
- if (!g_fullpipe->_currentScene || g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode) == 0) {
- ani = g_fullpipe->accessScene(cmd->_field_20)->getStaticANIObject1ById(cmd->_parentId, -1);
+ if (!g_fp->_currentScene || g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode) == 0) {
+ ani = g_fp->accessScene(cmd->_field_20)->getStaticANIObject1ById(cmd->_parentId, -1);
if (ani) {
ani = new StaticANIObject(ani);
- g_fullpipe->_currentScene->addStaticANIObject(ani, 1);
+ g_fp->_currentScene->addStaticANIObject(ani, 1);
}
}
// fall through
case 5:
- if (g_fullpipe->_currentScene)
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ if (g_fp->_currentScene)
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -619,10 +620,10 @@ int global_messageHandler4(ExCommand *cmd) {
break;
case 10:
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -633,34 +634,34 @@ int global_messageHandler4(ExCommand *cmd) {
break;
case 7: {
- if (!g_fullpipe->_currentScene->_picObjList.size())
+ if (!g_fp->_currentScene->_picObjList.size())
break;
- int offX = g_fullpipe->_scrollSpeed * (cmd->_x / g_fullpipe->_scrollSpeed);
- int offY = g_fullpipe->_scrollSpeed * (cmd->_y / g_fullpipe->_scrollSpeed);
+ int offX = g_fp->_scrollSpeed * (cmd->_x / g_fp->_scrollSpeed);
+ int offY = g_fp->_scrollSpeed * (cmd->_y / g_fp->_scrollSpeed);
if (cmd->_messageNum) {
- g_fullpipe->_currentScene->_x = offX - g_fullpipe->_sceneRect.left;
- g_fullpipe->_currentScene->_y = offY - g_fullpipe->_sceneRect.top;
+ g_fp->_currentScene->_x = offX - g_fp->_sceneRect.left;
+ g_fp->_currentScene->_y = offY - g_fp->_sceneRect.top;
if (cmd->_field_24) {
- g_fullpipe->_currentScene->_messageQueueId = cmd->_parId;
+ g_fp->_currentScene->_messageQueueId = cmd->_parId;
}
} else {
- g_fullpipe->_sceneRect.moveTo(offX, offY);
+ g_fp->_sceneRect.translate(offX - g_fp->_sceneRect.left, offY - g_fp->_sceneRect.top);
- g_fullpipe->_currentScene->_x = 0;
- g_fullpipe->_currentScene->_y = 0;
+ g_fp->_currentScene->_x = 0;
+ g_fp->_currentScene->_y = 0;
- g_fullpipe->_currentScene->updateScrolling2();
+ g_fp->_currentScene->updateScrolling2();
}
break;
}
case 34:
- if (!g_fullpipe->_currentScene)
+ if (!g_fp->_currentScene)
break;
- ani = g_fullpipe->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
if (!ani)
break;
@@ -690,15 +691,15 @@ int MovGraph_messageHandler(ExCommand *cmd) {
if (cmd->_messageNum != 33)
return 0;
- StaticANIObject *ani = g_fullpipe->_currentScene->getStaticANIObject1ById(g_fullpipe->_gameLoader->_field_FA, -1);
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(g_fp->_gameLoader->_field_FA, -1);
- if (!getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId))
+ if (!getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId))
return 0;
- if (getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->_objtype != kObjTypeMovGraph || !ani)
+ if (getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->_objtype != kObjTypeMovGraph || !ani)
return 0;
- MovGraph *gr = (MovGraph *)getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId);
+ MovGraph *gr = (MovGraph *)getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId);
MovGraphLink *link = 0;
double mindistance = 1.0e10;
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index 4abf2ef56f..7dfdd06fc8 100644
--- a/engines/fullpipe/messages.cpp
+++ b/engines/fullpipe/messages.cpp
@@ -41,7 +41,10 @@ ExCommand::ExCommand(ExCommand *src) : Message(src) {
_messageNum = src->_messageNum;
_excFlags = src->_excFlags;
_parId = src->_parId;
+}
+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) :
@@ -73,22 +76,24 @@ bool ExCommand::load(MfcArchive &file) {
_field_3C = 0;
- if (g_fullpipe->_gameProjectVersion >= 12) {
+ if (g_fp->_gameProjectVersion >= 12) {
_excFlags = file.readUint32LE();
_parId = file.readUint32LE();
}
+ _objtype = kObjTypeExCommand;
+
return true;
}
bool ExCommand::handleMessage() {
int cnt = 0;
- for (MessageHandler *m = g_fullpipe->_messageHandlers; m; m = m->nextItem)
+ for (MessageHandler *m = g_fp->_messageHandlers; m; m = m->nextItem)
cnt += m->callback(this);
if (_messageKind == 17 || (_excFlags & 1)) {
if (_parId) {
- MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(_parId);
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(_parId);
if (mq)
mq->update();
}
@@ -101,18 +106,18 @@ bool ExCommand::handleMessage() {
}
void ExCommand::sendMessage() {
- g_fullpipe->_exCommandList.push_back(this);
+ g_fp->_exCommandList.push_back(this);
processMessages();
}
void ExCommand::postMessage() {
- g_fullpipe->_exCommandList.push_back(this);
+ g_fp->_exCommandList.push_back(this);
}
void ExCommand::handle() {
- if (g_fullpipe->_modalObject) {
- g_fullpipe->_modalObject->handleMessage(this);
+ if (g_fp->_modalObject) {
+ g_fp->_modalObject->handleMessage(this);
delete this;
} else {
@@ -120,6 +125,61 @@ void ExCommand::handle() {
}
}
+void ExCommand::setf3c(int val) {
+ if (val != -1)
+ _field_3C = val;
+
+ _field_34 = 1;
+}
+
+void ExCommand::firef34() {
+ if (_field_34) {
+ if (_field_3C >= _keyCode) {
+ _field_34 = 0;
+
+ sendMessage();
+
+ if (!_field_30 )
+ setf3c(_field_2C);
+ }
+ }
+}
+
+ExCommand2::ExCommand2(int messageKind, int parentId, Common::Point **points, int pointsSize) : ExCommand(parentId, messageKind, 0, 0, 0, 0, 1, 0, 0, 0) {
+ _objtype = kObjTypeExCommand2;
+
+ _pointsSize = pointsSize;
+ _points = (Common::Point **)malloc(sizeof(Common::Point *) * pointsSize);
+
+ for (int i = 0; i < pointsSize; i++) {
+ _points[i] = new Common::Point;
+
+ *_points[i] = *points[i];
+ }
+}
+
+ExCommand2::ExCommand2(ExCommand2 *src) : ExCommand(src) {
+ _pointsSize = src->_pointsSize;
+ _points = (Common::Point **)malloc(sizeof(Common::Point *) * _pointsSize);
+
+ for (int i = 0; i < _pointsSize; i++) {
+ _points[i] = new Common::Point;
+
+ *_points[i] = *src->_points[i];
+ }
+}
+
+ExCommand2::~ExCommand2() {
+ for (int i = 0; i < _pointsSize; i++)
+ delete _points[i];
+
+ free(_points);
+}
+
+ExCommand2 *ExCommand2::createClone() {
+ return new ExCommand2(this);
+}
+
Message::Message() {
_messageKind = 0;
_parentId = 0;
@@ -174,12 +234,23 @@ ObjstateCommand::ObjstateCommand() {
_objCommandName = 0;
}
+ObjstateCommand::ObjstateCommand(ObjstateCommand *src) : ExCommand(src) {
+ _value = src->_value;
+ _objCommandName = (char *)calloc(strlen(src->_objCommandName) + 1, 1);
+
+ strncpy(_objCommandName, src->_objCommandName, strlen(src->_objCommandName));
+}
+
+ObjstateCommand::~ObjstateCommand() {
+ free(_objCommandName);
+}
+
bool ObjstateCommand::load(MfcArchive &file) {
debug(5, "ObjStateCommand::load()");
_objtype = kObjTypeObjstateCommand;
- _cmd.load(file);
+ ExCommand::load(file);
_value = file.readUint32LE();
@@ -188,6 +259,10 @@ bool ObjstateCommand::load(MfcArchive &file) {
return true;
}
+ObjstateCommand *ObjstateCommand::createClone() {
+ return new ObjstateCommand(this);
+}
+
MessageQueue::MessageQueue() {
_field_14 = 0;
_parId = 0;
@@ -205,7 +280,7 @@ MessageQueue::MessageQueue(int dataId) {
_field_14 = 0;
_parId = 0;
_dataId = dataId;
- _id = g_fullpipe->_globalMessageQueueList->compact();
+ _id = g_fp->_globalMessageQueueList->compact();
_isFinished = 0;
_flags = 0;
_queueName = 0;
@@ -219,7 +294,7 @@ MessageQueue::MessageQueue(MessageQueue *src, int parId, int field_38) {
_field_38 = (field_38 == 0);
for (Common::List<ExCommand *>::iterator it = src->_exCommands.begin(); it != src->_exCommands.end(); ++it) {
- ExCommand *ex = new ExCommand(*it);
+ ExCommand *ex = (*it)->createClone();
ex->_excFlags |= 2;
_exCommands.push_back(ex);
@@ -231,11 +306,12 @@ MessageQueue::MessageQueue(MessageQueue *src, int parId, int field_38) {
else
_parId = src->_parId;
- _id = g_fullpipe->_globalMessageQueueList->compact();
+ _id = g_fp->_globalMessageQueueList->compact();
_dataId = src->_dataId;
_flags = src->_flags;
+ _queueName = 0;
- g_fullpipe->_globalMessageQueueList->addMessageQueue(this);
+ g_fp->_globalMessageQueueList->addMessageQueue(this);
_isFinished = 0;
_flag1 = 0;
@@ -255,7 +331,7 @@ MessageQueue::~MessageQueue() {
delete _field_14;
if (_flags & 2) {
- g_fullpipe->_globalMessageQueueList->removeQueueById(_id);
+ g_fp->_globalMessageQueueList->removeQueueById(_id);
}
finish();
@@ -270,7 +346,7 @@ bool MessageQueue::load(MfcArchive &file) {
int count = file.readUint16LE();
- assert(g_fullpipe->_gameProjectVersion >= 12);
+ assert(g_fp->_gameProjectVersion >= 12);
_queueName = file.readPascalString();
@@ -291,7 +367,7 @@ bool MessageQueue::load(MfcArchive &file) {
bool MessageQueue::chain(StaticANIObject *ani) {
if (checkGlobalExCommandList1() && checkGlobalExCommandList2()) {
if (!(getFlags() & 2)) {
- g_fullpipe->_globalMessageQueueList->addMessageQueue(this);
+ g_fp->_globalMessageQueueList->addMessageQueue(this);
_flags |= 2;
}
if (ani) {
@@ -309,7 +385,7 @@ void MessageQueue::update() {
if (_counter > 0)
_counter--;
- if (_exCommands.size()) {
+ if (getCount()) {
sendNextCommand();
} else if (_counter == 0) {
_isFinished = 1;
@@ -326,8 +402,21 @@ void MessageQueue::addExCommand(ExCommand *ex) {
_exCommands.push_front(ex);
}
+void MessageQueue::addExCommandToEnd(ExCommand *ex) {
+ _exCommands.push_back(ex);
+}
+
+void MessageQueue::insertExCommandAt(int pos, ExCommand *ex) {
+ Common::List<ExCommand *>::iterator it = _exCommands.begin();
+
+ for (int i = pos; i > 0; i--)
+ ++it;
+
+ _exCommands.insert(it, ex);
+}
+
ExCommand *MessageQueue::getExCommandByIndex(uint idx) {
- if (idx > _exCommands.size())
+ if (idx >= getCount())
return 0;
Common::List<ExCommand *>::iterator it = _exCommands.begin();
@@ -341,7 +430,7 @@ ExCommand *MessageQueue::getExCommandByIndex(uint idx) {
}
void MessageQueue::deleteExCommandByIndex(uint idx, bool doFree) {
- if (idx > _exCommands.size())
+ if (idx >= getCount())
return;
Common::List<ExCommand *>::iterator it = _exCommands.begin();
@@ -351,10 +440,10 @@ void MessageQueue::deleteExCommandByIndex(uint idx, bool doFree) {
idx--;
}
- _exCommands.erase(it);
-
if (doFree)
delete *it;
+
+ _exCommands.erase(it);
}
void MessageQueue::transferExCommands(MessageQueue *mq) {
@@ -365,7 +454,7 @@ void MessageQueue::transferExCommands(MessageQueue *mq) {
}
void MessageQueue::sendNextCommand() {
- if (_exCommands.size()) {
+ if (getCount()) {
if (!(_flags & 4) && (_flags & 1)) {
messageQueueCallback1(16);
}
@@ -394,7 +483,7 @@ bool MessageQueue::checkGlobalExCommandList1() {
if (ex->_messageKind != 1 && ex->_messageKind != 20 && ex->_messageKind != 5 && ex->_messageKind != 27)
continue;
- for (Common::List<ExCommand *>::iterator it = g_fullpipe->_exCommandList.begin(); it != g_fullpipe->_exCommandList.end(); it++) {
+ for (Common::List<ExCommand *>::iterator it = g_fp->_exCommandList.begin(); it != g_fp->_exCommandList.end(); it++) {
ex1 = *it;
if (ex1->_messageKind != 1 && ex1->_messageKind != 20 && ex1->_messageKind != 5 && ex1->_messageKind != 27)
@@ -403,7 +492,7 @@ bool MessageQueue::checkGlobalExCommandList1() {
if (ex1->_keyCode != ex->_keyCode && ex1->_keyCode != -1 && ex->_keyCode != -1)
continue;
- MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex1->_parId);
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex1->_parId);
if (mq) {
if (mq->getFlags() & 1)
@@ -423,7 +512,7 @@ bool MessageQueue::checkGlobalExCommandList2() {
if (ex->_messageKind != 1 && ex->_messageKind != 20 && ex->_messageKind != 5 && ex->_messageKind != 27)
continue;
- for (Common::List<ExCommand *>::iterator it = g_fullpipe->_exCommandList.begin(); it != g_fullpipe->_exCommandList.end();) {
+ for (Common::List<ExCommand *>::iterator it = g_fp->_exCommandList.begin(); it != g_fp->_exCommandList.end();) {
ex1 = *it;
if (ex1->_messageKind != 1 && ex1->_messageKind != 20 && ex1->_messageKind != 5 && ex1->_messageKind != 27) {
@@ -436,7 +525,7 @@ bool MessageQueue::checkGlobalExCommandList2() {
continue;
}
- MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex1->_parId);
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex1->_parId);
if (mq) {
if (mq->getFlags() & 1)
@@ -445,7 +534,7 @@ bool MessageQueue::checkGlobalExCommandList2() {
delete mq;
}
- it = g_fullpipe->_exCommandList.erase(it);
+ it = g_fp->_exCommandList.erase(it);
if (ex1->_excFlags & 2) {
delete ex1;
@@ -459,7 +548,7 @@ void MessageQueue::finish() {
if (!_parId)
return;
- MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(_parId);
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(_parId);
_parId = 0;
@@ -492,7 +581,8 @@ int MessageQueue::calcDuration(StaticANIObject *obj) {
ExCommand *ex;
Movement *mov;
- for (uint i = 0; (ex = getExCommandByIndex(i)); i++)
+ for (uint i = 0; i < getCount(); i++) {
+ ex = getExCommandByIndex(i);
if (ex->_parentId == obj->_id) {
if (ex->_messageKind == 1 || ex->_messageKind == 20) {
if ((mov = obj->getMovementById(ex->_messageNum)) != 0) {
@@ -503,12 +593,13 @@ int MessageQueue::calcDuration(StaticANIObject *obj) {
}
}
}
+ }
return res;
}
void MessageQueue::changeParam28ForObjectId(int objId, int oldParam28, int newParam28) {
- for (uint i = 0; i < _exCommands.size(); i++) {
+ for (uint i = 0; i < getCount(); i++) {
ExCommand *ex = getExCommandByIndex(i);
int k = ex->_messageKind;
@@ -557,16 +648,32 @@ void GlobalMessageQueueList::disableQueueById(int id) {
}
int GlobalMessageQueueList::compact() {
+ int *useList = new int[size() + 2];
+
+ for (uint i = 0; i < size() + 2; i++)
+ useList[i] = 0;
+
for (uint i = 0; i < size();) {
if (((MessageQueue *)_storage[i])->_isFinished) {
disableQueueById(_storage[i]->_id);
remove_at(i);
} else {
+ if ((uint)_storage[i]->_id < size() + 2)
+ useList[_storage[i]->_id] = 1;
i++;
}
}
- return size() + 1;
+ uint i;
+
+ for (i = 1; i < size() + 2; i++) {
+ if (!useList[i])
+ break;
+ }
+
+ delete [] useList;
+
+ return i;
}
void GlobalMessageQueueList::addMessageQueue(MessageQueue *msg) {
@@ -576,12 +683,25 @@ void GlobalMessageQueueList::addMessageQueue(MessageQueue *msg) {
}
void clearGlobalMessageQueueList1() {
- warning("STUB: clearGlobalMessageQueueList1()");
+ clearMessages();
+
+ g_fp->_globalMessageQueueList->clear();
+}
+
+void clearMessages() {
+ while (g_fp->_exCommandList.size()) {
+ ExCommand *ex = g_fp->_exCommandList.front();
+
+ g_fp->_exCommandList.pop_front();
+
+ if (ex->_excFlags & 2)
+ delete ex;
+ }
}
bool removeMessageHandler(int16 id, int pos) {
- if (g_fullpipe->_messageHandlers) {
- MessageHandler *curItem = g_fullpipe->_messageHandlers;
+ if (g_fp->_messageHandlers) {
+ MessageHandler *curItem = g_fp->_messageHandlers;
MessageHandler *prevItem = 0;
int curPos = 0;
@@ -615,13 +735,13 @@ void addMessageHandler(int (*callback)(ExCommand *), int16 id) {
if (getMessageHandlerById(id))
return;
- MessageHandler *curItem = g_fullpipe->_messageHandlers;
+ MessageHandler *curItem = g_fp->_messageHandlers;
if (!curItem)
return;
int index = 0;
- for (MessageHandler *i = g_fullpipe->_messageHandlers->nextItem; i; i = i->nextItem) {
+ for (MessageHandler *i = g_fp->_messageHandlers->nextItem; i; i = i->nextItem) {
curItem = i;
index++;
}
@@ -633,7 +753,7 @@ void addMessageHandler(int (*callback)(ExCommand *), int16 id) {
}
MessageHandler *getMessageHandlerById(int16 id) {
- MessageHandler *curItem = g_fullpipe->_messageHandlers;
+ MessageHandler *curItem = g_fp->_messageHandlers;
if (!curItem)
return 0;
@@ -663,7 +783,7 @@ bool allocMessageHandler(MessageHandler *where, int16 id, int (*callback)(ExComm
msg->callback = callback;
msg->index = 0;
- g_fullpipe->_messageHandlers = msg;
+ g_fp->_messageHandlers = msg;
}
return true;
@@ -671,7 +791,7 @@ bool allocMessageHandler(MessageHandler *where, int16 id, int (*callback)(ExComm
int getMessageHandlersCount() {
int result;
- MessageHandler *curItem = g_fullpipe->_messageHandlers;
+ MessageHandler *curItem = g_fp->_messageHandlers;
for (result = 0; curItem; result++)
curItem = curItem->nextItem;
@@ -684,7 +804,7 @@ bool addMessageHandlerByIndex(int (*callback)(ExCommand *), int index, int16 id)
return false;
if (index) {
- MessageHandler *curItem = g_fullpipe->_messageHandlers;
+ MessageHandler *curItem = g_fp->_messageHandlers;
for (int i = index - 1; i > 0; i--)
if (curItem)
@@ -702,13 +822,13 @@ bool addMessageHandlerByIndex(int (*callback)(ExCommand *), int index, int16 id)
} else {
MessageHandler *newItem = new MessageHandler;
- newItem->nextItem = g_fullpipe->_messageHandlers;
+ newItem->nextItem = g_fp->_messageHandlers;
newItem->id = id;
newItem->callback = callback;
newItem->index = 0;
- updateMessageHandlerIndex(g_fullpipe->_messageHandlers, 1);
- g_fullpipe->_messageHandlers = newItem;
+ updateMessageHandlerIndex(g_fp->_messageHandlers, 1);
+ g_fp->_messageHandlers = newItem;
return true;
}
@@ -718,7 +838,7 @@ bool insertMessageHandler(int (*callback)(ExCommand *), int index, int16 id) {
if (getMessageHandlerById(id))
return false;
- MessageHandler *curItem = g_fullpipe->_messageHandlers;
+ MessageHandler *curItem = g_fp->_messageHandlers;
for (int i = index; i > 0; i--)
if (curItem)
@@ -735,7 +855,7 @@ void clearMessageHandlers() {
MessageHandler *curItem;
MessageHandler *nextItem;
- curItem = g_fullpipe->_messageHandlers;
+ curItem = g_fp->_messageHandlers;
if (curItem) {
do {
nextItem = curItem->nextItem;
@@ -745,32 +865,51 @@ void clearMessageHandlers() {
curItem = nextItem;
} while (nextItem);
- g_fullpipe->_messageHandlers = 0;
+ g_fp->_messageHandlers = 0;
}
}
void processMessages() {
- if (!g_fullpipe->_isProcessingMessages) {
- g_fullpipe->_isProcessingMessages = true;
+ if (!g_fp->_isProcessingMessages) {
+ g_fp->_isProcessingMessages = true;
- while (g_fullpipe->_exCommandList.size()) {
- ExCommand *ex = g_fullpipe->_exCommandList.front();
- g_fullpipe->_exCommandList.pop_front();
+ while (g_fp->_exCommandList.size()) {
+ ExCommand *ex = g_fp->_exCommandList.front();
+ g_fp->_exCommandList.pop_front();
ex->handleMessage();
}
- g_fullpipe->_isProcessingMessages = false;
+ g_fp->_isProcessingMessages = false;
}
}
void updateGlobalMessageQueue(int id, int objid) {
- MessageQueue *m = g_fullpipe->_globalMessageQueueList->getMessageQueueById(id);
+ MessageQueue *m = g_fp->_globalMessageQueueList->getMessageQueueById(id);
if (m) {
m->update();
}
}
bool chainQueue(int queueId, int flags) {
- MessageQueue *mq = g_fullpipe->_currentScene->getMessageQueueById(queueId);
+ MessageQueue *mq = g_fp->_currentScene->getMessageQueueById(queueId);
+
+ if (!mq)
+ return false;
+
+ MessageQueue *nmq = new MessageQueue(mq, 0, 0);
+
+ nmq->_flags |= flags;
+
+ if (!nmq->chain(0)) {
+ delete nmq;
+
+ return false;
+ }
+
+ return true;
+}
+
+bool chainObjQueue(StaticANIObject *obj, int queueId, int flags) {
+ MessageQueue *mq = g_fp->_currentScene->getMessageQueueById(queueId);
if (!mq)
return false;
@@ -779,8 +918,8 @@ bool chainQueue(int queueId, int flags) {
nmq->_flags |= flags;
- if (!mq->chain(0)) {
- delete mq;
+ if (!nmq->chain(obj)) {
+ delete nmq;
return false;
}
@@ -788,4 +927,17 @@ bool chainQueue(int queueId, int flags) {
return true;
}
+void postExCommand(int parentId, int keyCode, int x, int y, int f20, int f14) {
+ ExCommand *ex = new ExCommand(parentId, 17, 64, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_keyCode = keyCode;
+ ex->_excFlags |= 3;
+ ex->_x = x;
+ ex->_y = y;
+ ex->_field_20 = f20;
+ ex->_field_14 = f14;
+
+ ex->postMessage();
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h
index 326f05cef3..33bb827888 100644
--- a/engines/fullpipe/messages.h
+++ b/engines/fullpipe/messages.h
@@ -57,7 +57,6 @@ class Message : public CObject {
class ExCommand : public Message {
public:
-
int _messageNum;
int _field_3C;
int _excFlags;
@@ -70,27 +69,42 @@ class ExCommand : public Message {
virtual bool load(MfcArchive &file);
+ virtual ExCommand *createClone();
+
bool handleMessage();
void sendMessage();
void postMessage();
void handle();
+
+ void firef34();
+ void setf3c(int val);
};
class ExCommand2 : public ExCommand {
public:
Common::Point **_points;
int _pointsSize;
+
+ ExCommand2(int messageKind, int parentId, Common::Point **points, int pointsSize);
+ ExCommand2(ExCommand2 *src);
+ virtual ~ExCommand2();
+
+ virtual ExCommand2 *createClone();
};
-class ObjstateCommand : public CObject {
+class ObjstateCommand : public ExCommand {
public:
- ExCommand _cmd;
char *_objCommandName;
int _value;
public:
ObjstateCommand();
+ ObjstateCommand(ObjstateCommand *src);
+ virtual ~ObjstateCommand();
+
virtual bool load(MfcArchive &file);
+
+ virtual ObjstateCommand *createClone();
};
class MessageQueue : public CObject {
@@ -100,13 +114,15 @@ class MessageQueue : public CObject {
char *_queueName;
int16 _dataId;
CObject *_field_14;
- Common::List<ExCommand *> _exCommands;
int _counter;
int _field_38;
int _isFinished;
int _parId;
int _flag1;
+ private:
+ Common::List<ExCommand *> _exCommands;
+
public:
MessageQueue();
MessageQueue(int dataId);
@@ -121,6 +137,8 @@ class MessageQueue : public CObject {
uint getCount() { return _exCommands.size(); }
void addExCommand(ExCommand *ex);
+ void addExCommandToEnd(ExCommand *ex);
+ void insertExCommandAt(int pos, ExCommand *ex);
ExCommand *getExCommandByIndex(uint idx);
void deleteExCommandByIndex(uint idx, bool doFree);
@@ -172,9 +190,12 @@ bool insertMessageHandler(int (*callback)(ExCommand *), int index, int16 id);
void clearMessageHandlers();
void processMessages();
void updateGlobalMessageQueue(int id, int objid);
+void clearMessages();
void clearGlobalMessageQueueList1();
bool chainQueue(int queueId, int flags);
+bool chainObjQueue(StaticANIObject *obj, int queueId, int flags);
+void postExCommand(int parentId, int keyCode, int x, int y, int f20, int f16);
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index f766be3eac..ddb5b63d6a 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -24,9 +24,15 @@
#include "fullpipe/modal.h"
#include "fullpipe/messages.h"
#include "fullpipe/constants.h"
+#include "fullpipe/motion.h"
#include "fullpipe/scenes.h"
#include "fullpipe/gameloader.h"
+#include "fullpipe/constants.h"
+
+#include "graphics/palette.h"
+#include "video/avi_decoder.h"
+
namespace Fullpipe {
ModalIntro::ModalIntro() {
@@ -40,17 +46,17 @@ ModalIntro::ModalIntro() {
_introFlags = 33;
_countDown = 150;
- PictureObject *pict = g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0);
+ PictureObject *pict = g_fp->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0);
pict->setFlags(pict->_flags & 0xFFFB);
}
g_vars->sceneIntro_skipIntro = false;
- _sfxVolume = g_fullpipe->_sfxVolume;
+ _sfxVolume = g_fp->_sfxVolume;
}
ModalIntro::~ModalIntro() {
- g_fullpipe->stopAllSounds();
- g_fullpipe->_sfxVolume = _sfxVolume;
+ g_fp->stopAllSounds();
+ g_fp->_sfxVolume = _sfxVolume;
}
bool ModalIntro::handleMessage(ExCommand *message) {
@@ -84,7 +90,7 @@ bool ModalIntro::init(int counterdiff) {
}
if (_introFlags & 0x10)
- g_fullpipe->_gameLoader->updateSystems(42);
+ g_fp->_gameLoader->updateSystems(42);
_introFlags |= 2;
@@ -94,7 +100,7 @@ bool ModalIntro::init(int counterdiff) {
if (_introFlags & 4) {
ModalVideoPlayer *player = new ModalVideoPlayer();
- g_fullpipe->_modalObject = player;
+ g_fp->_modalObject = player;
player->_parentObj = this;
player->play("intro.avi");
@@ -118,7 +124,7 @@ bool ModalIntro::init(int counterdiff) {
if (_introFlags & 0x40) {
ModalVideoPlayer *player = new ModalVideoPlayer();
- g_fullpipe->_modalObject = player;
+ g_fp->_modalObject = player;
player->_parentObj = this;
player->play("intro2.avi");
@@ -151,7 +157,7 @@ bool ModalIntro::init(int counterdiff) {
_countDown = 150;
_introFlags = (_introFlags & 0xf7) | 0x21;
- g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0)->_flags &= 0xfffb;
+ g_fp->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0)->_flags &= 0xfffb;
}
if (!(_introFlags & 0x20)) {
@@ -159,12 +165,12 @@ bool ModalIntro::init(int counterdiff) {
if (!_stillRunning) {
_introFlags |= 1;
- g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0)->_flags &= 0xfffb;
- g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_GAMETITLE, 0)->_flags &= 0xfffb;
+ g_fp->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0)->_flags &= 0xfffb;
+ g_fp->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_GAMETITLE, 0)->_flags &= 0xfffb;
chainQueue(QU_INTR_STARTINTRO, 1);
}
- g_fullpipe->_gameLoader->updateSystems(42);
+ g_fp->_gameLoader->updateSystems(42);
}
return true;
}
@@ -180,7 +186,7 @@ bool ModalIntro::init(int counterdiff) {
_introFlags = (_introFlags & 0xdf) | 0x10;
- g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_GAMETITLE, 0)->_flags &= 0xfffb;
+ g_fp->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_GAMETITLE, 0)->_flags &= 0xfffb;
_stillRunning = 0;
}
@@ -189,14 +195,14 @@ bool ModalIntro::init(int counterdiff) {
}
void ModalIntro::update() {
- if (g_fullpipe->_currentScene) {
+ if (g_fp->_currentScene) {
if (_introFlags & 1) {
//sceneFade(virt, g_currentScene, 1);
_stillRunning = 255;
_introFlags &= 0xfe;
if (_introFlags & 0x20)
- g_fullpipe->playSound(SND_INTR_019, 0);
+ g_fp->playSound(SND_INTR_019, 0);
} else if (_introFlags & 2) {
if (g_vars->sceneIntro_needBlackout) {
//vrtRectangle(*(_DWORD *)virt, 0, 0, 0, 800, 600);
@@ -209,26 +215,349 @@ void ModalIntro::update() {
_introFlags &= 0xfd;
}
} else if (_stillRunning) {
- g_fullpipe->_currentScene->draw();
+ g_fp->_currentScene->draw();
}
}
}
void ModalIntro::finish() {
- g_fullpipe->_gameLoader->unloadScene(SC_INTRO2);
- g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO1);
- g_fullpipe->_gameLoader->preloadScene(SC_INTRO1, TrubaDown);
+ g_fp->_gameLoader->unloadScene(SC_INTRO2);
+ g_fp->_currentScene = g_fp->accessScene(SC_INTRO1);
+ g_fp->_gameLoader->preloadScene(SC_INTRO1, TrubaDown);
+
+ if (g_fp->_currentScene)
+ g_fp->_gameLoader->updateSystems(42);
+}
+
+void ModalVideoPlayer::play(const char *filename) {
+ // TODO: Videos are encoded using Intel Indeo 5 (IV50), which isn't supported yet
+
+ Video::AVIDecoder *aviDecoder = new Video::AVIDecoder();
+
+ if (!aviDecoder->loadFile(filename))
+ return;
+
+ uint16 x = (g_system->getWidth() - aviDecoder->getWidth()) / 2;
+ uint16 y = (g_system->getHeight() - aviDecoder->getHeight()) / 2;
+ bool skipVideo = false;
+
+ aviDecoder->start();
+
+ while (!g_fp->shouldQuit() && !aviDecoder->endOfVideo() && !skipVideo) {
+ if (aviDecoder->needsUpdate()) {
+ const Graphics::Surface *frame = aviDecoder->decodeNextFrame();
+ if (frame) {
+ g_fp->_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
+
+ if (aviDecoder->hasDirtyPalette())
+ g_fp->_system->getPaletteManager()->setPalette(aviDecoder->getPalette(), 0, 256);
+
+ g_fp->_system->updateScreen();
+ }
+ }
+
+ Common::Event event;
+ while (g_fp->_system->getEventManager()->pollEvent(event)) {
+ if ((event.type == Common::EVENT_KEYDOWN && (event.kbd.keycode == Common::KEYCODE_ESCAPE ||
+ event.kbd.keycode == Common::KEYCODE_RETURN ||
+ event.kbd.keycode == Common::KEYCODE_SPACE))
+ || event.type == Common::EVENT_LBUTTONUP)
+ skipVideo = true;
+ }
+
+ g_fp->_system->delayMillis(aviDecoder->getTimeToNextFrame());
+ }
+}
+
+ModalMap::ModalMap() {
+ _mapScene = 0;
+ _pic = 0;
+ _isRunning = false;
+ _rect1 = g_fp->_sceneRect;
+ _x = g_fp->_currentScene->_x;
+ _y = g_fp->_currentScene->_y;
+ _flag = 0;
+ _mouseX = 0;
+ _mouseY = 0;
+ _field_38 = 0;
+ _field_3C = 0;
+ _field_40 = 12;
+ _rect2.top = 0;
+ _rect2.left = 0;
+ _rect2.bottom = 600;
+ _rect2.right = 800;
+}
+
+ModalMap::~ModalMap() {
+ g_fp->_gameLoader->unloadScene(SC_MAP);
+
+ g_fp->_sceneRect = _rect1;
- if (g_fullpipe->_currentScene)
- g_fullpipe->_gameLoader->updateSystems(42);
+ g_fp->_currentScene->_x = _x;
+ g_fp->_currentScene->_y = _y;
}
-void ModalVideoPlayer::play(const char *fname) {
- warning("STUB: ModalVideoPlayer::play(%s)", fname);
+bool ModalMap::init(int counterdiff) {
+ g_fp->setCursor(PIC_CSR_ITN);
+
+ if (_flag) {
+ _rect2.left = _mouseX + _field_38 - g_fp->_mouseScreenPos.x;
+ _rect2.top = _mouseY + _field_3C - g_fp->_mouseScreenPos.y;;
+ _rect2.right = _rect2.left + 800;
+ _rect2.bottom = _rect2.top + 600;
+
+ g_fp->_sceneRect =_rect2;
+
+ _mapScene->updateScrolling2();
+
+ _rect2 = g_fp->_sceneRect;
+ }
+
+ _field_40--;
+
+ if (_field_40 <= 0) {
+ _field_40 = 12;
+
+ if (_pic)
+ _pic->_flags ^= 4;
+ }
+
+ return _isRunning;
+}
+
+void ModalMap::update() {
+ g_fp->_sceneRect = _rect2;
+
+ _mapScene->draw();
+
+ g_fp->drawArcadeOverlay(1);
+}
+
+bool ModalMap::handleMessage(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return false;
+
+ switch (cmd->_messageNum) {
+ case 29:
+ _flag = 1;
+ _mouseX = g_fp->_mouseScreenPos.x;
+ _mouseY = g_fp->_mouseScreenPos.x;
+
+ _field_3C = _rect2.top;
+ _field_38 = _rect2.left;
+
+ break;
+
+ case 30:
+ _flag = 0;
+ break;
+
+ case 36:
+ if (cmd->_keyCode != 9 && cmd->_keyCode != 27 )
+ return false;
+
+ break;
+
+ case 107:
+ break;
+
+ default:
+ return false;
+ }
+
+ _isRunning = 0;
+
+ return true;
+}
+
+void ModalMap::initMap() {
+ _isRunning = 1;
+
+ _mapScene = g_fp->accessScene(SC_MAP);
+
+ if (!_mapScene)
+ error("ModalMap::initMap(): error accessing scene SC_MAP");
+
+ PictureObject *pic;
+
+ for (int i = 0; i < 200; i++) {
+ if (!g_fp->_mapTable[i] >> 16)
+ break;
+
+ pic = _mapScene->getPictureObjectById(g_fp->_mapTable[i] >> 16, 0);
+
+ if ((g_fp->_mapTable[i] & 0xffff) == 1)
+ pic->_flags |= 4;
+ else
+ pic->_flags &= 0xfffb;
+ }
+
+ pic = getScenePicture();
+
+ Common::Point point;
+ Common::Point point2;
+
+ if (pic) {
+ pic->getDimensions(&point);
+
+ _rect2.left = point.x / 2 + pic->_ox - 400;
+ _rect2.top = point.y / 2 + pic->_oy - 300;
+ _rect2.right = _rect2.left + 800;
+ _rect2.bottom = _rect2.top + 600;
+
+ _mapScene->updateScrolling2();
+
+ _pic = _mapScene->getPictureObjectById(PIC_MAP_I02, 0);
+ _pic->getDimensions(&point2);
+
+ _pic->setOXY(pic->_ox + point.x / 2 - point2.x / 2, point.y - point2.y / 2 + pic->_oy - 24);
+ _pic->_flags |= 4;
+
+ _pic = _mapScene->getPictureObjectById(PIC_MAP_I01, 0);
+ _pic->getDimensions(&point2);
+
+ _pic->setOXY(pic->_ox + point.x / 2 - point2.x / 2, point.y - point2.y / 2 + pic->_oy - 25);
+ _pic->_flags |= 4;
+ }
+
+ g_fp->setArcadeOverlay(PIC_CSR_MAP);
+}
+
+PictureObject *ModalMap::getScenePicture() {
+ int picId = 0;
+
+ switch (g_fp->_currentScene->_sceneId) {
+ case SC_1:
+ picId = PIC_MAP_S01;
+ break;
+ case SC_2:
+ picId = PIC_MAP_S02;
+ break;
+ case SC_3:
+ picId = PIC_MAP_S03;
+ break;
+ case SC_4:
+ picId = PIC_MAP_S04;
+ break;
+ case SC_5:
+ picId = PIC_MAP_S05;
+ break;
+ case SC_6:
+ picId = PIC_MAP_S06;
+ break;
+ case SC_7:
+ picId = PIC_MAP_S07;
+ break;
+ case SC_8:
+ picId = PIC_MAP_S08;
+ break;
+ case SC_9:
+ picId = PIC_MAP_S09;
+ break;
+ case SC_10:
+ picId = PIC_MAP_S10;
+ break;
+ case SC_11:
+ picId = PIC_MAP_S11;
+ break;
+ case SC_12:
+ picId = PIC_MAP_S12;
+ break;
+ case SC_13:
+ picId = PIC_MAP_S13;
+ break;
+ case SC_14:
+ picId = PIC_MAP_S14;
+ break;
+ case SC_15:
+ picId = PIC_MAP_S15;
+ break;
+ case SC_16:
+ picId = PIC_MAP_S16;
+ break;
+ case SC_17:
+ picId = PIC_MAP_S17;
+ break;
+ case SC_18:
+ case SC_19:
+ picId = PIC_MAP_S1819;
+ break;
+ case SC_20:
+ picId = PIC_MAP_S20;
+ break;
+ case SC_21:
+ picId = PIC_MAP_S21;
+ break;
+ case SC_22:
+ picId = PIC_MAP_S22;
+ break;
+ case SC_23:
+ picId = PIC_MAP_S23_1;
+ break;
+ case SC_24:
+ picId = PIC_MAP_S24;
+ break;
+ case SC_25:
+ picId = PIC_MAP_S25;
+ break;
+ case SC_26:
+ picId = PIC_MAP_S26;
+ break;
+ case SC_27:
+ picId = PIC_MAP_S27;
+ break;
+ case SC_28:
+ picId = PIC_MAP_S28;
+ break;
+ case SC_29:
+ picId = PIC_MAP_S29;
+ break;
+ case SC_30:
+ picId = PIC_MAP_S30;
+ break;
+ case SC_31:
+ picId = PIC_MAP_S31_1;
+ break;
+ case SC_32:
+ picId = PIC_MAP_S32_1;
+ break;
+ case SC_33:
+ picId = PIC_MAP_S33;
+ break;
+ case SC_34:
+ picId = PIC_MAP_S34;
+ break;
+ case SC_35:
+ picId = PIC_MAP_S35;
+ break;
+ case SC_36:
+ picId = PIC_MAP_S36;
+ break;
+ case SC_37:
+ picId = PIC_MAP_S37;
+ break;
+ case SC_38:
+ picId = PIC_MAP_S38;
+ break;
+ case SC_FINAL1:
+ picId = PIC_MAP_S38;
+ break;
+ }
+
+ if (picId)
+ return _mapScene->getPictureObjectById(picId, 0);
+
+ error("ModalMap::getScenePicture(): Unknown scene id: %d", g_fp->_currentScene->_sceneId);
}
void FullpipeEngine::openMap() {
- warning("STUB: FullpipeEngine::openMap()");
+ if (!_modalObject) {
+ ModalMap *map = new ModalMap;
+
+ _modalObject = map;
+
+ map->initMap();
+ }
}
void FullpipeEngine::openHelp() {
diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h
index b57d1fbd06..af52e1b6a9 100644
--- a/engines/fullpipe/modal.h
+++ b/engines/fullpipe/modal.h
@@ -25,6 +25,8 @@
namespace Fullpipe {
+class PictureObject;
+
class BaseModalObject {
public:
@@ -75,6 +77,35 @@ public:
void play(const char *fname);
};
+class ModalMap : public BaseModalObject {
+ Scene *_mapScene;
+ PictureObject *_pic;
+ bool _isRunning;
+ Common::Rect _rect1;
+ int _x;
+ int _y;
+ int _flag;
+ int _mouseX;
+ int _mouseY;
+ int _field_38;
+ int _field_3C;
+ int _field_40;
+ Common::Rect _rect2;
+
+ public:
+ ModalMap();
+ virtual ~ModalMap();
+
+ virtual bool pollEvent() { return true; }
+ virtual bool handleMessage(ExCommand *message);
+ virtual bool init(int counterdiff);
+ virtual void update();
+ virtual void saveload() {}
+
+ void initMap();
+ PictureObject *getScenePicture();
+};
+
} // End of namespace Fullpipe
#endif /* FULLPIPE_MODAL_H */
diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk
index 88e3ac5d02..d9cecf058a 100644
--- a/engines/fullpipe/module.mk
+++ b/engines/fullpipe/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/fullpipe
MODULE_OBJS = \
behavior.o \
+ console.o \
detection.o \
floaters.o \
fullpipe.o \
@@ -23,12 +24,42 @@ MODULE_OBJS = \
stateloader.o \
statics.o \
utils.o \
+ scenes/sceneIntro.o \
scenes/scene01.o \
scenes/scene02.o \
scenes/scene03.o \
scenes/scene04.o \
- scenes/sceneDbg.o \
- scenes/sceneIntro.o
+ scenes/scene05.o \
+ scenes/scene06.o \
+ scenes/scene07.o \
+ scenes/scene08.o \
+ scenes/scene10.o \
+ scenes/scene11.o \
+ scenes/scene12.o \
+ scenes/scene13.o \
+ scenes/scene14.o \
+ scenes/scene15.o \
+ scenes/scene16.o \
+ scenes/scene17.o \
+ scenes/scene18and19.o \
+ scenes/scene20.o \
+ scenes/scene21.o \
+ scenes/scene22.o \
+ scenes/scene23.o \
+ scenes/scene24.o \
+ scenes/scene25.o \
+ scenes/scene26.o \
+ scenes/scene28.o \
+ scenes/scene30.o \
+ scenes/scene31.o \
+ scenes/scene32.o \
+ scenes/scene33.o \
+ scenes/scene34.o \
+ scenes/scene35.o \
+ scenes/scene36.o \
+ scenes/scene37.o \
+ scenes/scene38.o \
+ scenes/sceneDbg.o
# This module can be built as a plugin
ifeq ($(ENABLE_FULLPIPE), DYNAMIC_PLUGIN)
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index c1977c0ac3..f0318581f1 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -28,9 +28,9 @@
#include "fullpipe/objects.h"
#include "fullpipe/statics.h"
+#include "fullpipe/gameloader.h"
#include "fullpipe/motion.h"
#include "fullpipe/messages.h"
-#include "fullpipe/gameloader.h"
namespace Fullpipe {
@@ -42,6 +42,48 @@ bool MotionController::load(MfcArchive &file) {
return true;
}
+void MotionController::enableLinks(const char *linkName, bool enable) {
+ warning("STUB: MotionController::enableLinks()");
+}
+
+MovGraphLink *MotionController::getLinkByName(const char *name) {
+ if (_objtype == kObjTypeMctlCompound) {
+ MctlCompound *obj = (MctlCompound *)this;
+
+ for (uint i = 0; i < obj->getMotionControllerCount(); i++) {
+ MotionController *con = obj->getMotionController(i);
+
+ if (con->_objtype == kObjTypeMovGraph) {
+ MovGraph *gr = (MovGraph *)con;
+
+ for (ObList::iterator l = gr->_links.begin(); l != gr->_links.end(); ++l) {
+ assert(((CObject *)*l)->_objtype == kObjTypeMovGraphLink);
+
+ MovGraphLink *lnk = (MovGraphLink *)*l;
+
+ if (!strcmp(lnk->_name, name))
+ return lnk;
+ }
+ }
+ }
+ }
+
+ if (_objtype == kObjTypeMovGraph) {
+ MovGraph *gr = (MovGraph *)this;
+
+ for (ObList::iterator l = gr->_links.begin(); l != gr->_links.end(); ++l) {
+ assert(((CObject *)*l)->_objtype == kObjTypeMovGraphLink);
+
+ MovGraphLink *lnk = (MovGraphLink *)*l;
+
+ if (!strcmp(lnk->_name, name))
+ return lnk;
+ }
+ }
+
+ return 0;
+}
+
bool MctlCompound::load(MfcArchive &file) {
debug(5, "MctlCompound::load()");
@@ -168,9 +210,9 @@ MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos,
if (mq) {
for (uint i = 0; i < closestP->_messageQueueObj->getCount(); i++) {
- ex = new ExCommand(closestP->_messageQueueObj->getExCommandByIndex(i));
+ ex = closestP->_messageQueueObj->getExCommandByIndex(i)->createClone();
ex->_excFlags |= 2;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
}
ex = new ExCommand(subj->_id, 51, 0, xpos, ypos, 0, 1, 0, 0, 0);
@@ -179,18 +221,201 @@ MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos,
ex->_keyCode = subj->_okeyCode;
ex->_excFlags |= 2;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
}
return mq;
}
+MctlCompoundArrayItem::~MctlCompoundArrayItem() {
+ delete _movGraphReactObj;
+ delete _motionControllerObj;
+}
+
+MctlLadder::MctlLadder() {
+ _width = 0;
+ _ladderX = 0;
+ _height = 0;
+ _ladderY = 0;
+ _ladder_field_14 = 0;
+
+ _ladder_field_20 = 0;
+ _ladder_field_24 = 0;
+}
+
+MctlLadder::~MctlLadder() {
+ freeItems();
+}
+
+int MctlLadder::collisionDetection(StaticANIObject *man) {
+ if (findObjectPos(man) < 0)
+ return 0;
+
+ double delta;
+
+ if ((double)(man->_oy - _ladderY) / (double)_height < 0.0)
+ delta = -0.5;
+ else
+ delta = 0.5;
+
+ int res = (int)((double)(man->_oy - _ladderY) / (double)_height + delta);
+
+ if (res < 0)
+ return 0;
+
+ return res;
+}
+
+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);
+ } else {
+ delete movement;
+ }
+ }
+}
+
+int MctlLadder::findObjectPos(StaticANIObject *obj) {
+ int res = -1;
+
+ for (Common::List<MctlLadderMovement *>::iterator it = _movements.begin(); it != _movements.end(); ++it, ++res)
+ if ((*it)->objId == obj->_id)
+ break;
+
+ return res;
+}
+
+bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement) {
+ GameVar *v = g_fp->getGameLoaderGameVar()->getSubVarByName(ani->getName());
+
+ if (!v)
+ return false;
+
+ v = v->getSubVarByName("Test_Ladder");
+
+ if (!v)
+ return false;
+
+ movement->staticIdsSize = 6;
+ movement->movVars = new MctlLadderMovementVars;
+ movement->staticIds = new int[movement->staticIdsSize];
+
+ v = v->getSubVarByName("Up");
+
+ if (!v)
+ return false;
+
+ movement->movVars->varUpStart = v->getSubVarAsInt("Start");
+ movement->movVars->varUpGo = v->getSubVarAsInt("Go");
+ movement->movVars->varUpStop = v->getSubVarAsInt("Stop");
+
+ movement->staticIds[0] = ani->getMovementById(movement->movVars->varUpStart)->_staticsObj1->_staticsId;
+ movement->staticIds[2] = ani->getMovementById(movement->movVars->varUpGo)->_staticsObj1->_staticsId;
+
+ v = v->getSubVarByName("Down");
+
+ if (!v)
+ return false;
+
+ movement->movVars->varDownStart = v->getSubVarAsInt("Start");
+ movement->movVars->varDownGo = v->getSubVarAsInt("Go");
+ movement->movVars->varDownStop = v->getSubVarAsInt("Stop");
+
+ movement->staticIds[1] = ani->getMovementById(movement->movVars->varDownStart)->_staticsObj1->_staticsId;
+ movement->staticIds[3] = ani->getMovementById(movement->movVars->varDownGo)->_staticsObj1->_staticsId;
+
+ movement->objId = ani->_id;
+
+ return true;
+}
+
+void MctlLadder::freeItems() {
+ _mgm.clear();
+
+ for (Common::List<MctlLadderMovement *>::iterator it = _movements.begin(); it != _movements.end(); ++it) {
+ delete (*it)->movVars;
+ delete [] (*it)->staticIds;
+ }
+
+ _movements.clear();
+}
+
+MessageQueue *MctlLadder::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
+ MessageQueue *mq = doWalkTo(subj, xpos, ypos, fuzzyMatch, staticsId);
+
+ if (mq) {
+ if (mq->chain(subj))
+ return mq;
+ }
+
+ return 0;
+}
+
+MessageQueue *MctlLadder::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
+ warning("STUB: MctlLadder::doWalkTo()");
+
+ return 0;
+}
+
+MessageQueue *MctlLadder::controllerWalkTo(StaticANIObject *ani, int off) {
+ return doWalkTo(ani, _ladderX + off * _width, _ladderY + off * _height, 1, 0);
+}
+
MctlConnectionPoint *MctlCompound::findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, int *minDistancePtr) {
warning("STUB: MctlCompound::findClosestConnectionPoint()");
return 0;
}
+void MctlCompound::replaceNodeX(int from, int to) {
+ warning("STUB: MctlCompound::replaceNodeX()");
+}
+
+MctlConnectionPoint::MctlConnectionPoint() {
+ _connectionX = 0;
+ _connectionY = 0;
+ _field_C = 0;
+ _field_10 = 0;
+ _field_14 = 0;
+ _field_16 = 0;
+ _messageQueueObj = 0;
+ _motionControllerObj = 0;
+}
+
+MctlConnectionPoint::~MctlConnectionPoint() {
+ delete _messageQueueObj;
+}
+
+MovInfo1::MovInfo1(MovInfo1 *src) {
+ index = src->index;
+ pt1 = src->pt1;
+ pt2 = src->pt2;
+ distance1 = src->distance1;
+ distance2 = src->distance2;
+ subIndex = src->subIndex;
+ item1Index = src->item1Index;
+ items = src->items;
+ itemsCount = src->itemsCount;
+ flags = src->flags;
+}
+
+void MovInfo1::clear() {
+ index = 0;
+ pt1.x = pt1.y = 0;
+ pt2.x = pt2.y = 0;
+ distance1 = 0;
+ distance2 = 0;
+ subIndex = 0;
+ item1Index = 0;
+ items.clear();
+ itemsCount = 0;
+ flags = 0;
+}
+
bool MctlCompoundArray::load(MfcArchive &file) {
debug(5, "MctlCompoundArray::load()");
@@ -238,6 +463,10 @@ MovGraph::MovGraph() {
_objtype = kObjTypeMovGraph;
}
+MovGraph::~MovGraph() {
+ warning("STUB: MovGraph::~MovGraph()");
+}
+
bool MovGraph::load(MfcArchive &file) {
debug(5, "MovGraph::load()");
@@ -280,10 +509,9 @@ int MovGraph::method28() {
return 0;
}
-int MovGraph::method2C() {
- warning("STUB: MovGraph::method2C()");
-
- return 0;
+int MovGraph::method2C(StaticANIObject *obj, int x, int y) {
+ obj->setOXY(x, y);
+ return method3C(obj, 1);
}
MessageQueue *MovGraph::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
@@ -298,7 +526,7 @@ int MovGraph::changeCallback() {
return 0;
}
-int MovGraph::method3C() {
+int MovGraph::method3C(StaticANIObject *ani, int flag) {
warning("STUB: MovGraph::method3C()");
return 0;
@@ -351,8 +579,8 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzz
return -1.0;
}
} else {
- point->x = n1x + (dist2x * distm / link->_distance);
- point->y = n1y + (dist2y * distm / link->_distance);
+ point->x = (int)(n1x + (dist2x * distm / link->_distance));
+ point->y = (int)(n1y + (dist2y * distm / link->_distance));
}
return res;
@@ -405,7 +633,7 @@ bool MovGraph2::initDirections(StaticANIObject *obj, MovGraph2Item *item) {
item->_obj = obj;
item->_objectId = obj->_id;
- GameVar *var = g_fullpipe->getGameLoaderGameVar()->getSubVarByName(obj->_objectName);
+ GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(obj->_objectName);
if (!var)
return false;
@@ -658,15 +886,13 @@ void MovGraph2::buildMovInfo1SubItems(MovInfo1 *movinfo, Common::Array<MovGraphL
}
MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
- MovInfo1 movinfo;
-
- memcpy(&movinfo, movInfo, sizeof(movinfo));
+ MovInfo1 movinfo(movInfo);
int curX = movInfo->pt1.x;
int curY = movInfo->pt1.y;
int curDistance = movInfo->distance1;
- MessageQueue *mq = new MessageQueue(g_fullpipe->_globalMessageQueueList->compact());
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
for (int i = 0; i < movInfo->itemsCount - 1; i++) {
if (movInfo->items[i + 1]->subIndex != 10) {
@@ -674,10 +900,10 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
if (i >= movInfo->itemsCount - 2 || movInfo->items[i + 2]->subIndex != 10) {
movinfo.flags = 0;
- mg2i = &_items2[movInfo->field_0]->_subItems[movInfo->items[i]->subIndex]._turnS[movInfo->items[i + 1]->subIndex];
+ mg2i = &_items2[movInfo->index]->_subItems[movInfo->items[i]->subIndex]._turnS[movInfo->items[i + 1]->subIndex];
} else {
movinfo.flags = 2;
- mg2i = &_items2[movInfo->field_0]->_subItems[movInfo->items[i]->subIndex]._turn[movInfo->items[i + 1]->subIndex];
+ mg2i = &_items2[movInfo->index]->_subItems[movInfo->items[i]->subIndex]._turn[movInfo->items[i + 1]->subIndex];
}
if (i < movInfo->itemsCount - 2
|| (movInfo->items[i]->x == movInfo->items[i + 1]->x
@@ -687,13 +913,13 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
|| movInfo->items[i + 1]->x == -1
|| movInfo->items[i + 1]->y == -1) {
- ExCommand *ex = new ExCommand(_items2[movInfo->field_0]->_objectId, 1, mg2i->_movementId, 0, 0, 0, 1, 0, 0, 0);
+ ExCommand *ex = new ExCommand(_items2[movInfo->index]->_objectId, 1, mg2i->_movementId, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags |= 2;
- ex->_keyCode = _items2[movInfo->field_0]->_obj->_okeyCode;
+ ex->_keyCode = _items2[movInfo->index]->_obj->_okeyCode;
ex->_field_24 = 1;
ex->_field_14 = -1;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
curX += mg2i->_mx;
curY += mg2i->_my;
@@ -702,7 +928,7 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
memset(&mgminfo, 0, sizeof(mgminfo));
- mgminfo.ani = _items2[movInfo->field_0]->_obj;
+ mgminfo.ani = _items2[movInfo->index]->_obj;
mgminfo.staticsId2 = mg2i->_mov->_staticsObj2->_staticsId;
mgminfo.x1 = movInfo->items[i + 1]->x;
mgminfo.y1 = movInfo->items[i + 1]->y;
@@ -745,13 +971,13 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
|| movInfo->items[i + 2]->subIndex == movInfo->items[i + 3]->subIndex) {
movinfo.flags &= 3;
} else {
- MG2I *m = &_items2[movInfo->field_0]->_subItems[movInfo->items[i + 2]->subIndex]._turnS[movInfo->items[i + 3]->subIndex];
+ MG2I *m = &_items2[movInfo->index]->_subItems[movInfo->items[i + 2]->subIndex]._turnS[movInfo->items[i + 3]->subIndex];
movinfo.pt2.x -= m->_mx;
movinfo.pt2.y -= m->_my;
movinfo.flags &= 3;
}
} else {
- MG2I *m = &_items2[movInfo->field_0]->_subItems[movInfo->items[i + 2]->subIndex]._turn[movInfo->items[i + 3]->subIndex];
+ MG2I *m = &_items2[movInfo->index]->_subItems[movInfo->items[i + 2]->subIndex]._turn[movInfo->items[i + 3]->subIndex];
if (movinfo.item1Index && movinfo.item1Index != 1) {
movinfo.pt2.y -= m->_my;
@@ -765,7 +991,7 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
MessageQueue *mq2 = genMovement(&movinfo);
- if (mq2) {
+ if (!mq2) {
delete mq;
return 0;
}
@@ -902,7 +1128,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
}
if (obj->_ox == xpos && obj->_oy == ypos) {
- g_fullpipe->_globalMessageQueueList->compact();
+ g_fp->_globalMessageQueueList->compact();
MessageQueue *mq = new MessageQueue();
@@ -922,20 +1148,20 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
ex->_keyCode = picAniInfo.field_8;
ex->_excFlags |= 2;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
} else {
ExCommand *ex = new ExCommand(picAniInfo.objectId, 22, obj->_statics->_staticsId, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = picAniInfo.field_8;
ex->_excFlags |= 3;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
ex = new ExCommand(picAniInfo.objectId, 5, -1, obj->_ox, obj->_oy, 0, 1, 0, 0, 0);
ex->_field_14 = -1;
ex->_keyCode = picAniInfo.field_8;
ex->_excFlags |= 3;
- mq->_exCommands.push_back(ex);
+ mq->addExCommandToEnd(ex);
}
obj->setPicAniInfo(&picAniInfo);
@@ -979,6 +1205,8 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
if (minPath < 0.0 || ((linkInfoSource.node != linkInfoDest.node || !linkInfoSource.node) && !tempLinkList.size()))
return 0;
+ movInfo1.clear();
+
movInfo1.subIndex = idxsub;
movInfo1.pt1.x = obj->_ox;
movInfo1.pt1.y = obj->_oy;
@@ -1008,7 +1236,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
double dst1 = sqrt((double)((ypos - nod->_y) * (ypos - nod->_y) + (xpos - nod->_x) * (xpos - nod->_x)));
int dst = linkInfoDest.link->_movGraphNode2->_distance - nod->_distance;
- movInfo1.distance2 = nod->_distance + (dst1 * (double)dst / linkInfoDest.link->_distance);
+ movInfo1.distance2 = (int)(nod->_distance + (dst1 * (double)dst / linkInfoDest.link->_distance));
calcDistance(&movInfo1.pt2, linkInfoDest.link, 1);
@@ -1155,10 +1383,205 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common
return node3->_x >= node2->_x;
}
-MessageQueue *MovGraph2::genMovement(MovInfo1 *movinfo) {
- warning("STUB: MovGraph2::genMovement()");
+MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
+ int mx1 = 0;
+ int my1 = 0;
- return 0;
+ if (!(info->flags & 2)) {
+ mx1 = _items2[info->index]->_subItems[info->subIndex]._walk[0]._mx;
+ my1 = _items2[info->index]->_subItems[info->subIndex]._walk[0]._my;
+ }
+
+ int mx2 = 0;
+ int my2 = 0;
+
+ if (!(info->flags & 4)) {
+ mx2 = _items2[info->index]->_subItems[info->subIndex]._walk[2]._mx;
+ my2 = _items2[info->index]->_subItems[info->subIndex]._walk[2]._my;
+ }
+
+ Common::Point point;
+
+ int y = info->pt2.y - info->pt1.y - my2 - my1;
+ int x = info->pt2.x - info->pt1.x - mx2 - mx1;
+ int a2;
+ int mgmLen;
+
+ _mgm.calcLength(&point, _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, x, y, &mgmLen, &a2, info->flags & 1);
+
+ int x1 = point.x;
+ int y1 = point.y;
+
+ if (!(info->flags & 1)) {
+ if (info->subIndex == 1 || info->subIndex == 0) {
+ a2 = -1;
+ x1 = mgmLen * _items2[info->index]->_subItems[info->subIndex]._walk[1]._mx;
+ x = x1;
+ info->pt2.x = x1 + info->pt1.x + mx1 + mx2;
+ }
+ }
+
+ if (!(info->flags & 1)) {
+ if (info->subIndex == 2 || info->subIndex == 3) {
+ a2 = -1;
+ y1 = mgmLen * _items2[info->index]->_subItems[info->subIndex]._walk[1]._my;
+ y = y1;
+ info->pt2.y = y1 + info->pt1.y + my1 + my2;
+ }
+ }
+
+ int cntX = 0;
+ int cntY = 0;
+
+ if (!(info->flags & 2)) {
+ cntX = _items2[info->index]->_subItems[info->subIndex]._walk[0]._mov->countPhasesWithFlag(-1, 1);
+ cntY = _items2[info->index]->_subItems[info->subIndex]._walk[0]._mov->countPhasesWithFlag(-1, 2);
+ }
+
+ if (mgmLen > 1) {
+ cntX += (mgmLen - 1) * _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(-1, 1);
+ cntY += (mgmLen - 1) * _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(-1, 2);
+ }
+
+ if (mgmLen > 0) {
+ cntX += _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(a2, 1);
+ cntY += _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(a2, 2);
+ }
+
+ if (!(info->flags & 4)) {
+ cntX += _items2[info->index]->_subItems[info->subIndex]._walk[2]._mov->countPhasesWithFlag(-1, 1);
+ cntY += _items2[info->index]->_subItems[info->subIndex]._walk[2]._mov->countPhasesWithFlag(-1, 2);
+ }
+
+ int dx1 = x - x1;
+ int dy1 = y - y1;
+
+ if (cntX)
+ x1 = (int)((double)dx1 / (double)cntX);
+ else
+ x1 = 0;
+
+ if (cntY)
+ y1 = (int)((double)dy1 / (double)cntY);
+ else
+ y1 = 0;
+
+ int v34 = dx1 - cntX * x1;
+ int v35 = dy1 - cntY * y1;
+ Common::Point x2;
+ Common::Point y2(v34, v35);
+
+ if (v34)
+ x2.x = v34 / abs(v34);
+ else
+ x2.x = 0;
+
+ if (v35)
+ x2.y = v35 / abs(v35);
+ else
+ x2.y = 0;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ ExCommand *ex;
+
+ if (info->flags & 2) {
+ ex = new ExCommand(
+ _items2[info->index]->_objectId,
+ 5,
+ _items2[info->index]->_subItems[info->subIndex]._walk[1]._movementId,
+ info->pt1.x,
+ info->pt1.y,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0);
+
+ ex->_field_14 = info->distance1;
+
+ ex->_keyCode = _items2[info->index]->_obj->_okeyCode;
+ ex->_field_24 = 1;
+ ex->_excFlags |= 2;
+ } else {
+ ex = new ExCommand(
+ _items2[info->index]->_objectId,
+ 5,
+ _items2[info->index]->_subItems[info->subIndex]._walk[0]._movementId,
+ info->pt1.x,
+ info->pt1.y,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0);
+
+ ex->_field_14 = info->distance1;
+
+ ex->_keyCode = _items2[info->index]->_obj->_okeyCode;
+ ex->_field_24 = 1;
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ ex = _mgm.buildExCommand2(
+ _items2[info->index]->_subItems[info->subIndex]._walk[0]._mov,
+ _items2[info->index]->_objectId,
+ x1,
+ y1,
+ &x2,
+ &y2,
+ -1);
+ ex->_parId = mq->_id;
+ ex->_keyCode = _items2[info->index]->_obj->_okeyCode;
+ }
+
+ mq->addExCommandToEnd(ex);
+
+ for (int i = 0; i < mgmLen; ++i) {
+ int par;
+
+ if (i == mgmLen - 1)
+ par = a2;
+ else
+ par = -1;
+
+ ex = _mgm.buildExCommand2(
+ _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov,
+ _items2[info->index]->_objectId,
+ x1,
+ y1,
+ &x2,
+ &y2,
+ par);
+ ex->_parId = mq->_id;
+ ex->_keyCode = _items2[info->index]->_obj->_okeyCode;
+ mq->addExCommandToEnd(ex);
+ }
+
+ if (!(info->flags & 4)) {
+ ex = _mgm.buildExCommand2(
+ _items2[info->index]->_subItems[info->subIndex]._walk[2]._mov,
+ _items2[info->index]->_objectId,
+ x1,
+ y1,
+ &x2,
+ &y2,
+ -1);
+ ex->_parId = mq->_id;
+ ex->_keyCode = _items2[info->index]->_obj->_okeyCode;
+
+ mq->addExCommandToEnd(ex);
+ }
+
+ ex = new ExCommand(_items2[info->index]->_objectId, 5, -1, info->pt2.x, info->pt2.y, 0, 1, 0, 0, 0);
+ ex->_field_14 = info->distance2;
+
+ ex->_keyCode = _items2[info->index]->_obj->_okeyCode;
+ ex->_field_24 = 0;
+ ex->_excFlags |= 2;
+
+ mq->addExCommandToEnd(ex);
+
+ return mq;
}
MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) {
@@ -1365,7 +1788,7 @@ void MGM::rebuildTables(int objId) {
_items[idx]->movements1.clear();
_items[idx]->movements2.clear();
- StaticANIObject *obj = g_fullpipe->_currentScene->getStaticANIObject1ById(objId, -1);
+ StaticANIObject *obj = g_fp->_currentScene->getStaticANIObject1ById(objId, -1);
if (!obj)
return;
@@ -1393,6 +1816,243 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
return 0;
}
+void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) {
+ if (getItemIndexById(ani->_id) == -1)
+ return;
+
+ if (ani->_movement) {
+ ani->queueMessageQueue(0);
+ ani->_movement->gotoLastFrame();
+ ani->_statics = ani->_movement->_staticsObj2;
+
+ int x = ani->_movement->_ox;
+ int y = ani->_movement->_oy;
+
+ ani->_movement = 0;
+
+ ani->setOXY(x, y);
+ }
+
+ if (ani->_statics) {
+ Common::Point point;
+
+ getPoint(&point, ani->_id, ani->_statics->_staticsId, staticsId);
+
+ ani->setOXY(ani->_ox + point.x, ani->_oy + point.y);
+
+ ani->_statics = ani->getStaticsById(staticsId);
+ }
+}
+
+Common::Point *MGM::getPoint(Common::Point *point, int objectId, int staticsId1, int staticsId2) {
+ int idx = getItemIndexById(objectId);
+
+ if (idx == -1) {
+ point->x = -1;
+ point->y = -1;
+ } else {
+ int st1idx = getStaticsIndexById(idx, staticsId1);
+ int st2idx = getStaticsIndexById(idx, staticsId2);
+
+ if (st1idx == st2idx) {
+ point->x = 0;
+ point->y = 0;
+ } else {
+ int subidx = st1idx + st2idx * _items[idx]->statics.size();
+
+ if (!_items[idx]->subItems[subidx]->movement) {
+ clearMovements2(idx);
+ recalcOffsets(idx, st1idx, st2idx, false, true);
+
+ if (!_items[idx]->subItems[subidx]->movement) {
+ clearMovements2(idx);
+ recalcOffsets(idx, st1idx, st2idx, true, false);
+ }
+ }
+
+ MGMSubItem *sub = _items[idx]->subItems[subidx];
+
+ if (sub->movement) {
+ point->x = sub->x;
+ point->y = sub->y;
+ } else {
+ point->x = 0;
+ point->y = 0;
+ }
+ }
+ }
+
+ return point;
+}
+
+int MGM::getStaticsIndexById(int idx, int16 id) {
+ if (!_items[idx]->statics.size())
+ return -1;
+
+ for (uint i = 0; i < _items[idx]->statics.size(); i++) {
+ if (_items[idx]->statics[i]->_staticsId == id)
+ return i;
+ }
+
+ return 0;
+}
+
+int MGM::getStaticsIndex(int idx, Statics *st) {
+ if (!_items[idx]->statics.size())
+ return -1;
+
+ for (uint i = 0; i < _items[idx]->statics.size(); i++) {
+ if (_items[idx]->statics[i] == st)
+ return i;
+ }
+
+ return 0;
+}
+
+void MGM::clearMovements2(int idx) {
+ _items[idx]->movements2.clear();
+}
+
+int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
+ warning("STUB: MGM::recalcOffsets()");
+
+ return 0;
+}
+
+Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *x1, int *y1, int flag) {
+ Common::Point point;
+
+ mov->calcSomeXY(point, 0);
+ int p1x = point.x;
+ int p1y = point.y;
+
+ int newx1 = 0;
+ int oldy1 = *y1;
+
+ if (abs(p1y) > abs(p1x)) {
+ if (mov->calcSomeXY(point, 0)->y)
+ newx1 = (int)((double)y / point.y);
+ } else if (mov->calcSomeXY(point, 0)->x) {
+ newx1 = (int)((double)x / point.y);
+ }
+
+ if (newx1 < 0)
+ newx1 = 0;
+
+ *x1 = newx1;
+
+ int phase = 1;
+ int sz;
+
+ if (flag) {
+ if (abs(p1y) > abs(p1x)) {
+ while (abs(p1y * newx1 + mov->calcSomeXY(point, 0)->y) < abs(y)) {
+ sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+
+ if (phase >= sz) {
+ phase--;
+
+ break;
+ }
+
+ phase++;
+ }
+ } else {
+ while (abs(p1x * newx1 + mov->calcSomeXY(point, 0)->x) < abs(x)) {
+ sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+
+ if (phase >= sz) {
+ phase--;
+
+ break;
+ }
+
+ phase++;
+ }
+ }
+
+ *y1 = phase - 1;
+ } else {
+ *y1 = -1;
+ }
+
+ int p2x = 0;
+ int p2y = 0;
+
+ if (!oldy1)
+ oldy1 = -1;
+
+ if (oldy1 > 0) {
+ ++*x1;
+
+ mov->calcSomeXY(point, 0);
+ p2x = point.x;
+ p2y = point.y;
+
+ if (abs(p1y) > abs(p1x))
+ p2x = p1x;
+ else
+ p2y = p1y;
+ }
+
+ pRes->x = p2x + p1x * newx1;
+ pRes->y = p2y + p1y * newx1;
+
+ return pRes;
+}
+
+ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) {
+ uint cnt;
+
+ if (mov->_currMovement)
+ cnt = mov->_currMovement->_dynamicPhases.size();
+ else
+ cnt = mov->_dynamicPhases.size();
+
+ if (len > 0 && cnt > (uint)len)
+ cnt = len;
+
+ Common::Point **points = (Common::Point **)malloc(sizeof(Common::Point *) * cnt);
+
+ for (uint i = 0; i < cnt; i++) {
+ int flags = mov->getDynamicPhaseByIndex(i)->getDynFlags();
+
+ points[i] = new Common::Point;
+
+ if (flags & 1) {
+ points[i]->x = x1 + x2->x;
+
+ y2->x -= x2->x;
+
+ if (!y2->x)
+ x2->x = 0;
+ }
+
+ if (flags & 2) {
+ points[i]->y = y1 + x2->y;
+
+ y2->y -= x2->y;
+
+ if (!y2->y)
+ x2->y = 0;
+ }
+ }
+
+ ExCommand2 *ex = new ExCommand2(20, objId, points, cnt);
+ ex->_excFlags = 2;
+ ex->_messageNum = mov->_id;
+ ex->_field_14 = len;
+ ex->_field_24 = 1;
+ ex->_keyCode = -1;
+
+ for (uint i = 0; i < cnt; i++)
+ delete points[i];
+
+ free(points);
+
+ return ex;
+}
+
MovGraphLink::MovGraphLink() {
_distance = 0;
_angle = 0;
@@ -1407,6 +2067,11 @@ MovGraphLink::MovGraphLink() {
_objtype = kObjTypeMovGraphLink;
}
+MovGraphLink::~MovGraphLink() {
+ warning("STUB: MovGraphLink::~MovGraphLink()");
+}
+
+
bool MovGraphLink::load(MfcArchive &file) {
debug(5, "MovGraphLink::load()");
@@ -1482,7 +2147,7 @@ void ReactParallel::createRegion() {
for (int i = 0; i < 4; i++)
_points[i] = new Common::Point;
- double at = atan2((double)(_x1 - _x2), (double)(_y1 - _y2)) + 1.570796;
+ double at = atan2((double)(_x1 - _x2), (double)(_y1 - _y2)) + 1.570796; // pi/2
double sn = sin(at);
double cs = cos(at);
@@ -1502,20 +2167,28 @@ void ReactParallel::createRegion() {
// GdiObject::Attach(_rgn, CreatePolygonRgn(_points, 4, 2);
}
-void ReactParallel::method14() {
- warning("STUB: ReactParallel::method14()");
+void ReactParallel::setCenter(int x1, int y1, int x2, int y2) {
+ _x1 = x1;
+ _y1 = y1;
+ _x2 = x2;
+ _y2 = y2;
}
ReactPolygonal::ReactPolygonal() {
- _field_C = 0;
- _field_10 = 0;
+ _centerX = 0;
+ _centerY = 0;
+ _bbox = 0;
+}
+
+ReactPolygonal::~ReactPolygonal() {
+ delete _bbox;
}
bool ReactPolygonal::load(MfcArchive &file) {
debug(5, "ReactPolygonal::load()");
- _field_C = file.readUint32LE();
- _field_10 = file.readUint32LE();
+ _centerX = file.readUint32LE();
+ _centerY = file.readUint32LE();
_pointCount = file.readUint32LE();
if (_pointCount > 0) {
@@ -1542,10 +2215,54 @@ void ReactPolygonal::createRegion() {
}
}
-void ReactPolygonal::method14() {
- warning("STUB: ReactPolygonal::method14()");
+void ReactPolygonal::setCenter(int x1, int y1, int x2, int y2) {
+ int cX = (x2 + x1) / 2;
+ int cY = (y2 + y1) / 2;
+
+ if (_points) {
+ for (int i = 0; i < _pointCount; i++) {
+ _points[i]->x += cX - _centerX;
+ _points[i]->y += cY - _centerY;
+ }
+ }
+
+ _centerX = cX;
+ _centerY = cY;
+}
+
+void ReactPolygonal::getBBox(Common::Rect *rect) {
+ if (!_pointCount)
+ return;
+
+ if (_bbox) {
+ *rect = *_bbox;
+ return;
+ }
+
+ rect->left = _points[0]->x;
+ rect->top = _points[0]->y;
+ rect->right = _points[0]->x;
+ rect->bottom = _points[0]->y;
+
+ for (int i = 1; i < _pointCount; i++) {
+ if (rect->left > _points[i]->x)
+ rect->left = _points[i]->x;
+
+ if (rect->top < _points[i]->y)
+ rect->top = _points[i]->y;
+
+ if (rect->right < _points[i]->x)
+ rect->right = _points[i]->x;
+
+ if (rect->bottom > _points[i]->y)
+ rect->bottom = _points[i]->y;
+ }
+
+ _bbox = new Common::Rect;
+ *_bbox = *rect;
}
+
bool MovGraphReact::pointInRegion(int x, int y) {
if (_pointCount < 3) {
return false;
@@ -1555,15 +2272,15 @@ bool MovGraphReact::pointInRegion(int x, int y) {
double xinters;
Common::Point p, p1, p2;
- p.x = (double)x;
- p.y = (double)y;
+ p.x = x;
+ p.y = y;
- p1.x = (double)_points[0]->x;
- p1.y = (double)_points[0]->y;
+ p1.x = _points[0]->x;
+ p1.y = _points[0]->y;
for (int i = 1; i <= _pointCount; i++) {
- p2.x = (double)_points[i % _pointCount]->x;
- p2.y = (double)_points[i % _pointCount]->y;
+ p2.x = _points[i % _pointCount]->x;
+ p2.y = _points[i % _pointCount]->y;
if (p.y > MIN(p1.y, p2.y)) {
if (p.y <= MAX(p1.y, p2.y)) {
@@ -1588,16 +2305,20 @@ bool MovGraphReact::pointInRegion(int x, int y) {
}
int startWalkTo(int objId, int objKey, int x, int y, int a5) {
- MctlCompound *mc = getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId);
+ MctlCompound *mc = getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId);
if (mc)
- return (mc->method34(g_fullpipe->_currentScene->getStaticANIObject1ById(objId, objKey), x, y, a5, 0) != 0);
+ return (mc->method34(g_fp->_currentScene->getStaticANIObject1ById(objId, objKey), x, y, a5, 0) != 0);
return 0;
}
int doSomeAnimation(int objId, int objKey, int a3) {
- warning("STUB: doSomeAnimation(%d, %d, %d)", objId, objKey, a3);
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(objId, objKey);
+ MctlCompound *cmp = getCurrSceneSc2MotionController();
+
+ if (ani && cmp)
+ return cmp->method3C(ani, a3);
return 0;
}
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index bab0ffc8ca..6ad46e719a 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -28,6 +28,9 @@ namespace Fullpipe {
class Statics;
class Movement;
class MctlConnectionPoint;
+class MovGraphLink;
+class MessageQueue;
+class ExCommand2;
int startWalkTo(int objId, int objKey, int x, int y, int a5);
int doSomeAnimation(int objId, int objKey, int a3);
@@ -50,15 +53,18 @@ public:
virtual int removeObject(StaticANIObject *obj) { return 0; }
virtual void freeItems() {}
virtual int method28() { return 0; }
- virtual int method2C() { return 0; }
+ virtual int method2C(StaticANIObject *obj, int x, int y) { return 0; }
virtual int method30() { return 0; }
virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; }
virtual int changeCallback() { return 0; }
- virtual int method3C() { return 0; }
+ virtual int method3C(StaticANIObject *ani, int flag) { return 0; }
virtual int method40() { return 0; }
virtual int method44() { return 0; }
virtual int method48() { return -1; }
virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; }
+
+ void enableLinks(const char *linkName, bool enable);
+ MovGraphLink *getLinkByName(const char *name);
};
class MovGraphReact : public CObject {
@@ -70,15 +76,13 @@ public:
MovGraphReact() : _pointCount(0), _points(0) {}
~MovGraphReact() { free(_points); }
- virtual void method14() {}
+ virtual void setCenter(int x1, int y1, int x2, int y2) {}
virtual void createRegion() {}
virtual bool pointInRegion(int x, int y);
};
class MctlCompoundArrayItem : public CObject {
- friend class MctlCompound;
-
-protected:
+public:
MotionController *_motionControllerObj;
MovGraphReact *_movGraphReactObj;
Common::Array<MctlConnectionPoint *> _connectionPoints;
@@ -88,6 +92,7 @@ protected:
public:
MctlCompoundArrayItem() : _movGraphReactObj(0), _motionControllerObj(0), _field_20(0), _field_24(0), _field_28(0) {}
+ ~MctlCompoundArrayItem();
};
class MctlCompoundArray : public Common::Array<MctlCompoundArrayItem *>, public CObject {
@@ -96,9 +101,9 @@ class MctlCompoundArray : public Common::Array<MctlCompoundArrayItem *>, public
};
class MctlCompound : public MotionController {
+public:
MctlCompoundArray _motionControllers;
- public:
MctlCompound() { _objtype = kObjTypeMctlCompound; }
virtual bool load(MfcArchive &file);
@@ -111,10 +116,14 @@ class MctlCompound : public MotionController {
void initMovGraph2();
MctlConnectionPoint *findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, int *minDistancePtr);
+ void replaceNodeX(int from, int to);
+
+ uint getMotionControllerCount() { return _motionControllers.size(); }
+ MotionController *getMotionController(int num) { return _motionControllers[num]->_motionControllerObj; }
};
struct MGMSubItem {
- int movement;
+ Movement *movement;
int staticsIndex;
int field_8;
int field_C;
@@ -146,6 +155,8 @@ struct MGMInfo {
int x2;
int y2;
int flags;
+
+ MGMInfo() { memset(this, 0, sizeof(MGMInfo)); }
};
class MGM : public CObject {
@@ -159,6 +170,60 @@ public:
int getItemIndexById(int objId);
MessageQueue *genMovement(MGMInfo *mgminfo);
+ void updateAnimStatics(StaticANIObject *ani, int staticsId);
+ Common::Point *getPoint(Common::Point *point, int aniId, int staticsId1, int staticsId2);
+ int getStaticsIndexById(int idx, int16 id);
+ 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);
+ ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len);
+};
+
+struct MctlLadderMovementVars {
+ int varUpGo;
+ int varDownGo;
+ int varUpStop;
+ int varDownStop;
+ int varUpStart;
+ int varDownStart;
+};
+
+struct MctlLadderMovement {
+ int objId;
+ int staticIdsSize;
+ MctlLadderMovementVars *movVars;
+ int *staticIds;
+};
+
+class MctlLadder : public MotionController {
+public:
+ int _ladderX;
+ int _ladderY;
+ int _ladder_field_14;
+ int _width;
+ int _height;
+ int _ladder_field_20;
+ int _ladder_field_24;
+ Common::List<MctlLadderMovement *> _movements;
+ MGM _mgm;
+
+public:
+ MctlLadder();
+ virtual ~MctlLadder();
+ int collisionDetection(StaticANIObject *man);
+
+ virtual void addObject(StaticANIObject *obj);
+ virtual int removeObject(StaticANIObject *obj) { return 1; }
+ virtual void freeItems();
+ virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
+ virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
+
+ MessageQueue *controllerWalkTo(StaticANIObject *ani, int off);
+
+private:
+ int findObjectPos(StaticANIObject *obj);
+ bool initMovement(StaticANIObject *ani, MctlLadderMovement *movement);
};
class MovGraphNode : public CObject {
@@ -183,25 +248,29 @@ class ReactParallel : public MovGraphReact {
int _dx;
int _dy;
- public:
+public:
ReactParallel();
virtual bool load(MfcArchive &file);
- virtual void method14();
+ virtual void setCenter(int x1, int y1, int x2, int y2);
virtual void createRegion();
};
class ReactPolygonal : public MovGraphReact {
- //CRgn _rgn;
- int _field_C;
- int _field_10;
+ Common::Rect *_bbox;
+ int _centerX;
+ int _centerY;
- public:
+public:
ReactPolygonal();
+ ~ReactPolygonal();
+
virtual bool load(MfcArchive &file);
- virtual void method14();
+ virtual void setCenter(int x1, int y1, int x2, int y2);
virtual void createRegion();
+
+ void getBBox(Common::Rect *rect);
};
class MovGraphLink : public CObject {
@@ -220,6 +289,8 @@ class MovGraphLink : public CObject {
public:
MovGraphLink();
+ virtual ~MovGraphLink();
+
virtual bool load(MfcArchive &file);
void calcNodeDistanceAndAngle();
@@ -257,16 +328,18 @@ public:
public:
MovGraph();
+ virtual ~MovGraph();
+
virtual bool load(MfcArchive &file);
virtual void addObject(StaticANIObject *obj);
virtual int removeObject(StaticANIObject *obj);
virtual void freeItems();
virtual int method28();
- virtual int method2C();
+ virtual int method2C(StaticANIObject *obj, int x, int y);
virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
virtual int changeCallback();
- virtual int method3C();
+ virtual int method3C(StaticANIObject *ani, int flag);
virtual int method44();
virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
virtual int method50();
@@ -306,7 +379,7 @@ struct MovInfo1Sub {
};
struct MovInfo1 {
- int field_0;
+ int index;
Common::Point pt1;
Common::Point pt2;
int distance1;
@@ -316,6 +389,10 @@ struct MovInfo1 {
Common::Array<MovInfo1Sub *> items;
int itemsCount;
int flags;
+
+ MovInfo1() { clear(); }
+ MovInfo1(MovInfo1 *src);
+ void clear();
};
struct MovGraph2Item { // 744
@@ -365,6 +442,9 @@ public:
int16 _field_16;
MessageQueue *_messageQueueObj;
int _motionControllerObj;
+
+ MctlConnectionPoint();
+ ~MctlConnectionPoint();
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/ngiarchive.cpp b/engines/fullpipe/ngiarchive.cpp
index 5d895c17a0..132f4758d3 100644
--- a/engines/fullpipe/ngiarchive.cpp
+++ b/engines/fullpipe/ngiarchive.cpp
@@ -91,7 +91,7 @@ NGIArchive::NGIArchive(const Common::String &filename) : _ngiFilename(filename)
free(fat);
- g_fullpipe->_currArchive = this;
+ g_fp->_currArchive = this;
debug(0, "NGIArchive::NGIArchive(%s): Located %d files", filename.c_str(), _headers.size());
}
@@ -103,7 +103,7 @@ NGIArchive::~NGIArchive() {
delete it->_value;
}
- g_fullpipe->_currArchive = 0;
+ g_fp->_currArchive = 0;
}
bool NGIArchive::hasFile(const Common::String &name) const {
diff --git a/engines/fullpipe/objectnames.h b/engines/fullpipe/objectnames.h
index 241e31b165..eafdb2a8e7 100644
--- a/engines/fullpipe/objectnames.h
+++ b/engines/fullpipe/objectnames.h
@@ -30,15 +30,16 @@ namespace Fullpipe {
#define sO_Grandma "\xc1\xe0\xe1\xf3\xeb\xff" // "Бабуля"
#define sO_Jar_4 "\xc1\xe0\xed\xea\xe0_4" // "Банка_4"
#define sO_Pool "\xc1\xe0\xf1\xf1\xe5\xe9\xed" // "Бассейн"
-#define sO_TumyTrampie "\xc1\xe0\xf2\xf3\xf2\xe0" // "Батута"
+#define sO_TummyTrampie "\xc1\xe0\xf2\xf3\xf2\xe0" // "Батута"
#define sO_WithoutBoot "\xc1\xe5\xe7 \xe1\xee\xf2\xe8\xed\xea\xe0" // "Без ботинка"
-#define sO_WithoutJug "\xc1\xe5\xe7 \xe3\xee\xf0\xf8\xea\xee\xe2" // "Без горшков"
+#define sO_WithoutJugs "\xc1\xe5\xe7 \xe3\xee\xf0\xf8\xea\xee\xe2" // "Без горшков"
#define sO_WithoutCarpet "\xc1\xe5\xe7 \xea\xee\xe2\xf0\xe8\xea\xe0" // "Без коврика"
#define sO_WithoutCoin "\xc1\xe5\xe7 \xec\xee\xed\xe5\xf2\xfb" // "Без монеты"
#define sO_WithNothing "\xc1\xe5\xe7 \xed\xe8\xf7\xe5\xe3\xee" // "Без ничего"
#define sO_WithoutHandle "\xc1\xe5\xe7 \xf0\xf3\xf7\xea\xe8" // "Без ручки"
#define sO_WithoutStool "\xc1\xe5\xe7 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xe8" // "Без табуретки"
#define sO_WithoutDrawer "\xc1\xe5\xe7 \xff\xf9\xe8\xea\xe0" // "Без ящика"
+#define sO_Nearby "\xc1\xeb\xe8\xe7\xea\xee" // "Близко"
#define sO_Blocked "\xc1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed" // "Блокирован"
#define sO_BlockedShe "\xc1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed\xe0" // "Блокирована"
#define sO_Awaken "\xc1\xee\xe4\xf0\xf1\xf2\xe2\xf3\xe5\xf2" // "Бодрствует"
@@ -48,8 +49,14 @@ namespace Fullpipe {
#define sO_InSock "\xc2 \xed\xee\xf1\xea\xe5" // "В носке"
#define sO_InGlasses "\xc2 \xee\xf7\xea\xe0\xf5" // "В очках"
#define sO_In_14 "\xc2_14" // "В_14"
+#define sO_In_15 "\xc2_15" // "В_15"
+#define sO_In_15_1 "\xc2_15_1" // "В_15_1"
+#define sO_In_15_2 "\xc2_15_2" // "В_15_2"
+#define sO_In_15_3 "\xc2_15_3" // "В_15_3"
+#define sO_In_16 "\xc2_16" // "В_16"
+#define sO_In_32 "\xc2_32" // "В_32"
#define sO_In_32_Lies "\xc2_32 \xeb\xe5\xe6\xe8\xf2" // "В_32 лежит"
-#define sO_In_32_Stands "\xc2_32 \xf2\xee\xf0\xf7\xe8\xf2" // "В_32 торчит"
+#define sO_In_32_Sticks "\xc2_32 \xf2\xee\xf0\xf7\xe8\xf2" // "В_32 торчит"
#define sO_In_33 "\xc2_33" // "В_33"
#define sO_In_7 "\xc2_7" // "В_7"
#define sO_Together "\xc2\xe4\xe2\xee\xe5\xec" // "Вдвоем"
@@ -73,16 +80,17 @@ namespace Fullpipe {
#define sO_Jug "\xc3\xee\xf0\xf8\xee\xea" // "Горшок"
#define sO_Strolling "\xc3\xf3\xeb\xff\xe5\xf2" // "Гуляет"
#define sO_Yes "\xc4\xe0" // "Да"
+#define sO_FarAway "\xc4\xe0\xeb\xe5\xea\xee" // "Далеко"
#define sO_Girl "\xc4\xe5\xe2\xee\xf7\xea\xe0" // "Девочка"
#define sO_Elephantine "\xc4\xe5\xe2\xee\xf7\xea\xe0-\xf1\xeb\xee\xed\xe8\xea" // "Девочка-слоник"
#define sO_Grandpa "\xc4\xe5\xe4\xf3\xf8\xea\xe0" // "Дедушка"
-#define sO_Plank_25 "\xc4\xee\xf1\xea\xe0_25" // "Доска_25"
+#define sO_Board_25 "\xc4\xee\xf1\xea\xe0_25" // "Доска_25"
#define sO_Plank_34 "\xc4\xee\xf1\xea\xe0_34" // "Доска_34"
-#define sO_DudeJumped "\xc4\xff\xe4\xff \xef\xf0\xfb\xe3\xe0\xeb" // "Дядя прыгал"
+#define sO_DudeHasJumped "\xc4\xff\xe4\xff \xef\xf0\xfb\xe3\xe0\xeb" // "Дядя прыгал"
#define sO_Dude "\xc4\xff\xe4\xff" // "Дядя"
#define sO_GuvTheDrawer "\xc4\xff\xe4\xff-\xff\xf9\xe8\xea" // "Дядя-ящик"
#define sO_DudeSwinged "\xc4\xff\xe4\xff_\xea\xe0\xf2\xe0\xeb\xf1\xff" // "Дядя_катался"
-#define sO_Eats "\xc5\xf1\xf2" // "Ест"
+#define sO_IsEating "\xc5\xf1\xf2" // "Ест"
#define sO_Present "\xc5\xf1\xf2\xfc" // "Есть"
#define sO_CloseThing1 "\xc7\xe0\xea\xf0\xfb\xe2\xe0\xe5\xec\xee\xe5 1" // "Закрываемое 1"
#define sO_CloseThing2 "\xc7\xe0\xea\xf0\xfb\xe2\xe0\xe5\xec\xee\xe5 2" // "Закрываемое 2"
@@ -94,11 +102,11 @@ namespace Fullpipe {
#define sO_HalfFull "\xc7\xe0\xef\xee\xeb\xed\xe5\xed \xed\xe0\xef\xee\xeb\xee\xe2\xe8\xed\xf3" // "Заполнен наполовину"
#define sO_Full "\xc7\xe0\xef\xee\xeb\xed\xe5\xed \xf6\xe5\xeb\xe8\xea\xee\xec" // "Заполнен целиком"
#define sO_MirroredTo "\xc7\xe5\xf0\xea\xe0\xeb\xfc\xed\xe0\xff \xea" // "Зеркальная к"
-#define sO_Playing "\xc8\xe3\xf0\xe0\xe5\xf2" // "Играет"
+#define sO_IsPlaying "\xc8\xe3\xf0\xe0\xe5\xf2" // "Играет"
#define sO_Tub "\xca\xe0\xe4\xea\xe0" // "Кадка"
#define sO_Cactus "\xca\xe0\xea\xf2\xf3\xf1" // "Кактус"
-#define sO_SwingingWithBoot "\xca\xe0\xf2\xe0\xe5\xf2\xf1\xff \xf1 \xe1\xee\xf2\xe8\xed\xea\xee\xec" // "Катается с ботинком"
-#define sO_Swinging "\xca\xe0\xf2\xe0\xe5\xf2\xf1\xff" // "Катается"
+#define sO_IsSwingingWithBoot "\xca\xe0\xf2\xe0\xe5\xf2\xf1\xff \xf1 \xe1\xee\xf2\xe8\xed\xea\xee\xec" // "Катается с ботинком"
+#define sO_IsSwinging "\xca\xe0\xf2\xe0\xe5\xf2\xf1\xff" // "Катается"
#define sO_Swingie "\xca\xe0\xf7\xe5\xeb\xe5\xed\xff" // "Качеленя"
#define sO_LiftButtons "\xca\xed\xee\xef\xea\xe8 \xeb\xe8\xf4\xf2\xe0" // "Кнопки лифта"
#define sO_Carpet_35 "\xca\xee\xe2\xf0\xe8\xea_35" // "Коврик_35"
@@ -110,7 +118,7 @@ namespace Fullpipe {
#define sO_LeftPipe_29 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_29" // "Левая труба_29"
#define sO_LeftPipe_30 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_30" // "Левая труба_30"
#define sO_LeftPipe_37 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_37" // "Левая труба_37"
-#define sO_StarsDown_24 "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0 \xe2\xed\xe8\xe7_24" // "Лестница вниз_24"
+#define sO_StairsDown_24 "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0 \xe2\xed\xe8\xe7_24" // "Лестница вниз_24"
#define sO_StairsUp_8 "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0 \xf1\xe2\xe5\xf0\xf5\xf3_8" // "Лестница сверху_8"
#define sO_Stairway "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0" // "Лестница"
#define sO_Fliers "\xcb\xe5\xf2\xf3\xed\xfb" // "Летуны"
@@ -135,7 +143,7 @@ namespace Fullpipe {
#define sO_NotGrown "\xcd\xe5 \xe2\xfb\xf0\xee\xf1" // "Не вырос"
#define sO_DidNotCrackEgg "\xcd\xe5 \xea\xee\xeb\xee\xeb \xff\xe9\xf6\xee" // "Не колол яйцо"
#define sO_NotFallen "\xcd\xe5 \xef\xe0\xe4\xe0\xeb" // "Не падал"
-#define sO_NotAvailable "\xcd\xe5\xe4\xee\xf1\xf2\xf3\xef\xed\xe0" // "Недоступна"
+#define sO_IsNotAvailable "\xcd\xe5\xe4\xee\xf1\xf2\xf3\xef\xed\xe0" // "Недоступна"
#define sO_CannotTake "\xcd\xe5\xeb\xfc\xe7\xff \xe2\xe7\xff\xf2\xfc" // "Нельзя взять"
#define sO_No "\xcd\xe5\xf2" // "Нет"
#define sO_LowerHatch_23 "\xcd\xe8\xe6\xed\xe8\xe9 \xeb\xfe\xea_23" // "Нижний люк_23"
@@ -148,7 +156,7 @@ namespace Fullpipe {
#define sO_ClockAxis "\xce\xf1\xfc \xf7\xe0\xf1\xee\xe2" // "Ось часов"
#define sO_Opened "\xce\xf2\xea\xf0\xfb\xf2" // "Открыт"
#define sO_OpenedWithBoot "\xce\xf2\xea\xf0\xfb\xf2\xe0 \xf1 \xe1\xee\xf2\xe8\xed\xea\xee\xec" // "Открыта с ботинком"
-#define sO_OpenedShe "\xce\xf2\xea\xf0\xfb\xf2\xe0" // "Открыта"
+#define sO_IsOpened "\xce\xf2\xea\xf0\xfb\xf2\xe0" // "Открыта"
#define sO_WeirdWacko "\xce\xf2\xec\xee\xf0\xee\xe6\xe5\xed\xed\xfb\xe9" // "Отмороженный"
#define sO_NotPresent "\xce\xf2\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2" // "Отсутствует"
#define sO_Error "\xce\xf8\xe8\xe1\xea\xe0" // "Ошибка"
@@ -161,17 +169,17 @@ namespace Fullpipe {
#define sO_FullPipe "\xcf\xee\xeb\xed\xe0\xff \xd2\xf0\xf3\xe1\xe0" // "Полная Труба"
#define sO_RightStairs_9 "\xcf\xf0\xe0\xe2\xe0\xff \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe0_9" // "Правая лестница_9"
#define sO_RightPipe_17 "\xcf\xf0\xe0\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_17" // "Правая труба_17"
-#define sO_Available "\xcf\xf0\xe8\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2" // "Присутствует"
+#define sO_IsPresent "\xcf\xf0\xe8\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2" // "Присутствует"
#define sO_GulpedEgg "\xcf\xf0\xee\xe3\xeb\xee\xf7\xe5\xed\xed\xee\xe5 \xff\xe9\xf6\xee" // "Проглоченное яйцо"
#define sO_GulpedEggs "\xcf\xf0\xee\xe3\xeb\xee\xf7\xe5\xed\xed\xfb\xe5 \xff\xe9\xf6\xe0" // "Проглоченные яйца"
#define sO_BellyInflater "\xcf\xf3\xe7\xee\xe4\xf3\xe2" // "Пузодув"
#define sO_Empty "\xcf\xf3\xf1\xf2" // "Пуст"
#define sO_EmptyShe "\xcf\xf3\xf1\xf2\xe0\xff" // "Пустая"
#define sO_WayToPipe "\xcf\xf3\xf2\xfc \xea \xf2\xf0\xf3\xe1\xe5" // "Путь к трубе"
-#define sO_Drinking "\xcf\xfc\xe5\xf2" // "Пьет"
-#define sO_BrokenInPieces "\xd0\xe0\xe7\xe1\xe8\xf2\xe0" // "Разбита"
+#define sO_IsDrinking "\xcf\xfc\xe5\xf2" // "Пьет"
+#define sO_Broken "\xd0\xe0\xe7\xe1\xe8\xf2\xe0" // "Разбита"
#define sO_Unblocked "\xd0\xe0\xe7\xe1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed" // "Разблокирован"
-#define sO_Unfolded "\xd0\xe0\xe7\xe2\xe5\xf0\xed\xf3\xf2" // "Развернут"
+#define sO_Unconvoluted "\xd0\xe0\xe7\xe2\xe5\xf0\xed\xf3\xf2" // "Развернут"
#define sO_Jawcrucnher "\xd0\xee\xf2\xee\xf5\xf0\xf3\xf1" // "Ротохрус"
#define sO_UsherHand "\xd0\xf3\xea\xe0 \xc1\xe8\xeb\xe5\xf2\xe5\xf0\xf8\xe8" // "Рука Билетерши"
#define sO_LeverHandle_23 "\xd0\xf3\xea\xee\xff\xf2\xea\xe0 \xf0\xfb\xf7\xe0\xe3\xe0_23" // "Рукоятка рычага_23"
@@ -185,7 +193,7 @@ namespace Fullpipe {
#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_WithTiny "\xd1 \xec\xe0\xeb\xfb\xec" // "С малым"
+#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" // "С монетой"
#define sO_WithSock "\xd1 \xed\xee\xf1\xea\xee\xec" // "С носком"
@@ -197,19 +205,19 @@ namespace Fullpipe {
#define sO_Sugar "\xd1\xe0\xf5\xe0\xf0\xee\xea" // "Сахарок"
#define sO_Convoluted "\xd1\xe2\xe5\xf0\xed\xf3\xf2" // "Свернут"
#define sO_IsFree "\xd1\xe2\xee\xe1\xee\xe4\xed\xe0" // "Свободна"
-#define sO_Sitting "\xd1\xe8\xe4\xe8\xf2" // "Сидит"
-#define sO_Laughing "\xd1\xec\xe5\xe5\xf2\xf1\xff" // "Смеется"
-#define sO_WithEveryone "\xd1\xee \xe2\xf1\xe5\xec\xe8" // "Со всеми"
+#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_WithHose "\xd1\xee \xf8\xeb\xe0\xed\xe3\xee\xec" // "Со шлангом"
#define sO_WithBrush "\xd1\xee \xf9\xe5\xf2\xea\xee\xe9" // "Со щеткой"
-#define sO_Sleeping "\xd1\xef\xe8\xf2" // "Спит"
+#define sO_IsSleeping "\xd1\xef\xe8\xf2" // "Спит"
#define sO_OnRight "\xd1\xef\xf0\xe0\xe2\xe0" // "Справа"
-#define sO_StandsInBoots "\xd1\xf2\xee\xe8\xf2 \xe2 \xe1\xee\xf2\xe8\xed\xea\xe0\xf5" // "Стоит в ботинках"
-#define sO_StandsInCorner "\xd1\xf2\xee\xe8\xf2 \xe2 \xf3\xe3\xeb\xf3" // "Стоит в углу"
+#define sO_IsStandingInBoots "\xd1\xf2\xee\xe8\xf2 \xe2 \xe1\xee\xf2\xe8\xed\xea\xe0\xf5" // "Стоит в ботинках"
+#define sO_IsStandingInCorner "\xd1\xf2\xee\xe8\xf2 \xe2 \xf3\xe3\xeb\xf3" // "Стоит в углу"
#define sO_Guardian "\xd1\xf2\xee\xf0\xee\xe6" // "Сторож"
#define sO_Guard_1 "\xd1\xf2\xf0\xe0\xe6 1" // "Страж 1"
-#define sO_Gurad_2 "\xd1\xf2\xf0\xe0\xe6 2" // "Страж 2"
+#define sO_Guard_2 "\xd1\xf2\xf0\xe0\xe6 2" // "Страж 2"
#define sO_Guard_3 "\xd1\xf2\xf0\xe0\xe6 3" // "Страж 3"
#define sO_Stool_34 "\xd2\xe0\xe1\xf3\xf0\xe5\xf2_34" // "Табурет_34"
#define sO_Pipe_9 "\xd2\xf0\xf3\xe1\xe0_9" // "Труба_9"
@@ -217,16 +225,17 @@ namespace Fullpipe {
#define sO_Pedestal_17 "\xd2\xf3\xec\xe1\xe0_17" // "Тумба_17"
#define sO_Pedestal_33 "\xd2\xf3\xec\xe1\xe0_33" // "Тумба_33"
#define sO_NearDudesStairs "\xd3 \xc4\xff\xe4\xe8 \xed\xe0 \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe5" // "У Дяди на лестнице"
-#define sO_NearDude "\xd3 \xc4\xff\xe4\xe8" // "У Дяди"
+#define sO_DudeHas "\xd3 \xc4\xff\xe4\xe8" // "У Дяди"
#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_Gone "\xd3\xe5\xf5\xe0\xeb\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" // "Упал раз"
-#define sO_FallenBrush "\xd3\xef\xe0\xeb\xe0 \xf9\xe5\xf2\xea\xe0" // "Упала щетка"
+#define sO_BrushHasFallen "\xd3\xef\xe0\xeb\xe0 \xf9\xe5\xf2\xea\xe0" // "Упала щетка"
#define sO_NotBroken "\xd6\xe5\xeb\xe0" // "Цела"
-#define sO_ScratchingBelly "\xd7\xe5\xf8\xe5\xf2 \xef\xf3\xe7\xee" // "Чешет пузо"
+#define sO_IsScratchingBelly "\xd7\xe5\xf8\xe5\xf2 \xef\xf3\xe7\xee" // "Чешет пузо"
#define sO_Level0 "\xdd\xf2\xe0\xe6 0" // "Этаж 0"
#define sO_Level1 "\xdd\xf2\xe0\xe6 1" // "Этаж 1"
#define sO_Level2 "\xdd\xf2\xe0\xe6 2" // "Этаж 2"
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index a12851e63b..d13559429a 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -82,6 +82,8 @@ class GameVar : public CObject {
public:
GameVar();
+ virtual ~GameVar();
+
virtual bool load(MfcArchive &file);
GameVar *getSubVarByName(const char *name);
bool setSubVarAsInt(const char *name, int value);
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index 3831831866..997d92ae1c 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -92,6 +92,9 @@ bool SceneTag::load(MfcArchive &file) {
SceneTag::~SceneTag() {
free(_tag);
+
+ delete _scene;
+ delete _field_4;
}
void SceneTag::loadScene() {
@@ -114,7 +117,7 @@ void SceneTag::loadScene() {
delete file;
- g_fullpipe->_currArchive = 0;
+ g_fp->_currArchive = 0;
free(fname);
free(archname);
@@ -129,6 +132,10 @@ Scene::Scene() {
_sceneName = 0;
}
+Scene::~Scene() {
+ warning("STUB: Scene::~Scene()");
+}
+
bool Scene::load(MfcArchive &file) {
debug(5, "Scene::load()");
@@ -146,7 +153,7 @@ bool Scene::load(MfcArchive &file) {
int aniNum = file.readUint16LE();
char *aniname = genFileName(0, aniNum, "ani");
- Common::SeekableReadStream *f = g_fullpipe->_currArchive->createReadStreamForMember(aniname);
+ Common::SeekableReadStream *f = g_fp->_currArchive->createReadStreamForMember(aniname);
StaticANIObject *ani = new StaticANIObject();
@@ -168,7 +175,7 @@ bool Scene::load(MfcArchive &file) {
int qNum = file.readUint16LE();
char *qname = genFileName(0, qNum, "qu");
- Common::SeekableReadStream *f = g_fullpipe->_currArchive->createReadStreamForMember(qname);
+ Common::SeekableReadStream *f = g_fp->_currArchive->createReadStreamForMember(qname);
MfcArchive archive(f);
archive.readUint16LE(); // Skip 2 bytes
@@ -191,7 +198,7 @@ bool Scene::load(MfcArchive &file) {
assert(0);
}
- _libHandle = g_fullpipe->_currArchive;
+ _libHandle = g_fp->_currArchive;
if (_picObjList.size() > 0 && _bgname && strlen(_bgname) > 1) {
char fname[260];
@@ -216,10 +223,10 @@ bool Scene::load(MfcArchive &file) {
char *slsname = genFileName(0, _sceneId, "sls");
- if (g_fullpipe->_soundEnabled) {
+ if (g_fp->_soundEnabled) {
_soundList = new SoundList();
- if (g_fullpipe->_flgSoundList) {
+ if (g_fp->_flgSoundList) {
char *nlname = genFileName(17, _sceneId, "nl");
_soundList->loadFile(slsname, nlname);
@@ -249,7 +256,7 @@ void Scene::init() {
_x = 0;
_y = 0;
- g_fullpipe->_sceneRect.moveTo(0, 0);
+ g_fp->_sceneRect.moveTo(0, 0);
for (uint i = 0; i < _picObjList.size(); i++)
((PictureObject *)_picObjList[i])->clearFlags();
@@ -398,7 +405,7 @@ void Scene::preloadMovements(GameVar *var) {
}
void Scene::initObjectCursors(const char *varname) {
- GameVar *cursorsVar = g_fullpipe->getGameLoaderGameVar()->getSubVarByName(varname)->getSubVarByName("CURSORS");
+ GameVar *cursorsVar = g_fp->getGameLoaderGameVar()->getSubVarByName(varname)->getSubVarByName("CURSORS");
if (!cursorsVar || !cursorsVar->_subVars)
return;
@@ -417,10 +424,10 @@ void Scene::initObjectCursors(const char *varname) {
}
}
- g_fullpipe->_minCursorId = minId;
- g_fullpipe->_maxCursorId = maxId;
+ g_fp->_minCursorId = minId;
+ g_fp->_maxCursorId = maxId;
- g_fullpipe->_objectIdCursors.resize(maxId - minId + 1);
+ g_fp->_objectIdCursors.resize(maxId - minId + 1);
for (GameVar *sub = cursorsVar->_subVars; sub; sub = sub->_nextVarObj) {
GameObject *obj = getPictureObjectByName(sub->_varName, -1);
@@ -431,7 +438,7 @@ void Scene::initObjectCursors(const char *varname) {
PictureObject *pic = getGameLoaderInventory()->getScene()->getPictureObjectByName(sub->_value.stringValue, -1);
if (obj && pic)
- g_fullpipe->_objectIdCursors[obj->_id - minId] = pic->_id;
+ g_fp->_objectIdCursors[obj->_id - minId] = pic->_id;
}
}
@@ -442,14 +449,25 @@ bool Scene::compareObjPriority(const void *p1, const void *p2) {
return false;
}
-void Scene::objectList_sortByPriority(PtrList &list) {
- Common::sort(list.begin(), list.end(), Scene::compareObjPriority);
+void Scene::objectList_sortByPriority(PtrList &list, bool skipFirst) {
+ if (skipFirst) {
+ PtrList::iterator s = list.begin();
+
+ ++s;
+
+ Common::sort(s, list.end(), Scene::compareObjPriority);
+ } else {
+ Common::sort(list.begin(), list.end(), Scene::compareObjPriority);
+ }
}
void Scene::draw() {
- debug(0, ">>>>> Scene::draw()");
+ debug(6, ">>>>> Scene::draw()");
updateScrolling();
+ // Clean previous stuff
+ g_fp->_backgroundSurface.fillRect(Common::Rect(0, 0, 800, 600), 0);
+
drawContent(60000, 0, true);
objectList_sortByPriority(_staticANIObjectList2);
@@ -470,11 +488,74 @@ void Scene::draw() {
}
void Scene::updateScrolling() {
- debug(0, "STUB Scene::updateScrolling()");
+ if (_messageQueueId && !_x && !_y) {
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(_messageQueueId);
+
+ if (mq)
+ mq->update();
+
+ _messageQueueId = 0;
+ }
+
+ if (_x || _y) {
+ int offsetX = 0;
+ int offsetY = 0;
+
+ if (_x < 0) {
+ if (!g_fp->_sceneRect.left && !(((PictureObject *)_picObjList[0])->_flags & 2))
+ _x = 0;
+
+ if (_x <= -g_fp->_scrollSpeed) {
+ offsetX = -g_fp->_scrollSpeed;
+ _x += g_fp->_scrollSpeed;
+ }
+ } else if (_x >= g_fp->_scrollSpeed) {
+ offsetX = g_fp->_scrollSpeed;
+ _x -= g_fp->_scrollSpeed;
+ } else {
+ _x = 0;
+ }
+
+ if (_y > 0) {
+ offsetY = g_fp->_scrollSpeed;
+ _y -= g_fp->_scrollSpeed;
+ }
+
+ if (_y < 0) {
+ offsetY -= g_fp->_scrollSpeed;
+ _y += g_fp->_scrollSpeed;
+ }
+
+ g_fp->_sceneRect.translate(offsetX, offsetY);
+ }
+
+ updateScrolling2();
}
void Scene::updateScrolling2() {
- warning("STUB Scene::updateScrolling2()");
+ if (_picObjList.size()) {
+ Common::Point point;
+ int offsetY = 0;
+ int offsetX = 0;
+
+ ((PictureObject *)_picObjList[0])->getDimensions(&point);
+
+ int flags = ((PictureObject *)_picObjList[0])->_flags;
+
+ if (g_fp->_sceneRect.left < 0 && !(flags & 2))
+ offsetX = -g_fp->_sceneRect.left;
+
+ if (g_fp->_sceneRect.top < 0 && !(flags & 0x20))
+ offsetY = -g_fp->_sceneRect.top;
+
+ if (g_fp->_sceneRect.right > point.x - 1 && g_fp->_sceneRect.left > 0 && !(flags & 2))
+ offsetX = point.x - g_fp->_sceneRect.right - 1;
+
+ if (g_fp->_sceneRect.bottom > point.y - 1 && g_fp->_sceneRect.top > 0 && !(flags & 0x20))
+ offsetY = point.y - g_fp->_sceneRect.bottom - 1;
+
+ g_fp->_sceneRect.translate(offsetX, offsetY);
+ }
}
StaticANIObject *Scene::getStaticANIObjectAtPos(int x, int y) {
@@ -525,7 +606,7 @@ int Scene::getPictureObjectIdAtPos(int x, int y) {
}
void Scene::update(int counterdiff) {
- debug(0, "Scene::update(%d)", counterdiff);
+ debug(6, "Scene::update(%d)", counterdiff);
for (PtrList::iterator s = _staticANIObjectList2.begin(); s != _staticANIObjectList2.end(); ++s)
((StaticANIObject *)*s)->update(counterdiff);
@@ -536,13 +617,13 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
return;
if (_palette) {
- g_fullpipe->_globalPalette = _palette->_data;
+ g_fp->_globalPalette = _palette->_data;
}
debug(8, "Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg);
if (_picObjList.size() > 2) { // We need to z-sort them
- objectList_sortByPriority(_picObjList);
+ objectList_sortByPriority(_picObjList, true);
}
if (minPri == -1 && _picObjList.size())
@@ -569,7 +650,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
debug(8, "w2: %d h2:%d", point.x, point.y);
- int bgStX = g_fullpipe->_sceneRect.left % point.x;
+ int bgStX = g_fp->_sceneRect.left % point.x;
if (bgStX < 0)
bgStX += point.x;
@@ -577,7 +658,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
int bgNumX = bgStX / width;
int bgOffsetX = bgStX % width;
- int bgStY = g_fullpipe->_sceneRect.top % point.y;
+ int bgStY = g_fp->_sceneRect.top % point.y;
if (bgStY < 0)
bgStY += point.y;
@@ -585,12 +666,12 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
int bgNumY = bgStY / height;
int bgOffsetY = bgStY % height;
- int bgPosX = g_fullpipe->_sceneRect.left - bgOffsetX;
+ int bgPosX = g_fp->_sceneRect.left - bgOffsetX;
- if (bgPosX < g_fullpipe->_sceneRect.right - 1) {
+ if (bgPosX < g_fp->_sceneRect.right - 1) {
while (1) {
int v25 = bgNumY;
- for (int y = g_fullpipe->_sceneRect.top - bgOffsetY; y < g_fullpipe->_sceneRect.bottom - 1;) {
+ for (int y = g_fp->_sceneRect.top - bgOffsetY; y < g_fp->_sceneRect.bottom - 1;) {
BigPicture *v27 = _bigPictureArray[bgNumX][v25];
v27->draw(bgPosX, y, 0, 0);
y += v27->getDimensions(&point)->y;
@@ -603,7 +684,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
}
}
_bigPictureArray[bgNumX][0]->getDimensions(&point);
- int v32 = point.x + bgPosX;
+ int oldx = point.x + bgPosX;
bgPosX += point.x;
bgNumX++;
@@ -612,7 +693,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
break;
bgNumX = 0;
}
- if (v32 >= g_fullpipe->_sceneRect.right - 1)
+ if (oldx >= g_fp->_sceneRect.right - 1)
break;
}
}
@@ -637,22 +718,22 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
int height = point.y;
if (obj->_flags & 8) {
- while (objX > g_fullpipe->_sceneRect.right) {
+ while (objX > g_fp->_sceneRect.right) {
objX -= width;
obj->setOXY(objX, objY);
}
- for (int j = width + objX; width + objX < g_fullpipe->_sceneRect.left; j = width + objX) {
+ for (int j = width + objX; width + objX < g_fp->_sceneRect.left; j = width + objX) {
objX = j;
obj->setOXY(j, objY);
}
}
if (obj->_flags & 0x10) {
- while (objY > g_fullpipe->_sceneRect.bottom) {
+ while (objY > g_fp->_sceneRect.bottom) {
objY -= height;
obj->setOXY(objX, objY);
}
- for (int j = objY + height; objY + height < g_fullpipe->_sceneRect.top; j = objY + height) {
+ for (int j = objY + height; objY + height < g_fp->_sceneRect.top; j = objY + height) {
objY = j;
obj->setOXY(objX, j);
}
@@ -661,12 +742,12 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
obj->draw();
if (obj->_flags & 2) {
- if (objX > g_fullpipe->_sceneRect.left) {
+ if (objX > g_fp->_sceneRect.left) {
obj->setOXY(objX - width, objY);
obj->draw();
obj->setOXY(objX, objY);
}
- if (width + objX < g_fullpipe->_sceneRect.right) {
+ if (width + objX < g_fp->_sceneRect.right) {
obj->setOXY(width + objX, objY);
obj->draw();
obj->setOXY(objX, objY);
@@ -674,12 +755,12 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
}
if (obj->_flags & 0x20) {
- if (objY > g_fullpipe->_sceneRect.top) {
+ if (objY > g_fp->_sceneRect.top) {
obj->setOXY(objX, objY - height);
obj->draw();
obj->setOXY(objX, objY);
}
- if (height + objY < g_fullpipe->_sceneRect.bottom) {
+ if (height + objY < g_fp->_sceneRect.bottom) {
obj->setOXY(objX, height + objY);
obj->draw();
obj->setOXY(objX, objY);
diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h
index db0da5db31..fc04a877f5 100644
--- a/engines/fullpipe/scene.h
+++ b/engines/fullpipe/scene.h
@@ -44,6 +44,7 @@ class Scene : public Background {
public:
Scene();
+ virtual ~Scene();
virtual bool load(MfcArchive &file);
@@ -79,12 +80,12 @@ class Scene : public Background {
private:
static bool compareObjPriority(const void *p1, const void *p2);
- void objectList_sortByPriority(PtrList &list);
+ void objectList_sortByPriority(PtrList &list, bool skipFirst = false);
};
class SceneTag : public CObject {
public:
- int _field_4;
+ CObject *_field_4;
char *_tag;
Scene *_scene;
int16 _sceneId;
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index 6771fe8ec8..1e4a5633ea 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -72,30 +72,319 @@ Vars::Vars() {
scene04_coinPut = false;
scene04_soundPlaying = false;
scene04_dynamicPhaseIndex = 0;
+ scene04_dudeOnLadder = false;
scene04_sceneClickX = 0;
scene04_sceneClickY = 0;
- scene04_var01 = 0;
- scene04_var02 = 0;
- scene04_var04 = 0;
- scene04_var05 = 0;
- scene04_var06 = 0;
- scene04_var07 = 0;
- scene04_var08 = 0;
- scene04_var09 = 0;
- scene04_var10 = 0;
- scene04_var11 = 0;
- scene04_var12 = 0;
- scene04_var13 = 0;
- scene04_var14 = 0;
- scene04_var15 = 0;
- scene04_var16 = 0;
- scene04_var17 = 0;
- scene04_var18 = 0;
- scene04_var19 = 0;
- scene04_var20 = 0;
- scene04_var24 = 0;
+ scene04_dudePosX = 0;
+ scene04_dudePosY = 0;
+
+ scene04_bottleIsTaken = false;
+ scene04_kozyawkaOnLadder = false;
+ scene04_walkingKozyawka = 0;
+ scene04_bottleWeight = 0;
+ scene04_var07 = false;
+ scene04_ladderClickable = false;
+ scene04_handIsDown = false;
+ scene04_dudeInBottle = false;
+ scene04_kozHeadRaised = false;
+ scene04_bottleIsDropped = false;
+ scene04_bigBallIn = false;
+ scene04_bigBallCounter = 0;
+ scene04_bigBallFromLeft = false;
+ scene04_speakerVariant = 0;
+ scene04_speakerPhase = 0;
+ scene04_clockCanGo = false;
+ scene04_objectIsTaken = false;
+ scene04_springOffset = 0;
+ scene04_lastKozyawka = 0;
+ scene04_springDelay = 0;
+ scene04_bottleY = 0;
+ scene04_ladderOffset = 0;
+
+ scene05_handle = 0;
+ scene05_wacko = 0;
+ scene05_bigHatch = 0;
+ scene05_wackoTicker = 0;
+ scene05_handleFlipper = 0;
+ scene05_floatersTicker = 0;
+
+ scene06_manX = 0;
+ scene06_manY = 0;
+ scene06_ballX = 0;
+ scene06_ballY = 0;
+ scene06_mumsy = 0;
+ scene06_someBall = 0;
+ scene06_invHandle = 0;
+ scene06_liftButton = 0;
+ scene06_ballDrop = 0;
+ scene06_arcadeEnabled = false;
+ scene06_aimingBall = false;
+ scene06_currentBall = 0;
+ scene06_ballInHands = 0;
+ scene06_flyingBall = 0;
+ scene06_numBallsGiven = 0;
+ scene06_mumsyNumBalls = 0;
+ scene06_eggieTimeout = 0;
+ scene06_eggieDirection = true;
+ scene06_mumsyGotBall = 0;
+ scene06_ballDeltaX = 0;
+ scene06_ballDeltaY = 0;
+ scene06_sceneClickX = 0;
+ scene06_sceneClickY = 0;
+ scene06_mumsyPos = 0;
+ scene06_mumsyJumpBk = 0;
+ scene06_mumsyJumpFw = 0;
+ scene06_mumsyJumpBkPercent = 0;
+ scene06_mumsyJumpFwPercent = 0;
+
+ scene07_lukeAnim = 0;
+ scene07_lukePercent = 0;
+ scene07_plusMinus = 0;
+
+ scene08_batuta = 0;
+ scene08_vmyats = 0;
+ scene08_clock = 0;
+ scene08_inAir = false;
+ scene08_flyingUp = false;
+ scene08_onBelly = false;
+ scene08_stairsOffset = -37;
+ scene08_snoringCountdown = -1;
+ scene08_inArcade = false;
+ scene08_stairsVisible = true;
+ scene08_manOffsetY = 0;
+
+ scene10_gum = 0;
+ scene10_packet = 0;
+ scene10_packet2 = 0;
+ scene10_inflater = 0;
+ scene10_ladder = 0;
+ scene10_hasGum = 0;
+
+ scene11_swingie = 0;
+ scene11_boots = 0;
+ scene11_dudeOnSwing = 0;
+ scene11_hint = 0;
+ scene11_arcadeIsOn = false;
+ scene11_scrollIsEnabled = false;
+ scene11_scrollIsMaximized = false;
+ scene11_hintCounter = 0;
+ scene11_swingieScreenEdge = 0;
+ scene11_crySound = 0;
+ scene11_swingAngle = 1.0;
+ scene11_swingOldAngle = 1.0;
+ scene11_swingSpeed = 1.0;
+ scene11_swingAngleDiff = 1.0;
+ scene11_swingInertia = 0.0;
+ scene11_swingCounter = 0;
+ scene11_swingCounterPrevTurn = 0;
+ scene11_swingDirection = 0;
+ scene11_swingDirectionPrevTurn = 0;
+ scene11_swingIsSwinging = false;
+ scene11_swingieStands = false;
+ scene11_dudeX = 0;
+ scene11_dudeY = 0;
+ scene11_swingMaxAngle = 45;
+
+ scene12_fly = 0;
+ scene12_flyCountdown = 0;
+
+ scene13_whirlgig = 0;
+ scene13_guard = 0;
+ scene13_handleR = 0;
+ scene13_handleL = 0;
+ scene13_bridge = 0;
+ scene13_guardDirection = false;
+ scene13_dudeX = 0;
+
+ scene14_grandma = 0;
+ scene14_sceneDeltaX = 0;
+ scene14_sceneDeltaY = 0;
+ scene14_arcadeIsOn = false;
+ scene14_dudeIsKicking = false;
+ scene14_ballIsFlying = false;
+ scene14_dudeCanKick = false;
+ scene14_sceneDiffX = 0;
+ scene14_sceneDiffY = 0;
+ scene14_pink = 0;
+ scene14_flyingBall = 0;
+ scene14_balls.clear();
+ scene14_grandmaIsHere = false;
+ scene14_dudeX = 0;
+ scene14_dudeY = 0;
+ scene14_grandmaX = 0;
+ scene14_grandmaY = 0;
+ scene14_dude2X = 0;
+ scene14_ballDeltaX = 0;
+ scene14_ballDeltaY = 0;
+ scene14_ballX = 0;
+ scene14_ballY = 0;
+ scene14_hitsLeft = 0;
+
+ scene15_chantingCountdown = 0;
+ scene15_plusminus = 0;
+ scene15_ladder = 0;
+ scene15_boot = 0;
+
+ scene16_figures.clear();
+ scene16_walkingBoy = 0;
+ scene16_walkingGirl = 0;
+ scene16_walkingCount = 0;
+ scene16_wire = 0;
+ scene16_mug = 0;
+ scene16_jettie = 0;
+ scene16_boot = 0;
+ scene16_girlIsLaughing = false;
+ scene16_sound = 0;
+ scene16_placeIsOccupied = false;
+
+ scene17_flyState = 0;
+ scene17_sugarIsShown = false;
+ scene17_sceneOldEdgeX = 0;
+ scene17_flyCountdown = 0;
+ scene17_hand = 0;
+ scene17_handPhase = false;
+ scene17_sceneEdgeX = 0;
+
+ scene18_var01 = 0;
+
+ scene20_fliesCountdown = 0;
+ scene20_grandma = 0;
+
+ scene21_giraffeBottom = 0;
+ scene21_giraffeBottomX = 0;
+ scene21_giraffeBottomY = 0;
+ scene21_pipeIsOpen = false;
+ scene21_wigglePos = 0.0;
+ scene21_wiggleTrigger = 0;
+
+ scene22_bag = 0;
+ scene22_giraffeMiddle = 0;
+ scene22_dudeIsOnStool = false;
+ scene22_interactionIsDisabled = false;
+ scene22_craneIsOut = true;
+ scene22_numBagFalls = 1;
+
+ scene23_calend0 = 0;
+ scene23_calend1 = 0;
+ scene23_calend2 = 0;
+ scene23_calend3 = 0;
+ scene23_topReached = false;
+ scene23_isOnStool = false;
+ scene23_someVar = 0;
+ scene23_giraffeTop = 0;
+ scene23_giraffee = 0;
+
+ scene24_jetIsOn = false;
+ scene24_flowIsLow = false;
+ scene24_waterIsOn = false;
+ scene24_water = 0;
+ scene24_jet = 0;
+ scene24_drop = 0;
+
+ scene25_water = 0;
+ scene25_board = 0;
+ scene25_drop = 0;
+ scene25_dudeIsOnBoard = false;
+ scene25_waterIsPresent = false;
+ scene25_boardIsSelectable = false;
+ scene25_beardersAreThere = false;
+ scene25_beardersCounter = 0;
+ scene25_bearders.clear();
+ scene25_sneezeFlipper = false;
+
+ scene26_chhi = 0;
+ scene26_drop = 0;
+ scene26_sockPic = 0;
+ scene26_sock = 0;
+ scene26_activeVent = 0;
+
+ scene28_fliesArePresent = true;
+ scene28_beardedDirection = true;
+ scene28_darkeningObject = 0;
+ scene28_lighteningObject = 0;
+ scene28_headDirection = false;
+ scene28_headBeardedFlipper = false;
+ scene28_lift6inside = false;
+
+ scene30_leg = 0;
+ scene30_liftFlag = 1;
+
+ scene31_chantingCountdown = 0;
+ scene31_cactus = 0;
+ scene31_plusMinus = 0;
+
+ scene32_flagIsWaving = false;
+ scene32_flagNeedsStopping = false;
+ scene32_dudeIsSitting = false;
+ scene32_cactusCounter = -1;
+ scene32_dudeOnLadder = false;
+ scene32_cactusIsGrowing = false;
+ scene32_flag = 0;
+ scene32_cactus = 0;
+ scene32_massOrange = 0;
+ scene32_massBlue = 0;
+ scene32_massGreen = 0;
+ scene32_button = 0;
+
+ scene33_mug = 0;
+ scene33_jettie = 0;
+ scene33_cube = 0;
+ scene33_cubeX = -1;
+ scene33_handleIsDown = false;
+
+ for (int i = 0; i < 9; i++) {
+ scene33_ventsX[i] = 0;
+ scene33_ventsState[i] = 0;
+ }
+
+ scene34_cactus = 0;
+ scene34_vent = 0;
+ scene34_hatch = 0;
+ scene34_boot = 0;
+ scene34_dudeClimbed = false;
+ scene34_dudeOnBoard = false;
+ scene34_dudeOnCactus = false;
+ scene34_fliesCountdown = 0;
+
+ scene35_hose = 0;
+ scene35_bellyInflater = 0;
+ scene35_flowCounter = 0;
+ scene35_fliesCounter = 0;
+
+ scene36_rotohrust = 0;
+ scene36_scissors = 0;
+
+ scene37_rings.clear();
+ scene37_lastDudeX = -1;
+ scene37_cursorIsLocked = 0;
+ scene37_plusMinus1 = 0;
+ scene37_plusMinus2 = 0;
+ scene37_plusMinus3 = 0;
+ scene37_soundFlipper = 0;
+ scene37_dudeX = 0;
+
+ scene38_var01 = 0;
+ scene38_var02 = 0;
+ scene38_var03 = 0;
+ scene38_var04 = 0;
+ scene38_boss = 0;
+ scene38_tally = 0;
+ scene38_shorty = 0;
+ scene38_domino0 = 0;
+ scene38_dominos = 0;
+ scene38_domino1 = 0;
+ scene38_bottle = 0;
+ scene38_var05 = 0;
+ scene38_var06 = 0;
+ scene38_var07 = 0;
+ scene38_var08 = 0;
+ scene38_var09 = 0;
+ scene38_var10 = 0;
+ scene38_var11 = 0;
+ scene38_var12 = 0;
+ scene38_var13 = 0;
selector = 0;
}
@@ -104,19 +393,43 @@ static int scenes[] = {
SC_1, SC_2, SC_3, SC_4, SC_5, SC_6, SC_7, SC_8, SC_9, SC_10,
SC_11, SC_12, SC_13, SC_14, SC_15, SC_16, SC_17, SC_18, SC_19, SC_20,
SC_21, SC_22, SC_23, SC_24, SC_25, SC_26, SC_27, SC_28, SC_29, SC_30,
- SC_31, SC_32, SC_33, SC_34, SC_35, SC_36, SC_37, SC_38, SC_DBGMENU
+ SC_31, SC_32, SC_33, SC_34, SC_35, SC_36, SC_37, SC_38, SC_FINAL1, SC_DBGMENU
+};
+
+static int scenesD[] = {
+ PIC_SCD_1, PIC_SCD_2, PIC_SCD_3, PIC_SCD_4, PIC_SCD_5, PIC_SCD_6, PIC_SCD_7, PIC_SCD_8, PIC_SCD_9, PIC_SCD_10,
+ PIC_SCD_11, PIC_SCD_12, PIC_SCD_13, PIC_SCD_14, PIC_SCD_15, PIC_SCD_16, PIC_SCD_17, PIC_SCD_18, PIC_SCD_19, PIC_SCD_20,
+ PIC_SCD_21, PIC_SCD_22, PIC_SCD_23, PIC_SCD_24, PIC_SCD_25, PIC_SCD_26, PIC_SCD_27, PIC_SCD_28, PIC_SCD_29, PIC_SCD_30,
+ PIC_SCD_31, PIC_SCD_32, PIC_SCD_33, PIC_SCD_34, PIC_SCD_35, PIC_SCD_36, PIC_SCD_37, PIC_SCD_38, PIC_SCD_FIN, 0
};
int FullpipeEngine::convertScene(int scene) {
if (!scene || scene >= SC_1)
return scene;
- if (scene < 1 || scene > 39)
+ if (scene < 1 || scene > 40)
return SC_1;
return scenes[scene - 1];
}
+int FullpipeEngine::getSceneEntrance(int scene) {
+ for (int i = 0; i < 40; i++)
+ if (scenes[i] == scene)
+ return scenesD[i];
+
+ return 0;
+}
+
+int FullpipeEngine::getSceneFromTag(int tag) {
+ for (int i = 0; i < ARRAYSIZE(scenes); i++) {
+ if (scenes[i] == tag)
+ return i + 1;
+ }
+
+ return 1;
+}
+
bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
GameVar *sceneVar;
Common::Point sceneDim;
@@ -259,7 +572,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
_updateCursorCallback = scene04_updateCursor;
break;
-#if 0
case SC_5:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_5");
scene->preloadMovements(sceneVar);
@@ -278,7 +590,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
_behaviorManager->initBehavior(scene, sceneVar);
scene->initObjectCursors("SC_6");
setSceneMusicParameters(sceneVar);
- sub_415300();
+ scene06_initMumsy();
insertMessageHandler(sceneHandler06, 2, 2);
_updateCursorCallback = scene06_updateCursor;
break;
@@ -301,11 +613,12 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
_behaviorManager->initBehavior(scene, sceneVar);
scene->initObjectCursors("SC_8");
setSceneMusicParameters(sceneVar);
- sub_416890();
+ scene08_setupMusic();
addMessageHandler(sceneHandler08, 2);
_updateCursorCallback = scene08_updateCursor;
break;
+#if 0
case SC_9:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_9");
scene->preloadMovements(sceneVar);
@@ -316,6 +629,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
insertMessageHandler(sceneHandler09, 2, 2);
_updateCursorCallback = scene09_updateCursor;
break;
+#endif
case SC_10:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_10");
@@ -336,7 +650,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_11");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler11, 2, 2);
- scene11_sub_41A980();
+ scene11_setupMusic();
_updateCursorCallback = scene11_updateCursor;
break;
@@ -370,7 +684,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_14");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler14, 2, 2);
- scene14_sub_41D2B0();
+ scene14_setupMusic();
_updateCursorCallback = scene14_updateCursor;
break;
@@ -404,10 +718,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_17");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler17, 2);
- scene17_sub_41F060();
+ scene17_restoreState();
_updateCursorCallback = scene17_updateCursor;
break;
+#if 0
case SC_18:
sub_40E1B0();
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_18");
@@ -448,6 +763,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene19_sub_4211D0(scene);
_updateCursorCallback = scene19_updateCursor;
break;
+#endif
case SC_20:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_20");
@@ -478,7 +794,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
_behaviorManager->initBehavior(scene, sceneVar);
scene->initObjectCursors("SC_22");
setSceneMusicParameters(sceneVar);
- scene22_sub_4228A0();
+ scene22_setBagState();
insertMessageHandler(sceneHandler22, 2, 2);
_updateCursorCallback = scene22_updateCursor;
break;
@@ -491,7 +807,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_23");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler23, 2, 2);
- scene23_sub_423B00();
+ scene23_setGiraffeState();
_updateCursorCallback = scene23_updateCursor;
break;
@@ -503,19 +819,19 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_24");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler24, 2);
- scene24_sub_423DD0();
+ scene24_setPoolState();
_updateCursorCallback = defaultUpdateCursor;
break;
case SC_25:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_25");
scene->preloadMovements(sceneVar);
- scene25_initScene(scene, entrance->field_4);
+ scene25_initScene(scene, entrance->_field_4);
_behaviorManager->initBehavior(scene, sceneVar);
scene->initObjectCursors("SC_25");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler25, 2);
- scene25_sub_4253B0(scene, entrance->field_4);
+ scene25_setupWater(scene, entrance->_field_4);
_updateCursorCallback = scene25_updateCursor;
break;
@@ -527,10 +843,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_26");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler26, 2, 2);
- scene26_sub_426140(scene);
+ scene26_setupDrop(scene);
_updateCursorCallback = scene26_updateCursor;
break;
+#if 0
case SC_27:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_27");
scene->preloadMovements(sceneVar);
@@ -541,6 +858,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
addMessageHandler(sceneHandler27, 2);
_updateCursorCallback = scene27_updateCursor;
break;
+#endif
case SC_28:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_28");
@@ -553,6 +871,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
_updateCursorCallback = scene28_updateCursor;
break;
+#if 0
case SC_29:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_29");
scene->preloadMovements(sceneVar);
@@ -563,11 +882,12 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
addMessageHandler(sceneHandler29, 2);
_updateCursorCallback = scene29_updateCursor;
break;
+#endif
case SC_30:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_30");
scene->preloadMovements(sceneVar);
- scene30_initScene(scene, entrance->field_4);
+ scene30_initScene(scene, entrance->_field_4);
_behaviorManager->initBehavior(scene, sceneVar);
scene->initObjectCursors("SC_30");
setSceneMusicParameters(sceneVar);
@@ -594,7 +914,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_32");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler32, 2, 2);
- scene32_sub_42C5C0();
+ scene32_setupMusic();
_updateCursorCallback = scene32_updateCursor;
break;
@@ -606,7 +926,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_33");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler33, 2, 2);
- scene33_sub_42CEF0();
+ scene33_setupMusic();
_updateCursorCallback = scene33_updateCursor;
break;
@@ -618,7 +938,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_34");
setSceneMusicParameters(sceneVar);
insertMessageHandler(sceneHandler34, 2, 2);
- scene34_sub_42DEE0();
+ scene34_initBeh();
_updateCursorCallback = scene34_updateCursor;
break;
@@ -655,6 +975,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
_updateCursorCallback = scene37_updateCursor;
break;
+#if 0
case SC_38:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_38");
scene->preloadMovements(sceneVar);
@@ -688,7 +1009,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
break;
default:
- _behaviorManager->initBehavior(0, 0);
+ error("Unknown scene %d", entrance->_sceneId);
break;
}
@@ -696,13 +1017,346 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
}
int defaultUpdateCursor() {
- g_fullpipe->updateCursorCommon();
+ g_fp->updateCursorCommon();
+
+ return g_fp->_cursorId;
+}
+
+void FullpipeEngine::processArcade(ExCommand *ex) {
+ warning("STUB: FullpipeEngine::processArcade()");
+}
+
+void FullpipeEngine::updateMapPiece(int mapId, int update) {
+ for (int i = 0; i < 200; i++) {
+ int hiWord = (_mapTable[i] >> 16) & 0xffff;
- return g_fullpipe->_cursorId;
+ if (hiWord == mapId) {
+ _mapTable[i] |= update;
+ return;
+ }
+ if (!hiWord) {
+ _mapTable[i] = (mapId << 16) | update;
+ return;
+ }
+ }
}
-void FullpipeEngine::initArcadeKeys(const char *varname) {
- warning("STUB: FullpipeEngine::initArcadeKeys(\"%s\")", varname);
+void FullpipeEngine::updateMap(PreloadItem *pre) {
+ switch (pre->sceneId) {
+ case SC_1:
+ updateMapPiece(PIC_MAP_S01, 1);
+
+ if (pre->keyCode == TrubaUp)
+ updateMapPiece(PIC_MAP_P01, 1);
+
+ if (pre->keyCode == TrubaLeft)
+ updateMapPiece(PIC_MAP_A13, 1);
+ break;
+
+ case SC_2:
+ updateMapPiece(PIC_MAP_S02, 1);
+
+ if (pre->keyCode == TrubaLeft)
+ updateMapPiece(PIC_MAP_P01, 1);
+
+ break;
+
+ case SC_3:
+ updateMapPiece(PIC_MAP_S03, 1);
+ break;
+
+ case SC_4:
+ updateMapPiece(PIC_MAP_S04, 1);
+
+ if (pre->keyCode == TrubaRight)
+ updateMapPiece(PIC_MAP_P04, 1);
+
+ break;
+
+ case SC_5:
+ updateMapPiece(PIC_MAP_S05, 1);
+
+ if (pre->keyCode == TrubaLeft) {
+ updateMapPiece(PIC_MAP_P04, 1);
+ }
+
+ if (pre->keyCode == TrubaUp) {
+ updateMapPiece(PIC_MAP_P05, 1);
+ updateMapPiece(PIC_MAP_A11, 1);
+ }
+
+ break;
+
+ case SC_6:
+ updateMapPiece(PIC_MAP_S06, 1);
+
+ if (pre->keyCode == TrubaUp)
+ updateMapPiece(PIC_MAP_A12, 1);
+
+ break;
+
+ case SC_7:
+ updateMapPiece(PIC_MAP_S07, 1);
+
+ if (pre->keyCode == TrubaLeft)
+ updateMapPiece(PIC_MAP_P18, 1);
+
+ break;
+
+ case SC_8:
+ updateMapPiece(PIC_MAP_S08, 1);
+
+ if (pre->keyCode == TrubaUp)
+ updateMapPiece(PIC_MAP_P11, 1);
+
+ if (pre->keyCode == TrubaRight)
+ updateMapPiece(PIC_MAP_P18, 1);
+
+ return;
+
+ case SC_9:
+ updateMapPiece(PIC_MAP_S09, 1);
+
+ if (pre->keyCode == TrubaDown)
+ updateMapPiece(PIC_MAP_P11, 1);
+
+ return;
+
+ case SC_10:
+ updateMapPiece(PIC_MAP_S10, 1);
+
+ if (pre->keyCode == TrubaRight)
+ updateMapPiece(PIC_MAP_P02, 1);
+
+ break;
+
+ case SC_11:
+ updateMapPiece(PIC_MAP_S11, 1);
+
+ if (pre->keyCode == TrubaLeft)
+ updateMapPiece(PIC_MAP_P02, 1);
+
+ break;
+
+ case SC_12:
+ updateMapPiece(PIC_MAP_S12, 1);
+ break;
+
+ case SC_13:
+ updateMapPiece(PIC_MAP_S13, 1);
+
+ if (pre->keyCode == TrubaUp) {
+ updateMapPiece(PIC_MAP_P06, 1);
+ updateMapPiece(PIC_MAP_A10, 1);
+ }
+ break;
+
+ case SC_14:
+ updateMapPiece(PIC_MAP_S14, 1);
+ break;
+
+ case SC_15:
+ updateMapPiece(PIC_MAP_S15, 1);
+
+ if (pre->keyCode == TrubaUp) {
+ updateMapPiece(PIC_MAP_P08, 1);
+ updateMapPiece(PIC_MAP_A14, 1);
+ }
+
+ break;
+
+ case SC_16:
+ updateMapPiece(PIC_MAP_S16, 1);
+ break;
+
+ case SC_17:
+ updateMapPiece(PIC_MAP_S17, 1);
+ break;
+
+ case SC_18:
+ updateMapPiece(PIC_MAP_S1819, 1);
+
+ if (pre->keyCode == PIC_SC18_RTRUBA)
+ updateMapPiece(PIC_MAP_P14, 1);
+
+ break;
+
+ case SC_19:
+ updateMapPiece(PIC_MAP_S1819, 1);
+
+ if (pre->keyCode == PIC_SC19_RTRUBA3) {
+ updateMapPiece(PIC_MAP_P15, 1);
+ updateMapPiece(PIC_MAP_A09, 1);
+ }
+
+ break;
+
+ case SC_20:
+ updateMapPiece(PIC_MAP_S20, 1);
+ break;
+
+ case SC_21:
+ updateMapPiece(PIC_MAP_S21, 1);
+
+ if (pre->keyCode == TrubaLeft) {
+ updateMapPiece(PIC_MAP_P15, 1);
+ updateMapPiece(PIC_MAP_A09, 1);
+ }
+
+ if (pre->keyCode == TrubaDown)
+ updateMapPiece(PIC_MAP_A08, 1);
+
+ break;
+
+ case SC_22:
+ updateMapPiece(PIC_MAP_S22, 1);
+ break;
+
+ case SC_23:
+ if (getObjectState("Верхний люк_23") == getObjectEnumState("Верхний люк_23", "Открыт")) {
+ updateMapPiece(PIC_MAP_S23_1, 0);
+ updateMapPiece(PIC_MAP_S23_2, 1);
+ updateMapPiece(PIC_MAP_P07, 1);
+ } else {
+ updateMapPiece(PIC_MAP_S23_1, 1);
+ updateMapPiece(PIC_MAP_S23_2, 0);
+ }
+ break;
+
+ case SC_24:
+ updateMapPiece(PIC_MAP_S24, 1);
+
+ if (pre->keyCode == TrubaUp)
+ updateMapPiece(PIC_MAP_A08, 1);
+
+ if (pre->keyCode == TrubaDown) {
+ updateMapPiece(PIC_MAP_P13, 1);
+ updateMapPiece(PIC_MAP_A07, 1);
+ }
+ break;
+
+ case SC_25:
+ updateMapPiece(PIC_MAP_S25, 1);
+ break;
+
+ case SC_26:
+ updateMapPiece(PIC_MAP_S26, 1);
+
+ if (pre->keyCode == TrubaLeft)
+ updateMapPiece(PIC_MAP_A06, 1);
+
+ if (pre->keyCode == TrubaUp) {
+ updateMapPiece(PIC_MAP_P13, 1);
+ updateMapPiece(PIC_MAP_A07, 1);
+ }
+
+ break;
+
+ case SC_27:
+ updateMapPiece(PIC_MAP_S27, 1);
+ break;
+
+ case SC_28:
+ updateMapPiece(PIC_MAP_S28, 1);
+
+ if (pre->keyCode == TrubaRight)
+ updateMapPiece(PIC_MAP_A06, 1);
+
+ break;
+
+ case SC_29:
+ updateMapPiece(PIC_MAP_S29, 1);
+
+ if (pre->keyCode == TrubaUp)
+ updateMapPiece(PIC_MAP_A05, 1);
+
+ break;
+
+ case SC_30:
+ updateMapPiece(PIC_MAP_S30, 1);
+
+ if (pre->keyCode == TrubaLeft)
+ updateMapPiece(PIC_MAP_P09, 1);
+
+ if (pre->keyCode == TrubaRight)
+ updateMapPiece(PIC_MAP_A04, 1);
+
+ break;
+
+ case SC_31:
+ updateMapPiece(PIC_MAP_S31_2, 1);
+
+ if (getObjectState("Кактус") == getObjectEnumState("Кактус", "Вырос"))
+ updateMapPiece(PIC_MAP_S31_1, 1);
+
+ if (pre->keyCode == TrubaRight)
+ updateMapPiece(PIC_MAP_P09, 1);
+
+ break;
+
+ case SC_32:
+ updateMapPiece(PIC_MAP_S32_2, 1);
+
+ if (getObjectState("Кактус") == getObjectEnumState("Кактус", "Вырос"))
+ updateMapPiece(PIC_MAP_S32_1, 1);
+
+ break;
+
+ case SC_33:
+ updateMapPiece(PIC_MAP_S33, 1);
+ break;
+
+ case SC_34:
+ updateMapPiece(PIC_MAP_S34, 1);
+
+ if (pre->keyCode == TrubaUp)
+ updateMapPiece(PIC_MAP_A03, 1);
+
+ break;
+
+ case SC_35:
+ updateMapPiece(PIC_MAP_S35, 1);
+
+ if (pre->keyCode == TrubaLeft)
+ updateMapPiece(PIC_MAP_A02, 1);
+
+ if (pre->keyCode == TrubaDown)
+ updateMapPiece(PIC_MAP_A03, 1);
+
+ break;
+
+ case SC_36:
+ updateMapPiece(PIC_MAP_S36, 1);
+ break;
+
+ case SC_37:
+ updateMapPiece(PIC_MAP_S37, 1);
+ updateMapPiece(PIC_MAP_A01, 1);
+ break;
+
+ case SC_38:
+ updateMapPiece(PIC_MAP_S38, 1);
+
+ switch (pre->preloadId1) {
+ case SC_15:
+ updateMapPiece(PIC_MAP_P16, 1);
+ break;
+
+ case SC_1:
+ updateMapPiece(PIC_MAP_P10, 1);
+ break;
+
+ case SC_10:
+ updateMapPiece(PIC_MAP_P17, 1);
+ break;
+
+ case SC_19:
+ updateMapPiece(PIC_MAP_P12, 1);
+ break;
+ }
+ break;
+ }
}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index 277beb0083..b35d0eb87f 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -25,6 +25,10 @@
namespace Fullpipe {
+struct BehaviorEntryInfo;
+class MGM;
+class MctlLadder;
+struct Ring;
class StaticANIObject;
int defaultUpdateCursor();
@@ -49,6 +53,126 @@ int scene04_updateCursor();
void scene04_initScene(Scene *sc);
int sceneHandler04(ExCommand *cmd);
+void scene05_initScene(Scene *sc);
+int sceneHandler05(ExCommand *cmd);
+
+void scene06_initScene(Scene *sc);
+void scene06_initMumsy();
+int sceneHandler06(ExCommand *cmd);
+int scene06_updateCursor();
+
+void scene07_initScene(Scene *sc);
+int sceneHandler07(ExCommand *cmd);
+
+void scene08_initScene(Scene *sc);
+void scene08_setupMusic();
+int sceneHandler08(ExCommand *cmd);
+int scene08_updateCursor();
+
+void scene10_initScene(Scene *sc);
+int sceneHandler10(ExCommand *cmd);
+int scene10_updateCursor();
+
+void scene11_initScene(Scene *sc);
+void scene11_setupMusic();
+int sceneHandler11(ExCommand *cmd);
+int scene11_updateCursor();
+
+void scene12_initScene(Scene *sc);
+int sceneHandler12(ExCommand *ex);
+
+void scene13_initScene(Scene *sc);
+int sceneHandler13(ExCommand *ex);
+
+void scene14_initScene(Scene *sc);
+void scene14_setupMusic();
+int sceneHandler14(ExCommand *cmd);
+int scene14_updateCursor();
+
+int scene15_updateCursor();
+void scene15_initScene(Scene *sc);
+int sceneHandler15(ExCommand *cmd);
+
+void scene16_initScene(Scene *sc);
+int sceneHandler16(ExCommand *cmd);
+int scene16_updateCursor();
+
+void scene17_initScene(Scene *sc);
+void scene17_restoreState();
+int sceneHandler17(ExCommand *cmd);
+int scene17_updateCursor();
+
+void scene18_preload();
+void scene19_preload(Scene *sc, int key);
+
+void scene20_initScene(Scene *sc);
+int sceneHandler20(ExCommand *ex);
+
+int scene21_updateCursor();
+void scene21_initScene(Scene *sc);
+int sceneHandler21(ExCommand *cmd);
+
+void scene22_initScene(Scene *sc);
+void scene22_setBagState();
+int sceneHandler22(ExCommand *cmd);
+int scene22_updateCursor();
+
+void scene23_initScene(Scene *sc);
+void scene23_setGiraffeState();
+int sceneHandler23(ExCommand *cmd);
+int scene23_updateCursor();
+
+void scene24_initScene(Scene *sc);
+void scene24_setPoolState();
+int sceneHandler24(ExCommand *cmd);
+
+void scene25_initScene(Scene *sc, int entrance);
+void scene25_setupWater(Scene *sc, int entrance);
+int sceneHandler25(ExCommand *cmd);
+int scene25_updateCursor();
+
+void scene26_initScene(Scene *sc);
+void scene26_setupDrop(Scene *sc);
+int sceneHandler26(ExCommand *cmd);
+int scene26_updateCursor();
+
+void scene28_initScene(Scene *sc);
+ int sceneHandler28(ExCommand *ex);
+int scene28_updateCursor();
+
+int scene30_updateCursor();
+void scene30_initScene(Scene *sc, int flag);
+int sceneHandler30(ExCommand *cmd);
+
+void scene31_initScene(Scene *sc);
+int sceneHandler31(ExCommand *ex);
+
+void scene32_initScene(Scene *sc);
+void scene32_setupMusic();
+int sceneHandler32(ExCommand *cmd);
+int scene32_updateCursor();
+
+void scene33_initScene(Scene *sc);
+void scene33_setupMusic();
+int sceneHandler33(ExCommand *cmd);
+int scene33_updateCursor();
+
+void scene34_initScene(Scene *sc);
+void scene34_initBeh();
+int sceneHandler34(ExCommand *cmd);
+int scene34_updateCursor();
+
+void scene35_initScene(Scene *sc);
+int sceneHandler35(ExCommand *cmd);
+
+int scene36_updateCursor();
+void scene36_initScene(Scene *sc);
+int sceneHandler36(ExCommand *cmd);
+
+void scene37_initScene(Scene *sc);
+int sceneHandler37(ExCommand *ex);
+int scene37_updateCursor();
+
void sceneDbgMenu_initScene(Scene *sc);
int sceneHandlerDbgMenu(ExCommand *cmd);
@@ -89,43 +213,344 @@ public:
Common::Point scene04_jumpingKozyawki[20];
Common::Point scene04_jumpRotateKozyawki[20];
- Common::Array<StaticANIObject *> scene04_kozyawkiObjList;
- Common::Array<GameObject *> scene04_bottleObjList;
- Common::Array<StaticANIObject *> scene04_kozyawkiAni;
+ Common::List<StaticANIObject *> scene04_kozyawkiObjList;
+ Common::List<GameObject *> scene04_bottleObjList;
+ Common::List<StaticANIObject *> scene04_kozyawkiAni;
+
+ MctlLadder *scene04_ladder;
+ int scene04_ladderOffset;
- int scene04_ladder;
bool scene04_coinPut;
bool scene04_soundPlaying;
+ bool scene04_dudeOnLadder;
+
int scene04_dynamicPhaseIndex;
int scene04_sceneClickX;
int scene04_sceneClickY;
int scene04_dudePosX;
int scene04_dudePosY;
+ int scene04_bottleY;
+
+ StaticANIObject *scene04_walkingKozyawka;
+
+ int scene04_speakerVariant;
+ int scene04_speakerPhase;
- int scene04_var01;
- int scene04_var02;
- int scene04_var04;
- StaticANIObject *scene04_var05;
- int scene04_var06;
- int scene04_var07;
- int scene04_var08;
- int scene04_var09;
- int scene04_var10;
- int scene04_var11;
- int scene04_var12;
- int scene04_var13;
- int scene04_var14;
- int scene04_var15;
- int scene04_var16;
- int scene04_var17;
- int scene04_var18;
- int scene04_var19;
- int scene04_var20;
- StaticANIObject *scene04_var24;
+ bool scene04_bottleIsTaken;
+ bool scene04_kozyawkaOnLadder;
+ int scene04_bottleWeight;
+ bool scene04_var07;
+ bool scene04_ladderClickable;
+ bool scene04_handIsDown;
+ bool scene04_dudeInBottle;
+ bool scene04_kozHeadRaised;
+ bool scene04_bottleIsDropped;
+ bool scene04_bigBallIn;
+ int scene04_bigBallCounter;
+ bool scene04_bigBallFromLeft;
+ bool scene04_clockCanGo;
+ bool scene04_objectIsTaken;
+ int scene04_springOffset;
+ StaticANIObject *scene04_lastKozyawka;
+ int scene04_springDelay;
+
+ StaticANIObject *scene05_handle;
+ StaticANIObject *scene05_wacko;
+ StaticANIObject *scene05_bigHatch;
+ int scene05_wackoTicker;
+ int scene05_handleFlipper;
+ int scene05_floatersTicker;
+
+ StaticANIObject *scene06_mumsy;
+ int scene06_manX;
+ int scene06_manY;
+ int scene06_ballX;
+ int scene06_ballY;
+ StaticANIObject *scene06_someBall;
+ StaticANIObject *scene06_invHandle;
+ StaticANIObject *scene06_liftButton;
+ StaticANIObject *scene06_ballDrop;
+ bool scene06_arcadeEnabled;
+ bool scene06_aimingBall;
+ StaticANIObject *scene06_currentBall;
+ StaticANIObject *scene06_ballInHands;
+ StaticANIObject *scene06_flyingBall;
+ Common::Array<StaticANIObject *> scene06_balls;
+ int scene06_numBallsGiven;
+ int scene06_mumsyNumBalls;
+ int scene06_eggieTimeout;
+ int scene06_eggieDirection;
+ int scene06_mumsyGotBall;
+ int scene06_ballDeltaX;
+ int scene06_ballDeltaY;
+ int scene06_sceneClickX;
+ int scene06_sceneClickY;
+ int scene06_mumsyPos;
+ BehaviorEntryInfo *scene06_mumsyJumpBk;
+ BehaviorEntryInfo *scene06_mumsyJumpFw;
+ int scene06_mumsyJumpBkPercent;
+ int scene06_mumsyJumpFwPercent;
+
+ BehaviorEntryInfo *scene07_lukeAnim;
+ int scene07_lukePercent;
+ StaticANIObject *scene07_plusMinus;
+
+ StaticANIObject *scene08_batuta;
+ StaticANIObject *scene08_vmyats;
+ StaticANIObject *scene08_clock;
+ bool scene08_inAir;
+ bool scene08_flyingUp;
+ int scene08_onBelly;
+ int scene08_stairsOffset;
+ int scene08_snoringCountdown;
+ bool scene08_inArcade;
+ bool scene08_stairsVisible;
+ int scene08_manOffsetY;
+
+ StaticANIObject *scene10_gum;
+ StaticANIObject *scene10_packet;
+ StaticANIObject *scene10_packet2;
+ StaticANIObject *scene10_inflater;
+ PictureObject *scene10_ladder;
+ int scene10_hasGum;
+
+ StaticANIObject *scene11_swingie;
+ StaticANIObject *scene11_boots;
+ StaticANIObject *scene11_dudeOnSwing;
+ PictureObject *scene11_hint;
+ MGM scene11_mgm;
+ bool scene11_arcadeIsOn;
+ bool scene11_scrollIsEnabled;
+ bool scene11_scrollIsMaximized;
+ int scene11_hintCounter;
+ int scene11_swingieScreenEdge;
+ int scene11_crySound;
+ double scene11_swingAngle;
+ double scene11_swingOldAngle;
+ double scene11_swingSpeed;
+ double scene11_swingAngleDiff;
+ double scene11_swingInertia;
+ int scene11_swingCounter;
+ int scene11_swingCounterPrevTurn;
+ int scene11_swingDirection;
+ int scene11_swingDirectionPrevTurn;
+ bool scene11_swingIsSwinging;
+ bool scene11_swingieStands;
+ int scene11_dudeX;
+ int scene11_dudeY;
+ int scene11_swingMaxAngle;
+
+ int scene12_fly;
+ int scene12_flyCountdown;
+
+ StaticANIObject *scene13_whirlgig;
+ StaticANIObject *scene13_guard;
+ StaticANIObject *scene13_handleR;
+ StaticANIObject *scene13_handleL;
+ StaticANIObject *scene13_bridge;
+ bool scene13_guardDirection;
+ int scene13_dudeX;
+
+ StaticANIObject *scene14_grandma;
+ int scene14_sceneDeltaX;
+ int scene14_sceneDeltaY;
+ bool scene14_arcadeIsOn;
+ bool scene14_dudeIsKicking;
+ bool scene14_ballIsFlying;
+ bool scene14_dudeCanKick;
+ int scene14_sceneDiffX;
+ int scene14_sceneDiffY;
+ StaticANIObject *scene14_pink;
+ StaticANIObject *scene14_flyingBall;
+ Common::List<StaticANIObject *> scene14_balls;
+ bool scene14_grandmaIsHere;
+ int scene14_dudeX;
+ int scene14_dudeY;
+ int scene14_grandmaX;
+ int scene14_grandmaY;
+ int scene14_dude2X;
+ int scene14_ballDeltaX;
+ int scene14_ballDeltaY;
+ int scene14_ballX;
+ int scene14_ballY;
+ int scene14_hitsLeft;
+ Common::Point scene14_mouseCursorPos;
+
+ int scene15_chantingCountdown;
+ StaticANIObject *scene15_plusminus;
+ PictureObject *scene15_ladder;
+ StaticANIObject *scene15_boot;
+
+ Common::List<StaticANIObject *> scene16_figures;
+ StaticANIObject *scene16_walkingBoy;
+ StaticANIObject *scene16_walkingGirl;
+ int scene16_walkingCount;
+ StaticANIObject *scene16_wire;
+ StaticANIObject *scene16_mug;
+ StaticANIObject *scene16_jettie;
+ StaticANIObject *scene16_boot;
+ bool scene16_girlIsLaughing;
+ int scene16_sound;
+ bool scene16_placeIsOccupied;
+
+ int scene17_flyState;
+ bool scene17_sugarIsShown;
+ int scene17_sceneOldEdgeX;
+ int scene17_flyCountdown;
+ StaticANIObject *scene17_hand;
+ bool scene17_handPhase;
+ int scene17_sceneEdgeX;
+
+ int scene18_var01;
+
+ int scene20_fliesCountdown;
+ StaticANIObject *scene20_grandma;
+
+ StaticANIObject *scene21_giraffeBottom;
+ int scene21_giraffeBottomX;
+ int scene21_giraffeBottomY;
+ int scene21_pipeIsOpen;
+ double scene21_wigglePos;
+ bool scene21_wiggleTrigger;
+
+ StaticANIObject *scene22_bag;
+ StaticANIObject *scene22_giraffeMiddle;
+ bool scene22_dudeIsOnStool;
+ bool scene22_interactionIsDisabled;
+ bool scene22_craneIsOut;
+ int scene22_numBagFalls;
+
+ StaticANIObject *scene23_calend0;
+ StaticANIObject *scene23_calend1;
+ StaticANIObject *scene23_calend2;
+ StaticANIObject *scene23_calend3;
+ bool scene23_topReached;
+ bool scene23_isOnStool;
+ int scene23_someVar;
+ StaticANIObject *scene23_giraffeTop;
+ StaticANIObject *scene23_giraffee;
+
+ bool scene24_jetIsOn;
+ bool scene24_flowIsLow;
+ bool scene24_waterIsOn;
+ StaticANIObject *scene24_water;
+ StaticANIObject *scene24_jet;
+ StaticANIObject *scene24_drop;
+
+ StaticANIObject *scene25_water;
+ StaticANIObject *scene25_board;
+ StaticANIObject *scene25_drop;
+ bool scene25_dudeIsOnBoard;
+ bool scene25_waterIsPresent;
+ bool scene25_boardIsSelectable;
+ bool scene25_beardersAreThere;
+ int scene25_beardersCounter;
+ Common::Array<StaticANIObject *> scene25_bearders;
+ bool scene25_sneezeFlipper;
+
+ StaticANIObject *scene26_chhi;
+ StaticANIObject *scene26_drop;
+ PictureObject *scene26_sockPic;
+ StaticANIObject *scene26_sock;
+ StaticANIObject *scene26_activeVent;
+
+ bool scene28_fliesArePresent;
+ bool scene28_beardedDirection;
+ PictureObject *scene28_darkeningObject;
+ PictureObject *scene28_lighteningObject;
+ bool scene28_headDirection;
+ bool scene28_headBeardedFlipper;
+ bool scene28_lift6inside;
+
+ StaticANIObject *scene30_leg;
+ int scene30_liftFlag;
+
+ int scene31_chantingCountdown;
+ StaticANIObject *scene31_cactus;
+ StaticANIObject *scene31_plusMinus;
+
+ bool scene32_flagIsWaving;
+ bool scene32_flagNeedsStopping;
+ bool scene32_dudeIsSitting;
+ int scene32_cactusCounter;
+ bool scene32_dudeOnLadder;
+ bool scene32_cactusIsGrowing;
+ StaticANIObject *scene32_flag;
+ StaticANIObject *scene32_cactus;
+ StaticANIObject *scene32_massOrange;
+ StaticANIObject *scene32_massBlue;
+ StaticANIObject *scene32_massGreen;
+ StaticANIObject *scene32_button;
+
+ StaticANIObject *scene33_mug;
+ StaticANIObject *scene33_jettie;
+ StaticANIObject *scene33_cube;
+ int scene33_cubeX;
+ bool scene33_handleIsDown;
+ int scene33_ventsX[9];
+ int scene33_ventsState[9];
+
+ StaticANIObject *scene34_cactus;
+ StaticANIObject *scene34_vent;
+ StaticANIObject *scene34_hatch;
+ StaticANIObject *scene34_boot;
+ bool scene34_dudeClimbed;
+ bool scene34_dudeOnBoard;
+ bool scene34_dudeOnCactus;
+ int scene34_fliesCountdown;
+
+ StaticANIObject *scene35_hose;
+ StaticANIObject *scene35_bellyInflater;
+ int scene35_flowCounter;
+ int scene35_fliesCounter;
+
+ StaticANIObject *scene36_rotohrust;
+ StaticANIObject *scene36_scissors;
+
+ Common::Array<Ring *> scene37_rings;
+ int scene37_lastDudeX;
+ bool scene37_cursorIsLocked;
+ StaticANIObject *scene37_plusMinus1;
+ StaticANIObject *scene37_plusMinus2;
+ StaticANIObject *scene37_plusMinus3;
+ int scene37_soundFlipper;
+ int scene37_dudeX;
+
+ int scene38_var01;
+ int scene38_var02;
+ int scene38_var03;
+ int scene38_var04;
+ StaticANIObject *scene38_boss;
+ StaticANIObject *scene38_tally;
+ StaticANIObject *scene38_shorty;
+ StaticANIObject *scene38_domino0;
+ StaticANIObject *scene38_dominos;
+ StaticANIObject *scene38_domino1;
+ StaticANIObject *scene38_bottle;
+ int scene38_var05;
+ int scene38_var06;
+ int scene38_var07;
+ int scene38_var08;
+ int scene38_var09;
+ int scene38_var10;
+ int scene38_var11;
+ int scene38_var12;
+ int scene38_var13;
PictureObject *selector;
};
+struct Ring {
+ StaticANIObject *ani;
+ int x;
+ int y;
+ int numSubRings;
+ int subRings[10];
+ bool state;
+
+ Ring();
+};
+
} // End of namespace Fullpipe
#endif /* FULLPIPE_SCENES_H */
diff --git a/engines/fullpipe/scenes/scene01.cpp b/engines/fullpipe/scenes/scene01.cpp
index 4181bbffe3..6c8f26d209 100644
--- a/engines/fullpipe/scenes/scene01.cpp
+++ b/engines/fullpipe/scenes/scene01.cpp
@@ -26,6 +26,7 @@
#include "fullpipe/constants.h"
#include "fullpipe/gameloader.h"
+#include "fullpipe/motion.h"
#include "fullpipe/scenes.h"
#include "fullpipe/statics.h"
@@ -36,7 +37,7 @@
namespace Fullpipe {
void scene01_fixEntrance() {
- GameVar *var = g_fullpipe->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName("SAVEGAME");
+ GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName("SAVEGAME");
if (var->getSubVarAsInt("Entrance") == TrubaLeft)
var->setSubVarAsInt("Entrance", TrubaRight);
}
@@ -48,7 +49,7 @@ void scene01_initScene(Scene *sc, int entrance) {
g_vars->scene01_picSc01Osk2 = sc->getPictureObjectById(PIC_SC1_OSK2, 0);
g_vars->scene01_picSc01Osk2->_flags &= 0xFFFB;
- if (g_fullpipe->getObjectState(sO_EggCracker) == g_fullpipe->getObjectEnumState(sO_EggCracker, sO_DidNotCrackEgg)) {
+ if (g_fp->getObjectState(sO_EggCracker) == g_fp->getObjectEnumState(sO_EggCracker, sO_DidNotCrackEgg)) {
PictureObject *pic = sc->getPictureObjectById(PIC_SC1_KUCHKA, 0);
if (pic)
pic->_flags &= 0xFFFB;
@@ -60,7 +61,7 @@ void scene01_initScene(Scene *sc, int entrance) {
bootAnim->_flags &= ~0x04;
}
- g_fullpipe->lift_setButton(sO_Level2, ST_LBN_2N);
+ g_fp->lift_setButton(sO_Level2, ST_LBN_2N);
}
int sceneHandler01(ExCommand *cmd) {
@@ -71,7 +72,7 @@ int sceneHandler01(ExCommand *cmd) {
if (cmd->_messageNum > MSG_SC1_SHOWOSK) {
if (cmd->_messageNum == MSG_SC1_UTRUBACLICK)
- handleObjectInteraction(g_fullpipe->_aniMan, g_fullpipe->_currentScene->getPictureObjectById(PIC_SC1_LADDER, 0), 0);
+ handleObjectInteraction(g_fp->_aniMan, g_fp->_currentScene->getPictureObjectById(PIC_SC1_LADDER, 0), 0);
return 0;
}
@@ -97,19 +98,19 @@ int sceneHandler01(ExCommand *cmd) {
return 0;
}
- if (g_fullpipe->_aniMan2) {
- if (g_fullpipe->_aniMan2->_ox < g_fullpipe->_sceneRect.left + 200) {
- g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.left - 300;
+ if (g_fp->_aniMan2) {
+ if (g_fp->_aniMan2->_ox < g_fp->_sceneRect.left + 200) {
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.left - 300;
}
- if (g_fullpipe->_aniMan2->_ox > g_fullpipe->_sceneRect.right - 200)
- g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.right + 300;
+ if (g_fp->_aniMan2->_ox > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.right + 300;
res = 1;
}
- g_fullpipe->_behaviorManager->updateBehaviors();
+ g_fp->_behaviorManager->updateBehaviors();
- g_fullpipe->startSceneTrack();
+ g_fp->startSceneTrack();
return res;
}
diff --git a/engines/fullpipe/scenes/scene02.cpp b/engines/fullpipe/scenes/scene02.cpp
index dd01af4c4b..95cf1df7dd 100644
--- a/engines/fullpipe/scenes/scene02.cpp
+++ b/engines/fullpipe/scenes/scene02.cpp
@@ -26,6 +26,7 @@
#include "fullpipe/constants.h"
#include "fullpipe/gameloader.h"
+#include "fullpipe/motion.h"
#include "fullpipe/scenes.h"
#include "fullpipe/statics.h"
@@ -39,12 +40,12 @@ namespace Fullpipe {
void scene02_initScene(Scene *sc) {
g_vars->scene02_guvTheDrawer = sc->getStaticANIObject1ById(ANI_DADAYASHIK, -1);
- if (g_fullpipe->getObjectState(sO_GuvTheDrawer) == g_fullpipe->getObjectEnumState(sO_GuvTheDrawer, sO_Sleeping)) {
- Scene *s = g_fullpipe->_currentScene;
+ if (g_fp->getObjectState(sO_GuvTheDrawer) == g_fp->getObjectEnumState(sO_GuvTheDrawer, sO_IsSleeping)) {
+ Scene *s = g_fp->_currentScene;
- g_fullpipe->_currentScene = sc;
+ g_fp->_currentScene = sc;
g_vars->scene02_guvTheDrawer->changeStatics2(ST_DYAS_LIES);
- g_fullpipe->_currentScene = s;
+ g_fp->_currentScene = s;
}
g_vars->scene02_boxDelay = 0;
@@ -55,23 +56,23 @@ void scene02_initScene(Scene *sc) {
g_vars->scene02_boxOpen = false;
} else {
g_vars->scene02_boxOpen = true;
- g_vars->scene02_boxDelay = 100 * g_fullpipe->_rnd->getRandomNumber(32767) + 150;
+ g_vars->scene02_boxDelay = 100 * g_fp->_rnd->getRandomNumber(32767) + 150;
}
- g_fullpipe->_floaters->init(g_fullpipe->_gameLoader->_gameVar->getSubVarByName("SC_2"));
+ g_fp->_floaters->init(g_fp->_gameLoader->_gameVar->getSubVarByName("SC_2"));
}
void sceneHandler02_ladderClick() {
- handleObjectInteraction(g_fullpipe->_aniMan2, g_fullpipe->_currentScene->getPictureObjectById(PIC_SC2_DTRUBA, 0), 0);
+ handleObjectInteraction(g_fp->_aniMan2, g_fp->_currentScene->getPictureObjectById(PIC_SC2_DTRUBA, 0), 0);
}
void sceneHandler02_showLadder() {
- g_fullpipe->_currentScene->getPictureObjectById(PIC_SC2_LADDER, 0)->_flags |= 4;
+ g_fp->_currentScene->getPictureObjectById(PIC_SC2_LADDER, 0)->_flags |= 4;
}
void sceneHandler02_hideLadder() {
- g_fullpipe->_currentScene->getPictureObjectById(PIC_SC2_LADDER, 0)->_flags &= 0xfffb;
- g_fullpipe->_aniMan2->_priority = 25;
+ g_fp->_currentScene->getPictureObjectById(PIC_SC2_LADDER, 0)->_flags &= 0xfffb;
+ g_fp->_aniMan2->_priority = 25;
}
int sceneHandler02(ExCommand *ex) {
@@ -90,7 +91,7 @@ int sceneHandler02(ExCommand *ex) {
return 0;
case MSG_SC2_PUTMANUP:
- g_fullpipe->_aniMan2->_priority = 0;
+ g_fp->_aniMan2->_priority = 0;
return 0;
case MSG_SC2_HIDELADDER:
@@ -98,12 +99,12 @@ int sceneHandler02(ExCommand *ex) {
return 0;
case 33:
- if (g_fullpipe->_aniMan2) {
- if (g_fullpipe->_aniMan2->_ox < g_fullpipe->_sceneRect.left + 200)
- g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.left - 300;
+ if (g_fp->_aniMan2) {
+ if (g_fp->_aniMan2->_ox < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.left - 300;
- if (g_fullpipe->_aniMan2->_ox > g_fullpipe->_sceneRect.right - 200)
- g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.right + 300;
+ if (g_fp->_aniMan2->_ox > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.right + 300;
res = 1;
}
@@ -111,24 +112,24 @@ int sceneHandler02(ExCommand *ex) {
if (g_vars->scene02_boxOpen) {
if (g_vars->scene02_boxDelay >= 1) {
--g_vars->scene02_boxDelay;
- } else if (g_fullpipe->_floaters->_array2.size() >= 1) {
- if (g_fullpipe->_floaters->_array2[0]->val5 == -50) {
- g_fullpipe->_floaters->stopAll();
+ } else if (g_fp->_floaters->_array2.size() >= 1) {
+ if (g_fp->_floaters->_array2[0]->val5 == -50) {
+ g_fp->_floaters->stopAll();
g_vars->scene02_boxOpen = false;
- g_vars->scene02_boxDelay = 100 * g_fullpipe->_rnd->getRandomNumber(32767) + 150;
+ g_vars->scene02_boxDelay = 100 * g_fp->_rnd->getRandomNumber(32767) + 150;
} else {
- g_fullpipe->_floaters->_array2[0]->val3 = -50;
+ g_fp->_floaters->_array2[0]->val3 = -50;
}
} else {
- g_fullpipe->_floaters->genFlies(g_fullpipe->_currentScene, g_fullpipe->_rnd->getRandomNumber(700) + 100, -50, 0, 0);
- g_vars->scene02_boxDelay = 500 * g_fullpipe->_rnd->getRandomNumber(32767) + 1000;
+ g_fp->_floaters->genFlies(g_fp->_currentScene, g_fp->_rnd->getRandomNumber(700) + 100, -50, 0, 0);
+ g_vars->scene02_boxDelay = 500 * g_fp->_rnd->getRandomNumber(32767) + 1000;
}
}
- g_fullpipe->_floaters->update();
- g_fullpipe->_behaviorManager->updateBehaviors();
+ g_fp->_floaters->update();
+ g_fp->_behaviorManager->updateBehaviors();
- g_fullpipe->startSceneTrack();
+ g_fp->startSceneTrack();
}
return res;
diff --git a/engines/fullpipe/scenes/scene03.cpp b/engines/fullpipe/scenes/scene03.cpp
index e9f8a240e8..40e70e2ea5 100644
--- a/engines/fullpipe/scenes/scene03.cpp
+++ b/engines/fullpipe/scenes/scene03.cpp
@@ -26,6 +26,7 @@
#include "fullpipe/constants.h"
#include "fullpipe/gameloader.h"
+#include "fullpipe/motion.h"
#include "fullpipe/scenes.h"
#include "fullpipe/statics.h"
@@ -50,34 +51,34 @@ void scene03_initScene(Scene *sc) {
g_vars->scene03_eggeater = sc->getStaticANIObject1ById(ANI_EGGEATER, -1);
g_vars->scene03_domino = sc->getStaticANIObject1ById(ANI_DOMINO_3, -1);
- GameVar *v = g_fullpipe->_gameLoader->_gameVar->getSubVarByName("OBJSTATES")->getSubVarByName(sO_GulpedEggs);
+ GameVar *v = g_fp->_gameLoader->_gameVar->getSubVarByName("OBJSTATES")->getSubVarByName(sO_GulpedEggs);
g_vars->swallowedEgg1 = v->getSubVarByName(sO_Egg1);
g_vars->swallowedEgg2 = v->getSubVarByName(sO_Egg2);
g_vars->swallowedEgg3 = v->getSubVarByName(sO_Egg3);
- g_fullpipe->lift_setButton(sO_Level2, ST_LBN_2N);
+ g_fp->lift_setButton(sO_Level2, ST_LBN_2N);
- g_fullpipe->lift_sub5(sc, QU_SC3_ENTERLIFT, QU_SC3_EXITLIFT);
+ g_fp->lift_sub5(sc, QU_SC3_ENTERLIFT, QU_SC3_EXITLIFT);
}
void scene03_setEaterState() {
- if (g_fullpipe->getObjectState(sO_EggGulperGaveCoin) == g_fullpipe->getObjectEnumState(sO_EggGulperGaveCoin, sO_Yes)) {
- g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_SLIM, QU_EGTR_SLIMSHOW, 0);
- g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID1, QU_EGTR_MD1_SHOW, 0);
- g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID2, QU_EGTR_MD2_SHOW, 0);
+ if (g_fp->getObjectState(sO_EggGulperGaveCoin) == g_fp->getObjectEnumState(sO_EggGulperGaveCoin, sO_Yes)) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_SLIM, QU_EGTR_SLIMSHOW, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID1, QU_EGTR_MD1_SHOW, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID2, QU_EGTR_MD2_SHOW, 0);
}
}
int scene03_updateCursor() {
- g_fullpipe->updateCursorCommon();
+ g_fp->updateCursorCommon();
- if (g_fullpipe->_cursorId == PIC_CSR_DEFAULT && g_fullpipe->_objectIdAtCursor == PIC_SC3_DOMIN && g_vars->scene03_domino) {
+ if (g_fp->_cursorId == PIC_CSR_DEFAULT && g_fp->_objectIdAtCursor == PIC_SC3_DOMIN && g_vars->scene03_domino) {
if (g_vars->scene03_domino->_flags & 4)
- g_fullpipe->_cursorId = PIC_CSR_ITN;
+ g_fp->_cursorId = PIC_CSR_ITN;
}
- return g_fullpipe->_cursorId;
+ return g_fp->_cursorId;
}
void sceneHandler03_eaterFat() {
@@ -94,7 +95,7 @@ void sceneHandler03_swallowEgg(int item) {
} else if (!g_vars->swallowedEgg3->_value.intValue) {
g_vars->swallowedEgg3->_value.intValue = item;
- g_fullpipe->setObjectState(sO_EggGulperGaveCoin, g_fullpipe->getObjectEnumState(sO_EggGulperGaveCoin, sO_Yes));
+ g_fp->setObjectState(sO_EggGulperGaveCoin, g_fp->getObjectEnumState(sO_EggGulperGaveCoin, sO_Yes));
scene03_setEaterState();
}
@@ -112,7 +113,7 @@ int sceneHandler03_swallowedEgg1State() {
}
void sceneHandler03_giveCoin(ExCommand *ex) {
- MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex->_parId);
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex->_parId);
if (mq && mq->getCount() > 0) {
ExCommand *ex0 = mq->getExCommandByIndex(0);
@@ -136,7 +137,7 @@ void sceneHandler03_giveCoin(ExCommand *ex) {
}
void sceneHandler03_goLadder() {
- handleObjectInteraction(g_fullpipe->_aniMan, g_fullpipe->_currentScene->getPictureObjectById(PIC_SC3_LADDER, 0), 0);
+ handleObjectInteraction(g_fp->_aniMan, g_fp->_currentScene->getPictureObjectById(PIC_SC3_LADDER, 0), 0);
}
void sceneHandler03_pushEggStack() {
@@ -158,7 +159,7 @@ void sceneHandler03_releaseEgg() {
}
void sceneHandler03_takeEgg(ExCommand *ex) {
- MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex->_parId);
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex->_parId);
if (mq && mq->getCount() > 0) {
ExCommand *ex0 = mq->getExCommandByIndex(0);
@@ -179,7 +180,7 @@ void sceneHandler03_takeEgg(ExCommand *ex) {
if (ex1->_objtype == kObjTypeObjstateCommand) {
ObjstateCommand *com = (ObjstateCommand *)ex1;
- com->_value = g_fullpipe->getObjectEnumState(sO_EggGulper, sO_WantsNothing);
+ com->_value = g_fp->getObjectEnumState(sO_EggGulper, sO_WantsNothing);
}
}
}
@@ -194,11 +195,11 @@ int sceneHandler03(ExCommand *ex) {
switch (ex->_messageNum) {
case MSG_LIFT_EXITLIFT:
- g_fullpipe->lift_exitSeq(ex);
+ g_fp->lift_exitSeq(ex);
break;
case MSG_LIFT_CLOSEDOOR:
- g_fullpipe->lift_closedoorSeq();
+ g_fp->lift_closedoorSeq();
break;
case MSG_SC3_ONTAKECOIN:
@@ -206,7 +207,7 @@ int sceneHandler03(ExCommand *ex) {
break;
case MSG_LIFT_STARTEXITQUEUE:
- g_fullpipe->lift_startExitQueue();
+ g_fp->lift_startExitQueue();
break;
case MSG_SC3_RELEASEEGG:
@@ -214,7 +215,7 @@ int sceneHandler03(ExCommand *ex) {
break;
case MSG_LIFT_CLICKBUTTON:
- g_fullpipe->lift_animation3();
+ g_fp->lift_animation3();
break;
case MSG_SC3_HIDEDOMINO:
@@ -226,7 +227,7 @@ int sceneHandler03(ExCommand *ex) {
break;
case MSG_LIFT_GO:
- g_fullpipe->lift_goAnimation();
+ g_fp->lift_goAnimation();
break;
case MSG_SC3_UTRUBACLICK:
@@ -238,25 +239,25 @@ int sceneHandler03(ExCommand *ex) {
break;
case 64:
- g_fullpipe->lift_sub05(ex);
+ g_fp->lift_sub05(ex);
break;
- case 93:
+ case 29:
{
- StaticANIObject *ani = g_fullpipe->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY);
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY);
if (ani && ani->_id == ANI_LIFTBUTTON) {
- g_fullpipe->lift_sub1(ani);
+ g_fp->lift_sub1(ani);
ex->_messageKind = 0;
return 0;
}
- if (g_fullpipe->_currentScene->getPictureObjectIdAtPos(ex->_sceneClickX, ex->_sceneClickY) == PIC_SC3_DOMIN) {
+ if (g_fp->_currentScene->getPictureObjectIdAtPos(ex->_sceneClickX, ex->_sceneClickY) == PIC_SC3_DOMIN) {
if (g_vars->scene03_domino)
if (g_vars->scene03_domino->_flags & 4)
- if (g_fullpipe->_aniMan->isIdle())
- if (!(g_fullpipe->_aniMan->_flags & 0x100) && g_fullpipe->_msgObjectId2 != g_vars->scene03_domino->_id) {
- handleObjectInteraction(g_fullpipe->_aniMan, g_vars->scene03_domino, ex->_keyCode);
+ if (g_fp->_aniMan->isIdle())
+ if (!(g_fp->_aniMan->_flags & 0x100) && g_fp->_msgObjectId2 != g_vars->scene03_domino->_id) {
+ handleObjectInteraction(g_fp->_aniMan, g_vars->scene03_domino, ex->_keyCode);
ex->_messageKind = 0;
return 0;
@@ -266,23 +267,23 @@ int sceneHandler03(ExCommand *ex) {
break;
}
- case 97:
+ case 33:
{
int res = 0;
- if (g_fullpipe->_aniMan2) {
- if (g_fullpipe->_aniMan2->_ox < g_fullpipe->_sceneRect.left + 200)
- g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.left - 300;
+ if (g_fp->_aniMan2) {
+ if (g_fp->_aniMan2->_ox < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.left - 300;
- if (g_fullpipe->_aniMan2->_ox > g_fullpipe->_sceneRect.right - 200)
- g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.right + 300;
+ if (g_fp->_aniMan2->_ox > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.right + 300;
res = 1;
}
- g_fullpipe->_behaviorManager->updateBehaviors();
+ g_fp->_behaviorManager->updateBehaviors();
- g_fullpipe->startSceneTrack();
+ g_fp->startSceneTrack();
return res;
}
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index 5e1454793f..332935072c 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -26,8 +26,9 @@
#include "fullpipe/constants.h"
#include "fullpipe/utils.h"
#include "fullpipe/gfx.h"
-#include "fullpipe/scenes.h"
#include "fullpipe/messages.h"
+#include "fullpipe/motion.h"
+#include "fullpipe/scenes.h"
#include "fullpipe/statics.h"
#include "fullpipe/scene.h"
#include "fullpipe/interaction.h"
@@ -36,12 +37,31 @@
namespace Fullpipe {
-void scene04_callback(int *param) {
- warning("STUB: scene04_callback");
+static const int scene04_speakerPhases[] = {
+ 0, 1, 2, 3, -1, -1,
+ 0, 2, 3, -1, -1, -1,
+ 0, 2, -1, -1, -1, -1
+};
+
+void scene04_speakerCallback(int *phase) {
+ if (g_vars->scene04_soundPlaying) {
+ if (g_vars->scene04_speakerPhase >= 0) {
+ *phase = scene04_speakerPhases[g_vars->scene04_speakerPhase + 6 * g_vars->scene04_speakerVariant];
+
+ g_vars->scene04_speakerPhase++;
+
+ if (scene04_speakerPhases[g_vars->scene04_speakerPhase + 6 * g_vars->scene04_speakerVariant] < 0) {
+ g_vars->scene04_speakerPhase = 0;
+ g_vars->scene04_speakerVariant = g_fp->_rnd->getRandomNumber(2);
+ }
+ } else {
+ ++g_vars->scene04_speakerPhase;
+ }
+ }
}
void scene04_initScene(Scene *sc) {
- g_vars->scene04_var01 = 0;
+ g_vars->scene04_dudeOnLadder = false;
g_vars->scene04_bottle = sc->getPictureObjectById(PIC_SC4_BOTTLE, 0);
g_vars->scene04_hand = sc->getStaticANIObject1ById(ANI_HAND, -1);
g_vars->scene04_plank = sc->getStaticANIObject1ById(ANI_PLANK, -1);
@@ -93,7 +113,7 @@ void scene04_initScene(Scene *sc) {
if (plank)
plank->_flags |= 8;
- if (g_fullpipe->getObjectState(sO_Jar_4) == g_fullpipe->getObjectEnumState(sO_Jar_4, sO_UpsideDown)) {
+ if (g_fp->getObjectState(sO_Jar_4) == g_fp->getObjectEnumState(sO_Jar_4, sO_UpsideDown)) {
g_vars->scene04_bottleObjList.clear();
g_vars->scene04_kozyawkiObjList.clear();
@@ -101,8 +121,8 @@ void scene04_initScene(Scene *sc) {
sc->getPictureObjectById(PIC_SC4_MASK, 0)->_flags &= 0xfffb;
sc->getStaticANIObject1ById(ANI_SPRING, 0)->_flags &= 0xfffb;
- g_vars->scene04_var18 = 0;
- g_vars->scene04_var19 = 0;
+ g_vars->scene04_clockCanGo = false;
+ g_vars->scene04_objectIsTaken = false;
} else {
StaticANIObject *spring = sc->getStaticANIObject1ById(ANI_SPRING, -1);
@@ -136,118 +156,364 @@ void scene04_initScene(Scene *sc) {
}
sc->getPictureObjectById(PIC_SC4_BOTTLE2, 0)->_flags &= 0xfffb;
- g_vars->scene04_var18 = 1;
- g_vars->scene04_var19 = 1;
+ g_vars->scene04_clockCanGo = true;
+ g_vars->scene04_objectIsTaken = true;
}
- g_vars->scene04_var02 = 0;
- g_vars->scene04_soundPlaying = 0;
- g_vars->scene04_var04 = 0;
- g_vars->scene04_var05 = 0;
- g_vars->scene04_var06 = 2;
+ g_vars->scene04_bottleIsTaken = false;
+ g_vars->scene04_soundPlaying = false;
+ g_vars->scene04_kozyawkaOnLadder = false;
+ g_vars->scene04_walkingKozyawka = 0;
+ g_vars->scene04_bottleWeight = 2;
g_vars->scene04_dynamicPhaseIndex = 0;
g_vars->scene04_kozyawkiAni.clear();
- g_fullpipe->setObjectState(sO_LowerPipe, g_fullpipe->getObjectEnumState(sO_LowerPipe, sO_IsClosed));
+ g_fp->setObjectState(sO_LowerPipe, g_fp->getObjectEnumState(sO_LowerPipe, sO_IsClosed));
- g_vars->scene04_var07 = 0;
- g_vars->scene04_var08 = 0;
- g_vars->scene04_coinPut = 0;
- g_vars->scene04_var09 = 0;
- g_vars->scene04_var10 = 0;
- g_vars->scene04_var11 = 0;
- g_vars->scene04_var12 = 0;
- g_vars->scene04_var13 = 1;
- g_vars->scene04_var14 = 0;
- g_vars->scene04_var15 = 1;
+ g_vars->scene04_var07 = false;
+ g_vars->scene04_ladderClickable = false;
+ g_vars->scene04_coinPut = false;
+ g_vars->scene04_handIsDown = false;
+ g_vars->scene04_dudeInBottle = false;
+ g_vars->scene04_kozHeadRaised = false;
+ g_vars->scene04_bottleIsDropped = false;
+ g_vars->scene04_bigBallIn = true;
+ g_vars->scene04_bigBallCounter = 0;
+ g_vars->scene04_bigBallFromLeft = true;
- if (g_fullpipe->getObjectState(sO_BigMumsy) != g_fullpipe->getObjectEnumState(sO_BigMumsy, sO_Gone))
+ if (g_fp->getObjectState(sO_BigMumsy) != g_fp->getObjectEnumState(sO_BigMumsy, sO_IsGone))
g_vars->scene04_mamasha->hide();
g_vars->scene04_speaker = sc->getStaticANIObject1ById(ANI_SPEAKER_4, -1);
- g_vars->scene04_speaker->_callback2 = scene04_callback;
+ g_vars->scene04_speaker->_callback2 = scene04_speakerCallback;
g_vars->scene04_speaker->startAnim(MV_SPK4_PLAY, 0, -1);
- g_vars->scene04_var16 = 0;
- g_vars->scene04_var17 = 0;
+ g_vars->scene04_speakerVariant = 0;
+ g_vars->scene04_speakerPhase = 0;
- g_fullpipe->initArcadeKeys("SC_4");
+ g_fp->initArcadeKeys("SC_4");
}
bool sceneHandler04_friesAreWalking() {
- warning("STUB: sceneHandler04_friesAreWalking()");
+ if (g_vars->scene04_dudeOnLadder && g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
+ int col = g_vars->scene04_ladder->collisionDetection(g_fp->_aniMan);
+ if (col >= 3 && col <= 6 ) {
+ Movement *koz;
+
+ if (!g_vars->scene04_walkingKozyawka
+ || (koz = g_vars->scene04_walkingKozyawka->_movement) == 0
+ || koz->_id != MV_KZW_WALKPLANK
+ || koz->_currDynamicPhaseIndex < 10
+ || koz->_currDynamicPhaseIndex > 41)
+ return true;
+ }
+ }
return false;
}
int scene04_updateCursor() {
- g_fullpipe->updateCursorCommon();
+ g_fp->updateCursorCommon();
- if (g_fullpipe->_objectIdAtCursor == PIC_SC4_LRTRUBA) {
- if (!g_vars->scene04_var19) {
- g_fullpipe->_cursorId = PIC_CSR_DEFAULT;
+ if (g_fp->_objectIdAtCursor == PIC_SC4_LRTRUBA) {
+ if (!g_vars->scene04_objectIsTaken) {
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
- return g_fullpipe->_cursorId;
+ return g_fp->_cursorId;
}
- } else if (g_fullpipe->_objectIdAtCursor == ANI_PLANK || g_fullpipe->_objectIdAtCursor == PIC_SC4_PLANK) {
- if (g_fullpipe->_objectIdAtCursor == ANI_PLANK && g_fullpipe->_cursorId != PIC_CSR_ITN)
- return g_fullpipe->_cursorId;
+ } else if (g_fp->_objectIdAtCursor == ANI_PLANK || g_fp->_objectIdAtCursor == PIC_SC4_PLANK) {
+ if (g_fp->_objectIdAtCursor == ANI_PLANK && g_fp->_cursorId != PIC_CSR_ITN)
+ return g_fp->_cursorId;
- if (g_fullpipe->_objectIdAtCursor == ANI_PLANK || (g_fullpipe->_objectIdAtCursor == PIC_SC4_PLANK && g_fullpipe->_cursorId == PIC_CSR_DEFAULT)) {
+ if (g_fp->_objectIdAtCursor == ANI_PLANK || (g_fp->_objectIdAtCursor == PIC_SC4_PLANK && g_fp->_cursorId == PIC_CSR_DEFAULT)) {
if (sceneHandler04_friesAreWalking()) {
- g_fullpipe->_cursorId = PIC_CSR_ARCADE1;
- return g_fullpipe->_cursorId;
+ g_fp->_cursorId = PIC_CSR_ARCADE1;
+ return g_fp->_cursorId;
}
if (g_vars->scene04_soundPlaying) {
- g_fullpipe->_cursorId = PIC_CSR_DEFAULT;
- return g_fullpipe->_cursorId;
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
+ return g_fp->_cursorId;
}
}
}
- if (g_fullpipe->_objectIdAtCursor == PIC_CSR_ITN && g_fullpipe->_objectIdAtCursor == PIC_SC4_DOWNTRUBA)
- g_fullpipe->_cursorId = PIC_CSR_GOD;
+ if (g_fp->_objectIdAtCursor == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC4_DOWNTRUBA)
+ g_fp->_cursorId = PIC_CSR_GOD;
- return g_fullpipe->_cursorId;
+ return g_fp->_cursorId;
}
-void sceneHandlers_sub01(ExCommand *ex) {
- warning("sceneHandlers_sub01()");
+void sceneHandler04_checkBigBallClick() {
+ StaticANIObject *ball = g_fp->_currentScene->getStaticANIObject1ById(ANI_BIGBALL, -1);
+
+ if (ball)
+ for (uint i = 0; i < ball->_movements.size(); i++)
+ ((Movement *)ball->_movements[i])->_counterMax = 73;
+
+ g_vars->scene04_bigBallIn = true;
}
void sceneHandler04_clickBottle() {
- if (!g_vars->scene04_var02)
- g_vars->scene04_var20 += 5;
+ if (!g_vars->scene04_bottleIsTaken)
+ g_vars->scene04_springOffset += 5;
}
void sceneHandler04_clickButton() {
- warning("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 &&
+ g_vars->scene04_clock->_movement->_currDynamicPhaseIndex < 105)) {
+ if (!g_vars->scene04_hand->_movement && !g_vars->scene04_bottleIsTaken) {
+ but->startAnim(MV_BTN_CLICK, 0, -1);
+ g_vars->scene04_hand->startAnim(MV_HND_POINT, 0, -1);
+ }
+ }
+ }
+}
+
+void sceneHandler04_downLadder(int x, int y) {
+ g_vars->scene04_ladder->method34(g_fp->_aniMan, x + g_vars->scene04_ladder->_ladder_field_20, y + g_vars->scene04_ladder->_ladder_field_24, 0, 0);
+}
+
+void sceneHandler04_walkClimbLadder(ExCommand *ex) {
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+
+ ExCommand *ex1 = new ExCommand(ANI_MAN, 1, MV_MAN_TOLADDER, 0, 0, 0, 1, 0, 0, 0);
+
+ ex1->_keyCode = g_fp->_aniMan->_okeyCode;
+ ex1->_excFlags |= 2;
+
+ mq->addExCommandToEnd(ex1);
+
+ ExCommand *ex2 = new ExCommand(ANI_MAN, 1, MV_MAN_STOPLADDER, 0, 0, 0, 1, 0, 0, 0);
+
+ ex2->_keyCode = g_fp->_aniMan->_okeyCode;
+ ex2->_excFlags |= 2;
+
+ mq->addExCommandToEnd(ex2);
+
+ ExCommand *ex3;
+
+ if (ex) {
+ ex3 = ex->createClone();
+ } else {
+ ex3 = new ExCommand(0, 17, MSG_SC4_CLICKLADDER, 0, 0, 0, 1, 0, 0, 0);
+ ex3->_excFlags |= 3;
+ }
+
+ mq->addExCommandToEnd(ex3);
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ mq->chain(0);
+
+ g_vars->scene04_dudeOnLadder = 1;
+
+ g_vars->scene04_ladder = new MctlLadder;
+ g_vars->scene04_ladder->_ladderX = 1089;
+ g_vars->scene04_ladder->_ladderY = 406;
+ g_vars->scene04_ladder->_ladder_field_14 = 12;
+ g_vars->scene04_ladder->_width = 0;
+ g_vars->scene04_ladder->_height = -40;
+ g_vars->scene04_ladder->_ladder_field_20 = 0;
+ g_vars->scene04_ladder->_ladder_field_24 = -60;
+
+ g_vars->scene04_ladder->addObject(g_fp->_aniMan);
+
+ if (g_vars->scene04_soundPlaying) {
+ g_vars->scene04_ladder->_movements.front()->movVars->varUpStart = MV_MAN_STARTLADDER2;
+ g_vars->scene04_ladder->_movements.front()->movVars->varUpGo = MV_MAN_GOLADDER2;
+ g_vars->scene04_ladder->_movements.front()->movVars->varUpStop = MV_MAN_STOPLADDER2;
+ g_vars->scene04_ladder->_movements.front()->staticIds[2] = ST_MAN_GOLADDER2;
+ } else {
+ g_vars->scene04_ladder->_movements.front()->movVars->varUpStart = MV_MAN_STARTLADDER;
+ g_vars->scene04_ladder->_movements.front()->movVars->varUpGo = MV_MAN_GOLADDER;
+ g_vars->scene04_ladder->_movements.front()->movVars->varUpStop = MV_MAN_STOPLADDER;
+ g_vars->scene04_ladder->_movements.front()->staticIds[2] = ST_MAN_GOLADDER;
+ }
+
+ g_fp->_aniMan->_priority = 12;
+
+ getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
}
void sceneHandler04_clickLadder() {
- warning("sceneHandler04_clickLadder()");
+ g_vars->scene04_dudePosX = g_fp->_aniMan->_ox;
+ g_vars->scene04_dudePosY = g_fp->_aniMan->_oy;
+
+ if (g_vars->scene04_dudeOnLadder) {
+ if (!g_fp->_aniMan->isIdle() || (g_fp->_aniMan->_flags & 0x100)) {
+ g_vars->scene04_ladderClickable = true;
+ } else {
+ int h3 = 3 * g_vars->scene04_ladder->_height;
+ int half = abs(g_vars->scene04_ladder->_height) / 2;
+ int start = g_vars->scene04_ladder->_ladderY - g_vars->scene04_ladder->_ladder_field_24;
+ int min = 2 * h3 + start + half + 1;
+ int max = h3 + start - half - 1;
+
+ if (g_vars->scene04_sceneClickY > max)
+ g_vars->scene04_sceneClickY = max;
+
+ if (g_vars->scene04_sceneClickY < min)
+ g_vars->scene04_sceneClickY = min;
+
+ sceneHandler04_downLadder(g_vars->scene04_sceneClickX, g_vars->scene04_sceneClickY);
+
+ g_vars->scene04_ladderClickable = false;
+ }
+ } else {
+ if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
+ if (abs(1095 - g_vars->scene04_dudePosX) > 1 || abs(434 - g_vars->scene04_dudePosY) > 1) {
+ MessageQueue *mq = getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->method34(g_fp->_aniMan, 1095, 434, 1, ST_MAN_UP);
+ if (mq) {
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC4_CLICKLADDER, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_excFlags = 3;
+ mq->addExCommandToEnd(ex);
+
+ postExCommand(g_fp->_aniMan->_id, 2, 1095, 434, 0, -1);
+ }
+ } else {
+ sceneHandler04_walkClimbLadder(0);
+ }
+ }
+ }
}
-void sceneHandler04_sub13() {
- warning("sceneHandler04_sub13()");
+void sceneHandler04_jumpOnLadder() {
+ if (g_fp->_aniMan->_movement && g_fp->_aniMan->_movement->_id != MV_MAN_LOOKLADDER)
+ return;
+
+ if (g_fp->_aniMan->_statics->_staticsId != ST_MAN_STANDLADDER && g_fp->_aniMan->_statics->_staticsId != ST_MAN_LADDERDOWN)
+ return;
+
+ g_fp->_aniMan->changeStatics2(ST_MAN_LADDERDOWN);
+
+ g_fp->_aniMan->_flags |= 1;
+
+ MGM mgm;
+ MGMInfo mgminfo;
+
+ mgm.addItem(ANI_MAN);
+
+ mgminfo.ani = g_fp->_aniMan;
+ mgminfo.staticsId2 = ST_MAN_ONPLANK;
+ mgminfo.x1 = 938;
+ mgminfo.y1 = 442;
+ mgminfo.field_1C = 10;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 78;
+ mgminfo.movementId = MV_MAN_JUMPONPLANK;
+
+ MessageQueue *mq = mgm.genMovement(&mgminfo);
+
+ if (mq) {
+ mq->_flags |= 1;
+
+ if (!mq->chain(g_fp->_aniMan))
+ delete mq;
+
+ g_fp->_aniMan->_priority = 10;
+ }
+
+ g_vars->scene04_ladderOffset = g_vars->scene04_ladder->collisionDetection(g_fp->_aniMan);
}
void sceneHandler04_clickPlank() {
if (sceneHandler04_friesAreWalking())
- sceneHandler04_sub13();
- else if (g_vars->scene04_var01)
- g_fullpipe->playSound(SND_4_033, 0);
+ sceneHandler04_jumpOnLadder();
+ else if (g_vars->scene04_dudeOnLadder)
+ g_fp->playSound(SND_4_033, 0);
else if (!g_vars->scene04_soundPlaying)
chainQueue(QU_PNK_CLICK, 0);
}
void sceneHandler04_dropBottle() {
- warning("sceneHandler04_dropBottle()");
+ g_vars->scene04_bottleIsDropped = true;
+ g_vars->scene04_bottleY = 10;
+ g_vars->scene04_bottleWeight = 0;
+
+ while (g_vars->scene04_kozyawkiAni.size()) {
+ StaticANIObject *koz = g_vars->scene04_kozyawkiAni.front();
+ g_vars->scene04_kozyawkiAni.pop_front();
+
+ for (Common::List<GameObject *>::iterator it = g_vars->scene04_bottleObjList.begin(); it != g_vars->scene04_bottleObjList.end(); ++it)
+ if (*it == koz) {
+ g_vars->scene04_bottleObjList.erase(it);
+ break;
+ }
+
+ koz->queueMessageQueue(0);
+ koz->hide();
+
+ g_vars->scene04_kozyawkiObjList.push_back(koz);
+ }
+
+ g_vars->scene04_hand->changeStatics2(ST_HND_EMPTY);
+
+ g_vars->scene04_hand->setOXY(429, 21);
+ g_vars->scene04_hand->_priority = 15;
}
-void sceneHandler04_gotoLadder(int par) {
- warning("sceneHandler04_gotoLadder()");
+void sceneHandler04_gotoLadder(ExCommand *ex) {
+ MGM mgm;
+ MGMInfo mgminfo;
+
+ mgm.addItem(ANI_MAN);
+
+ mgminfo.ani = g_fp->_aniMan;
+ mgminfo.staticsId2 = ST_MAN_UP;
+ mgminfo.x1 = 1095;
+ mgminfo.y1 = 434;
+ mgminfo.field_1C = 12;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 78;
+ mgminfo.movementId = MV_MAN_PLANKTOLADDER;
+
+ MessageQueue *mq = mgm.genMovement(&mgminfo);
+
+ if (mq) {
+ mq->deleteExCommandByIndex(mq->getCount() - 1, 1);
+
+ ExCommand *ex1 = new ExCommand(ANI_MAN, 1, MV_MAN_TOLADDER, 0, 0, 0, 1, 0, 0, 0);
+ ex1->_excFlags = 2;
+ ex1->_field_24 = 1;
+ ex1->_keyCode = -1;
+ mq->addExCommandToEnd(ex1);
+
+ ExCommand *ex2 = new ExCommand(ANI_MAN, 1, MV_MAN_STOPLADDER, 0, 0, 0, 1, 0, 0, 0);
+ ex2->_excFlags = 2;
+ ex2->_field_24 = 1;
+ ex2->_keyCode = -1;
+ mq->addExCommandToEnd(ex2);
+
+ ExCommand *ex3 = new ExCommand(g_fp->_aniMan->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0);
+ ex3->_field_14 = 256;
+ ex3->_messageNum = 0;
+ ex3->_excFlags |= 3;
+ mq->addExCommandToEnd(ex3);
+
+ if (ex) {
+ ExCommand *ex4 = ex->createClone();
+
+ mq->addExCommandToEnd(ex4);
+ }
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ if (mq->chain(g_fp->_aniMan)) {
+ g_fp->_aniMan->_priority = 12;
+ g_fp->_aniMan->_flags |= 1;
+ } else {
+ delete mq;
+ }
+ }
+
+ g_vars->scene04_kozyawkaOnLadder = false;
}
void sceneHandler04_lowerPlank() {
@@ -255,27 +521,355 @@ void sceneHandler04_lowerPlank() {
}
void sceneHandler04_manFromBottle() {
- warning("sceneHandler04_manFromBottle()");
+ for (Common::List<GameObject *>::iterator it = g_vars->scene04_bottleObjList.begin(); it != g_vars->scene04_bottleObjList.end(); ++it)
+ if (*it == g_fp->_aniMan) {
+ g_vars->scene04_bottleObjList.erase(it);
+ g_vars->scene04_bottleWeight -= 9;
+ break;
+ }
+
+ if (g_vars->scene04_ladder)
+ delete g_vars->scene04_ladder;
+
+ g_vars->scene04_ladder = 0;
+
+ getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
}
void sceneHandler04_manToBottle() {
- g_vars->scene04_bottleObjList.push_back(g_fullpipe->_aniMan);
- g_vars->scene04_var20 = 5;
- g_vars->scene04_var06 += 9;
- g_fullpipe->_aniMan2 = g_fullpipe->_aniMan;
- g_vars->scene04_var10 = 1;
+ g_vars->scene04_bottleObjList.push_back(g_fp->_aniMan);
+ g_vars->scene04_springOffset = 5;
+ g_vars->scene04_bottleWeight += 9;
+ g_fp->_aniMan2 = g_fp->_aniMan;
+ g_vars->scene04_dudeInBottle = 1;
}
void sceneHandler04_raisePlank() {
g_vars->scene04_plank->startAnim(MV_PNK_WEIGHTLEFT, 0, -1);
}
+MessageQueue *sceneHandler04_kozFly3(StaticANIObject *ani, double phase) {
+ MGM mgm;
+ MGMInfo mgminfo;
+
+ mgm.addItem(ANI_KOZAWKA);
+
+ mgminfo.ani = ani;
+ mgminfo.staticsId2 = ST_KZW_SIT;
+ mgminfo.x1 = (int)(723.0 - phase * 185.0);
+ mgminfo.y1 = 486;
+ mgminfo.field_1C = 10;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 78;
+ mgminfo.movementId = MV_KZW_JUMP;
+
+ MessageQueue *mq = mgm.genMovement(&mgminfo);
+
+ if (mq) {
+ ExCommand *ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_STANDUP, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_TURN, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ for (int i = 0; i < 5; i++) {
+ ex = new ExCommand(ANI_KOZAWKA, 1, rMV_KZW_GOR, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+ }
+
+ ex = new ExCommand(ANI_KOZAWKA, 6, 0, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_KOZAWKA, 17, MSG_KOZAWRESTART, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+ }
+
+ return mq;
+}
+
+MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
+ MGM mgm;
+ MGMInfo mgminfo;
+
+ mgm.addItem(ANI_KOZAWKA);
+
+ mgminfo.ani = ani;
+ mgminfo.staticsId2 = ST_KZW_JUMPOUT;
+ mgminfo.x1 = 525;
+ mgminfo.y1 = (int)(344.0 - (double)(320 - g_vars->scene04_bottle->_oy) * phase);
+ mgminfo.field_1C = 10;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 78;
+ mgminfo.movementId = MV_KZW_JUMPHIT;
+
+ MessageQueue *mq1 = mgm.genMovement(&mgminfo);
+
+ memset(&mgminfo, 0, sizeof(mgminfo));
+ mgminfo.ani = ani;
+ mgminfo.staticsId1 = ST_KZW_JUMPOUT;
+ mgminfo.staticsId2 = ST_KZW_SIT;
+ mgminfo.x2 = 525;
+ mgminfo.y2 = (int)(344.0 - (double)(320 - g_vars->scene04_bottle->_oy) * phase);
+ mgminfo.y1 = 486;
+ mgminfo.field_1C = 10;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 117;
+ mgminfo.movementId = MV_KZW_JUMPOUT;
+
+ MessageQueue *mq2 = mgm.genMovement(&mgminfo);
+
+ if (mq1 && mq2) {
+ mq1->addExCommandToEnd(mq2->getExCommandByIndex(0)->createClone());
+
+ delete mq2;
+
+ ExCommand *ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_STANDUP, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq1->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_TURN, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq1->addExCommandToEnd(ex);
+
+ for (int i = 0; i < 5; i++) {
+ ex = new ExCommand(ANI_KOZAWKA, 1, rMV_KZW_GOR, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq1->addExCommandToEnd(ex);
+ }
+
+ ex = new ExCommand(ANI_KOZAWKA, 6, 0, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+ ex->_keyCode = ani->_okeyCode;
+ mq1->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_KOZAWKA, 17, MSG_KOZAWRESTART, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+ ex->_keyCode = ani->_okeyCode;
+ mq1->addExCommandToEnd(ex);
+ }
+
+ return mq1;
+}
+
+MessageQueue *sceneHandler04_kozFly6(StaticANIObject *ani) {
+ MGM mgm;
+ MGMInfo mgminfo;
+
+ mgm.addItem(ANI_KOZAWKA);
+
+ mgminfo.ani = ani;
+ mgminfo.staticsId2 = ST_KZW_SIT;
+ mgminfo.x1 = 397 - 4 * g_fp->_rnd->getRandomNumber(1);
+ mgminfo.field_1C = ani->_priority;
+ mgminfo.y1 = g_vars->scene04_bottle->_oy - 4 * g_fp->_rnd->getRandomNumber(1) + 109;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 78;
+ mgminfo.movementId = MV_KZW_JUMPROTATE;
+
+ MessageQueue *mq = mgm.genMovement(&mgminfo);
+
+ if (mq) {
+ mq->deleteExCommandByIndex(mq->getCount() - 1, 1);
+
+ ExCommand *ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_STANDUP, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_GOR, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_RAISEHEAD, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ g_vars->scene04_kozHeadRaised = true;
+ }
+
+ return mq;
+}
+
+void sceneHandler04_kozMove(Movement *mov, int from, int to, Common::Point *points, double phase) {
+ for (int i = from; i < to; i++) {
+ mov->setDynamicPhaseIndex(i);
+
+ Common::Point *p;
+ if (mov->_framePosOffsets) {
+ p = mov->_framePosOffsets[mov->_currDynamicPhaseIndex];
+ } else {
+ p = &mov->_somePoint;
+ p->x = 0;
+ p->y = 0;
+ }
+
+ p->y = (int)((double)points[i].y * phase);
+ }
+}
+
+MessageQueue *sceneHandler04_kozFly7(StaticANIObject *ani, double phase) {
+ MGM mgm;
+ MGMInfo mgminfo;
+
+ mgm.addItem(ANI_KOZAWKA);
+
+ mgminfo.ani = ani;
+ mgminfo.staticsId2 = 560;
+ mgminfo.x1 = (int)(250.0 - phase * 100.0);
+ mgminfo.y1 = 455;
+ mgminfo.field_1C = 10;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 78;
+ mgminfo.movementId = MV_KZW_JUMPROTATE;
+
+ MessageQueue *mq = mgm.genMovement(&mgminfo);
+
+ if (mq) {
+ sceneHandler04_kozMove(ani->getMovementById(MV_KZW_JUMPROTATE), 1, 9, g_vars->scene04_jumpRotateKozyawki, phase * 0.5 + 1.5);
+
+ ani->_priority = 10;
+
+ ExCommand *ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_STANDUP, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_TURN, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ for (int i = 0; i < 2; i++) {
+ ex = new ExCommand(ANI_KOZAWKA, 1, rMV_KZW_GOR, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+ }
+
+ ex = new ExCommand(ANI_KOZAWKA, 6, 0, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_KOZAWKA, 17, MSG_KOZAWRESTART, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+ ex->_keyCode = ani->_okeyCode;
+ mq->addExCommandToEnd(ex);
+ }
+
+ return mq;
+}
+
+static const int kozTrajectory3[] = {
+ 3, 2, 0,
+ 3, 2, 0,
+ 3, 2, 0
+};
+
+static const int kozTrajectory4[] = {
+ 5, 3, 1,
+ 5, 4, 1,
+ 5, 3, 1
+};
+
+static const int kozTrajectory5[] = {
+ 6, 5, 4,
+ 6, 5, 4,
+ 6, 5, 4
+};
+
+static const int kozTrajectory6[] = {
+ 7, 6, 5,
+ 7, 6, 5,
+ 7, 6, 5
+};
+
void sceneHandler04_shootKozyawka() {
- warning("sceneHandler04_shootKozyawka()");
+ g_vars->scene04_plank->changeStatics2(ST_PNK_WEIGHTRIGHT);
+
+ if (!g_vars->scene04_walkingKozyawka)
+ return;
+
+ if (g_vars->scene04_walkingKozyawka->_movement) {
+ if (g_vars->scene04_walkingKozyawka->_movement->_id == MV_KZW_WALKPLANK) {
+ int dphase = g_vars->scene04_walkingKozyawka->_movement->_currDynamicPhaseIndex;
+
+ if (dphase < 41) {
+ int col = 3 * dphase / 15;
+ if (col > 2)
+ col = 2;
+
+ int row = g_vars->scene04_kozyawkiAni.size();
+ if (row > 2)
+ row = 2;
+
+ int idx = 3 * row + col;
+ int phase;
+
+ if (g_vars->scene04_ladderOffset == 3) {
+ phase = kozTrajectory3[idx];
+ } else if (g_vars->scene04_ladderOffset == 4) {
+ phase = kozTrajectory4[idx];
+ } else {
+ if (g_vars->scene04_ladderOffset == 5)
+ phase = kozTrajectory5[idx];
+ else
+ phase = kozTrajectory6[idx];
+ }
+
+ g_vars->scene04_walkingKozyawka->queueMessageQueue(0);
+ g_vars->scene04_walkingKozyawka->_movement = 0;
+ g_vars->scene04_walkingKozyawka->_statics = g_vars->scene04_walkingKozyawka->getStaticsById(ST_KZW_RIGHT);
+
+ MessageQueue *mq;
+
+ if (phase > 2) {
+ if (phase > 5) {
+ if (phase == 6)
+ mq = sceneHandler04_kozFly6(g_vars->scene04_walkingKozyawka);
+ else
+ mq = sceneHandler04_kozFly7(g_vars->scene04_walkingKozyawka, (double)(phase - 6) * 0.3333333333333333);
+ } else {
+ mq = sceneHandler04_kozFly5(g_vars->scene04_walkingKozyawka, (double)(phase - 2) * 0.3333333333333333);
+ }
+ } else {
+ mq = sceneHandler04_kozFly3(g_vars->scene04_walkingKozyawka, (double)phase * 0.5);
+ }
+
+ if (mq) {
+ g_vars->scene04_lastKozyawka = g_vars->scene04_walkingKozyawka;
+
+ if (!mq->chain(g_vars->scene04_walkingKozyawka) )
+ delete mq;
+ }
+ }
+ }
+ }
+
+ if (g_vars->scene04_ladderOffset > 3)
+ g_fp->_aniMan->changeStatics1(ST_MAN_LOOKPLANK);
+
+ g_vars->scene04_kozyawkaOnLadder = true;
}
void sceneHandler04_showCoin() {
- StaticANIObject *ani = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_SC4_COIN, -1);
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_SC4_COIN, -1);
if (ani) {
ani->show1(MV_BDG_OPEN, MV_MAN_GOU, MV_SC4_COIN_default, 0);
@@ -285,67 +879,401 @@ void sceneHandler04_showCoin() {
}
void sceneHandler04_stopSound() {
- warning("sceneHandler04_stopSound()");
+ g_vars->scene04_soundPlaying = false;
+
+ warning("STUB: sceneHandler04_stopSound()");
}
-void sceneHandler04_sub1(ExCommand *ex) {
- warning("sceneHandler04_sub1()");
+void sceneHandler04_animOutOfBottle(ExCommand *ex) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_SIT);
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC4_MANFROMBOTTLE), 0, 0);
+
+ if (ex) {
+ ExCommand *newex = ex->createClone();
+
+ mq->addExCommandToEnd(newex);
+ }
+
+ mq->_flags |= 1;
+ mq->chain(0);
+
+ g_vars->scene04_dudeInBottle = false;
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
+}
+
+void sceneHandler04_walkKozyawka() {
+ if (g_vars->scene04_kozyawkiObjList.size()) {
+ g_vars->scene04_walkingKozyawka = g_vars->scene04_kozyawkiObjList.front();
+ g_vars->scene04_kozyawkiObjList.pop_front();
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_KOZAW_WALK), 0, 1);
+ mq->replaceKeyCode(-1, g_vars->scene04_walkingKozyawka->_okeyCode);
+ mq->chain(0);
+ }
+}
+
+void sceneHandler04_bottleUpdateObjects(int off) {
+ for (Common::List<GameObject *>::iterator it = g_vars->scene04_bottleObjList.begin(); it != g_vars->scene04_bottleObjList.end(); ++it) {
+ GameObject *obj = *it;
+
+ obj->setOXY(obj->_ox, off + obj->_oy);
+ }
+}
+
+void sceneHandler04_springWobble() {
+ int oldDynIndex = g_vars->scene04_dynamicPhaseIndex;
+ int newdelta = g_vars->scene04_springOffset + g_vars->scene04_dynamicPhaseIndex;
+
+ g_vars->scene04_dynamicPhaseIndex += g_vars->scene04_springOffset;
+
+ if (newdelta < 0) {
+ newdelta = 0;
+ g_vars->scene04_dynamicPhaseIndex = 0;
+ g_vars->scene04_springOffset = 0;
+ }
+
+ if (newdelta > 14) {
+ newdelta = 14;
+ g_vars->scene04_dynamicPhaseIndex = 14;
+ g_vars->scene04_springOffset = 0;
+ }
+
+ if (g_vars->scene04_bottleWeight > newdelta)
+ g_vars->scene04_springOffset++;
+
+ if (g_vars->scene04_bottleWeight < newdelta)
+ g_vars->scene04_springOffset--;
+
+ if ((oldDynIndex > g_vars->scene04_bottleWeight && newdelta > g_vars->scene04_bottleWeight) || newdelta <= g_vars->scene04_bottleWeight) {
+ g_vars->scene04_springDelay++;
+
+ if (g_vars->scene04_springOffset && g_vars->scene04_springDelay > 1) {
+ g_vars->scene04_springDelay = 0;
+ g_vars->scene04_springOffset = g_vars->scene04_springOffset - g_vars->scene04_springOffset / abs(g_vars->scene04_springOffset);
+ }
+ }
+
+ Common::Point point;
+
+ if (g_vars->scene04_dynamicPhaseIndex) {
+ if (!g_vars->scene04_spring->_movement)
+ g_vars->scene04_spring->startAnim(MV_SPR_LOWER, 0, -1);
+
+ g_vars->scene04_spring->_movement->setDynamicPhaseIndex(g_vars->scene04_dynamicPhaseIndex);
+ } else {
+ g_vars->scene04_spring->changeStatics2(ST_SPR_UP);
+ }
+
+ if (g_vars->scene04_dynamicPhaseIndex != oldDynIndex)
+ sceneHandler04_bottleUpdateObjects(oldDynIndex - g_vars->scene04_dynamicPhaseIndex);
}
-void sceneHandler04_sub3() {
- warning("sceneHandler04_sub3()");
+void sceneHandler04_leaveScene() {
+ g_fp->_aniMan2 = 0;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC4_MANTOBOTTLE), 0, 0);
+ ExCommand *ex = 0;
+
+ for (uint i = 0; i < mq->getCount(); i++) {
+ if (mq->getExCommandByIndex(i)->_messageKind == 27) {
+ ex = mq->getExCommandByIndex(i);
+ break;
+ }
+ }
+
+ if (!ex) {
+ error("sceneHandler04_leaveScene(): Cannot find exit");
+ }
+
+ ex->_y = g_vars->scene04_bottle->_oy - 304;
+
+ mq->chain(0);
+
+ g_vars->scene04_var07 = false;
+ g_vars->scene04_dudeOnLadder = 0;
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
+
+ g_fp->updateMapPiece(PIC_MAP_P03, 1);
}
-void sceneHandler04_sub4() {
- warning("sceneHandler04_sub4()");
+void sceneHandler04_liftBottle() {
+ int newy = g_vars->scene04_bottleY + g_vars->scene04_spring->_oy;
+
+ g_vars->scene04_bottleY += 5;
+
+ sceneHandler04_bottleUpdateObjects(newy - g_vars->scene04_spring->_oy);
+
+ g_vars->scene04_spring->setOXY(g_vars->scene04_spring->_ox, newy);
+
+ if (g_vars->scene04_bottle->_oy >= 226) {
+ sceneHandler04_bottleUpdateObjects(226 - g_vars->scene04_bottle->_oy);
+
+ g_vars->scene04_spring->setOXY(g_vars->scene04_spring->_ox, 437);
+ g_vars->scene04_bottleIsDropped = false;
+ g_vars->scene04_handIsDown = false;
+ g_vars->scene04_objectIsTaken = true;
+ g_vars->scene04_bottleWeight = 2;
+ g_vars->scene04_springOffset = 10;
+ g_vars->scene04_bottleIsTaken = false;
+
+ g_fp->setObjectState(sO_LowerPipe, g_fp->getObjectEnumState(sO_LowerPipe, sO_IsClosed));
+ }
}
-void sceneHandler04_sub5() {
- warning("sceneHandler04_sub5()");
+void sceneHandler04_startSounds(const char *snd1, const char *snd2, const char *snd3) {
+ warning("STUB: sceneHandler04_startSounds()");
+
+ // playFile(snd1);
+ // playFile(snd2);
+ // playFile(snd3);
}
-void sceneHandler04_sub6() {
- warning("sceneHandler04_sub6()");
+void sceneHandler04_goClock() {
+ sceneHandler04_walkKozyawka();
+ chainQueue(QU_SC4_GOCLOCK, 0);
+ g_vars->scene04_soundPlaying = true;
+ g_vars->scene04_coinPut = false;
+
+ g_fp->stopAllSoundStreams();
+
+ sceneHandler04_startSounds("sc4_start.ogg", "sc4_loop.ogg", "sc4_stop2.ogg");
+
+ g_vars->scene04_bigBallCounter = 0;
}
-void sceneHandler04_sub7() {
- warning("sceneHandler04_sub7()");
+void sceneHandler04_bigBallOut() {
+ StaticANIObject *ball = g_fp->_currentScene->getStaticANIObject1ById(ANI_BIGBALL, -1);
+
+ if (ball && ball->_flags & 4)
+ for (uint i = 0; i < ball->_movements.size(); i++)
+ ((Movement *)ball->_movements[i])->_counterMax = 0;
+
+ g_vars->scene04_bigBallIn = false;
}
-void sceneHandler04_sub8(ExCommand *ex) {
- warning("sceneHandler04_sub8()");
+void sceneHandler04_leaveLadder(ExCommand *ex) {
+ if (!g_fp->_aniMan->isIdle())
+ return;
+
+ if (!(g_fp->_aniMan->_flags & 0x100)) {
+ if (getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->_objtype == kObjTypeMctlCompound) {
+ MctlCompound *mc = (MctlCompound *)getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId);
+
+ if (mc->_motionControllers[0]->_movGraphReactObj->pointInRegion(g_fp->_sceneRect.left + ex->_x, g_fp->_sceneRect.top + ex->_y)) {
+ if (g_vars->scene04_ladder->collisionDetection(g_fp->_aniMan)) {
+ MessageQueue *mq = g_vars->scene04_ladder->controllerWalkTo(g_fp->_aniMan, 0);
+
+ if (mq) {
+ mq->addExCommandToEnd(ex->createClone());
+
+ if (mq->chain(g_fp->_aniMan) )
+ ex->_messageKind = 0;
+ else
+ delete mq;
+
+ if (g_vars->scene04_bigBallIn) {
+ sceneHandler04_bigBallOut();
+ return;
+ }
+ }
+ } else {
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ ExCommand *ex1;
+
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN) {
+ ex1 = new ExCommand(ANI_MAN, 1, MV_MAN_LOOKLADDERRV, 0, 0, 0, 1, 0, 0, 0);
+ ex1->_keyCode = g_fp->_aniMan->_okeyCode;
+ ex1->_excFlags |= 2;
+ mq->addExCommandToEnd(ex1);
+ }
+
+ ex1 = new ExCommand(ANI_MAN, 1, MV_MAN_STARTLADDERD, 0, 0, 0, 1, 0, 0, 0);
+ ex1->_keyCode = g_fp->_aniMan->_okeyCode;
+ ex1->_excFlags |= 2;
+ mq->addExCommandToEnd(ex1);
+
+ ex1 = new ExCommand(ANI_MAN, 1, MV_MAN_FROMLADDER, 0, 0, 0, 1, 0, 0, 0);
+ ex1->_keyCode = g_fp->_aniMan->_okeyCode;
+ ex1->_excFlags |= 2;
+ mq->addExCommandToEnd(ex1);
+
+ ex1 = ex->createClone();
+ mq->addExCommandToEnd(ex1);
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ if (mq->chain(g_fp->_aniMan)) {
+ if (g_vars->scene04_ladder)
+ delete g_vars->scene04_ladder;
+
+ g_vars->scene04_ladder = 0;
+ g_vars->scene04_dudeOnLadder = 0;
+
+ ex->_messageKind = 0;
+
+ mc->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+ } else {
+ delete mq;
+ }
+
+ if (g_vars->scene04_bigBallIn) {
+ sceneHandler04_bigBallOut();
+ return;
+ }
+ }
+ }
+ }
+ }
}
-void sceneHandler04_sub9(StaticANIObject *ani) {
- warning("sceneHandler04_sub9()");
+void sceneHandler04_handTake() {
+ g_vars->scene04_clock->changeStatics2(ST_CLK_CLOSED);
+
+ if (g_vars->scene04_kozyawkiAni.size()) {
+ if (g_vars->scene04_kozyawkiAni.size() == 1) {
+ chainQueue(QU_HND_TAKE1, 0);
+ g_vars->scene04_objectIsTaken = false;
+ } else {
+ chainQueue((g_vars->scene04_kozyawkiAni.size() != 2) ? QU_HND_TAKEBOTTLE : QU_HND_TAKE2, 0);
+ g_vars->scene04_objectIsTaken = false;
+ }
+ } else {
+ chainQueue(QU_HND_TAKE0, 0);
+ g_vars->scene04_objectIsTaken = false;
+ }
}
-void sceneHandler04_sub15() {
- warning("sceneHandler04_sub15()");
+void sceneHandler04_putKozyawkaBack(StaticANIObject *ani) {
+ g_vars->scene04_bottleObjList.push_back(ani);
+ g_vars->scene04_kozyawkiAni.push_back(ani);
+
+ g_vars->scene04_bottleWeight += 2;
+ g_vars->scene04_walkingKozyawka = 0;
+ g_vars->scene04_lastKozyawka = 0;
+
+ if (g_vars->scene04_kozyawkiAni.size() > 1 )
+ g_vars->scene04_objectIsTaken = false;
+
+ if (g_vars->scene04_kozyawkiAni.size() <= 2 || g_vars->scene04_hand->_movement) {
+ sceneHandler04_walkKozyawka();
+ } else {
+ sceneHandler04_handTake();
+ sceneHandler04_stopSound();
+ }
}
-void sceneHandler04_sub17() {
- warning("sceneHandler04_sub17()");
+void sceneHandler04_bigBallWalkIn() {
+ StaticANIObject *ball = g_fp->_currentScene->getStaticANIObject1ById(ANI_BIGBALL, -1);
+
+ if (g_vars->scene04_dudeOnLadder
+ && (!ball || !(ball->_flags & 4))
+ && g_vars->scene04_ladder->collisionDetection(g_fp->_aniMan) > 3) {
+
+ if (!g_fp->_rnd->getRandomNumber(49)) {
+ if (g_vars->scene04_bigBallFromLeft)
+ chainQueue(QU_BALL_WALKR, 0);
+ else
+ chainQueue(QU_BALL_WALKL, 0);
+
+ g_vars->scene04_bigBallFromLeft = !g_vars->scene04_bigBallFromLeft;
+
+ sceneHandler04_checkBigBallClick();
+
+ g_vars->scene04_bigBallCounter = 0;
+ }
+ }
}
void sceneHandler04_takeBottle() {
- warning("sceneHandler04_takeBottle()");
+ g_vars->scene04_bottleIsTaken = true;
+ g_vars->scene04_hand->_priority = 5;
+
+ g_fp->setObjectState(sO_LowerPipe, g_fp->getObjectEnumState(sO_LowerPipe, sO_IsOpened));
}
void sceneHandler04_takeKozyawka() {
- warning("sceneHandler04_takeKozyawka()");
+ if (g_vars->scene04_kozyawkiAni.size() > 0) {
+ if (g_vars->scene04_kozyawkiAni.size() == 1)
+ g_vars->scene04_objectIsTaken = true;
+
+ StaticANIObject *koz = g_vars->scene04_kozyawkiAni.front();
+ g_vars->scene04_kozyawkiAni.pop_front();
+
+ if (koz) {
+ koz->queueMessageQueue(0);
+ koz->hide();
+
+ g_vars->scene04_kozyawkiObjList.push_back(koz);
+
+ for (Common::List<GameObject *>::iterator it = g_vars->scene04_bottleObjList.begin(); it != g_vars->scene04_bottleObjList.end(); ++it)
+ if (*it == koz) {
+ g_vars->scene04_bottleObjList.erase(it);
+ break;
+ }
+
+ g_vars->scene04_bottleWeight -= 2;
+ }
+ }
}
void sceneHandler04_testPlank(ExCommand *ex) {
- warning("sceneHandler04_testPlank()");
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex->_parId);
+
+ if (!mq)
+ return;
+
+ if (g_vars->scene04_plank->_movement || !g_vars->scene04_plank->_statics || g_vars->scene04_plank->_statics->_staticsId != ST_PNK_WEIGHTLEFT) {
+ mq->getExCommandByIndex(0)->_messageNum = MV_KZW_TOHOLERV;
+ } else {
+ mq->getExCommandByIndex(0)->_messageNum = MV_KZW_WALKPLANK;
+ }
}
void sceneHandler04_updateBottle() {
- warning("sceneHandler04_updateBottle()");
+ Common::Point point;
+
+ int yoff;
+
+ if (g_vars->scene04_hand->_movement)
+ yoff = g_vars->scene04_hand->_movement->_oy;
+ else
+ yoff = g_vars->scene04_hand->_oy;
+
+ int newy = g_vars->scene04_hand->getSomeXY(point)->y + yoff + 140;
+
+ sceneHandler04_bottleUpdateObjects(newy - g_vars->scene04_spring->_oy);
+
+ g_vars->scene04_spring->setOXY(g_vars->scene04_spring->_ox, newy);
}
void sceneHandler04_winArcade() {
- warning("sceneHandler04_winArcade()");
+ if (g_fp->getObjectState(sO_LowerPipe) == g_fp->getObjectEnumState(sO_LowerPipe, sO_IsClosed)
+ && g_vars->scene04_soundPlaying) {
+ g_vars->scene04_clock->changeStatics2(ST_CLK_CLOSED);
+ g_vars->scene04_hand->changeStatics2(ST_HND_EMPTY);
+
+ chainQueue(QU_HND_TAKEBOTTLE, 1);
+
+ if (g_vars->scene04_walkingKozyawka) {
+ g_vars->scene04_kozyawkiObjList.push_back(g_vars->scene04_walkingKozyawka);
+
+ g_vars->scene04_walkingKozyawka->changeStatics2(ST_KZW_EMPTY);
+ g_vars->scene04_walkingKozyawka->hide();
+ g_vars->scene04_walkingKozyawka = 0;
+ }
+
+ g_vars->scene04_objectIsTaken = false;
+ g_vars->scene04_soundPlaying = false;
+
+ getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->setEnabled();
+
+ getGameLoaderInteractionController()->enableFlag24();
+
+ g_fp->stopSoundStream2();
+ }
}
int sceneHandler04(ExCommand *ex) {
@@ -366,18 +1294,18 @@ int sceneHandler04(ExCommand *ex) {
break;
case MSG_SHAKEBOTTLE:
- if (!g_vars->scene04_var02)
- ++g_vars->scene04_var20;
+ if (!g_vars->scene04_bottleIsTaken)
+ ++g_vars->scene04_springOffset;
break;
case MSG_STARTHAND:
- g_vars->scene04_var09 = 1;
- g_vars->scene04_coinPut = 0;
+ g_vars->scene04_handIsDown = true;
+ g_vars->scene04_coinPut = false;
- if (g_vars->scene04_var10)
- sceneHandler04_sub1(0);
+ if (g_vars->scene04_dudeInBottle)
+ sceneHandler04_animOutOfBottle(0);
- sceneHandler04_sub15();
+ sceneHandler04_handTake();
sceneHandler04_stopSound();
break;
@@ -398,13 +1326,14 @@ int sceneHandler04(ExCommand *ex) {
break;
case MSG_KOZAWRESTART:
- if (g_vars->scene04_var05) {
- g_vars->scene04_kozyawkiObjList.push_back(g_vars->scene04_var05);
- g_vars->scene04_var05->hide();
- g_vars->scene04_var05 = 0;
+ if (g_vars->scene04_walkingKozyawka) {
+ g_vars->scene04_kozyawkiObjList.push_back(g_vars->scene04_walkingKozyawka);
+ g_vars->scene04_walkingKozyawka->hide();
+ g_vars->scene04_walkingKozyawka = 0;
}
+
if (g_vars->scene04_soundPlaying)
- sceneHandler04_sub3();
+ sceneHandler04_walkKozyawka();
break;
@@ -418,93 +1347,93 @@ int sceneHandler04(ExCommand *ex) {
case 33:
{
- g_vars->scene04_dudePosX = g_fullpipe->_aniMan->_ox;
- g_vars->scene04_dudePosY = g_fullpipe->_aniMan->_oy;
+ g_vars->scene04_dudePosX = g_fp->_aniMan->_ox;
+ g_vars->scene04_dudePosY = g_fp->_aniMan->_oy;
int res = 0;
- if (g_fullpipe->_aniMan2) {
- if (g_fullpipe->_aniMan->_ox < g_fullpipe->_sceneRect.left + 200) {
- g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan->_ox - g_fullpipe->_sceneRect.left - 300;
- g_fullpipe->_aniMan->_ox = g_vars->scene04_dudePosX;
+ if (g_fp->_aniMan2) {
+ if (g_fp->_aniMan->_ox < g_fp->_sceneRect.left + 200) {
+ g_fp->_currentScene->_x = g_fp->_aniMan->_ox - g_fp->_sceneRect.left - 300;
+ g_fp->_aniMan->_ox = g_vars->scene04_dudePosX;
}
- if (g_fullpipe->_aniMan->_ox > g_fullpipe->_sceneRect.right - 200) {
- g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan->_ox - g_fullpipe->_sceneRect.right + 300;
+ if (g_fp->_aniMan->_ox > g_fp->_sceneRect.right - 200) {
+ g_fp->_currentScene->_x = g_fp->_aniMan->_ox - g_fp->_sceneRect.right + 300;
}
res = 1;
if (g_vars->scene04_soundPlaying) {
- if (g_fullpipe->_aniMan->_movement) {
- if (g_fullpipe->_aniMan->_movement->_id == MV_MAN_TOLADDER) {
- g_fullpipe->_aniMan2 = 0;
+ if (g_fp->_aniMan->_movement) {
+ if (g_fp->_aniMan->_movement->_id == MV_MAN_TOLADDER) {
+ g_fp->_aniMan2 = 0;
- if (g_fullpipe->_sceneRect.left > 380)
- g_fullpipe->_currentScene->_x = 380 - g_fullpipe->_sceneRect.left;
+ if (g_fp->_sceneRect.left > 380)
+ g_fp->_currentScene->_x = 380 - g_fp->_sceneRect.left;
}
}
}
} else {
- if (g_fullpipe->_aniMan->_movement && g_fullpipe->_aniMan->_movement->_id == MV_MAN_GOD)
- g_fullpipe->_aniMan2 = g_fullpipe->_aniMan;
+ if (g_fp->_aniMan->_movement && g_fp->_aniMan->_movement->_id == MV_MAN_GOD)
+ g_fp->_aniMan2 = g_fp->_aniMan;
}
- sceneHandler04_sub4();
+ sceneHandler04_springWobble();
- if (g_vars->scene04_var07 && !g_vars->scene04_var09)
- sceneHandler04_sub5();
+ if (g_vars->scene04_var07 && !g_vars->scene04_handIsDown)
+ sceneHandler04_leaveScene();
- if (g_vars->scene04_var12)
- sceneHandler04_sub6();
+ if (g_vars->scene04_bottleIsDropped)
+ sceneHandler04_liftBottle();
- if (g_vars->scene04_var08)
+ if (g_vars->scene04_ladderClickable)
sceneHandler04_clickLadder();
- if (g_vars->scene04_var10 && g_vars->scene04_hand->_movement)
- sceneHandler04_sub1(0);
+ if (g_vars->scene04_dudeInBottle && g_vars->scene04_hand->_movement)
+ sceneHandler04_animOutOfBottle(0);
- if (g_vars->scene04_coinPut && g_vars->scene04_var18 && !g_vars->scene04_var09 && !g_vars->scene04_soundPlaying)
- sceneHandler04_sub7();
+ if (g_vars->scene04_coinPut && g_vars->scene04_clockCanGo && !g_vars->scene04_handIsDown && !g_vars->scene04_soundPlaying)
+ sceneHandler04_goClock();
- if (g_vars->scene04_var01) {
+ if (g_vars->scene04_dudeOnLadder) {
if (!g_vars->scene04_soundPlaying) {
- g_fullpipe->startSceneTrack();
+ g_fp->startSceneTrack();
- g_fullpipe->_behaviorManager->updateBehaviors();
+ g_fp->_behaviorManager->updateBehaviors();
return res;
}
- g_vars->scene04_var14++;
+ g_vars->scene04_bigBallCounter++;
- if (g_vars->scene04_var14 > 600)
- sceneHandler04_sub17();
+ if (g_vars->scene04_bigBallCounter > 600)
+ sceneHandler04_bigBallWalkIn();
}
if (g_vars->scene04_soundPlaying) {
- g_fullpipe->_behaviorManager->updateBehaviors();
+ g_fp->_behaviorManager->updateBehaviors();
return res;
}
- g_fullpipe->startSceneTrack();
+ g_fp->startSceneTrack();
- g_fullpipe->_behaviorManager->updateBehaviors();
+ g_fp->_behaviorManager->updateBehaviors();
return res;
}
case 29:
{
- int picid = g_fullpipe->_currentScene->getPictureObjectIdAtPos(ex->_sceneClickX, ex->_sceneClickY);
+ int picid = g_fp->_currentScene->getPictureObjectIdAtPos(ex->_sceneClickX, ex->_sceneClickY);
- if (g_vars->scene04_var10) {
- sceneHandler04_sub1(ex);
+ if (g_vars->scene04_dudeInBottle) {
+ sceneHandler04_animOutOfBottle(ex);
break;
}
if (picid == PIC_SC4_LADDER) {
- if (!g_vars->scene04_var04) {
+ if (!g_vars->scene04_kozyawkaOnLadder) {
g_vars->scene04_sceneClickX = ex->_sceneClickX;
g_vars->scene04_sceneClickY = ex->_sceneClickY;
@@ -520,21 +1449,21 @@ int sceneHandler04(ExCommand *ex) {
break;
}
- StaticANIObject *ani = g_fullpipe->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY);
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY);
if ((ani && ani->_id == ANI_PLANK) || picid == PIC_SC4_PLANK) {
sceneHandler04_clickPlank();
ex->_messageKind = 0;
- } else if (g_vars->scene04_var01) {
- sceneHandler04_sub8(ex);
- } else if (!ani || !canInteractAny(g_fullpipe->_aniMan, ani, ex->_keyCode)) {
- PictureObject *pic = g_fullpipe->_currentScene->getPictureObjectById(picid, 0);
-
- if (!pic || !canInteractAny(g_fullpipe->_aniMan, pic,ex->_keyCode)) {
- if ((g_fullpipe->_sceneRect.right - ex->_sceneClickX < 47 && g_fullpipe->_sceneRect.right < g_fullpipe->_sceneWidth - 1)
- || (ex->_sceneClickX - g_fullpipe->_sceneRect.left < 47 && g_fullpipe->_sceneRect.left > 0))
- sceneHandlers_sub01(ex);
+ } else if (g_vars->scene04_dudeOnLadder) {
+ sceneHandler04_leaveLadder(ex);
+ } else if (!ani || !canInteractAny(g_fp->_aniMan, ani, ex->_keyCode)) {
+ PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picid, 0);
+
+ 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)
+ || (ex->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0))
+ g_fp->processArcade(ex);
}
}
}
@@ -550,8 +1479,8 @@ int sceneHandler04(ExCommand *ex) {
break;
case MSG_SC4_HANDOVER:
- g_vars->scene04_var09 = 0;
- g_vars->scene04_var19 = 1;
+ g_vars->scene04_handIsDown = false;
+ g_vars->scene04_objectIsTaken = true;
break;
case MSG_SC4_DROPBOTTLE:
@@ -560,16 +1489,16 @@ int sceneHandler04(ExCommand *ex) {
case MSG_SC4_COINOUT:
g_vars->scene04_clock->changeStatics2(ST_CLK_CLOSED);
- g_vars->scene04_coinPut = 0;
+ g_vars->scene04_coinPut = false;
sceneHandler04_stopSound();
- if (g_vars->scene04_kozyawkiAni.size() && !g_vars->scene04_var02) {
- g_vars->scene04_var09 = 1;
+ if (g_vars->scene04_kozyawkiAni.size() && !g_vars->scene04_bottleIsTaken) {
+ g_vars->scene04_handIsDown = true;
- if (g_vars->scene04_var10)
- sceneHandler04_sub1(0);
+ if (g_vars->scene04_dudeInBottle)
+ sceneHandler04_animOutOfBottle(0);
- sceneHandler04_sub15();
+ sceneHandler04_handTake();
}
break;
@@ -578,10 +1507,10 @@ int sceneHandler04(ExCommand *ex) {
{
ExCommand *exnew;
- if (g_vars->scene04_var11) {
- sceneHandler04_sub9(g_vars->scene04_var24);
+ if (g_vars->scene04_kozHeadRaised) {
+ sceneHandler04_putKozyawkaBack(g_vars->scene04_lastKozyawka);
- g_vars->scene04_var11 = 0;
+ g_vars->scene04_kozHeadRaised = 0;
exnew = new ExCommand(0, 35, SND_4_010, 0, 0, 0, 1, 0, 0, 0);
} else {
@@ -619,7 +1548,7 @@ int sceneHandler04(ExCommand *ex) {
break;
case MSG_SC4_COINPUT:
- g_vars->scene04_coinPut = 1;
+ g_vars->scene04_coinPut = true;
break;
}
diff --git a/engines/fullpipe/scenes/scene05.cpp b/engines/fullpipe/scenes/scene05.cpp
new file mode 100644
index 0000000000..c6e21daf1e
--- /dev/null
+++ b/engines/fullpipe/scenes/scene05.cpp
@@ -0,0 +1,386 @@
+/* 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/objects.h"
+#include "fullpipe/objectnames.h"
+#include "fullpipe/constants.h"
+#include "fullpipe/statics.h"
+#include "fullpipe/scene.h"
+#include "fullpipe/motion.h"
+#include "fullpipe/scenes.h"
+#include "fullpipe/messages.h"
+#include "fullpipe/floaters.h"
+#include "fullpipe/behavior.h"
+
+namespace Fullpipe {
+
+void scene05_initScene(Scene *sc) {
+ g_vars->scene05_handle = sc->getStaticANIObject1ById(ANI_HANDLE, -1);
+ g_vars->scene05_wacko = sc->getStaticANIObject1ById(ANI_OTMOROZ, -1);
+ g_vars->scene05_bigHatch = sc->getStaticANIObject1ById(ANI_BIGLUK, -1);
+
+
+ g_vars->scene05_wackoTicker = 0;
+ g_vars->scene05_handleFlipper = 1;
+ g_vars->scene05_floatersTicker = 1000;
+
+ Scene *oldscene = g_fp->_currentScene;
+
+ g_fp->_currentScene = sc;
+
+ if (g_fp->getObjectState(sO_WeirdWacko) == g_fp->getObjectEnumState(sO_WeirdWacko, sO_InGlasses)) {
+ g_vars->scene05_wacko->changeStatics2(ST_OTM_GLS_LEFT);
+ g_vars->scene05_bigHatch->changeStatics2(ST_BLK_CLOSED);
+
+ g_vars->scene05_handle->changeStatics2(ST_HDL_UP);
+ g_vars->scene05_handle->_flags |= 4;
+ } else if (g_fp->getObjectState(sO_WeirdWacko) == g_fp->getObjectEnumState(sO_WeirdWacko, sO_WithDrawer)) {
+ g_vars->scene05_wacko->changeStatics2(ST_OTM_BOX_LEFT);
+ g_vars->scene05_bigHatch->changeStatics2(ST_BLK_CLOSED);
+ g_vars->scene05_handle->changeStatics2(ST_HDL_UP);
+ g_vars->scene05_handle->_flags |= 4;
+ } else {
+ g_vars->scene05_wacko->changeStatics2(ST_OTM_VNT_LEFT);
+
+ if (g_fp->getObjectState(sO_WeirdWacko) != g_fp->getObjectEnumState(sO_WeirdWacko, sO_WithPlunger)) {
+ g_vars->scene05_handle->changeStatics2(ST_HDL_BROKEN);
+ g_vars->scene05_bigHatch->changeStatics2(ST_BLK_CLOSED);
+ }
+ }
+
+ g_fp->_currentScene = oldscene;
+}
+
+void sceneHandler05_makeManFlight() {
+ int qid;
+
+ if (!g_vars->scene05_bigHatch->_statics || g_vars->scene05_bigHatch->_statics->_staticsId != ST_BLK_OPEN)
+ qid = QU_SC5_MANBUMP;
+ else
+ qid = QU_SC5_MANFLY;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(qid), 0, 0);
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ mq->chain(0);
+}
+
+void sceneHandler05_makeWackoFeedback() {
+ int staticsId1;
+ int staticsId2;
+
+ if (g_fp->getObjectState(sO_WeirdWacko) == g_fp->getObjectEnumState(sO_WeirdWacko, sO_InGlasses)) {
+ staticsId1 = ST_OTM_GLS_LEFT;
+ staticsId2 = (g_vars->scene05_handle->_statics->_staticsId == ST_HDL_DOWN) ? MV_OTM_HANDLEUP : MV_OTM_HANDLEDOWN;
+ } else if (g_fp->getObjectState(sO_WeirdWacko) != g_fp->getObjectEnumState(sO_WeirdWacko, sO_WithDrawer)) {
+ return;
+ } else {
+ staticsId1 = ST_OTM_BOX_LEFT;
+ staticsId2 = (g_vars->scene05_handle->_statics->_staticsId == ST_HDL_DOWN) ? MV_OTM_BOXHANDLEUP : MV_OTM_BOXHANDLEDOWN;
+ }
+
+ if (g_vars->scene05_wacko->_movement)
+ g_vars->scene05_wacko->changeStatics2(g_vars->scene05_wacko->_movement->_staticsObj2->_staticsId);
+
+ if (staticsId1 == g_vars->scene05_wacko->_statics->_staticsId) {
+ g_vars->scene05_wacko->startAnim(staticsId2, 0, -1);
+ } else {
+ MessageQueue *mq = g_vars->scene05_wacko->changeStatics1(staticsId1);
+
+ if (mq) {
+ mq->setFlags(mq->getFlags() | 1);
+
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC5_MAKEOTMFEEDBACK, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_excFlags |= 2;
+
+ mq->addExCommandToEnd(ex);
+ mq->_isFinished = 0;
+ }
+ }
+}
+
+void sceneHandler05_resetTicks() {
+ 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
+ g_vars->scene05_wackoTicker = 0;
+}
+
+void sceneHandler05_genFlies() {
+ if (g_vars->scene05_floatersTicker <= 1000)
+ return;
+
+ if (g_fp->_rnd->getRandomNumber(1)) {
+ int numFlies = g_fp->_rnd->getRandomNumber(3) + 1;
+
+ for (int i = 0; i < numFlies; i++) {
+ int x = g_fp->_rnd->getRandomNumber(55) + 538;
+ int y = g_fp->_rnd->getRandomNumber(60) + i * 30 + 520;
+
+ g_fp->_floaters->genFlies(g_fp->_currentScene, x, y, 5, 1);
+ g_fp->_floaters->_array2.back()->val2 = 585;
+ g_fp->_floaters->_array2.back()->val3 = -70;
+ g_fp->_floaters->_array2.back()->val11 = 8.0;
+ }
+ }
+
+ g_vars->scene05_floatersTicker = 0;
+}
+
+void sceneHandler05_showHandle() {
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_HANDLE, -1)->show1(-1, -1, -1, 0);
+}
+
+void sceneHandler05_handleDown() {
+ StaticANIObject *hatch = g_fp->_currentScene->getStaticANIObject1ById(ANI_BIGLUK, -1);
+
+ hatch->changeStatics2(ST_BLK_CLOSED);
+ hatch->startAnim(MV_BLK_OPEN, 0, -1);
+
+ sceneHandler05_resetTicks();
+ sceneHandler05_genFlies();
+}
+
+void sceneHandler05_hideHandle() {
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_HANDLE, -1)->hide();
+}
+
+void sceneHandler05_handleUp() {
+ StaticANIObject *hatch = g_fp->_currentScene->getStaticANIObject1ById(ANI_BIGLUK, -1);
+
+ hatch->changeStatics2(ST_BLK_OPEN);
+ hatch->startAnim(MV_BLK_CLOSE, 0, -1);
+
+ sceneHandler05_resetTicks();
+}
+
+void sceneHandler05_testHatch(ExCommand *inex) {
+ ExCommand *ex;
+
+ if (g_fp->_currentScene->getStaticANIObject1ById(ANI_BIGLUK, -1)->_statics->_staticsId == ST_BLK_CLOSED) {
+ ex = new ExCommand(SC_5, 17, 61, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = TrubaLeft;
+ ex->_excFlags |= 2;
+ ex->postMessage();
+
+ return;
+ }
+
+ StaticANIObject *wacko = g_fp->_currentScene->getStaticANIObject1ById(ANI_OTMOROZ, -1);
+
+ if (wacko->_movement)
+ wacko->changeStatics2(wacko->_movement->_staticsObj2->_staticsId);
+
+ if (g_fp->getObjectState(sO_WeirdWacko) == g_fp->getObjectEnumState(sO_WeirdWacko, sO_InGlasses)) {
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(inex->_parId);
+
+ if (mq)
+ mq->deleteExCommandByIndex(mq->getCount() - 1, 1);
+
+ if (wacko->_statics->_staticsId != ST_OTM_GLS_LEFT) {
+ mq = wacko->changeStatics1(ST_OTM_GLS_LEFT);
+
+ if (!mq) {
+ wacko->changeStatics2(ST_OTM_GLS_LEFT);
+ mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ }
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ ex = new ExCommand(ANI_OTMOROZ, 1, MV_OTM_HANDLEUP, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2u;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(SC_5, 17, 61, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = TrubaLeft;
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ mq->_isFinished = 0;
+ return;
+ }
+
+ mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ mq->setFlags(mq->getFlags() | 1);
+
+ ex = new ExCommand(ANI_OTMOROZ, 1, MV_OTM_HANDLEUP, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(SC_5, 17, 61, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = TrubaLeft;
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ if (!mq->chain(wacko))
+ delete mq;
+ } else if (g_fp->getObjectState(sO_WeirdWacko) == g_fp->getObjectEnumState(sO_WeirdWacko, sO_WithDrawer)) {
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(inex->_parId);
+
+ if (mq)
+ mq->deleteExCommandByIndex(mq->getCount() - 1, 1);
+
+ if (wacko->_statics->_staticsId != ST_OTM_BOX_LEFT) {
+ mq = wacko->changeStatics1(ST_OTM_BOX_LEFT);
+ if (!mq) {
+ wacko->changeStatics2(ST_OTM_BOX_LEFT);
+ mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ }
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ ex = new ExCommand(ANI_OTMOROZ, 1, MV_OTM_BOXHANDLEUP, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(SC_5, 17, 61, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = TrubaLeft;
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ mq->_isFinished = 0;
+
+ return;
+ }
+
+ mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ mq->setFlags(mq->getFlags() | 1);
+
+ ex = new ExCommand(ANI_OTMOROZ, 1, MV_OTM_BOXHANDLEUP, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(SC_5, 17, 61, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = TrubaLeft;
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ if (!mq->chain(wacko))
+ delete mq;
+
+ return;
+ } else {
+ ex = new ExCommand(SC_5, 17, 61, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = TrubaLeft;
+ ex->_excFlags |= 2;
+ ex->postMessage();
+
+ return;
+ }
+}
+
+
+int sceneHandler05(ExCommand *ex) {
+ if (ex->_messageKind != 17)
+ return 0;
+
+ switch (ex->_messageNum) {
+ case MSG_SC5_BGRSOUNDOFF:
+ g_fp->stopAllSoundInstances(SND_5_026);
+ break;
+
+ case MSG_SC5_BGRSOUNDON:
+ g_fp->playSound(SND_5_026, 1);
+ break;
+
+ case MSG_SC5_MAKEMANFLIGHT:
+ sceneHandler05_makeManFlight();
+ break;
+
+ case MSG_SC5_MAKEOTMFEEDBACK:
+ 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;
+ }
+ break;
+
+ case MSG_SC5_SHOWHANDLE:
+ sceneHandler05_showHandle();
+ break;
+
+ case MSG_SC5_HANDLEDOWN:
+ g_vars->scene05_handle->changeStatics2(ST_HDL_DOWN);
+ sceneHandler05_handleDown();
+ break;
+
+ case MSG_SC5_HIDEHANDLE:
+ sceneHandler05_hideHandle();
+ break;
+
+ case MSG_SC5_HANDLEUP:
+ g_vars->scene05_handle->changeStatics2(ST_HDL_UP);
+ sceneHandler05_handleUp();
+ break;
+
+ case MSG_SC5_TESTLUK:
+ sceneHandler05_testHatch(ex);
+ break;
+
+ case 33:
+ {
+ int res = 0;
+ if (g_fp->_aniMan2) {
+ if (g_fp->_aniMan2->_ox < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.left - 300;
+
+ if (g_fp->_aniMan2->_ox > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.right + 300;
+
+ res = 1;
+ }
+
+ 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
+ && g_fp->_aniMan->_movement->_id != MV_MANHDL_HANDLEDOWN)) {
+ if (g_vars->scene05_handleFlipper % 2)
+ sceneHandler05_makeWackoFeedback();
+
+ g_vars->scene05_wackoTicker = 0;
+
+ ++g_vars->scene05_handleFlipper;
+ }
+ }
+ }
+
+ ++g_vars->scene05_floatersTicker;
+
+ g_fp->_floaters->update();
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+
+ return res;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene06.cpp b/engines/fullpipe/scenes/scene06.cpp
new file mode 100644
index 0000000000..c352d27dd6
--- /dev/null
+++ b/engines/fullpipe/scenes/scene06.cpp
@@ -0,0 +1,770 @@
+/* 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/objects.h"
+#include "fullpipe/objectnames.h"
+#include "fullpipe/constants.h"
+#include "fullpipe/gfx.h"
+#include "fullpipe/motion.h"
+#include "fullpipe/scenes.h"
+#include "fullpipe/statics.h"
+#include "fullpipe/scene.h"
+#include "fullpipe/messages.h"
+#include "fullpipe/gameloader.h"
+#include "fullpipe/behavior.h"
+#include "fullpipe/interaction.h"
+
+namespace Fullpipe {
+
+void scene06_initMumsy() {
+ g_vars->scene06_mumsyJumpFw = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene06_mumsy, ST_MOM_STANDS, QU_MOM_JUMPFW);
+ g_vars->scene06_mumsyJumpBk = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene06_mumsy, ST_MOM_STANDS, QU_MOM_JUMPBK);
+ g_vars->scene06_mumsyJumpFwPercent = g_vars->scene06_mumsyJumpFw->_percent;
+ g_vars->scene06_mumsyJumpBkPercent = g_vars->scene06_mumsyJumpBk->_percent;
+}
+
+int scene06_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_vars->scene06_arcadeEnabled) {
+ if (g_vars->scene06_aimingBall) {
+ g_fp->_cursorId = PIC_CSR_ARCADE2_D;
+
+ return PIC_CSR_ARCADE2_D;
+ }
+ if (g_fp->_aniMan == (StaticANIObject *)g_fp->_objectAtCursor) {
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN6_BALL && g_fp->_cursorId == PIC_CSR_DEFAULT) {
+ g_fp->_cursorId = PIC_CSR_ITN;
+
+ return PIC_CSR_ITN;
+ }
+ } else if (g_fp->_objectAtCursor && (StaticANIObject *)g_fp->_objectAtCursor == g_vars->scene06_currentBall
+ && g_fp->_cursorId == PIC_CSR_DEFAULT) {
+ g_fp->_cursorId = PIC_CSR_ITN;
+ }
+ }
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler06_setExits(Scene *sc) {
+ MotionController *mc = getSc2MctlCompoundBySceneId(sc->_sceneId);
+
+ mc->enableLinks(sO_CloseThing, (g_fp->getObjectState(sO_BigMumsy) != g_fp->getObjectEnumState(sO_BigMumsy, sO_IsGone)));
+ mc->enableLinks(sO_CloseThing2, g_vars->scene06_arcadeEnabled);
+}
+
+void sceneHandler06_winArcade() {
+ g_fp->setObjectState(sO_BigMumsy, g_fp->getObjectEnumState(sO_BigMumsy, sO_IsGone));
+
+ if (g_fp->getObjectState(sO_ClockAxis) == g_fp->getObjectEnumState(sO_ClockAxis, sO_IsNotAvailable))
+ g_fp->setObjectState(sO_ClockAxis, g_fp->getObjectEnumState(sO_ClockAxis, sO_WithoutHandle));
+
+ if (g_vars->scene06_arcadeEnabled) {
+ g_fp->_aniMan->_callback2 = 0;
+
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
+
+ if (g_vars->scene06_someBall) {
+ g_vars->scene06_someBall->_flags &= 0xFFFB;
+
+ g_vars->scene06_balls.push_back(g_vars->scene06_someBall);
+
+ g_vars->scene06_someBall = 0;
+ }
+
+ if (g_vars->scene06_flyingBall) {
+ g_vars->scene06_flyingBall->_flags &= 0xFFFB;
+
+ g_vars->scene06_balls.push_back(g_vars->scene06_flyingBall);
+
+ g_vars->scene06_flyingBall = 0;
+ }
+
+ if (g_vars->scene06_ballInHands) {
+ g_vars->scene06_ballInHands->_flags &= 0xFFFB;
+
+ g_vars->scene06_balls.push_back(g_vars->scene06_ballInHands);
+
+ g_vars->scene06_ballInHands = 0;
+ }
+
+ g_vars->scene06_arcadeEnabled = false;
+ g_vars->scene06_aimingBall = false;
+ }
+
+ g_vars->scene06_mumsy->_flags &= 0xFFFB;
+
+ sceneHandler06_setExits(g_fp->_currentScene);
+
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+}
+
+void sceneHandler06_enableDrops() {
+ chainQueue(QU_SC6_DROPS, 0);
+
+ g_vars->scene06_mumsy->changeStatics2(ST_MOM_SITS);
+ g_fp->setObjectState(sO_BigMumsy, g_fp->getObjectEnumState(sO_BigMumsy, sO_IsPlaying));
+
+ chainQueue(QU_MOM_STANDUP, 1);
+
+ g_vars->scene06_arcadeEnabled = true;
+ g_vars->scene06_numBallsGiven = 0;
+ g_vars->scene06_mumsyPos = 0;
+ g_vars->scene06_mumsyNumBalls = 0;
+ g_vars->scene06_mumsyGotBall = false;
+
+ sceneHandler06_setExits(g_fp->_currentScene);
+}
+
+void sceneHandler06_mumsyBallTake() {
+ int momAni = 0;
+
+ switch (g_vars->scene06_mumsyNumBalls) {
+ case 1:
+ momAni = MV_MOM_TAKE1;
+ break;
+ case 2:
+ momAni = MV_MOM_TAKE2;
+ break;
+ case 3:
+ momAni = MV_MOM_TAKE3;
+ break;
+ case 4:
+ momAni = MV_MOM_TAKE4;
+ break;
+ case 5:
+ momAni = MV_MOM_TAKE5;
+ break;
+ }
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+
+ ExCommand *ex = new ExCommand(ANI_MAMASHA, 2, 50, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_excFlags = 2u;
+ mq->addExCommandToEnd(ex);
+
+ if (g_vars->scene06_mumsyNumBalls >= 5) {
+ g_fp->setObjectState(sO_BigMumsy, g_fp->getObjectEnumState(sO_BigMumsy, sO_IsGone));
+
+ if (g_fp->getObjectState(sO_ClockAxis) == g_fp->getObjectEnumState(sO_ClockAxis, sO_IsNotAvailable))
+ g_fp->setObjectState(sO_ClockAxis, g_fp->getObjectEnumState(sO_ClockAxis, sO_WithoutHandle));
+
+ ex = new ExCommand(ANI_MAMASHA, 1, momAni, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ if (g_vars->scene06_mumsyPos + 3 >= 0) {
+ ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_STARTBK, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2u;
+ mq->addExCommandToEnd(ex);
+
+ for (int i = 0; i < g_vars->scene06_mumsyPos + 3; i++) {
+ ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_CYCLEBK, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+ }
+
+ ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_STOPBK, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+ }
+
+ ex = new ExCommand(0, 18, QU_MOM_TOLIFT, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+ mq->addExCommandToEnd(ex);
+ } else {
+ if (momAni) {
+ ex = new ExCommand(ANI_MAMASHA, 1, momAni, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+ }
+
+ if (g_vars->scene06_mumsyPos < 0) {
+ for (int i = 0; i > g_vars->scene06_mumsyPos; i--) {
+ ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_JUMPFW, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+ }
+ } else if (g_vars->scene06_mumsyPos > 0) {
+ for (int i = 0; i < g_vars->scene06_mumsyPos; i++) {
+ ex = new ExCommand(ANI_MAMASHA, 1, MV_MOM_JUMPBK, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+ }
+ }
+
+ ex = new ExCommand(0, 18, QU_MOM_SITDOWN, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3u;
+ mq->addExCommandToEnd(ex);
+ }
+
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+
+ g_vars->scene06_mumsyNumBalls = 0;
+ g_vars->scene06_arcadeEnabled = false;
+
+ g_fp->_aniMan2 = 0;
+}
+
+void sceneHandler06_spinHandle() {
+ int tummy = g_fp->getObjectState(sO_TummyTrampie);
+
+ if (tummy == g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsEating))
+ g_fp->setObjectState(sO_TummyTrampie, g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsSleeping));
+ else if (tummy == g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsSleeping))
+ g_fp->setObjectState(sO_TummyTrampie, g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsDrinking));
+ else if (tummy == g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsDrinking))
+ g_fp->setObjectState(sO_TummyTrampie, g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsScratchingBelly));
+ else if (tummy == g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsScratchingBelly))
+ g_fp->setObjectState(sO_TummyTrampie, g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsEating));
+}
+
+void sceneHandler06_uPipeClick() {
+ if (getGameLoaderInteractionController()->_flag24)
+ handleObjectInteraction(g_fp->_aniMan2, g_fp->_currentScene->getPictureObjectById(PIC_SC6_LADDER, 0), 0);
+}
+
+void sceneHandler06_buttonPush() {
+ g_vars->scene06_invHandle = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_HANDLE, -1);
+
+ if (g_vars->scene06_invHandle)
+ if (g_vars->scene06_invHandle->_flags & 4)
+ if (g_vars->scene06_invHandle->_statics)
+ if (g_vars->scene06_invHandle->_statics->_staticsId == ST_HDL_PLUGGED)
+ chainQueue(QU_SC6_FALLHANDLE, 1);
+}
+
+void sceneHandler06_showNextBall() {
+ if (g_vars->scene06_balls.size()) {
+ g_vars->scene06_currentBall = new StaticANIObject(g_vars->scene06_balls.front());
+ g_vars->scene06_balls.remove_at(0);
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC6_SHOWNEXTBALL), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene06_currentBall->_okeyCode);
+ mq->chain(0);
+
+ ++g_vars->scene06_numBallsGiven;
+ }
+}
+
+void sceneHandler06_installHandle() {
+ chainQueue(QU_SC6_SHOWHANDLE, 0);
+}
+
+int sceneHandler06_updateScreenCallback() {
+ int res;
+
+ res = g_fp->drawArcadeOverlay(g_vars->scene06_arcadeEnabled);
+
+ if (!res)
+ g_fp->_updateScreenCallback = 0;
+
+ return res;
+}
+
+void sceneHandler06_startAiming() {
+ if (g_vars->scene06_currentBall) {
+ g_vars->scene06_currentBall->hide();
+
+ g_fp->_aniMan->startAnim(MV_MAN6_TAKEBALL, 0, -1);
+
+ g_vars->scene06_ballInHands = g_vars->scene06_currentBall;
+ g_vars->scene06_currentBall = 0;
+
+ if (getCurrSceneSc2MotionController()->_isEnabled)
+ g_fp->_updateScreenCallback = sceneHandler06_updateScreenCallback;
+
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+
+ g_vars->scene06_ballDrop->queueMessageQueue(0);
+ }
+}
+
+void sceneHandler06_takeBall() {
+ if (g_vars->scene06_currentBall && !g_vars->scene06_currentBall->_movement && g_vars->scene06_currentBall->_statics->_staticsId == ST_NBL_NORM) {
+ if (abs(1158 - g_fp->_aniMan->_ox) > 1
+ || abs(452 - g_fp->_aniMan->_oy) > 1
+ || g_fp->_aniMan->_movement
+ || g_fp->_aniMan->_statics->_staticsId != (0x4000 | ST_MAN_RIGHT)) {
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1158, 452, 1, (0x4000 | ST_MAN_RIGHT));
+
+ if (mq) {
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC6_TAKEBALL, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+ mq->addExCommandToEnd(ex);
+
+ postExCommand(g_fp->_aniMan->_id, 2, 1158, 452, 0, -1);
+ }
+ } else {
+ sceneHandler06_startAiming();
+ }
+ }
+}
+
+void sceneHandler06_aiming() {
+ if (g_vars->scene06_ballInHands) {
+ g_vars->scene06_ballDeltaX = 4 * g_fp->_aniMan->_movement->_currDynamicPhaseIndex + 16;
+ g_vars->scene06_ballDeltaY = 5 * (g_fp->_aniMan->_movement->_currDynamicPhaseIndex + 4);
+
+ if (g_fp->_aniMan->_movement->_currDynamicPhaseIndex < 4) {
+ g_fp->_aniMan->_movement->setDynamicPhaseIndex(11);
+
+ g_vars->scene06_aimingBall = false;
+
+ return;
+ }
+
+ g_fp->_aniMan->_movement->setDynamicPhaseIndex(9);
+ }
+
+ g_vars->scene06_aimingBall = false;
+}
+
+void sceneHandler06_ballStartFly() {
+ if (g_vars->scene06_ballInHands) {
+ g_vars->scene06_flyingBall = g_vars->scene06_ballInHands;
+ g_vars->scene06_ballInHands = 0;
+ g_vars->scene06_flyingBall->show1(g_fp->_aniMan->_ox - 60, g_fp->_aniMan->_oy - 60, -1, 0);
+
+ g_vars->scene06_flyingBall->_priority = 27;
+ }
+}
+
+void sceneHandler06_throwCallback(int *arg) {
+ if (g_vars->scene06_aimingBall) {
+ int dist = (g_fp->_mouseVirtY - g_vars->scene06_sceneClickY)
+ * (g_fp->_mouseVirtY - g_vars->scene06_sceneClickY)
+ + (g_fp->_mouseVirtX - g_vars->scene06_sceneClickX)
+ * (g_fp->_mouseVirtX - g_vars->scene06_sceneClickX);
+
+ *arg = (int)(sqrt((double)dist) * 0.1);
+
+ if (*arg > 8)
+ *arg = 8;
+ } else {
+ *arg = *arg + 1;
+ if (*arg == 12)
+ sceneHandler06_ballStartFly();
+ }
+}
+
+void sceneHandler06_throwBall() {
+ g_fp->_aniMan->_callback2 = sceneHandler06_throwCallback;
+ g_fp->_aniMan->startAnim(MV_MAN6_THROWBALL, 0, -1);
+
+ g_vars->scene06_aimingBall = true;
+}
+
+void sceneHandler06_eggieWalk() {
+ if (15 - g_vars->scene06_numBallsGiven >= 4 && !g_fp->_rnd->getRandomNumber(9)) {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_EGGIE, -1);
+
+ if (!ani || !(ani->_flags & 4)) {
+ if (g_vars->scene06_eggieDirection)
+ chainQueue(QU_EGG6_GOR, 0);
+ else
+ chainQueue(QU_EGG6_GOL, 0);
+
+ g_vars->scene06_eggieTimeout = 0;
+ g_vars->scene06_eggieDirection = !g_vars->scene06_eggieDirection;
+ }
+ }
+}
+
+void sceneHandler06_dropBall() {
+ if (g_vars->scene06_numBallsGiven >= 15 || g_vars->scene06_mumsyNumBalls >= 5)
+ g_vars->scene06_ballDrop->hide();
+ else
+ chainQueue(QU_SC6_DROPS3, 0);
+}
+
+void sceneHandler06_fallBall() {
+ g_vars->scene06_ballY = 475;
+
+ g_vars->scene06_flyingBall->setOXY(g_vars->scene06_ballX, g_vars->scene06_ballY);
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC6_FALLBALL), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene06_flyingBall->_okeyCode);
+ mq->chain(0);
+
+ g_vars->scene06_balls.push_back(g_vars->scene06_flyingBall);
+
+ g_vars->scene06_flyingBall = 0;
+
+ sceneHandler06_dropBall();
+ sceneHandler06_eggieWalk();
+}
+
+void sceneHandler06_catchBall() {
+ if (g_vars->scene06_flyingBall) {
+ g_vars->scene06_flyingBall->hide();
+
+ g_vars->scene06_balls.push_back(g_vars->scene06_flyingBall);
+
+ g_vars->scene06_flyingBall = 0;
+
+ g_vars->scene06_mumsyNumBalls++;
+
+ if (g_vars->scene06_mumsy->_movement) {
+ Common::Point point;
+
+ if (g_vars->scene06_mumsy->_movement->_id == MV_MOM_JUMPFW) {
+ if (g_vars->scene06_mumsy->_movement->_currDynamicPhaseIndex <= 5) {
+ g_vars->scene06_mumsy->_movement->calcSomeXY(point, 0);
+
+ point.x = -point.x;
+ point.y = -point.y;
+ } else {
+ g_vars->scene06_mumsy->_movement->calcSomeXY(point, 1);
+
+ g_vars->scene06_mumsyPos++;
+ }
+ } else if (g_vars->scene06_mumsy->_movement->_id == MV_MOM_JUMPBK) {
+ if (g_vars->scene06_mumsy->_movement->_currDynamicPhaseIndex <= 4) {
+ g_vars->scene06_mumsy->_movement->calcSomeXY(point, 0);
+
+ point.x = -point.x;
+ point.y = -point.y;
+ } else {
+ g_vars->scene06_mumsy->_movement->calcSomeXY(point, 1);
+
+ g_vars->scene06_mumsyPos--;
+ }
+ }
+
+ g_vars->scene06_mumsy->changeStatics2(ST_MOM_STANDS);
+ g_vars->scene06_mumsy->setOXY(point.x + g_vars->scene06_mumsy->_ox,
+ point.y + g_vars->scene06_mumsy->_oy);
+ } else {
+ g_vars->scene06_mumsy->changeStatics2(ST_MOM_STANDS);
+ }
+
+ chainQueue(QU_MOM_PUTBALL, 1);
+ g_vars->scene06_mumsyGotBall = true;
+
+ sceneHandler06_dropBall();
+ }
+}
+
+void sceneHandler06_checkBallTarget(int par) {
+ int pixel;
+
+ if (g_vars->scene06_ballY <= 475) {
+ if (g_vars->scene06_mumsy->getPixelAtPos(g_vars->scene06_ballX, g_vars->scene06_ballY, &pixel)) {
+ if (pixel) {
+ chainObjQueue(g_vars->scene06_mumsy, QU_MOM_JUMPBK, 0);
+
+ sceneHandler06_catchBall();
+ }
+ }
+ } else {
+ sceneHandler06_fallBall();
+ }
+}
+
+void scene06_initScene(Scene *sc) {
+ g_vars->scene06_mumsy = sc->getStaticANIObject1ById(ANI_MAMASHA, -1);
+ g_vars->scene06_someBall = 0;
+ g_vars->scene06_invHandle = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1);
+ g_vars->scene06_liftButton = sc->getStaticANIObject1ById(ANI_BUTTON_6, -1);
+ g_vars->scene06_ballDrop = sc->getStaticANIObject1ById(ANI_BALLDROP, -1);
+ g_vars->scene06_arcadeEnabled = false;
+ g_vars->scene06_aimingBall = false;
+ g_vars->scene06_currentBall = 0;
+ g_vars->scene06_ballInHands = 0;
+ g_vars->scene06_flyingBall = 0;
+ g_vars->scene06_balls.clear();
+ g_vars->scene06_numBallsGiven = 0;
+ g_vars->scene06_mumsyNumBalls = 0;
+ g_vars->scene06_eggieTimeout = 0;
+ g_vars->scene06_eggieDirection = true;
+
+ StaticANIObject *ball = sc->getStaticANIObject1ById(ANI_NEWBALL, -1);
+
+ ball->hide();
+ ball->_statics = ball->getStaticsById(ST_NBL_NORM);
+ g_vars->scene06_balls.push_back(ball);
+
+ for (int i = 0; i < 3; i++) {
+ StaticANIObject *ball2 = new StaticANIObject(ball);
+
+ ball2->hide();
+ ball2->_statics = ball2->getStaticsById(ST_NBL_NORM);
+
+ sc->addStaticANIObject(ball2, 1);
+
+ g_vars->scene06_balls.push_back(ball2);
+ }
+
+ if (g_fp->getObjectState(sO_BigMumsy) == g_fp->getObjectEnumState(sO_BigMumsy, sO_IsPlaying))
+ g_fp->setObjectState(sO_BigMumsy, g_fp->getObjectEnumState(sO_BigMumsy, sO_IsSleeping));
+
+ if (g_fp->getObjectState(sO_BigMumsy) != g_fp->getObjectEnumState(sO_BigMumsy, sO_IsSleeping))
+ g_vars->scene06_mumsy->hide();
+
+ g_fp->lift_setButton(sO_Level3, ST_LBN_3N);
+ g_fp->lift_sub5(sc, QU_SC6_ENTERLIFT, QU_SC6_EXITLIFT);
+ g_fp->initArcadeKeys("SC_6");
+
+ sceneHandler06_setExits(sc);
+
+ g_fp->setArcadeOverlay(PIC_CSR_ARCADE2);
+}
+
+int sceneHandler06(ExCommand *ex) {
+ if (ex->_messageKind != 17)
+ return 0;
+
+ switch(ex->_messageNum) {
+ case MSG_LIFT_CLOSEDOOR:
+ g_fp->lift_closedoorSeq();
+ break;
+
+ case MSG_LIFT_EXITLIFT:
+ g_fp->lift_exitSeq(ex);
+ break;
+
+ case MSG_CMN_WINARCADE:
+ sceneHandler06_winArcade();
+ break;
+
+ case MSG_LIFT_STARTEXITQUEUE:
+ g_fp->lift_startExitQueue();
+ break;
+
+ case MSG_SC6_RESTORESCROLL:
+ g_fp->_aniMan2 = g_fp->_aniMan;
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+ sceneHandler06_setExits(g_fp->_currentScene);
+ break;
+
+ case MSG_SC6_STARTDROPS:
+ if (g_fp->getObjectState(sO_BigMumsy) == g_fp->getObjectEnumState(sO_BigMumsy, sO_IsSleeping))
+ sceneHandler06_enableDrops();
+ break;
+
+ case MSG_SC6_TESTNUMBALLS:
+ g_vars->scene06_mumsyGotBall = false;
+
+ if (g_vars->scene06_mumsyNumBalls < 5 || !g_vars->scene06_arcadeEnabled)
+ return 0;
+
+ sceneHandler06_mumsyBallTake();
+ break;
+
+ case MSG_SC6_JUMPFW:
+ ++g_vars->scene06_mumsyPos;
+ break;
+
+ case MSG_SC6_JUMPBK:
+ --g_vars->scene06_mumsyPos;
+ break;
+
+ case MSG_LIFT_CLICKBUTTON:
+ g_fp->lift_animation3();
+ break;
+
+ case MSG_SPINHANDLE:
+ sceneHandler06_spinHandle();
+ break;
+
+ case MSG_LIFT_GO:
+ g_fp->lift_goAnimation();
+ break;
+
+ case MSG_SC6_UTRUBACLICK:
+ sceneHandler06_uPipeClick();
+ break;
+
+ case MSG_SC6_BTNPUSH:
+ sceneHandler06_buttonPush();
+ break;
+
+ case MSG_SC6_SHOWNEXTBALL:
+ sceneHandler06_showNextBall();
+ break;
+
+ case MSG_SC6_INSTHANDLE:
+ sceneHandler06_installHandle();
+ break;
+
+ case MSG_SC6_ENABLEDROPS:
+ sceneHandler06_enableDrops();
+ break;
+
+ case 64:
+ g_fp->lift_sub05(ex);
+ break;
+
+ case MSG_SC6_TAKEBALL:
+ sceneHandler06_takeBall();
+ break;
+
+ case 30:
+ if (g_vars->scene06_aimingBall) {
+ sceneHandler06_aiming();
+ break;
+ }
+
+ if (!g_vars->scene06_arcadeEnabled) {
+ // Do nothing
+ break;
+ }
+ break;
+
+ case 29:
+ {
+ StaticANIObject *st = g_fp->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY);
+
+ if (st) {
+ if (!g_vars->scene06_arcadeEnabled && st->_id == ANI_LIFTBUTTON) {
+ g_fp->lift_sub1(st);
+ ex->_messageKind = 0;
+ return 0;
+ }
+
+ if (g_vars->scene06_currentBall == st) {
+ if (g_vars->scene06_numBallsGiven == 1)
+ sceneHandler06_takeBall();
+
+ ex->_messageKind = 0;
+ } else if (g_vars->scene06_ballInHands && g_fp->_aniMan == st && !g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN6_BALL) {
+ g_vars->scene06_sceneClickX = ex->_sceneClickX;
+ g_vars->scene06_sceneClickY = ex->_sceneClickY;
+
+ sceneHandler06_throwBall();
+ }
+ }
+
+ if (!st || !canInteractAny(g_fp->_aniMan, st, ex->_keyCode)) {
+ int picId = g_fp->_currentScene->getPictureObjectIdAtPos(ex->_sceneClickX, ex->_sceneClickY);
+ PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0);
+
+ 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)
+ || (ex->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) {
+ g_fp->processArcade(ex);
+ return 0;
+ }
+ }
+ }
+ }
+
+ break;
+
+ case 33:
+ {
+ int res = 0;
+
+ if (g_fp->_aniMan2) {
+ int ox = g_fp->_aniMan2->_ox;
+ int oy = g_fp->_aniMan2->_oy;
+
+ g_vars->scene06_manX = ox;
+ g_vars->scene06_manY = oy;
+
+ if (g_vars->scene06_arcadeEnabled && oy <= 470 && ox >= 1088) {
+ if (ox < g_fp->_sceneRect.left + 600) {
+ g_fp->_currentScene->_x = ox - g_fp->_sceneRect.left - 700;
+ ox = g_vars->scene06_manX;
+ }
+
+ if (ox > g_fp->_sceneRect.right - 50)
+ g_fp->_currentScene->_x = ox - g_fp->_sceneRect.right + 70;
+ } else {
+ if (ox < g_fp->_sceneRect.left + 200) {
+ g_fp->_currentScene->_x = ox - g_fp->_sceneRect.left - 300;
+ ox = g_vars->scene06_manX;
+ }
+
+ if (ox > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = ox - g_fp->_sceneRect.right + 300;
+ }
+
+ res = 1;
+ }
+ if (g_vars->scene06_arcadeEnabled) {
+ if (g_vars->scene06_mumsyPos > -3)
+ g_vars->scene06_mumsyJumpBk->_percent = g_vars->scene06_mumsyJumpBkPercent;
+ else
+ g_vars->scene06_mumsyJumpBk->_percent = 0;
+
+ if (g_vars->scene06_mumsyPos < 4)
+ g_vars->scene06_mumsyJumpFw->_percent = g_vars->scene06_mumsyJumpFwPercent;
+ else
+ g_vars->scene06_mumsyJumpFw->_percent = 0;
+
+ if (g_vars->scene06_aimingBall) {
+ g_vars->scene06_eggieTimeout++;
+
+ if (g_vars->scene06_eggieTimeout >= 600)
+ sceneHandler06_eggieWalk();
+ }
+ } else {
+ g_vars->scene06_mumsyJumpFw->_percent = 0;
+ g_vars->scene06_mumsyJumpBk->_percent = 0;
+ }
+
+ if (g_vars->scene06_flyingBall) {
+ g_vars->scene06_ballX = g_vars->scene06_flyingBall->_ox - g_vars->scene06_ballDeltaX;
+ g_vars->scene06_ballY = g_vars->scene06_flyingBall->_oy - g_vars->scene06_ballDeltaY;
+
+ g_vars->scene06_flyingBall->setOXY(g_vars->scene06_ballX, g_vars->scene06_ballY);
+
+ if (g_vars->scene06_ballDeltaX >= 2)
+ g_vars->scene06_ballDeltaX -= 2;
+
+ g_vars->scene06_ballDeltaY -= 5;
+
+ sceneHandler06_checkBallTarget(g_vars->scene06_ballDeltaX);
+ }
+ if (g_vars->scene06_arcadeEnabled
+ && !g_vars->scene06_currentBall
+ && !g_vars->scene06_ballInHands
+ && !g_vars->scene06_flyingBall
+ && g_vars->scene06_numBallsGiven >= 15
+ && !g_vars->scene06_ballDrop->_movement
+ && !g_vars->scene06_mumsy->_movement
+ && !g_vars->scene06_mumsyGotBall)
+ sceneHandler06_mumsyBallTake();
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ return res;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene07.cpp b/engines/fullpipe/scenes/scene07.cpp
new file mode 100644
index 0000000000..207189d151
--- /dev/null
+++ b/engines/fullpipe/scenes/scene07.cpp
@@ -0,0 +1,175 @@
+/* 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/objects.h"
+#include "fullpipe/objectnames.h"
+#include "fullpipe/constants.h"
+#include "fullpipe/motion.h"
+#include "fullpipe/scenes.h"
+#include "fullpipe/scene.h"
+#include "fullpipe/statics.h"
+#include "fullpipe/messages.h"
+#include "fullpipe/behavior.h"
+
+namespace Fullpipe {
+
+void scene07_initScene(Scene *sc) {
+ g_vars->scene07_lukeAnim = 0;
+ g_vars->scene07_lukePercent = 0;
+ g_vars->scene07_plusMinus = sc->getStaticANIObject1ById(ANI_PLUSMINUS, -1);
+
+ if (g_fp->getObjectState(sO_Guard_1) == g_fp->getObjectEnumState(sO_Guard_1, sO_Off))
+ g_vars->scene07_plusMinus->_statics = g_vars->scene07_plusMinus->getStaticsById(ST_PMS_MINUS);
+ else
+ g_vars->scene07_plusMinus->_statics = g_vars->scene07_plusMinus->getStaticsById(ST_PMS_PLUS);
+
+ if (g_fp->getObjectState(sO_HareTheNooksiter) == g_fp->getObjectEnumState(sO_HareTheNooksiter, sO_WithoutHandle)) {
+ Scene *oldsc = g_fp->_currentScene;
+
+ g_fp->_currentScene = sc;
+
+ sc->getStaticANIObject1ById(ANI_CORNERSITTER, -1)->changeStatics2(ST_CST_HANDLELESS);
+
+ g_fp->_currentScene = oldsc;
+ }
+}
+
+void sceneHandler07_openLuke() {
+ StaticANIObject *luke = g_fp->_currentScene->getStaticANIObject1ById(ANI_LUKE, -1);
+
+ luke->changeStatics2(ST_LUK_OPEN);
+ luke->show1(-1, -1, -1, 0);
+
+ if (g_vars->scene07_lukeAnim) {
+ g_vars->scene07_lukeAnim->_percent = g_vars->scene07_lukePercent;
+ } else {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_CORNERSITTER, -1);
+
+ g_vars->scene07_lukeAnim = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(ani, ST_CST_HANDLELESS, QU_CST_CLOSELUKE);
+
+ g_vars->scene07_lukeAnim->_percent = g_vars->scene07_lukePercent;
+ }
+}
+
+void sceneHandler07_closeLuke() {
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_LUKE, -1)->changeStatics2(ST_LUK_CLOSED);
+
+ if (!g_vars->scene07_lukeAnim) {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_CORNERSITTER, -1);
+
+ g_vars->scene07_lukeAnim = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(ani, ST_CST_HANDLELESS, QU_CST_CLOSELUKE);
+ }
+
+ g_vars->scene07_lukePercent = g_vars->scene07_lukeAnim->_percent;
+ g_vars->scene07_lukeAnim->_percent = 0;
+
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_HOOLIGAN, -1);
+
+ ani->changeStatics2(ST_HGN_LUKE);
+ ani->show1(-1, -1, -1, 0);
+}
+
+void sceneHandler07_hideLuke() {
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_LUKE, -1)->hide();
+
+ Movement *mov = g_fp->_currentScene->getStaticANIObject1ById(ANI_CORNERSITTER, -1)->_movement;
+
+ if (mov) {
+ if (mov->_id == MV_CST_CLOSELUKE) {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_HOOLIGAN, -1);
+
+ ani->changeStatics2(ST_HGN_LOOK);
+ ani->_flags &= 0xFFFB;
+ }
+ }
+}
+
+void sceneHandler07_showBox() {
+ StaticANIObject *box = g_fp->_currentScene->getStaticANIObject1ById(ANI_SC7_BOX, -1);
+
+ box->show1(492, 474, MV_SC7_BOX_default, 0);
+ box->_priority = 25;
+}
+
+void sceneHandler07_hideBox() {
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_SC7_BOX, -1)->hide();
+}
+
+int sceneHandler07(ExCommand *ex) {
+ if (ex->_messageKind != 17)
+ return 0;
+
+ switch(ex->_messageNum) {
+ case MSG_SC7_OPENLUKE:
+ sceneHandler07_openLuke();
+ break;
+
+ case MSG_SC7_PULL:
+ if (g_vars->scene07_plusMinus->_statics->_staticsId == ST_PMS_MINUS)
+ g_vars->scene07_plusMinus->_statics = g_vars->scene07_plusMinus->getStaticsById(ST_PMS_PLUS);
+ else
+ g_vars->scene07_plusMinus->_statics = g_vars->scene07_plusMinus->getStaticsById(ST_PMS_MINUS);
+
+ break;
+
+ case MSG_SC7_CLOSELUKE:
+ sceneHandler07_closeLuke();
+ break;
+
+ case MSG_SC7_HIDELUKE:
+ sceneHandler07_hideLuke();
+ break;
+
+ case MSG_SC7_SHOWBOX:
+ sceneHandler07_showBox();
+ break;
+
+ case MSG_SC7_HIDEBOX:
+ sceneHandler07_hideBox();
+ break;
+
+ case 33:
+ {
+ int res = 0;
+
+ if (g_fp->_aniMan2) {
+ if (g_fp->_aniMan2->_ox < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.left - 300;
+
+ if (g_fp->_aniMan2->_ox > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.right + 300;
+
+ res = 1;
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ return res;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene08.cpp b/engines/fullpipe/scenes/scene08.cpp
new file mode 100644
index 0000000000..716ca1f593
--- /dev/null
+++ b/engines/fullpipe/scenes/scene08.cpp
@@ -0,0 +1,546 @@
+/* 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/objects.h"
+#include "fullpipe/objectnames.h"
+#include "fullpipe/constants.h"
+#include "fullpipe/motion.h"
+#include "fullpipe/scenes.h"
+#include "fullpipe/scene.h"
+#include "fullpipe/statics.h"
+#include "fullpipe/floaters.h"
+#include "fullpipe/gameloader.h"
+#include "fullpipe/behavior.h"
+#include "fullpipe/interaction.h"
+
+namespace Fullpipe {
+
+void scene08_initScene(Scene *sc) {
+ g_vars->scene08_inArcade = false;
+ g_vars->scene08_inAir = false;
+ g_vars->scene08_flyingUp = false;
+ g_vars->scene08_onBelly = false;
+ g_vars->scene08_batuta = sc->getStaticANIObject1ById(ANI_BATUTA, -1);
+ g_vars->scene08_vmyats = sc->getStaticANIObject1ById(ANI_VMYATS, -1);
+ g_vars->scene08_clock = sc->getStaticANIObject1ById(ANI_CLOCK_8, -1);
+ g_vars->scene08_stairsOffset = -37;
+ g_vars->scene08_snoringCountdown = -1;
+
+ Scene *oldsc = g_fp->_currentScene;
+ g_fp->_currentScene = sc;
+
+ int batuta = g_fp->getObjectState(sO_TummyTrampie);
+ MovGraphLink *lock = getSc2MctlCompoundBySceneId(sc->_sceneId)->getLinkByName(sO_CloseThing);
+
+ if (lock)
+ lock->_flags &= 0xDFFFFFFF;
+
+ if (batuta == g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsEating)) {
+ g_vars->scene08_batuta->changeStatics2(ST_BTT_SPOON);
+ } else if (batuta == g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsDrinking)) {
+ g_vars->scene08_batuta->changeStatics2(ST_BTT_NOSPOON);
+
+ g_vars->scene08_clock->startAnim(MV_CLK8_GO, 0, -1);
+ g_vars->scene08_clock->_movement->setDynamicPhaseIndex(3);
+ } else if (batuta== g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsScratchingBelly)) {
+ g_vars->scene08_batuta->changeStatics2(ST_BTT_CHESHET);
+
+ g_vars->scene08_clock->startAnim(MV_CLK8_GO, 0, -1);
+ g_vars->scene08_clock->_movement->setDynamicPhaseIndex(8);
+ } else if (batuta == g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsSleeping)) {
+ g_vars->scene08_batuta->changeStatics2(ST_BTT_SLEEPS);
+
+ g_vars->scene08_clock->startAnim(MV_CLK8_GO, 0, -1);
+ g_vars->scene08_clock->_movement->setDynamicPhaseIndex(2);
+
+ if (lock)
+ lock->_flags |= 0x20000000;
+
+ g_vars->scene08_snoringCountdown = 71;
+ }
+
+ g_vars->scene08_clock->_callback2 = 0;
+
+ if (g_fp->getObjectState(sO_StairsUp_8) == g_fp->getObjectEnumState(sO_StairsUp_8, sO_Broken)) {
+ g_vars->scene08_stairsVisible = false;
+
+ sc->getPictureObjectById(PIC_SC8_LADDER, 0)->_flags &= 0xFFFB;
+
+ g_vars->scene08_stairsOffset = -39;
+ } else {
+ g_vars->scene08_stairsVisible = true;
+ }
+
+ sc->getPictureObjectById(PIC_SC8_ARCADENOW, 0)->_flags &= 0xFFFB;
+
+ g_fp->_currentScene = oldsc;
+
+ g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_8"));
+ g_fp->_floaters->genFlies(sc, 100, 100, 0, 0);
+
+ g_fp->setArcadeOverlay(PIC_CSR_ARCADE3);
+}
+
+void scene08_setupMusic() {
+ if (g_fp->getObjectState(sO_TummyTrampie) == g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsSleeping))
+ g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_8"), "MUSIC_ARCADE", 1);
+}
+
+int scene08_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_vars->scene08_inArcade) {
+ if (g_vars->scene08_onBelly) {
+ if (g_fp->_objectIdAtCursor == PIC_SC8_LADDERD && g_fp->_cursorId == PIC_CSR_ITN)
+ g_fp->_cursorId = PIC_CSR_GOU;
+ } else {
+ g_fp->_cursorId = -1;
+ }
+ } else {
+ if (g_fp->_objectIdAtCursor == PIC_SC8_LADDERD && g_fp->_cursorId == PIC_CSR_ITN) {
+ if (g_fp->_aniMan2->_oy >= 520) {
+ if (g_fp->_aniMan2->_oy <= 750)
+ g_fp->_cursorId = PIC_CSR_GOU;
+ } else {
+ g_fp->_cursorId = PIC_CSR_GOD;
+ }
+ }
+ }
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler08_enterUp() {
+ g_fp->_currentScene->getPictureObjectById(PIC_SC8_LADDER, 0)->_flags &= 0xFFFB;
+
+ g_fp->_aniMan->changeStatics2(ST_MAN8_HANDSUP);
+ g_fp->_aniMan->setOXY(386, 236);
+ g_fp->_aniMan->_priority = 10;
+ g_fp->_aniMan->_flags = 4;
+
+ chainObjQueue(g_fp->_aniMan, QU_SC8_FINISH, 1);
+
+ g_vars->scene08_inAir = false;
+}
+
+void sceneHandler08_winArcade() {
+ if (g_vars->scene08_inArcade) {
+ g_vars->scene08_inArcade = false;
+ g_fp->_sceneRect.top = 0;
+ g_fp->_sceneRect.bottom = 600;
+
+ sceneHandler08_enterUp();
+ }
+}
+
+void sceneHandler08_hideLadder() {
+ g_fp->_currentScene->getPictureObjectById(PIC_SC8_LADDER_D, 0)->_flags &= 0xFFFB;
+}
+
+void sceneHandler08_arcadeNow() {
+ MovGraphLink *lnk = getCurrSceneSc2MotionController()->getLinkByName(sO_Stairway);
+
+ g_fp->setObjectState(sO_TummyTrampie, g_fp->getObjectEnumState(sO_TummyTrampie, sO_IsSleeping));
+
+ g_vars->scene08_batuta->changeStatics2(ST_BTT_SLEEPS);
+
+ if (lnk)
+ lnk->_flags |= 0x20000000;
+}
+
+void sceneHandler08_resumeFlight() {
+ g_vars->scene08_manOffsetY = 3;
+ g_vars->scene08_stairsOffset = -39;
+ g_vars->scene08_inAir = true;
+ g_vars->scene08_stairsVisible = false;
+}
+
+int sceneHandler08_calcOffset(int off, int flag) {
+ if (off > 0) {
+ if (flag)
+ return off * 31 / 10; // off * 3.1
+ else
+ return 5 * off;
+ } else {
+ return 5 * off;
+ }
+}
+
+void sceneHandler08_pushCallback(int *par) {
+ Common::Point point;
+
+ int y = g_fp->_aniMan->_oy + g_fp->_aniMan->getSomeXY(point)->y;
+
+ if (g_fp->_aniMan->_statics && g_fp->_aniMan->_statics->_staticsId == ST_MAN8_FLYDOWN)
+ y -= 25;
+
+ *par = (y - 703) / 10;
+ if (*par > 11) {
+ *par = 11;
+ g_vars->scene08_manOffsetY = 0;
+ }
+ if (*par >= 0)
+ g_vars->scene08_manOffsetY -= sceneHandler08_calcOffset(*par, g_vars->scene08_manOffsetY < 0);
+ else
+ *par = 0;
+}
+
+int sceneHandler08_updateScreenCallback() {
+ int res;
+
+ res = g_fp->drawArcadeOverlay(g_vars->scene08_inArcade);
+
+ if (!res)
+ g_fp->_updateScreenCallback = 0;
+
+ return res;
+}
+
+void sceneHandler08_startArcade() {
+ g_vars->scene08_inArcade = true;
+ g_vars->scene08_inAir = true;
+ g_vars->scene08_flyingUp = false;
+ g_vars->scene08_onBelly = false;
+
+ getGameLoaderInteractionController()->disableFlag24();
+ getCurrSceneSc2MotionController()->clearEnabled();
+
+ g_vars->scene08_batuta->stopAnim_maybe();
+
+ g_vars->scene08_vmyats->_statics = g_vars->scene08_vmyats->getStaticsById(ST_VMT_MIN);
+ g_vars->scene08_vmyats->setOXY(382, 703);
+ g_vars->scene08_vmyats->_priority = 29;
+ g_vars->scene08_vmyats->_callback2 = sceneHandler08_pushCallback;
+
+ g_fp->_aniMan = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN, -1);
+
+ g_vars->scene08_manOffsetY = 15;
+
+ g_fp->_currentScene->_y = 0;
+
+ g_fp->_updateScreenCallback = sceneHandler08_updateScreenCallback;
+}
+
+void sceneHandler08_airMoves() {
+ if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
+ int x = g_fp->_aniMan->_ox;
+ int y = g_fp->_aniMan->_oy;
+ Common::Point point;
+
+ if (703 - g_fp->_aniMan->getSomeXY(point)->y - y < 150) {
+ if (g_fp->_aniMan->_statics) {
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN8_FLYDOWN) {
+ y -= 25;
+
+ g_fp->_aniMan->setOXY(x, y);
+ }
+ }
+
+ g_fp->_aniMan->changeStatics2(ST_MAN8_STAND);
+ g_fp->_aniMan->setOXY(380, y);
+ g_fp->_aniMan->startAnim(MV_MAN8_JUMP, 0, -1);
+
+ } else if (g_fp->_aniMan->_statics) {
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN8_FLYUP) {
+ g_fp->_aniMan->startAnim(MV_MAN8_DRYGUP, 0, -1);
+
+ } else if (g_fp->_aniMan->_statics->_staticsId == ST_MAN8_FLYDOWN) {
+ g_fp->_aniMan->startAnim(MV_MAN8_DRYGDOWN, 0, -1);
+ }
+ }
+ }
+}
+
+void sceneHandler08_finishArcade() {
+ g_vars->scene08_inArcade = false;
+
+ getGameLoaderInteractionController()->enableFlag24();
+ getCurrSceneSc2MotionController()->setEnabled();
+}
+
+void sceneHandler08_jumpOff(ExCommand *cmd) {
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+
+ mq->addExCommandToEnd(cmd->createClone());
+ mq->setFlags(mq->getFlags() | 1);
+
+ g_fp->_globalMessageQueueList->addMessageQueue(mq);
+
+ g_fp->_aniMan->startAnim(MV_MAN8_JUMPOFF, mq->_id, -1);
+
+ sceneHandler08_finishArcade();
+}
+
+void sceneHandler08_standUp() {
+ chainQueue(QU_SC8_STANDUP, 1);
+ g_vars->scene08_onBelly = false;
+}
+
+void sceneHandler08_jumpLogic(ExCommand *cmd) {
+ if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) == PIC_SC8_LADDERD) {
+ sceneHandler08_jumpOff(cmd);
+
+ cmd->_messageKind = 0;
+ } else {
+ sceneHandler08_standUp();
+ }
+}
+
+void sceneHandler08_badLuck() {
+ g_fp->_currentScene->getPictureObjectById(PIC_SC8_LADDER, 0)->_flags &= 0xFFFB;
+
+ g_fp->_aniMan->changeStatics2(ST_MAN8_HANDSUP);
+ g_fp->_aniMan->setOXY(376, 280);
+ g_fp->_aniMan->_priority = 10;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+
+ ExCommand *ex = new ExCommand(g_fp->_aniMan->_id, 1, MV_MAN8_BADLUCK, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ ex->_keyCode = g_fp->_aniMan->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+
+ g_fp->setObjectState(sO_StairsUp_8, g_fp->getObjectEnumState(sO_StairsUp_8, sO_NotBroken));
+
+ g_vars->scene08_inAir = false;
+}
+
+void sceneHandler08_sitDown() {
+ g_fp->_aniMan->setOXY(380, g_fp->_aniMan->_oy);
+
+ g_fp->_aniMan->changeStatics2(ST_MAN8_FLYDOWN);
+ g_fp->_aniMan->startAnim(MV_MAN8_SITDOWN, 0, -1);
+
+ g_vars->scene08_vmyats->changeStatics2(ST_VMT_MIN);
+ g_vars->scene08_vmyats->hide();
+
+ g_vars->scene08_inAir = false;
+ g_vars->scene08_onBelly = true;
+}
+
+void sceneHandler08_calcFlight() {
+ Common::Point point;
+ int y = g_vars->scene08_manOffsetY + g_fp->_aniMan->_oy;
+
+ g_fp->_aniMan->setOXY(g_fp->_aniMan->_ox, y);
+
+ g_vars->scene08_manOffsetY += 2;
+
+ if (g_vars->scene08_manOffsetY < g_vars->scene08_stairsOffset)
+ g_vars->scene08_manOffsetY = g_vars->scene08_stairsOffset;
+
+ y = y + g_fp->_aniMan->getSomeXY(point)->y;
+
+ if (g_fp->_aniMan->_statics && g_fp->_aniMan->_statics->_staticsId == ST_MAN8_FLYDOWN)
+ y -= 25;
+
+ if (y <= g_vars->scene08_vmyats->_oy) {
+ g_vars->scene08_vmyats->hide();
+ } else {
+ g_vars->scene08_vmyats->show1(-1, -1, -1, 0);
+
+ if (!g_vars->scene08_vmyats->_movement)
+ g_vars->scene08_vmyats->startAnim(MV_VMT_DEF, 0, -1);
+ }
+
+ if (g_fp->_aniMan->_oy <= 280 && g_vars->scene08_stairsVisible
+ && g_fp->_aniMan->_statics && g_fp->_aniMan->_statics->_staticsId == ST_MAN8_HANDSUP) {
+ sceneHandler08_badLuck();
+ } else if (g_fp->_aniMan->_oy > 236 || g_vars->scene08_stairsVisible
+ || !g_fp->_aniMan->_statics || g_fp->_aniMan->_statics->_staticsId != ST_MAN8_HANDSUP) {
+ if (g_fp->_aniMan->_movement || g_fp->_aniMan->_oy < 660
+ || (g_vars->scene08_vmyats->_movement && g_vars->scene08_vmyats->_movement->_currDynamicPhaseIndex > 0)
+ || abs(g_vars->scene08_manOffsetY) > 2) {
+ if (g_vars->scene08_manOffsetY >= 0 && !g_fp->_aniMan->_movement) {
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN8_HANDSUP)
+ g_fp->_aniMan->startAnim(MV_MAN8_HANDSDOWN, 0, -1);
+ else
+ g_fp->_aniMan->changeStatics2(ST_MAN8_FLYDOWN);
+ }
+
+ if (g_fp->_aniMan->_oy < 500 && !g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN8_FLYUP && g_vars->scene08_manOffsetY < 0)
+ g_fp->_aniMan->startAnim(MV_MAN8_HANDSUP, 0, -1);
+ } else {
+ sceneHandler08_sitDown();
+ }
+ } else {
+ sceneHandler08_enterUp();
+ }
+}
+
+void sceneHandler08_checkEndArcade() {
+ if (g_vars->scene08_flyingUp) {
+ int x = g_fp->_aniMan->_ox;
+ int y = g_vars->scene08_manOffsetY + g_fp->_aniMan->_oy;
+
+ if (!((g_vars->scene08_manOffsetY + g_fp->_aniMan->_oy) % 3))
+ g_vars->scene08_manOffsetY--;
+
+ g_fp->_aniMan->setOXY(x, y);
+
+ if (y < 80) {
+ sceneHandler08_finishArcade();
+
+ ExCommand *ex = new ExCommand(SC_8, 17, 0, 0, 0, 0, 1, 0, 0, 0);
+ ex->_messageNum = 61;
+ ex->_excFlags |= 2;
+ ex->_keyCode = TrubaUp;
+
+ ex->postMessage();
+ }
+ }
+}
+
+int sceneHandler08(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_CMN_WINARCADE:
+ sceneHandler08_winArcade();
+ break;
+
+ case MSG_SC8_ENTERUP:
+ sceneHandler08_enterUp();
+ break;
+
+ case MSG_SC8_HIDELADDER_D:
+ sceneHandler08_hideLadder();
+ break;
+
+ case MSG_SC8_STANDUP:
+ g_vars->scene08_manOffsetY = -10;
+ g_vars->scene08_vmyats->changeStatics2(ST_VMT_MIN);
+ g_vars->scene08_vmyats->setOXY(382, 703);
+ g_vars->scene08_vmyats->_priority = 29;
+ g_vars->scene08_vmyats->_callback2 = sceneHandler08_pushCallback;
+ g_vars->scene08_inAir = true;
+ break;
+
+ case MSG_SC8_ARCADENOW:
+ sceneHandler08_arcadeNow();
+ break;
+
+ case MSG_SC8_RESUMEFLIGHT:
+ sceneHandler08_resumeFlight();
+ break;
+
+ case MSG_SC8_GETHIMUP:
+ g_vars->scene08_manOffsetY = 0;
+ g_vars->scene08_flyingUp = true;
+ break;
+
+ case MSG_STARTARCADE:
+ sceneHandler08_startArcade();
+ break;
+
+ case 29:
+ if (g_vars->scene08_inArcade) {
+ if (g_vars->scene08_inAir) {
+ sceneHandler08_airMoves();
+ break;
+ }
+ if (g_vars->scene08_onBelly) {
+ sceneHandler08_jumpLogic(cmd);
+ break;
+ }
+ }
+ break;
+
+ case 33:
+ {
+ int res = 0;
+
+ if (g_fp->_aniMan2) {
+ if (g_vars->scene08_inArcade) {
+ int scHeight = g_fp->_sceneRect.bottom - g_fp->_sceneRect.top;
+
+ if (g_fp->_aniMan2->_oy < g_fp->_sceneRect.top + 200) {
+ g_fp->_sceneRect.top = g_fp->_aniMan2->_oy - 200;
+
+ if (g_fp->_sceneRect.top < 0)
+ g_fp->_sceneRect.top = 0;
+
+ g_fp->_sceneRect.bottom = scHeight + g_fp->_sceneRect.top;
+ }
+
+ if (g_fp->_aniMan2->_oy > g_fp->_sceneRect.bottom - 350) {
+ g_fp->_sceneRect.bottom = g_fp->_aniMan2->_oy + 350;
+ g_fp->_sceneRect.top = g_fp->_aniMan2->_oy + 350 - scHeight;
+ }
+ } else {
+ if (g_fp->_aniMan2->_ox < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.left - 300;
+
+ if (g_fp->_aniMan2->_ox > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.right + 300;
+
+ res = 1;
+ }
+ }
+
+ g_fp->_floaters->update();
+
+ if (g_vars->scene08_inArcade) {
+ if (g_vars->scene08_inAir)
+ sceneHandler08_calcFlight();
+ } else {
+ Movement *mov = g_fp->_aniMan->_movement;
+
+ if (mov) {
+ if (mov->_id == MV_MAN_TOLADDERD && mov->_currDynamicPhaseIndex == 8)
+ g_fp->_aniMan->_priority = 2;
+
+ if (mov && mov->_id == MV_MAN_FROMLADDERUP && mov->_currDynamicPhaseIndex == 13)
+ g_fp->_aniMan->_priority = 20;
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+ }
+
+ if (g_vars->scene08_flyingUp)
+ sceneHandler08_checkEndArcade();
+
+ if (g_vars->scene08_snoringCountdown > 0) {
+ g_vars->scene08_snoringCountdown--;
+
+ if (!g_vars->scene08_snoringCountdown) {
+ g_fp->playSound(SND_8_014, 0);
+
+ g_vars->scene08_snoringCountdown = 71;
+ }
+ }
+
+ return res;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene10.cpp b/engines/fullpipe/scenes/scene10.cpp
new file mode 100644
index 0000000000..f8d16b2759
--- /dev/null
+++ b/engines/fullpipe/scenes/scene10.cpp
@@ -0,0 +1,220 @@
+/* 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/behavior.h"
+#include "fullpipe/interaction.h"
+
+namespace Fullpipe {
+
+void scene10_initScene(Scene *sc) {
+ g_vars->scene10_gum = sc->getStaticANIObject1ById(ANI_GUM, -1);
+ g_vars->scene10_packet = sc->getStaticANIObject1ById(ANI_PACHKA, -1);
+ g_vars->scene10_packet2 = sc->getStaticANIObject1ById(ANI_PACHKA2, -1);
+ g_vars->scene10_inflater = sc->getStaticANIObject1ById(ANI_NADUVATEL, -1);
+ g_vars->scene10_ladder = sc->getPictureObjectById(PIC_SC10_LADDER, 0);
+
+ g_fp->lift_setButton(sO_Level1, ST_LBN_1N);
+ g_fp->lift_sub5(sc, QU_SC10_ENTERLIFT, QU_SC10_EXITLIFT);
+
+ if (g_fp->getObjectState(sO_Inflater) == g_fp->getObjectEnumState(sO_Inflater, sO_WithGum)) {
+ g_vars->scene10_hasGum = 1;
+ } else {
+ g_vars->scene10_hasGum = 0;
+ g_vars->scene10_gum->hide();
+ }
+}
+
+bool sceneHandler10_inflaterIsBlind() {
+ return g_vars->scene10_inflater->_movement
+ && g_vars->scene10_inflater->_movement->_id == MV_NDV_BLOW2
+ && g_vars->scene10_inflater->_movement->_currDynamicPhaseIndex < 42;
+}
+
+int scene10_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_objectIdAtCursor == ANI_PACHKA || g_fp->_objectIdAtCursor == ANI_GUM) {
+ if (g_fp->_cursorId == PIC_CSR_ITN) {
+ if (g_vars->scene10_hasGum)
+ g_fp->_cursorId = (sceneHandler10_inflaterIsBlind() != 0) ? PIC_CSR_ITN_RED : PIC_CSR_ITN_GREEN;
+ else
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
+ }
+ }
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler10_clickGum() {
+ if (g_vars->scene10_hasGum) {
+ if (sceneHandler10_inflaterIsBlind()) {
+ if (g_vars->scene10_hasGum) {
+ int x = g_vars->scene10_gum->_ox - 139;
+ int y = g_vars->scene10_gum->_oy - 48;
+
+ 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_RIGHT);
+ if (mq) {
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC10_CLICKGUM, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags = 2;
+ mq->addExCommandToEnd(ex);
+
+ postExCommand(g_fp->_aniMan->_id, 2, x, y, 0, -1);
+ }
+ } else {
+ g_vars->scene10_hasGum = 0;
+
+ chainQueue(QU_SC10_TAKEGUM, 1);
+ }
+ }
+ } else {
+ g_vars->scene10_inflater->changeStatics2(ST_NDV_SIT);
+
+ if (g_fp->getObjectState(sO_Inflater) == g_fp->getObjectEnumState(sO_Inflater, sO_WithGum))
+ g_vars->scene10_inflater->startAnim(MV_NDV_DENIES, 0, -1);
+ else
+ g_vars->scene10_inflater->startAnim(MV_NDV_DENY_NOGUM, 0, -1);
+ }
+ }
+}
+
+void sceneHandler10_hideGum() {
+ g_vars->scene10_gum->hide();
+ g_vars->scene10_packet->hide();
+ g_vars->scene10_packet2->hide();
+}
+
+void sceneHandler10_showGum() {
+ if (g_vars->scene10_hasGum)
+ g_vars->scene10_gum->show1(-1, -1, -1, 0);
+
+ g_vars->scene10_packet->show1(-1, -1, -1, 0);
+ g_vars->scene10_packet2->show1(-1, -1, -1, 0);
+}
+
+
+int sceneHandler10(ExCommand *ex) {
+ if (ex->_messageKind != 17)
+ return 0;
+
+ switch(ex->_messageNum) {
+ case MSG_LIFT_CLOSEDOOR:
+ g_fp->lift_closedoorSeq();
+ break;
+
+ case MSG_LIFT_EXITLIFT:
+ g_fp->lift_exitSeq(ex);
+ break;
+
+ case MSG_LIFT_STARTEXITQUEUE:
+ g_fp->lift_startExitQueue();
+ break;
+
+ case MSG_LIFT_CLICKBUTTON:
+ g_fp->lift_animation3();
+ break;
+
+ case MSG_SC10_LADDERTOBACK:
+ g_vars->scene10_ladder->_priority = 49;
+ break;
+
+ case MSG_SC10_LADDERTOFORE:
+ g_vars->scene10_ladder->_priority = 0;
+ break;
+
+ case MSG_LIFT_GO:
+ g_fp->lift_goAnimation();
+ break;
+
+ case MSG_SC10_CLICKGUM:
+ sceneHandler10_clickGum();
+
+ ex->_messageKind = 0;
+ break;
+
+ case MSG_SC10_HIDEGUM:
+ sceneHandler10_hideGum();
+ break;
+
+ case MSG_SC10_SHOWGUM:
+ sceneHandler10_showGum();
+ break;
+
+ case 64:
+ g_fp->lift_sub05(ex);
+ break;
+
+ case 29:
+ {
+ if (g_fp->_currentScene->getPictureObjectIdAtPos(ex->_sceneClickX, ex->_sceneClickY) == PIC_SC10_LADDER) {
+ handleObjectInteraction(g_fp->_aniMan, g_fp->_currentScene->getPictureObjectById(PIC_SC10_DTRUBA, 0), ex->_keyCode);
+ ex->_messageKind = 0;
+
+ return 0;
+ }
+
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY);
+
+ if (ani && ani->_id == ANI_LIFTBUTTON) {
+ g_fp->lift_sub1(ani);
+ ex->_messageKind = 0;
+
+ return 0;
+ }
+ }
+ break;
+
+ case 33:
+ {
+ int res = 0;
+
+ if (g_fp->_aniMan2) {
+ if (g_fp->_aniMan2->_ox < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.left - 300;
+
+ if (g_fp->_aniMan2->_ox > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.right + 300;
+
+ res = 1;
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ return res;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene11.cpp b/engines/fullpipe/scenes/scene11.cpp
new file mode 100644
index 0000000000..e7ed947a00
--- /dev/null
+++ b/engines/fullpipe/scenes/scene11.cpp
@@ -0,0 +1,786 @@
+/* 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 {
+
+void scene11_dudeSwingCallback(int *arg) {
+ int oldarg = *arg;
+
+ *arg = 45 - (int)(g_vars->scene11_swingAngle * -29.66666666666666);
+
+ if (*arg < 1)
+ *arg = 1;
+
+ if (*arg > 90)
+ *arg = 90;
+
+ g_vars->scene11_swingAngleDiff = (g_vars->scene11_swingAngle - g_vars->scene11_swingOldAngle) * -490.0000000000001;
+ g_vars->scene11_swingSpeed = g_vars->scene11_swingAngleDiff * 0.0042 + g_vars->scene11_swingSpeed - g_vars->scene11_swingInertia * (g_vars->scene11_swingAngleDiff * 0.0042 + g_vars->scene11_swingSpeed);
+ g_vars->scene11_swingAngle = g_vars->scene11_swingSpeed * 0.0042 + g_vars->scene11_swingAngle;
+
+ if (g_vars->scene11_swingAngle < -1.5) {
+ g_vars->scene11_swingAngle = -1.5; //1.0004882812500000;
+ g_vars->scene11_swingSpeed = 0.0;
+ g_vars->scene11_swingAngleDiff = 0.0;
+ }
+
+ if (g_vars->scene11_swingAngle > 1.5) {
+ g_vars->scene11_swingAngle = 1.5; //1.9990234375;
+ g_vars->scene11_swingSpeed = 0.0;
+ g_vars->scene11_swingAngleDiff = 0.0;
+ }
+
+ if (g_vars->scene11_swingMaxAngle == *arg && 0.0 != g_vars->scene11_swingSpeed && fabs(g_vars->scene11_swingSpeed) < 2.5) {
+ g_vars->scene11_swingSpeed = 0.0;
+ g_vars->scene11_swingAngleDiff = 0.0;
+ g_vars->scene11_swingAngle = g_vars->scene11_swingOldAngle;
+ }
+
+ g_vars->scene11_swingCounter++;
+
+ if (g_vars->scene11_arcadeIsOn) {
+ if (g_vars->scene11_hintCounter <= 720) {
+ g_vars->scene11_hintCounter++;
+
+ if (g_vars->scene11_hintCounter == 720)
+ g_vars->scene11_hint->_flags |= 4;
+ }
+ }
+
+ if ((oldarg >= 45) != (*arg >= 45) && g_vars->scene11_arcadeIsOn) {
+ if (oldarg >= *arg)
+ g_fp->playSound(SND_11_031, 0);
+ else
+ g_fp->playSound(SND_11_020, 0);
+ }
+}
+
+void scene11_setupMusic() {
+ if (g_fp->getObjectState(sO_DudeHasJumped) == g_fp->getObjectEnumState(sO_DudeHasJumped, sO_Yes))
+ g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_11"), "MUSIC2", 1);
+}
+
+void scene11_initScene(Scene *sc) {
+ g_vars->scene11_swingie = sc->getStaticANIObject1ById(ANI_SWINGER, -1);
+ g_vars->scene11_boots = sc->getStaticANIObject1ById(ANI_BOOTS_11, -1);
+ g_vars->scene11_mgm.clear();
+ g_vars->scene11_dudeOnSwing = sc->getStaticANIObject1ById(ANI_MAN11, -1);
+ g_vars->scene11_dudeOnSwing->_callback2 = scene11_dudeSwingCallback;
+ g_vars->scene11_dudeOnSwing = sc->getStaticANIObject1ById(ANI_KACHELI, -1);
+ g_vars->scene11_dudeOnSwing->_callback2 = scene11_dudeSwingCallback;
+ g_vars->scene11_hint = sc->getPictureObjectById(PIC_SC11_HINT, 0);
+ g_vars->scene11_hint->_flags &= 0xFFFB;
+
+ g_vars->scene11_arcadeIsOn = false;
+ g_vars->scene11_scrollIsEnabled = false;
+ g_vars->scene11_scrollIsMaximized = false;
+ g_vars->scene11_hintCounter = 0;
+ g_vars->scene11_swingieScreenEdge = 0;
+ g_vars->scene11_crySound = 0;
+ g_vars->scene11_swingAngle = 0.0;
+ g_vars->scene11_swingOldAngle = 0.0;
+ g_vars->scene11_swingSpeed = 0.0;
+ g_vars->scene11_swingAngleDiff = 0.0;
+ g_vars->scene11_swingInertia = 1.28; //1.9849218750000000;
+ g_vars->scene11_swingCounter = 0;
+ g_vars->scene11_swingCounterPrevTurn = 0;
+ g_vars->scene11_swingDirection = 0;
+ g_vars->scene11_swingDirectionPrevTurn = 0;
+
+ Scene *oldsc = g_fp->_currentScene;
+
+ g_fp->_currentScene = sc;
+
+ int swingie = g_fp->getObjectState(sO_Swingie);
+
+ if (swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsSwinging)
+ || swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsSwingingWithBoot)) {
+ g_vars->scene11_swingIsSwinging = true;
+ g_vars->scene11_swingieStands = false;
+
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 1);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 1);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing3, 0);
+
+ ((MctlCompound *)getCurrSceneSc2MotionController())->replaceNodeX(805, 905);
+
+ getSc2MctlCompoundBySceneId(sc->_sceneId)->replaceNodeX(303, 353);
+ } else if (swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInBoots)
+ || swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInCorner)) {
+ g_vars->scene11_swingIsSwinging = false;
+ g_vars->scene11_swingieStands = true;
+
+ g_vars->scene11_swingie->changeStatics2(ST_SWR_STAND3);
+
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 0);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 1);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing3, 0);
+
+ ((MctlCompound *)getCurrSceneSc2MotionController())->replaceNodeX(905, 805);
+ } else {
+ g_vars->scene11_swingIsSwinging = false;
+ g_vars->scene11_swingieStands = false;
+
+ if (swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsSitting)) {
+ g_vars->scene11_swingie->_movement = 0;
+ g_vars->scene11_swingie->_statics = g_vars->scene11_swingie->getStaticsById(ST_SWR_SIT);
+ g_vars->scene11_swingie->setOXY(144, 389);
+
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 0);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 0);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing3, 1);
+ } else {
+ g_vars->scene11_swingie->_movement = 0;
+ g_vars->scene11_swingie->_statics = g_vars->scene11_swingie->getStaticsById(ST_SWR_SITBALD);
+ g_vars->scene11_swingie->setOXY(144, 415);
+
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 0);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 0);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing3, 1);
+ }
+ }
+
+ if (!g_vars->scene11_swingIsSwinging) {
+ g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC);
+ g_vars->scene11_dudeOnSwing->setOXY(691, 371);
+ g_vars->scene11_dudeOnSwing->_priority = 20;
+
+ g_vars->scene11_dudeOnSwing->_flags |= 4;
+ }
+
+ g_fp->_currentScene = oldsc;
+
+ g_fp->initArcadeKeys("SC_11");
+ g_fp->setArcadeOverlay(PIC_CSR_ARCADE5);
+}
+
+void sceneHandler11_restartMan() {
+ chainObjQueue(0, QU_SC11_RESTARTMAN, 1);
+
+ getGameLoaderInteractionController()->enableFlag24();
+ getCurrSceneSc2MotionController()->setEnabled();
+
+ g_vars->scene11_scrollIsEnabled = false;
+}
+
+void sceneHandler11_hitMan() {
+ if (g_fp->_aniMan->_ox > 345 && g_fp->_aniMan->_ox < 355) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT);
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC11_MANFALL), 0, 0);
+
+ mq->setFlags(mq->getFlags() | 1);
+ if (!mq->chain(g_fp->_aniMan))
+ delete mq;
+
+ getCurrSceneSc2MotionController()->replaceNodeX(353, 303);
+ }
+}
+
+int scene11_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_vars->scene11_arcadeIsOn) {
+ if (g_fp->_cursorId != PIC_CSR_DEFAULT_INV && g_fp->_cursorId != PIC_CSR_ITN_INV)
+ g_fp->_cursorId = -1;
+ } else if (g_vars->scene11_swingie == g_fp->_objectAtCursor && g_fp->_inventory->getSelectedItemId() == ANI_INV_BOOT)
+ g_fp->_cursorId = PIC_CSR_ITN_INV;
+
+ return g_fp->_cursorId;
+}
+
+int sceneHandler11_updateScreenCallback() {
+ int res = g_fp->drawArcadeOverlay(g_vars->scene11_arcadeIsOn);
+
+ if (!res)
+ g_fp->_updateScreenCallback = 0;
+
+ return res;
+}
+
+void sceneHandler11_manToSwing() {
+ g_vars->scene11_arcadeIsOn = true;
+
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+
+ g_fp->_aniMan2->hide();
+
+ g_vars->scene11_swingCounter = 0;
+ g_vars->scene11_swingInertia = 1.28; //1.9849218;
+
+ g_vars->scene11_dudeOnSwing->_flags &= 0xFFFB;
+ g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN11, -1);
+ g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY);
+ g_vars->scene11_dudeOnSwing->_movement = 0;
+ g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_0, 0);
+ g_vars->scene11_dudeOnSwing->_priority = 20;
+ g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_0, 0, -1);
+ g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(45);
+
+ g_vars->scene11_mgm.addItem(g_fp->_aniMan->_id);
+
+ g_fp->_currentScene->_x = 1400 - g_fp->_sceneRect.right;
+
+ g_vars->scene11_scrollIsEnabled = true;
+ g_fp->_updateScreenCallback = sceneHandler11_updateScreenCallback;
+}
+
+void sceneHandler11_putABoot() {
+ if (g_vars->scene11_boots->_flags & 4) {
+ if (g_vars->scene11_boots->_statics->_staticsId == ST_BTS11_ONE)
+ chainObjQueue(0, QU_SC11_PUTBOOT2, 1);
+ } else {
+ chainObjQueue(0, QU_SC11_PUTBOOT1, 1);
+ }
+}
+
+void sceneHandler11_putBoot() {
+ if (abs(353 - g_fp->_aniMan->_ox) > 1 || abs(498 - g_fp->_aniMan->_oy) > 1
+ || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 353, 498, 1, ST_MAN_RIGHT);
+
+ if (mq) {
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC11_PUTBOOT, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+
+ mq->addExCommandToEnd(ex);
+
+ postExCommand(g_fp->_aniMan->_id, 2, 353, 498, 0, -1);
+ }
+ } else {
+ sceneHandler11_putABoot();
+ }
+}
+
+void sceneHandler11_showSwing() {
+ g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_KACHELI, -1);
+ g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_KCH_0);
+ g_vars->scene11_dudeOnSwing->_movement = 0;
+ g_vars->scene11_dudeOnSwing->show1(691, 371, MV_KCH_START, 0);
+ g_vars->scene11_dudeOnSwing->_priority = 20;
+}
+
+void sceneHandler11_jumpFromSwing() {
+ g_vars->scene11_arcadeIsOn = false;
+ g_vars->scene11_hint->_flags &= 0xFFFB;
+ g_vars->scene11_scrollIsEnabled = false;
+
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+
+ g_vars->scene11_swingOldAngle = 0.0;
+ g_vars->scene11_swingAngleDiff = 0.0;
+ g_vars->scene11_swingSpeed = 0.0;
+ g_vars->scene11_swingAngle = 0.0;
+
+ g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN11, -1);
+ g_vars->scene11_dudeOnSwing->_flags &= 0xFFFB;
+ g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_KACHELI, -1);
+ g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC);
+ g_vars->scene11_dudeOnSwing->setOXY(691, 371);
+ g_vars->scene11_dudeOnSwing->_priority = 20;
+ g_vars->scene11_dudeOnSwing->_flags |= 4;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ ExCommand *ex = new ExCommand(g_fp->_aniMan->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0);
+ ex->_field_14 = 256;
+ ex->_messageNum = 0;
+ ex->_excFlags |= 3;
+ mq->addExCommandToEnd(ex);
+ mq->setFlags(mq->getFlags() | 1);
+
+ g_fp->_globalMessageQueueList->addMessageQueue(mq);
+
+ g_fp->_aniMan->_flags |= 0x104;
+ g_fp->_aniMan->changeStatics2(ST_MAN11_SWING);
+ g_fp->_aniMan->setOXY(685, 373);
+ g_fp->_aniMan->startAnim(MV_MAN11_JUMPFROMSWING, mq->_id, -1);
+
+ g_fp->_aniMan2 = g_fp->_aniMan;
+}
+
+void sceneHandler11_swing0() {
+ g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY);
+ g_vars->scene11_dudeOnSwing->_movement = 0;
+ g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_0, 0);
+ g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_0, 0, -1);
+ g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex);
+
+ g_vars->scene11_swingDirection = 0;
+ g_vars->scene11_swingMaxAngle = 45;
+ g_vars->scene11_swingOldAngle = 0.0;
+}
+
+void sceneHandler11_swing1() {
+ g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY);
+ g_vars->scene11_dudeOnSwing->_movement = 0;
+ g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_1, 0);
+ g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_1, 0, -1);
+ g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex);
+
+ g_vars->scene11_swingDirection = 1;
+ g_vars->scene11_swingMaxAngle = 42;
+ g_vars->scene11_swingOldAngle = -(fabs(g_vars->scene11_swingAngle) * 0.075 + 0.12);
+}
+
+void sceneHandler11_swing2() {
+ g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY);
+ g_vars->scene11_dudeOnSwing->_movement = 0;
+ g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_2, 0);
+ g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_2, 0, -1);
+ g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex);
+
+ g_vars->scene11_swingDirection = 2;
+ g_vars->scene11_swingMaxAngle = 48;
+ g_vars->scene11_swingOldAngle = fabs(g_vars->scene11_swingAngle) * 0.075 + 0.12;
+}
+
+void sceneHandler11_emptySwing() {
+ if (g_vars->scene11_swingDirection)
+ sceneHandler11_swing0();
+
+ g_vars->scene11_dudeOnSwing->stopAnim_maybe();
+ g_vars->scene11_dudeOnSwing->hide();
+ g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_KACHELI, -1);
+ g_vars->scene11_dudeOnSwing->show1(-1, -1, -1, 0);
+ g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_EMPTY);
+ g_vars->scene11_dudeOnSwing->startAnim(MV_KCH_MOVE2, 0, -1);
+ g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex);
+
+ g_vars->scene11_swingInertia = 0.03; //1.9881250;
+}
+
+void sceneHandler11_jumpHitAndWin() {
+ MGMInfo mgminfo;
+
+ sceneHandler11_emptySwing();
+
+ g_fp->_aniMan->show1(690 - (int)(sin(g_vars->scene11_swingAngle) * -267.0), 215 - (int)(cos(g_vars->scene11_swingAngle) * -267.0),
+ MV_MAN11_JUMPHIT, 0);
+ g_fp->_aniMan->_priority = 10;
+
+ mgminfo.field_1C = 10;
+ mgminfo.ani = g_fp->_aniMan;
+ mgminfo.staticsId2 = ST_MAN_1PIX;
+ mgminfo.x1 = 1400;
+ mgminfo.y1 = 0;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 66;
+ mgminfo.movementId = MV_MAN11_JUMPHIT;
+
+ MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo);
+
+ if (mq) {
+ g_vars->scene11_crySound = SND_11_024;
+ ExCommand *ex = new ExCommand(ANI_MAN, 2, 36, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = -1;
+ ex->_excFlags = 2;
+
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(SC_11, 17, 61, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = TrubaRight;
+ ex->_excFlags = 3;
+
+ mq->addExCommandToEnd(ex);
+
+ if (!mq->chain(g_fp->_aniMan))
+ delete mq;
+
+
+ if (g_fp->getObjectState(sO_Swingie) == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInCorner))
+ g_fp->setObjectState(sO_Swingie, g_fp->getObjectEnumState(sO_Swingie, sO_IsSitting));
+
+ g_fp->setObjectState(sO_DudeHasJumped, g_fp->getObjectEnumState(sO_DudeHasJumped, sO_Yes));
+ }
+}
+
+void sceneHandler11_jumpOver(double angle) {
+ MGMInfo mgminfo;
+
+ sceneHandler11_emptySwing();
+
+ g_fp->_aniMan->show1(690 - (int)(sin(g_vars->scene11_swingAngle) * -267.0), 215 - (int)(cos(g_vars->scene11_swingAngle) * -267.0),
+ MV_MAN11_JUMPOVER, 0);
+ g_fp->_aniMan->_priority = 0;
+
+ mgminfo.staticsId2 = ST_MAN_1PIX;
+ mgminfo.ani = g_fp->_aniMan;
+ mgminfo.x1 = 1163;
+ mgminfo.y1 = 837 - (int)(angle * 153.0);
+ mgminfo.field_1C = 0;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 78;
+ mgminfo.movementId = MV_MAN11_JUMPOVER;
+
+ MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo);
+
+ if (mq) {
+ g_vars->scene11_crySound = SND_11_022;
+
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC11_RESTARTMAN, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags = 2;
+
+ mq->addExCommandToEnd(ex);
+
+ if (!mq->chain(g_fp->_aniMan))
+ delete mq;
+ }
+}
+
+void sceneHandler11_jumpHit(double angle) {
+ MGMInfo mgminfo;
+
+ sceneHandler11_emptySwing();
+
+ if (angle >= 0.0) {
+ if (angle > 1.0)
+ angle = 1.0;
+ } else {
+ angle = 0.0;
+ }
+
+ g_fp->_aniMan->show1(690 - (int)(sin(g_vars->scene11_swingAngle) * -267.0), 215 - (int)(cos(g_vars->scene11_swingAngle) * -267.0),
+ MV_MAN11_JUMPOVER, 0);
+ g_fp->_aniMan->_priority = 0;
+
+ mgminfo.staticsId2 = ST_MAN_1PIX;
+ mgminfo.ani = g_fp->_aniMan;
+ mgminfo.x1 = 1017 - (int)(angle * -214.0);
+ mgminfo.y1 = 700;
+ mgminfo.field_1C = 0;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 78;
+ mgminfo.movementId = MV_MAN11_JUMPHIT;
+
+ MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo);
+
+ if (mq) {
+ g_vars->scene11_crySound = SND_11_022;
+
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC11_RESTARTMAN, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags = 2;
+
+ mq->addExCommandToEnd(ex);
+
+ if (!mq->chain(g_fp->_aniMan))
+ delete mq;
+
+ }
+}
+
+void sceneHandler11_swingLogic() {
+ if (g_vars->scene11_dudeOnSwing->_movement) {
+ int ph = g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex;
+ if (ph > 53 && ph < 90) {
+ if (ph < 70 && g_vars->scene11_swingSpeed >= 22.0) {
+ sceneHandler11_jumpOver((double)ph * 0.01428571428571429); // = 1 / 70
+ } else if (ph <= 80 && g_vars->scene11_swingSpeed >= 22.0) {
+ sceneHandler11_jumpHitAndWin();
+ } else {
+ sceneHandler11_jumpHit((double)ph * g_vars->scene11_swingSpeed * 0.0006493506493506494); // = 1/1540
+ }
+
+ g_vars->scene11_arcadeIsOn = false;
+ g_vars->scene11_hint->_flags &= 0xFFFB;
+ return;
+ }
+
+ if (ph > 38 && ph < 53 && fabs(g_vars->scene11_swingSpeed) <= 5.0)
+ sceneHandler11_jumpFromSwing();
+ }
+}
+
+void sceneHandler11_setSwingDirection() {
+ if (g_vars->scene11_swingDirection == 2)
+ g_vars->scene11_swingDirectionPrevTurn = 1;
+ else if (g_vars->scene11_swingDirection == 1)
+ g_vars->scene11_swingDirectionPrevTurn = 2;
+ else
+ g_vars->scene11_swingDirectionPrevTurn = (g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex <= 45) + 1;
+}
+
+void sceneHandler11_swingieSit() {
+ if (g_fp->getObjectState(sO_Swingie) == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInBoots)) {
+ g_vars->scene11_swingIsSwinging = false;
+ g_vars->scene11_swingieStands = false;
+
+ g_vars->scene11_swingie->changeStatics2(ST_SWR_SIT);
+ g_vars->scene11_swingie->setOXY(144, 389);
+
+ g_fp->setObjectState(sO_Swingie, g_fp->getObjectEnumState(sO_Swingie, sO_IsSitting));
+
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 0);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 0);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing3, 1);
+ }
+}
+
+void sceneHandler11_swingieJumpDown() {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SWR_JUMPDOWN), 0, 0);
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ if (!mq->chain(g_vars->scene11_swingie))
+ delete mq;
+
+ g_vars->scene11_swingIsSwinging = false;
+ g_vars->scene11_swingieStands = true;
+ g_vars->scene11_swingieScreenEdge = g_fp->_sceneRect.left;
+
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 0);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 1);
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing3, 0);
+
+ getCurrSceneSc2MotionController()->replaceNodeX(905, 805);
+}
+
+void sceneHandler11_winArcade() {
+ if (g_vars->scene11_arcadeIsOn) {
+ g_vars->scene11_arcadeIsOn = false;
+
+ sceneHandler11_emptySwing();
+
+ g_fp->_gameLoader->preloadScene(SC_11, TrubaRight);
+ }
+}
+
+int sceneHandler11(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_CMN_WINARCADE:
+ sceneHandler11_winArcade();
+ break;
+
+ case MSG_SC11_SITSWINGER:
+ if (g_fp->getObjectState(sO_Swingie) == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInBoots)
+ || g_fp->getObjectState(sO_Swingie) == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInCorner)) {
+ g_fp->setObjectState(sO_Swingie, g_fp->getObjectEnumState(sO_Swingie, sO_IsSitting));
+ }
+ break;
+
+ case MSG_SC11_MANCRY:
+ g_fp->playSound(g_vars->scene11_crySound, 0);
+
+ g_vars->scene11_crySound = 0;
+ break;
+
+ case MSG_SC11_RESTARTMAN:
+ sceneHandler11_restartMan();
+ break;
+
+ case MSG_SC11_HITMAN:
+ sceneHandler11_hitMan();
+ break;
+
+ case MSG_SC11_MANTOSWING:
+ sceneHandler11_manToSwing();
+ break;
+
+ case MSG_SC11_PUTBOOT:
+ sceneHandler11_putBoot();
+ break;
+
+ case MSG_SC11_SHOWSWING:
+ sceneHandler11_showSwing();
+ break;
+
+ case 107:
+ if (g_vars->scene11_arcadeIsOn)
+ sceneHandler11_swingLogic();
+ break;
+
+ case 33:
+ {
+ int res = 0;
+ int x, y;
+
+ if (!g_fp->_aniMan2)
+ goto LABEL_27;
+
+ x = g_fp->_aniMan2->_ox;
+ y = g_fp->_aniMan2->_oy;
+
+ g_vars->scene11_dudeX = x;
+ g_vars->scene11_dudeY = y;
+
+ if (g_vars->scene11_scrollIsEnabled) {
+ if (x > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 300;
+ goto LABEL_26;
+ }
+
+ if (g_vars->scene11_scrollIsMaximized) {
+ g_fp->_currentScene->_x = g_fp->_sceneWidth - x;
+
+ if (g_vars->scene11_dudeX < 910)
+ g_vars->scene11_scrollIsMaximized = false;
+
+ LABEL_26:
+ res = 1;
+ LABEL_27:
+ if (g_vars->scene11_swingieStands) {
+ if (g_fp->_sceneRect.left >= 534 && g_vars->scene11_swingieScreenEdge < 534)
+ sceneHandler11_swingieSit();
+
+ g_vars->scene11_swingieScreenEdge = g_fp->_sceneRect.left;
+ }
+
+ if (!g_vars->scene11_arcadeIsOn)
+ goto LABEL_50;
+
+ if (g_vars->scene11_swingCounterPrevTurn <= 0 || g_vars->scene11_swingCounter - g_vars->scene11_swingCounterPrevTurn <= 72) {
+ } else {
+ sceneHandler11_swing0();
+ g_vars->scene11_swingDirectionPrevTurn = 0;
+ g_vars->scene11_swingCounterPrevTurn = 0;
+ }
+
+ if (!g_vars->scene11_arcadeIsOn)
+ goto LABEL_50;
+
+ if (g_vars->scene11_swingDirection == g_vars->scene11_swingDirectionPrevTurn || g_vars->scene11_swingCounterPrevTurn <= 0 || g_vars->scene11_swingCounter - g_vars->scene11_swingCounterPrevTurn <= 2) {
+ LABEL_49:
+ if (g_vars->scene11_arcadeIsOn) {
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+ return res;
+ }
+ LABEL_50:
+ if (g_vars->scene11_swingIsSwinging
+ || (0.0 == g_vars->scene11_swingSpeed
+ && g_vars->scene11_dudeOnSwing->_movement != 0
+ && g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex == 45
+ && (g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC), !g_vars->scene11_arcadeIsOn)
+ && g_vars->scene11_swingIsSwinging)) {
+ if (!g_vars->scene11_swingie->_movement) {
+ if ((g_vars->scene11_boots->_flags & 4) && g_vars->scene11_boots->_statics->_staticsId == ST_BTS11_2) {
+ sceneHandler11_swingieJumpDown();
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+ return res;
+ }
+ g_vars->scene11_swingie->startAnim(MV_SWR_SWING, 0, -1);
+ }
+ }
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+ return res;
+ }
+
+ if (g_vars->scene11_swingDirectionPrevTurn == 1) {
+ if (!g_vars->scene11_swingDirection)
+ sceneHandler11_swing1();
+ else
+ sceneHandler11_swing0();
+ } else if (g_vars->scene11_swingDirectionPrevTurn == 2) {
+ if (!g_vars->scene11_swingDirection)
+ sceneHandler11_swing2();
+ else
+ sceneHandler11_swing0();
+ }
+
+ g_vars->scene11_swingCounterPrevTurn = g_vars->scene11_swingCounter;
+ goto LABEL_49;
+ }
+ if (x >= g_fp->_sceneRect.left + 200) {
+ if (x <= g_fp->_sceneRect.right - 200) {
+ LABEL_18:
+ if (y < g_fp->_sceneRect.top + 200) {
+ g_fp->_currentScene->_y = y - g_fp->_sceneRect.top - 300;
+ y = g_vars->scene11_dudeY;
+ x = g_vars->scene11_dudeX;
+ }
+ if (y > g_fp->_sceneRect.bottom - 300) {
+ g_fp->_currentScene->_y = y - g_fp->_sceneRect.bottom + 300;
+ x = g_vars->scene11_dudeX;
+ }
+ if (x >= 940)
+ g_vars->scene11_scrollIsMaximized = true;
+ goto LABEL_26;
+ }
+ g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 300;
+ } else {
+ g_fp->_currentScene->_x = x - g_fp->_sceneRect.left - 300;
+ }
+ y = g_vars->scene11_dudeY;
+ x = g_vars->scene11_dudeX;
+ goto LABEL_18;
+ }
+
+ break;
+
+ case 29:
+ if (g_vars->scene11_swingIsSwinging) {
+ if (g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y) == g_vars->scene11_swingie
+ && cmd->_keyCode == ANI_INV_BOOT)
+ sceneHandler11_putBoot();
+ } else {
+ if (g_vars->scene11_arcadeIsOn) {
+ sceneHandler11_setSwingDirection();
+
+ g_vars->scene11_swingCounterPrevTurn = g_vars->scene11_swingCounter;
+ }
+ }
+
+ if (!g_vars->scene11_arcadeIsOn) {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) {
+ int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+ PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0);
+
+ if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) {
+ if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1)
+ || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) {
+ g_fp->processArcade(cmd);
+
+ return 0;
+ }
+ }
+ }
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene12.cpp b/engines/fullpipe/scenes/scene12.cpp
new file mode 100644
index 0000000000..0295efcaf5
--- /dev/null
+++ b/engines/fullpipe/scenes/scene12.cpp
@@ -0,0 +1,85 @@
+/* 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/objects.h"
+#include "fullpipe/objectnames.h"
+#include "fullpipe/constants.h"
+#include "fullpipe/motion.h"
+#include "fullpipe/scenes.h"
+#include "fullpipe/scene.h"
+#include "fullpipe/floaters.h"
+#include "fullpipe/messages.h"
+#include "fullpipe/statics.h"
+#include "fullpipe/behavior.h"
+
+namespace Fullpipe {
+
+void scene12_initScene(Scene *sc) {
+ GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName("SC_12");
+ g_fp->_floaters->init(var);
+
+ g_vars->scene12_fly = g_fp->getObjectState(sO_Fly_12);
+
+ if (g_vars->scene12_fly)
+ g_vars->scene12_flyCountdown = g_fp->_rnd->getRandomNumber(600) + 600;
+
+ g_fp->setObjectState(sO_Fly_12, g_fp->_rnd->getRandomNumber(1));
+}
+
+void sceneHandler12_updateFloaters() {
+ g_fp->_floaters->genFlies(g_fp->_currentScene, 397, -50, 100, 6);
+
+ g_fp->_floaters->_array2[0]->countdown = g_fp->_rnd->getRandomNumber(6) + 4;
+ g_fp->_floaters->_array2[0]->val6 = 397;
+ g_fp->_floaters->_array2[0]->val7 = -50;
+}
+
+int sceneHandler12(ExCommand *cmd) {
+ int res = 0;
+
+ if (cmd->_messageKind == 17 && cmd->_messageNum == 33) {
+ if (g_fp->_aniMan2) {
+ if (g_fp->_aniMan2->_ox < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.left - 300;
+
+ if (g_fp->_aniMan2->_ox > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = g_fp->_aniMan2->_ox - g_fp->_sceneRect.right + 300;
+
+ res = 1;
+ }
+
+ g_vars->scene12_flyCountdown--;
+
+ if (!g_vars->scene12_flyCountdown)
+ sceneHandler12_updateFloaters();
+
+ g_fp->_floaters->update();
+
+ g_fp->_behaviorManager->updateBehaviors();
+ }
+
+ return res;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene13.cpp b/engines/fullpipe/scenes/scene13.cpp
new file mode 100644
index 0000000000..0a0c2f3906
--- /dev/null
+++ b/engines/fullpipe/scenes/scene13.cpp
@@ -0,0 +1,380 @@
+/* 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 {
+
+void scene13_initScene(Scene *sc) {
+ g_vars->scene13_whirlgig = sc->getStaticANIObject1ById(ANI_WHIRLGIG_13, -1);
+ g_vars->scene13_guard = sc->getStaticANIObject1ById(ANI_STOROZH, -1);
+ g_vars->scene13_handleR = sc->getStaticANIObject1ById(ANI_HANDLE_R, -1);
+ g_vars->scene13_handleL = sc->getStaticANIObject1ById(ANI_HANDLE_L, -1);
+ g_vars->scene13_bridge = sc->getStaticANIObject1ById(ANI_BRIDGE, -1);
+ g_vars->scene13_guardDirection = true;
+
+ MovGraphLink *lnk = getSc2MctlCompoundBySceneId(sc->_sceneId)->getLinkByName(sO_Bridge);
+ Scene *oldsc = g_fp->_currentScene;
+
+ g_fp->_currentScene = sc;
+
+ if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Convoluted)) {
+ g_vars->scene13_bridge->changeStatics2(ST_BDG_CLOSED);
+
+ lnk->_flags |= 0x20000000u;
+
+ g_fp->playSound(SND_13_018, 1);
+
+ g_vars->scene13_whirlgig->_callback2 = 0;
+ } else {
+ g_vars->scene13_bridge->changeStatics2(ST_BDG_OPEN2);
+
+ lnk->_flags &= 0xDFFFFFFF;
+
+ g_vars->scene13_whirlgig->stopAnim_maybe();
+ g_vars->scene13_whirlgig->_callback2 = 0;
+ g_vars->scene13_whirlgig->startAnim(MV_WHR13_SPIN, 0, -1);
+
+ if (g_vars->scene13_whirlgig->_movement)
+ g_vars->scene13_whirlgig->_movement->setDynamicPhaseIndex(30);
+
+ g_fp->playSound(SND_13_037, 1);
+ }
+
+ g_vars->scene13_bridge->_flags &= 0xFFFD;
+
+ g_fp->_currentScene = oldsc;
+
+ g_fp->initArcadeKeys("SC_13");
+}
+
+void sceneHandler13_openBridge() {
+ Movement *mov = g_vars->scene13_bridge->_movement;
+
+ if (mov && mov->_id == MV_BDG_CLOSE) {
+ int sz;
+
+ if (mov->_currMovement)
+ sz = mov->_currMovement->_dynamicPhases.size();
+ else
+ sz = mov->_dynamicPhases.size();
+
+ g_vars->scene13_bridge->changeStatics2(ST_BDG_CLOSED);
+ g_vars->scene13_bridge->startAnim(MV_BDG_OPEN, 0, -1);
+
+ mov->setDynamicPhaseIndex(sz - mov->_currDynamicPhaseIndex);
+ } else {
+ g_vars->scene13_bridge->changeStatics2(ST_BDG_CLOSED);
+ g_vars->scene13_bridge->startAnim(MV_BDG_OPEN, 0, -1);
+ }
+}
+
+void sceneHandler13_testClose() {
+ int id = g_vars->scene13_handleL->_statics->_staticsId;
+
+ if (id == ST_HDLL_UP)
+ chainQueue(QU_SC13_CLOSEFAIL, 1);
+ else if (id == ST_HDLL_FIRECAN || id == ST_HDLL_HAMMER)
+ chainQueue(QU_SC13_CLOSESUCCESS, 1);
+}
+
+void sceneHandler13_testOpen() {
+ switch (g_vars->scene13_handleR->_statics->_staticsId) {
+ case ST_HDLR_DOWN:
+ chainQueue(QU_SC13_OPENFAIL, 1);
+ break;
+
+ case ST_HDLR_DOWN_GUM:
+ chainQueue(QU_SC13_OPENSUCCESS, 1);
+ break;
+
+ case ST_HDLR_GUM:
+ g_vars->scene13_handleR->changeStatics2(ST_HDLR_DOWN_GUM);
+
+ chainQueue(QU_SC13_OPENSUCCESS, 1);
+ break;
+ }
+}
+
+void sceneHandler13_closeBridge() {
+ Movement *mov = g_vars->scene13_bridge->_movement;
+
+ if (mov && mov->_id == MV_BDG_OPEN) {
+ int sz;
+
+ if (mov->_currMovement)
+ sz = mov->_currMovement->_dynamicPhases.size();
+ else
+ sz = mov->_dynamicPhases.size();
+
+ g_vars->scene13_bridge->changeStatics2(ST_BDG_OPEN2);
+ g_vars->scene13_bridge->startAnim(MV_BDG_CLOSE, 0, -1);
+
+ mov->setDynamicPhaseIndex(sz - mov->_currDynamicPhaseIndex);
+ } else {
+ g_vars->scene13_bridge->changeStatics2(ST_BDG_OPEN2);
+ g_vars->scene13_bridge->startAnim(MV_BDG_CLOSE, 0, -1);
+ }
+}
+
+void sceneHandler13_closeFast() {
+ g_vars->scene13_bridge->changeStatics2(ST_BDG_OPEN2);
+ g_vars->scene13_bridge->startAnim(MV_BDG_CLOSE, 0, -1);
+ g_vars->scene13_bridge->_movement->setDynamicPhaseIndex(21);
+}
+
+void sceneHandler13_stopWhirlgig() {
+ g_vars->scene13_whirlgig->_callback2 = 0;
+
+ g_fp->stopAllSoundInstances(SND_13_018);
+ g_fp->playSound(SND_13_033, 0);
+ g_fp->playSound(SND_13_037, 1);
+}
+
+void sceneHandler13_startWhirlgig() {
+ g_vars->scene13_whirlgig->_callback2 = 0;
+
+ g_fp->playSound(SND_13_018, 1);
+ g_fp->playSound(SND_13_034, 0);
+
+ g_fp->stopAllSoundInstances(SND_13_037);
+}
+
+void sceneHandler13_openFast() {
+ g_vars->scene13_bridge->changeStatics2(ST_BDG_CLOSED);
+ g_vars->scene13_bridge->startAnim(MV_BDG_OPEN, 0, -1);
+ g_vars->scene13_bridge->_movement->setDynamicPhaseIndex(15);
+}
+
+void sceneHandler13_uneatGum() {
+ BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_CHEW);
+
+ if (beh) {
+ beh->_percent = 0;
+ beh->_delay = 36;
+ }
+
+ beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_PLUU);
+ if (beh) {
+ beh->_percent = 0;
+ beh->_delay = 36;
+ }
+}
+
+void sceneHandler13_eatGum() {
+ BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_CHEW);
+
+ if (beh) {
+ beh->_percent = 10922;
+ beh->_delay = 0;
+ }
+}
+
+void sceneHandler13_updateBridge() {
+ MovGraphLink *lnk = getCurrSceneSc2MotionController()->getLinkByName(sO_Bridge);
+
+ if (lnk) {
+ if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Convoluted))
+ lnk->_flags |= 0x20000000;
+ else
+ lnk->_flags &= 0xDFFFFFFF;
+ }
+}
+
+void sceneHandler13_showGum() {
+ chainQueue(QU_SC13_SHOWGUM, 0);
+}
+
+void sceneHandler13_setBehFlag(BehaviorEntryInfo *beh, bool flag) {
+ if (!flag) {
+ beh->_percent = 327;
+ beh->_flags |= 1;
+ beh->_delay = 36;
+ } else {
+ beh->_percent = 0x7FFF;
+ beh->_flags &= 0xFFFFFFFE;
+ beh->_delay = 0;
+ }
+}
+
+void sceneHandler13_walkForward(bool flag) {
+ BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_RTOL);
+
+ sceneHandler13_setBehFlag(beh, flag);
+
+ beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_LEFT, QU_STR_TURNR);
+
+ sceneHandler13_setBehFlag(beh, flag);
+
+ beh->_flags &= 0xFE;
+}
+
+void sceneHandler13_walkBackward(bool flag) {
+ BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT|0x4000, QU_STR_LTOR);
+
+ sceneHandler13_setBehFlag(beh, flag);
+
+ beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_LEFT|0x4000, QU_STR_TURNR_L);
+
+ sceneHandler13_setBehFlag(beh, flag);
+
+ beh->_flags &= 0xFE;
+}
+
+int sceneHandler13(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch(cmd->_messageNum) {
+ case MSG_SC13_OPENBRIDGE:
+ sceneHandler13_openBridge();
+ break;
+
+ case MSG_SC13_TESTCLOSE:
+ sceneHandler13_testClose();
+ break;
+
+ case MSG_SC13_TESTOPEN:
+ sceneHandler13_testOpen();
+ break;
+
+ case MSG_SC13_CLOSEBRIDGE:
+ sceneHandler13_closeBridge();
+ break;
+
+ case MSG_SC13_CLOSEFAST:
+ sceneHandler13_closeFast();
+ break;
+
+ case MSG_SC13_STOPWHIRLGIG:
+ sceneHandler13_stopWhirlgig();
+ break;
+
+ case MSG_SC13_STARTWHIRLGIG:
+ sceneHandler13_startWhirlgig();
+ break;
+
+ case MSG_SC13_OPENFAST:
+ sceneHandler13_openFast();
+ break;
+
+ case MSG_SC13_UNEATGUM:
+ sceneHandler13_uneatGum();
+ break;
+
+ case MSG_SC13_EATGUM:
+ sceneHandler13_eatGum();
+ break;
+
+ case MSG_SC13_CHEW:
+ g_vars->scene13_guard->_flags &= 0xFF7Fu;
+ break;
+
+ case MSG_SC13_UPDATEBRIDGE:
+ sceneHandler13_updateBridge();
+ break;
+
+ case MSG_SC13_SHOWGUM:
+ sceneHandler13_showGum();
+ break;
+
+ case 29:
+ {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) {
+ int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+ PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0);
+
+ if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) {
+ if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47
+ && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1)
+ || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) {
+ g_fp->processArcade(cmd);
+ }
+ }
+ }
+ break;
+ }
+
+ case 33:
+ {
+ int res = 0;
+ int x;
+
+ if (g_fp->_aniMan2) {
+ x = g_fp->_aniMan2->_ox;
+ g_vars->scene13_dudeX = x;
+
+ 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 {
+ x = g_vars->scene13_dudeX;
+ }
+
+ if (g_vars->scene13_guardDirection) {
+ if (x < 1022) {
+ sceneHandler13_walkForward(1);
+ sceneHandler13_walkBackward(0);
+
+ g_vars->scene13_guardDirection = false;
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ return res;
+ }
+ } else if (x > 1022) {
+ sceneHandler13_walkForward(0);
+ sceneHandler13_walkBackward(1);
+
+ g_vars->scene13_guardDirection = true;
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ return res;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene14.cpp b/engines/fullpipe/scenes/scene14.cpp
new file mode 100644
index 0000000000..4a09bc9cb6
--- /dev/null
+++ b/engines/fullpipe/scenes/scene14.cpp
@@ -0,0 +1,849 @@
+/* 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"
+#include "fullpipe/input.h"
+
+namespace Fullpipe {
+
+void scene14_initScene(Scene *sc) {
+ g_vars->scene14_grandma = sc->getStaticANIObject1ById(ANI_GRANDMA, -1);
+ g_vars->scene14_sceneDeltaX = 200;
+ g_vars->scene14_sceneDeltaY = 200;
+ g_vars->scene14_arcadeIsOn = false;
+ g_vars->scene14_dudeIsKicking = false;
+ g_vars->scene14_ballIsFlying = false;
+ g_vars->scene14_dudeCanKick = false;
+ g_vars->scene14_sceneDiffX = 300;
+ g_vars->scene14_sceneDiffY = 300;
+ g_vars->scene14_pink = 0;
+ g_vars->scene14_flyingBall = 0;
+ g_vars->scene14_balls.clear();
+
+ if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_In_14)) {
+ g_vars->scene14_grandmaIsHere = true;
+
+ StaticANIObject *ball = sc->getStaticANIObject1ById(ANI_BALL14, -1);
+
+ ball->_flags &= 0xFFFB;
+ g_vars->scene14_balls.push_back(ball);
+
+ for (uint i = 0; i < 3; i++) {
+ ball = new StaticANIObject(ball); // create a copy
+
+ ball->_flags &= 0xFFFB;
+ g_vars->scene14_balls.push_back(ball);
+
+ sc->addStaticANIObject(ball, 1);
+ }
+ } else {
+ g_vars->scene14_grandmaIsHere = false;
+ g_vars->scene14_grandma->hide();
+ }
+
+ g_fp->lift_setButton(sO_Level4, ST_LBN_4N);
+ g_fp->lift_sub5(sc, QU_SC14_ENTERLIFT, QU_SC14_EXITLIFT);
+
+ g_fp->initArcadeKeys("SC_14");
+ g_fp->setArcadeOverlay(PIC_CSR_ARCADE6);
+}
+
+void scene14_setupMusic() {
+ if (!g_vars->scene14_grandmaIsHere)
+ g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_14"), "MUSIC2", 0);
+}
+
+int scene14_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_vars->scene14_arcadeIsOn) {
+ if (g_vars->scene14_dudeIsKicking) {
+ g_fp->_cursorId = PIC_CSR_ARCADE2_D;
+ } else {
+ if (g_fp->_aniMan != g_fp->_objectAtCursor || g_fp->_aniMan->_movement || g_fp->_cursorId != PIC_CSR_DEFAULT) {
+ if (g_fp->_cursorId != PIC_CSR_DEFAULT_INV && g_fp->_cursorId != PIC_CSR_ITN_INV) {
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
+ }
+ } else {
+ g_fp->_cursorId = PIC_CSR_ITN;
+ }
+ }
+ }
+
+ return g_fp->_cursorId;
+}
+
+int sceneHandler14_updateScreenCallback() {
+ int res;
+
+ res = g_fp->drawArcadeOverlay(g_vars->scene14_arcadeIsOn);
+ if (!res)
+ g_fp->_updateScreenCallback = 0;
+
+ return res;
+}
+
+void sceneHandler14_showBallGrandmaHit2() {
+ if (g_vars->scene14_flyingBall) {
+ g_vars->scene14_flyingBall->show1(g_vars->scene14_grandmaX + 223, g_vars->scene14_grandmaY + 35, MV_BAL14_SPIN, 0);
+ g_vars->scene14_flyingBall->_priority = 27;
+
+ g_vars->scene14_pink = g_vars->scene14_flyingBall;
+
+ g_vars->scene14_flyingBall = 0;
+ }
+}
+
+void sceneHandler14_showBallGrandmaDive() {
+ if (g_vars->scene14_flyingBall) {
+ g_vars->scene14_flyingBall->show1(g_vars->scene14_grandmaX + 506, g_vars->scene14_grandmaY - 29, -1, 0);
+
+ g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall);
+ g_vars->scene14_flyingBall = 0;
+ }
+
+ g_fp->_aniMan2 = g_fp->_aniMan;
+}
+
+void sceneHandler14_showBallGrandmaHit() {
+ if (g_vars->scene14_flyingBall) {
+ g_vars->scene14_flyingBall->show1(g_vars->scene14_grandmaX + 190, g_vars->scene14_grandmaY + 56, MV_BAL14_TOGMA, 0);
+ g_vars->scene14_flyingBall->_priority = 27;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_TOGMA, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
+ ex->_excFlags |= 2;
+ ex->_field_24 = 1;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
+ ex->_excFlags |= 3;
+ mq->addExCommandToEnd(ex);
+ mq->chain(0);
+
+ g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall);
+ g_vars->scene14_flyingBall = 0;
+ }
+}
+
+void sceneHandler14_exitScene() {
+ g_vars->scene14_arcadeIsOn = false;
+
+ if (g_fp->_aniMan->_movement)
+ g_fp->_aniMan->_movement->gotoLastFrame();
+
+ g_fp->_aniMan->stopAnim_maybe();
+
+ handleObjectInteraction(g_fp->_aniMan, g_fp->_currentScene->getPictureObjectById(PIC_SC14_RTRUBA, 0), 0);
+
+ g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT);
+
+ chainQueue(QU_SC14_ENDARCADE, 0);
+
+ getGameLoaderInteractionController()->disableFlag24();
+ getCurrSceneSc2MotionController()->clearEnabled();
+}
+
+void sceneHandler14_showBallMan() {
+ if (g_vars->scene14_flyingBall) {
+ g_vars->scene14_flyingBall->show1(g_vars->scene14_dudeX - 166, g_vars->scene14_dudeY + 40, MV_BAL14_TOGMA, 0);
+ g_vars->scene14_flyingBall->_priority = 27;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_TOGMA, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
+ ex->_excFlags |= 2;
+ ex->_field_24 = 1;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
+ ex->_excFlags |= 3;
+ mq->addExCommandToEnd(ex);
+ mq->chain(0);
+
+ g_vars->scene14_flyingBall->startAnim(MV_BAL14_TOGMA, 0, -1);
+
+ g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall);
+ g_vars->scene14_flyingBall = 0;
+
+ if (g_vars->scene14_dudeX >= 1300)
+ sceneHandler14_exitScene();
+ }
+}
+
+void sceneHandler14_manKickBall() {
+ int val = (g_vars->scene14_grandmaX + 65 - (g_vars->scene14_dudeX - 85)) / -32;
+ int den = val;
+
+ g_vars->scene14_ballX = g_vars->scene14_dudeX - 85;
+ g_vars->scene14_ballY = g_vars->scene14_dudeY - 76;
+ g_vars->scene14_ballDeltaX = -32;
+
+ if (!val)
+ den = 1;
+
+ g_vars->scene14_ballDeltaY = (g_vars->scene14_grandmaY - 102 - val * val / 2 - (g_vars->scene14_dudeY - 76)) / den;
+
+ g_vars->scene14_flyingBall->show1(g_vars->scene14_dudeX - 85, g_vars->scene14_dudeY - 76, -1, 0);
+ g_vars->scene14_flyingBall->startAnim(MV_BAL14_SPIN, 0, -1);
+ g_vars->scene14_flyingBall->_priority = 5;
+
+ g_vars->scene14_ballIsFlying = true;
+}
+
+void sceneHandler14_showBallFly() {
+ if (g_vars->scene14_balls.size()) {
+ g_vars->scene14_flyingBall = g_vars->scene14_balls.front();
+ g_vars->scene14_balls.pop_front();
+ }
+
+ int x, y;
+
+ if (g_vars->scene14_grandma->_movement) {
+ x = g_vars->scene14_grandma->_movement->_ox;
+ g_vars->scene14_ballX = x;
+ y = g_vars->scene14_grandma->_movement->_oy;
+ } else {
+ x = g_vars->scene14_grandmaX;
+ y = g_vars->scene14_grandmaY;
+ }
+
+ x = x + 38;
+ y = y - 77;
+
+ g_vars->scene14_ballDeltaX = 32;
+
+ int dist = (g_vars->scene14_dudeX - 16 - x) / 32;
+ int den = dist;
+
+ if (!dist)
+ den = 1;
+
+ g_vars->scene14_ballX = x + 32;
+ g_vars->scene14_ballDeltaY = (g_vars->scene14_dudeY - 40 - dist * dist / 2 - y) / den;
+ g_vars->scene14_ballY = g_vars->scene14_ballDeltaY + y;
+
+ g_vars->scene14_flyingBall->show1(x + 32, g_vars->scene14_ballDeltaY + y, MV_BAL14_SPIN, 0);
+ g_vars->scene14_flyingBall->_priority = 5;
+ g_vars->scene14_flyingBall->startAnim(MV_BAL14_SPIN, 0, -1);
+
+ g_vars->scene14_ballIsFlying = true;
+}
+
+void sceneHandler14_grandmaJump() {
+ BehaviorEntryInfo *beh1 = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPFW);
+ BehaviorEntryInfo *beh2 = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPBK);
+
+ if (beh1) {
+ if (beh2) {
+ int p = beh1->_percent;
+ beh1->_percent = beh2->_percent;
+ beh2->_percent = p;
+ }
+ }
+}
+
+void sceneHandler14_endArcade() {
+ g_vars->scene14_arcadeIsOn = false;
+
+ setInputDisabled(0);
+
+ getGameLoaderInteractionController()->enableFlag24();
+ getCurrSceneSc2MotionController()->setEnabled();
+
+ BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_BLINK);
+ if (beh)
+ beh->_percent = 327;
+
+ beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_THROW);
+ if (beh)
+ beh->_percent = 0;
+
+ g_vars->scene14_sceneDeltaX = 200;
+ g_vars->scene14_sceneDeltaY = 200;
+
+ g_fp->_aniMan2 = g_fp->_aniMan;
+
+ g_vars->scene14_sceneDiffX = 300;
+ g_vars->scene14_sceneDiffY = 300;
+}
+
+void sceneHandler14_winArcade() {
+ if (g_vars->scene14_arcadeIsOn) {
+ if (g_vars->scene14_dudeIsKicking) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+
+ g_vars->scene14_dudeIsKicking = false;
+ }
+
+ if (g_vars->scene14_flyingBall) {
+ g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall);
+
+ g_vars->scene14_flyingBall->_flags &= 0xFFFB;
+ g_vars->scene14_flyingBall = 0;
+ }
+
+ g_vars->scene14_ballIsFlying = false;
+
+ sceneHandler14_endArcade();
+
+ g_vars->scene14_grandmaIsHere = false;
+
+ if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_In_14)) {
+ g_fp->setObjectState(sO_Grandma, g_fp->getObjectEnumState(sO_Grandma, sO_In_15));
+ g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT);
+ g_vars->scene14_grandma->_flags &= 0xFFFB;
+ }
+
+ if (g_fp->_currentScene->_messageQueueId) {
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(g_fp->_currentScene->_messageQueueId);
+ if (mq)
+ delete mq;
+
+ g_fp->_currentScene->_messageQueueId = 0;
+ }
+ }
+}
+
+void sceneHandler14_showBallLast() {
+ if (g_vars->scene14_pink) {
+ g_vars->scene14_pink->show1(693, 491, MV_BAL14_SPIN, 0);
+ g_vars->scene14_pink->_priority = 27;
+ }
+}
+
+void sceneHandler14_hideBallLast() {
+ if (g_vars->scene14_pink) {
+ g_vars->scene14_pink->hide();
+ g_vars->scene14_balls.push_back(g_vars->scene14_pink);
+ g_vars->scene14_pink = 0;
+ }
+}
+
+void sceneHandler14_startArcade() {
+ g_vars->scene14_arcadeIsOn = true;
+ g_vars->scene14_dudeCanKick = true;
+
+ if (g_fp->_aniMan->_movement) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
+ g_fp->_aniMan->setOXY(1237, 451);
+ g_fp->_aniMan->_priority = 25;
+ }
+
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+
+ g_fp->_aniMan2 = 0;
+ g_vars->scene14_sceneDeltaX = 50;
+ g_vars->scene14_sceneDiffX = 100;
+ g_vars->scene14_hitsLeft = 4;
+ g_vars->scene14_pink = 0;
+
+ chainQueue(QU_SC14_STARTARCADE, 0);
+
+ g_fp->_updateScreenCallback = sceneHandler14_updateScreenCallback;
+}
+
+void sceneHandler14_clearCallback() {
+ g_fp->_aniMan->_callback2 = 0;
+ g_vars->scene14_dudeIsKicking = false;
+}
+
+void sceneHandler14_kickAnimation() {
+ if (g_fp->_aniMan->_movement) {
+ sceneHandler14_clearCallback();
+
+ if (g_vars->scene14_flyingBall && g_vars->scene14_dudeX - g_vars->scene14_flyingBall->_ox < 180) {
+ g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_movement->_staticsObj2->_staticsId);
+ g_fp->_aniMan->startAnim(MV_MAN14_KICK, 0, -1);
+
+ g_vars->scene14_ballIsFlying = false;
+
+ g_vars->scene14_flyingBall->stopAnim_maybe();
+ g_vars->scene14_flyingBall->hide();
+ } else {
+ g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_movement->_staticsObj2->_staticsId);
+ g_fp->_aniMan->startAnim(MV_MAN14_KICKAIR, 0, -1);
+ }
+ }
+}
+
+void sceneHandler14_declineCallback(int *arg) {
+ Common::Point point;
+
+ if (g_vars->scene14_dudeIsKicking) {
+ *arg = (int)(sqrt((double)(g_fp->_mouseVirtY - g_vars->scene14_mouseCursorPos.y)
+ * (g_fp->_mouseVirtY - g_vars->scene14_mouseCursorPos.y)
+ + (g_fp->_mouseVirtX - g_vars->scene14_mouseCursorPos.x)
+ * (g_fp->_mouseVirtX - g_vars->scene14_mouseCursorPos.x)) * 0.1);
+
+ if (*arg > 11)
+ *arg = 11;
+ } else {
+ ++*arg;
+ }
+}
+
+void sceneHandler14_dudeDecline() {
+ g_vars->scene14_mouseCursorPos.x = g_fp->_mouseVirtX;
+ g_vars->scene14_mouseCursorPos.y = g_fp->_mouseVirtY;
+
+ g_fp->_aniMan->_callback2 = sceneHandler14_declineCallback;
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->startAnim(MV_MAN14_DECLINE, 0, -1);
+
+ g_vars->scene14_dudeIsKicking = true;
+}
+
+bool sceneHandler14_arcadeProcessClick(ExCommand *cmd) {
+ if (!getCurrSceneSc2MotionController()->_isEnabled)
+ return 0;
+
+ if (!g_vars->scene14_grandmaIsHere) {
+ if (!cmd->_keyCode) {
+ if (g_vars->scene14_pink) {
+ if (g_vars->scene14_pink->_flags & 4) {
+ if (cmd->_sceneClickX < g_vars->scene14_pink->_ox + 40) {
+ handleObjectInteraction(g_fp->_aniMan, g_vars->scene14_pink, 0);
+ cmd->_messageKind = 0;
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ if (getCurrSceneSc2MotionController()->_objtype != kObjTypeMctlCompound)
+ return false;
+
+ if (!getCurrSceneSc2MotionController()->_motionControllers[0]->_movGraphReactObj->pointInRegion(cmd->_sceneClickX, cmd->_sceneClickY))
+ return false;
+
+ if (cmd->_sceneClickX > 1237)
+ return false;
+
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1237, 451, 1, 0);
+
+ if (!mq)
+ return false;
+
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC14_STARTARCADE, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_excFlags |= 3;
+ mq->addExCommandToEnd(ex);
+ mq->setFlags(mq->getFlags() | 1);
+
+ postExCommand(g_fp->_aniMan->_id, 2, 1237, 451, 0, -1);
+
+ cmd->_messageKind = 0;
+
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+ return true;
+}
+
+void sceneHandler14_grandmaThrow() {
+ g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT);
+
+ MessageQueue *mq = new MessageQueue;
+ ExCommand *ex = new ExCommand(ANI_GRANDMA, 2, 30, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ mq->chain(0);
+}
+
+void sceneHandler14_passToGrandma() {
+ g_vars->scene14_flyingBall->stopAnim_maybe();
+ g_vars->scene14_flyingBall->_priority = 27;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_FALL, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
+ ex->_excFlags |= 2;
+ ex->_field_24 = 1;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0);
+ ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
+ ex->_excFlags |= 3;
+ mq->addExCommandToEnd(ex);
+ mq->chain(0);
+
+ g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall);
+ g_vars->scene14_flyingBall = 0;
+
+ sceneHandler14_grandmaThrow();
+}
+
+void sceneHandler14_grandmaJumpThrow() {
+ g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT);
+
+ MessageQueue *mq = new MessageQueue;
+ ExCommand *ex = new ExCommand(ANI_GRANDMA, 2, 30, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_JUMPFW, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ mq->chain(0);
+
+ g_vars->scene14_dude2X += 71;
+ g_fp->_currentScene->_x = 71;
+
+ g_fp->_aniMan2 = g_fp->_aniMan;
+}
+
+void sceneHandler14_dudeFall() {
+ if (!g_fp->_aniMan->_movement || g_fp->_aniMan->_movement->_id != MV_MAN14_FALL) {
+ sceneHandler14_clearCallback();
+
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->startAnim(MV_MAN14_FALL, 0, -1);
+ g_vars->scene14_flyingBall->stopAnim_maybe();
+ g_vars->scene14_flyingBall->hide();
+
+ sceneHandler14_grandmaJumpThrow();
+ }
+ ++g_vars->scene14_hitsLeft;
+}
+
+void sceneHandler14_grandmaStepForward() {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->startAnim(MV_MAN14_STEPFW, 0, -1);
+
+ g_vars->scene14_dude2X -= 71;
+
+ g_fp->_currentScene->_x = -71;
+ g_fp->_aniMan2 = g_vars->scene14_grandma;
+}
+
+void sceneHandler14_arcadeLogic() {
+ g_vars->scene14_flyingBall->stopAnim_maybe();
+ g_vars->scene14_flyingBall->hide();
+
+ if (g_vars->scene14_dudeIsKicking)
+ sceneHandler14_clearCallback();
+
+ if (g_vars->scene14_hitsLeft <= 1) {
+ setInputDisabled(1);
+
+ sceneHandler14_clearCallback();
+
+ g_vars->scene14_dudeCanKick = false;
+ g_fp->_aniMan2 = 0;
+
+ chainQueue(QU_SC14_WINARCADE, 1);
+
+ --g_vars->scene14_hitsLeft;
+ } else {
+ ExCommand *ex;
+
+ g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT);
+
+ if (g_vars->scene14_hitsLeft != 3 || g_vars->scene14_pink) {
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+
+ ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_BACKOFF, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ mq->chain(0);
+ } else {
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+
+ ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_BACKOFF2, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 2;
+ mq->addExCommandToEnd(ex);
+
+ mq->chain(0);
+ }
+
+ sceneHandler14_grandmaStepForward();
+ --g_vars->scene14_hitsLeft;
+ }
+}
+
+void sceneHandler14_animateBall() {
+ int x = g_vars->scene14_ballDeltaX + g_vars->scene14_ballX;
+ int y = g_vars->scene14_ballDeltaY + g_vars->scene14_ballY;
+
+ g_vars->scene14_ballX += g_vars->scene14_ballDeltaX;
+ g_vars->scene14_ballY += g_vars->scene14_ballDeltaY;
+
+ g_vars->scene14_ballDeltaY++;
+
+ if (g_vars->scene14_ballDeltaY - 1 + g_vars->scene14_ballY > 517) {
+ if (x <= g_vars->scene14_dudeX - 16 ) {
+ if ( g_vars->scene14_ballDeltaX >= 0 || x >= g_vars->scene14_grandmaX + 65 || x <= g_vars->scene14_grandmaX - 135 || y <= g_vars->scene14_grandmaY - 102 ) {
+ if (g_vars->scene14_flyingBall->_movement)
+ g_vars->scene14_flyingBall->_movement->setOXY(x, y);
+ else
+ g_vars->scene14_flyingBall->setOXY(x, y);
+ } else {
+ sceneHandler14_arcadeLogic();
+ g_vars->scene14_ballIsFlying = false;
+ }
+ } else {
+ sceneHandler14_dudeFall();
+ g_vars->scene14_ballIsFlying = false;
+ }
+ } else {
+ sceneHandler14_passToGrandma();
+ g_vars->scene14_ballIsFlying = false;
+ }
+}
+
+int sceneHandler14(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch(cmd->_messageNum) {
+ case MSG_SC14_SHOWBALLGMAHIT2:
+ sceneHandler14_showBallGrandmaHit2();
+ break;
+
+ case MSG_SC14_SHOWBALLGMADIVE:
+ sceneHandler14_showBallGrandmaDive();
+ break;
+
+ case MSG_LIFT_CLICKBUTTON:
+ g_fp->lift_animation3();
+ break;
+
+ case MSG_SC14_SHOWBALLGMAHIT:
+ sceneHandler14_showBallGrandmaHit();
+ break;
+
+ case MSG_SC14_SHOWBALLMAN:
+ sceneHandler14_showBallMan();
+ break;
+
+ case MSG_SC14_MANKICKBALL:
+ sceneHandler14_manKickBall();
+ break;
+
+ case MSG_SC14_SHOWBALLFLY:
+ sceneHandler14_showBallFly();
+ break;
+
+ case MSG_LIFT_GO:
+ g_fp->lift_goAnimation();
+ break;
+
+ case MSG_SC14_GMAJUMP:
+ sceneHandler14_grandmaJump();
+ break;
+
+ case MSG_LIFT_CLOSEDOOR:
+ g_fp->lift_closedoorSeq();
+ break;
+
+ case MSG_LIFT_EXITLIFT:
+ g_fp->lift_exitSeq(cmd);
+ break;
+
+ case MSG_LIFT_STARTEXITQUEUE:
+ g_fp->lift_startExitQueue();
+ break;
+
+ case MSG_SC14_RESTORESCROLL:
+ g_fp->_aniMan2 = g_fp->_aniMan;
+ g_fp->_scrollSpeed = 8;
+ break;
+
+ case MSG_CMN_WINARCADE:
+ sceneHandler14_winArcade();
+ break;
+
+ case MSG_SC14_SCROLLLEFT:
+ g_fp->_aniMan2 = 0;
+ g_fp->_currentScene->_x = -g_fp->_sceneRect.left;
+ g_fp->_scrollSpeed = 24;
+ break;
+
+ case MSG_SC14_SHOWBALLLAST:
+ sceneHandler14_showBallLast();
+ break;
+
+ case MSG_SC14_HIDEBALLLAST:
+ sceneHandler14_hideBallLast();
+ break;
+
+ case MSG_SC14_HIDEPINK:
+ if (!g_vars->scene14_pink)
+ break;
+
+ g_vars->scene14_pink->hide();
+ break;
+
+ case MSG_SC14_GMATOTRUBA:
+ g_fp->_currentScene->_x = -g_fp->_sceneRect.left;
+ break;
+
+ case MSG_SC14_STARTARCADE:
+ sceneHandler14_startArcade();
+ break;
+
+ case MSG_SC14_ENDARCADE:
+ sceneHandler14_endArcade();
+
+ g_vars->scene14_grandmaIsHere = false;
+ break;
+
+ case 64:
+ g_fp->lift_sub05(cmd);
+ break;
+
+ case 33:
+ {
+ Movement *mov = g_fp->_aniMan->_movement;
+
+ if (mov) {
+ g_vars->scene14_dudeX = mov->_ox;
+ g_vars->scene14_dudeY = mov->_oy;
+
+ if (mov->_id == MV_MAN14_KICK)
+ g_vars->scene14_dudeX = mov->_ox + 2 * g_fp->_aniMan->_movement->_currDynamicPhaseIndex;
+ } else {
+ g_vars->scene14_dudeX = g_fp->_aniMan->_ox;
+ g_vars->scene14_dudeY = g_fp->_aniMan->_oy;
+ }
+
+ mov = g_vars->scene14_grandma->_movement;
+ if (mov) {
+ g_vars->scene14_grandmaX = mov->_ox;
+ g_vars->scene14_grandmaY = mov->_oy;
+ } else {
+ g_vars->scene14_grandmaX = g_vars->scene14_grandma->_ox;
+ g_vars->scene14_grandmaY = g_vars->scene14_grandma->_oy;
+ }
+
+ if (g_fp->_aniMan2) {
+ int x = g_fp->_aniMan2->_ox;
+ g_vars->scene14_dude2X = x;
+
+ if (x < g_fp->_sceneRect.left + g_vars->scene14_sceneDeltaX) {
+ g_fp->_currentScene->_x = x - g_vars->scene14_sceneDiffX - g_fp->_sceneRect.left;
+ x = g_vars->scene14_dude2X;
+ }
+
+ if (x > g_fp->_sceneRect.right - g_vars->scene14_sceneDeltaX)
+ g_fp->_currentScene->_x = x + g_vars->scene14_sceneDiffX - g_fp->_sceneRect.right;
+ }
+
+ if (g_vars->scene14_ballIsFlying)
+ sceneHandler14_animateBall();
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+ break;
+ }
+
+ case 30:
+ if (g_vars->scene14_dudeIsKicking) {
+ sceneHandler14_kickAnimation();
+ break;
+ }
+
+ if (!g_vars->scene14_arcadeIsOn) {
+ break;
+ }
+ break;
+
+ case 29:
+ if (g_vars->scene14_arcadeIsOn) {
+ int pixel;
+
+ if (g_vars->scene14_dudeCanKick && g_fp->_aniMan->getPixelAtPos(cmd->_sceneClickX, cmd->_sceneClickY, &pixel) && !g_fp->_aniMan->_movement) {
+ sceneHandler14_dudeDecline();
+ break;
+ }
+ } else {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (ani && ani->_id == ANI_LIFTBUTTON) {
+ g_fp->lift_sub1(ani);
+ cmd->_messageKind = 0;
+ break;
+ }
+
+ if (!sceneHandler14_arcadeProcessClick(cmd) && (!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);
+ sceneHandler14_arcadeProcessClick(cmd);
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene15.cpp b/engines/fullpipe/scenes/scene15.cpp
new file mode 100644
index 0000000000..046e9c9adc
--- /dev/null
+++ b/engines/fullpipe/scenes/scene15.cpp
@@ -0,0 +1,209 @@
+/* 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 {
+
+void scene15_initScene(Scene *sc) {
+ g_vars->scene15_chantingCountdown = 0;
+
+ StaticANIObject *grandma = sc->getStaticANIObject1ById(ANI_GRANDMA_ASS, -1);
+
+ Scene *oldsc = g_fp->_currentScene;
+ g_fp->_currentScene = sc;
+
+ int grandmaState = g_fp->getObjectState(sO_Grandma);
+
+ if (grandmaState == g_fp->getObjectEnumState(sO_Grandma, sO_In_15)) {
+ grandma->changeStatics2(ST_GMS_BOOT);
+ grandma->setOXY(97, 399);
+ g_fp->setObjectState(sO_LeftPipe_15, g_fp->getObjectEnumState(sO_LeftPipe_15, sO_IsClosed));
+ } else if (grandmaState == g_fp->getObjectEnumState(sO_Grandma, sO_In_15_1)) {
+ grandma->changeStatics2(ST_GMS_BOOT);
+ grandma->setOXY(86, 399);
+ g_fp->setObjectState(sO_LeftPipe_15, g_fp->getObjectEnumState(sO_LeftPipe_15, sO_IsClosed));
+ } else if (grandmaState == g_fp->getObjectEnumState(sO_Grandma, sO_In_15_2)) {
+ grandma->changeStatics2(ST_GMS_BOOT);
+ grandma->setOXY(71, 399);
+ g_fp->setObjectState(sO_LeftPipe_15, g_fp->getObjectEnumState(sO_LeftPipe_15, sO_IsClosed));
+ } else if (grandmaState == g_fp->getObjectEnumState(sO_Grandma, sO_In_15_3)) {
+ grandma->changeStatics2(ST_GMS_BOOT);
+ grandma->setOXY(49, 399);
+ g_fp->setObjectState(sO_LeftPipe_15, g_fp->getObjectEnumState(sO_LeftPipe_15, sO_IsClosed));
+ } else if (grandmaState == g_fp->getObjectEnumState(sO_Grandma, sO_WithoutBoot)) {
+ grandma->changeStatics2(ST_GMS_BOOT);
+ grandma->setOXY(97, 399);
+ grandma->changeStatics2(ST_GMS_BOOTLESS2);
+ g_fp->setObjectState(sO_LeftPipe_15, g_fp->getObjectEnumState(sO_LeftPipe_15, sO_IsClosed));
+ } else {
+ grandma->hide();
+ g_fp->setObjectState(sO_LeftPipe_15, g_fp->getObjectEnumState(sO_LeftPipe_15, sO_IsOpened));
+ }
+
+ g_vars->scene15_plusminus = sc->getStaticANIObject1ById(ANI_PLUSMINUS, -1);
+
+ if (g_fp->getObjectState(sO_Guard_2) == g_fp->getObjectEnumState(sO_Guard_2, sO_Off))
+ g_vars->scene15_plusminus->_statics = g_vars->scene15_plusminus->getStaticsById(ST_PMS_MINUS);
+ else
+ g_vars->scene15_plusminus->_statics = g_vars->scene15_plusminus->getStaticsById(ST_PMS_PLUS);
+
+ g_vars->scene15_ladder = sc->getPictureObjectById(PIC_SC15_LADDER, 0);
+ g_vars->scene15_boot = sc->getStaticANIObject1ById(ANI_BOOT_15, -1);
+
+ if (g_fp->getObjectState(sO_Boot_15) != g_fp->getObjectEnumState(sO_Boot_15, sO_IsPresent))
+ g_vars->scene15_boot->_flags &= 0xFFFB;
+
+ g_fp->_currentScene = oldsc;
+
+ g_fp->lift_setButton(sO_Level5, ST_LBN_5N);
+ g_fp->lift_sub5(sc, QU_SC15_ENTERLIFT, QU_SC15_EXITLIFT);
+}
+
+int scene15_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC15_LTRUBA)
+ g_fp->_cursorId = PIC_CSR_GOL;
+
+ return g_fp->_cursorId;
+}
+
+int sceneHandler15(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch(cmd->_messageNum) {
+ case MSG_LIFT_CLOSEDOOR:
+ g_fp->lift_closedoorSeq();
+ break;
+
+ case MSG_LIFT_EXITLIFT:
+ g_fp->lift_exitSeq(cmd);
+ break;
+
+ case MSG_LIFT_STARTEXITQUEUE:
+ g_fp->lift_startExitQueue();
+ break;
+
+ case MSG_SC4_HIDEBOOT:
+ g_vars->scene15_boot->_flags &= 0xFFFB;
+ break;
+
+ case MSG_SC15_STOPCHANTING:
+ g_fp->stopAllSoundInstances(SND_15_001);
+
+ g_vars->scene15_chantingCountdown = 120;
+ break;
+
+ case MSG_SC15_ASSDRYG:
+ if (g_fp->_rnd->getRandomNumber(1))
+ g_fp->playSound(SND_15_011, 0);
+ else
+ g_fp->playSound(SND_15_006, 0);
+
+ break;
+
+ case MSG_SC15_LADDERTOBACK:
+ g_vars->scene15_ladder->_priority = 60;
+ break;
+
+ case MSG_LIFT_GO:
+ g_fp->lift_goAnimation();
+ break;
+
+ case MSG_LIFT_CLICKBUTTON:
+ g_fp->lift_animation3();
+ break;
+
+ case MSG_SC15_PULL:
+ if (g_vars->scene15_plusminus->_statics->_staticsId == ST_PMS_MINUS)
+ g_vars->scene15_plusminus->_statics = g_vars->scene15_plusminus->getStaticsById(ST_PMS_PLUS);
+ else
+ g_vars->scene15_plusminus->_statics = g_vars->scene15_plusminus->getStaticsById(ST_PMS_MINUS);
+
+ break;
+
+ case 64:
+ g_fp->lift_sub05(cmd);
+ break;
+
+ case 29:
+ {
+ if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) == PIC_SC15_LADDER) {
+ handleObjectInteraction(g_fp->_aniMan, g_fp->_currentScene->getPictureObjectById(PIC_SC15_DTRUBA, 0), cmd->_keyCode);
+ cmd->_messageKind = 0;
+
+ return 0;
+ }
+
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (ani && ani->_id == ANI_LIFTBUTTON) {
+ g_fp->lift_sub1(ani);
+
+ cmd->_messageKind = 0;
+ }
+ break;
+ }
+
+ case 30:
+ // nop
+ 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->scene15_chantingCountdown > 0) {
+ g_vars->scene15_chantingCountdown--;
+
+ if (!g_vars->scene15_chantingCountdown)
+ g_fp->playSound(SND_15_001, 1);
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene16.cpp b/engines/fullpipe/scenes/scene16.cpp
new file mode 100644
index 0000000000..b1e261287a
--- /dev/null
+++ b/engines/fullpipe/scenes/scene16.cpp
@@ -0,0 +1,484 @@
+/* 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 {
+
+void scene16_initScene(Scene *sc) {
+ g_vars->scene16_figures.clear();
+ g_vars->scene16_walkingBoy = 0;
+ g_vars->scene16_walkingGirl = 0;
+ g_vars->scene16_walkingCount = 200;
+ g_vars->scene16_wire = sc->getStaticANIObject1ById(ANI_WIRE16, -1);
+ g_vars->scene16_mug = sc->getStaticANIObject1ById(ANI_MUG, -1);
+ g_vars->scene16_jettie = sc->getStaticANIObject1ById(ANI_JETTIE, -1);
+ g_vars->scene16_boot = sc->getStaticANIObject1ById(ANI_BOOT_16, -1);
+ g_vars->scene16_girlIsLaughing = false;
+ g_vars->scene16_sound = SND_16_034;
+
+ if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Convoluted)) {
+ g_vars->scene16_placeIsOccupied = true;
+
+ StaticANIObject *boy[2];
+ boy[0] = sc->getStaticANIObject1ById(ANI_BOY, -1);
+ boy[0]->loadMovementsPixelData();
+
+ boy[1] = new StaticANIObject(boy[0]);
+ sc->addStaticANIObject(boy[1], 1);
+
+ int idx = 0;
+
+ for (int i = 0; i < 3; i++) {
+ g_vars->scene16_figures.push_back(boy[idx]);
+
+ idx++;
+
+ if (idx >= 2)
+ idx = 0;
+ }
+
+ g_vars->scene16_figures.push_back(sc->getStaticANIObject1ById(ANI_GIRL, -1));
+
+ for (int i = 0; i < 4; i++) {
+ g_vars->scene16_figures.push_back(boy[idx]);
+
+ idx++;
+
+ if (idx >= 2)
+ idx = 0;
+ }
+ } else {
+ g_fp->setObjectState(sO_Girl, g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging));
+
+ g_vars->scene16_placeIsOccupied = false;
+
+ StaticANIObject *ani = new StaticANIObject(g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_BEARDED_CMN, -1));
+ ani->_movement = 0;
+ ani->_statics = (Statics *)ani->_staticsList[0];
+ sc->addStaticANIObject(ani, 1);
+ }
+
+ if (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsLaughing)) {
+ StaticANIObject *girl = sc->getStaticANIObject1ById(ANI_GIRL, -1);
+
+ girl->show1(554, 432, MV_GRL_LAUGH_POPA, 0);
+ girl->_priority = 20;
+ }
+
+ if (g_fp->getObjectState(sO_Cup) == g_fp->getObjectEnumState(sO_Cup, sO_In_16)) {
+ g_vars->scene16_mug->_statics = g_vars->scene16_mug->getStaticsById(ST_MUG_EMPTY);
+ g_vars->scene16_mug->_movement = 0;
+ g_vars->scene16_mug->setOXY(409, 459);
+ g_vars->scene16_mug->_priority = 5;
+ g_vars->scene16_mug->_flags |= 4;
+ }
+}
+
+int scene16_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_objectIdAtCursor == PIC_SC16_TUMBA) {
+ if (g_fp->_cursorId == PIC_CSR_DEFAULT)
+ g_fp->_cursorId = PIC_CSR_ITN;
+ } else {
+ if (g_fp->_objectIdAtCursor == ANI_MUG && g_fp->_cursorId == PIC_CSR_ITN && g_vars->scene16_mug->_statics->_staticsId == ST_MUG_FULL)
+ g_fp->_cursorId = PIC_CSR_ITN_GREEN;
+ }
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler16_laughSound() {
+ int snd = SND_16_035;
+
+ switch (g_vars->scene16_sound) {
+ case SND_16_034:
+ snd = SND_16_035;
+ break;
+
+ case SND_16_035:
+ snd = SND_16_037;
+ break;
+
+ case SND_16_037:
+ snd = SND_16_034;
+ break;
+ }
+
+ g_vars->scene16_sound = snd;
+
+ g_fp->playSound(snd, 0);
+}
+
+void sceneHandler16_showBearded() {
+ if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Unconvoluted)) {
+ StaticANIObject *brd = g_fp->_currentScene->getStaticANIObject1ById(ANI_BEARDED_CMN, -1);
+
+ if (!brd || !(brd->_flags & 4))
+ chainQueue(QU_BRD16_STARTBEARDED, 0);
+ }
+}
+
+void sceneHandler16_showMugFull() {
+ g_vars->scene16_mug->changeStatics2(ST_MUG_FULL);
+}
+
+void sceneHandler16_fillMug() {
+ if (g_vars->scene16_mug->_flags & 4) {
+ g_vars->scene16_jettie->_priority = 2;
+ g_vars->scene16_jettie->startAnim(MV_JTI_FLOWIN, 0, -1);
+
+ if (g_fp->_aniMan->_movement) {
+ if (g_fp->_aniMan->_movement->_id == MV_MAN16_TAKEMUG) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT);
+
+ g_vars->scene16_mug->show1(-1, -1, -1, 0);
+
+ g_fp->setObjectState(sO_Cup, g_fp->getObjectEnumState(sO_Cup, sO_DudeHas));
+ }
+ }
+ return;
+ }
+
+ MessageQueue *mq;
+
+ if (!(g_vars->scene16_boot->_flags & 4)) {
+ g_vars->scene16_jettie->_priority = 15;
+ g_vars->scene16_jettie->startAnim(MV_JTI_FLOWBY, 0, -1);
+
+ if (g_vars->scene16_walkingBoy) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYOUT), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode);
+ if (mq->chain(g_vars->scene16_walkingBoy) || !mq)
+ return;
+ } else {
+ if (!g_vars->scene16_walkingGirl)
+ return;
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLOUT), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene16_walkingGirl->_okeyCode);
+ if (mq->chain(g_vars->scene16_walkingGirl))
+ return;
+ }
+ delete mq;
+
+ return;
+ }
+
+ g_vars->scene16_jettie->_priority = 15;
+
+ g_vars->scene16_boot->startAnim(MV_BT16_FILL, 0, -1);
+
+ StaticANIObject *ani;
+
+ if (g_vars->scene16_walkingBoy) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYOUT), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode);
+
+ ani = g_vars->scene16_walkingBoy;
+ } else {
+ if (!g_vars->scene16_walkingGirl)
+ return;
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLOUT), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene16_walkingGirl->_okeyCode);
+ ani = g_vars->scene16_walkingGirl;
+ }
+
+ if (!mq->chain(ani))
+ delete mq;
+}
+
+void sceneHandler16_startLaugh() {
+ StaticANIObject *girl = g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1);
+
+ girl->changeStatics2(ST_GRL_STAND);
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLLAUGH), 0, 1);
+
+ mq->replaceKeyCode(-1, girl->_okeyCode);
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+
+ g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->setSubVarAsInt(sO_DudeSwinged, 0);
+
+ g_vars->scene16_girlIsLaughing = true;
+}
+
+void sceneHandler16_drink() {
+ if (g_vars->scene16_mug->_flags & 4) {
+ if (!g_vars->scene16_jettie->_movement) {
+ if (!g_vars->scene16_walkingBoy || !g_vars->scene16_walkingBoy->_movement || g_vars->scene16_walkingBoy->_movement->_id != MV_BOY_DRINK) {
+ if (!g_vars->scene16_walkingGirl || !g_vars->scene16_walkingGirl->_movement || g_vars->scene16_walkingGirl->_movement->_id != MV_GRL_DRINK) {
+ if (g_vars->scene16_mug->_statics->_staticsId == ST_MUG_FULL) {
+ MessageQueue *mq;
+ ExCommand *ex;
+
+ if (g_vars->scene16_walkingBoy) {
+ g_fp->_aniMan->_flags |= 0x180;
+
+ g_vars->scene16_walkingBoy->changeStatics2(ST_BOY_STAND);
+ g_vars->scene16_walkingBoy->queueMessageQueue(0);
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYKICK), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode);
+
+ ex = new ExCommand(ANI_MAN, 34, 384, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3u;
+ ex->_field_14 = 384;
+ ex->_messageNum = 0;
+
+ mq->insertExCommandAt(2, ex);
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+ } else {
+ g_fp->_aniMan->_flags |= 1;
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_MANDRINK), 0, 1);
+
+ ex = new ExCommand(ANI_MAN, 34, 256, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3u;
+ ex->_field_14 = 256;
+ ex->_messageNum = 0;
+
+ mq->addExCommandToEnd(ex);
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1)->changeStatics2(ST_GRL_STAND);
+ }
+
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_WIRE16, -1)->show1(-1, -1, -1, 0);
+ } else {
+ chainObjQueue(g_fp->_aniMan, QU_SC16_TAKEMUG, 1);
+ }
+ }
+ }
+ }
+ }
+}
+
+void sceneHandler16_mugClick() {
+ if (abs(310 - g_fp->_aniMan->_ox) >= 1 || abs(449 - g_fp->_aniMan->_oy) >= 1
+ || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 310, 449, 1, ST_MAN_RIGHT);
+
+ if (mq) {
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC16_MUGCLICK, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags = 2;
+ mq->addExCommandToEnd(ex);
+
+ postExCommand(g_fp->_aniMan->_id, 2, 310, 449, 0, -1);
+ }
+ } else {
+ sceneHandler16_drink();
+ }
+}
+
+void sceneHandler16_showMan() {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT);
+ g_fp->_aniMan->show1(-1, -1, -1, 0);
+
+ g_vars->scene16_mug->show1(-1, -1, -1, 0);
+}
+
+void sceneHandler16_showMug() {
+ chainQueue(QU_SC16_SHOWMUG, 0);
+}
+
+void sceneHandler16_hideMan() {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT);
+ g_fp->_aniMan->hide();
+
+ g_vars->scene16_mug->hide();
+}
+
+void sceneHandler16_hideMug() {
+ g_vars->scene16_mug->hide();
+}
+
+void sceneHandler16_hideWire() {
+ g_vars->scene16_wire->hide();
+}
+
+void sceneHandler16_showWire() {
+ g_vars->scene16_wire->show1(-1, -1, -1, 0);
+}
+
+void sceneHandler16_putOnWheel() {
+ StaticANIObject *ani = g_vars->scene16_walkingBoy;
+
+ if (!ani)
+ ani = g_vars->scene16_walkingGirl;
+
+ if (ani)
+ g_vars->scene16_figures.push_back(ani);
+
+ ani = g_vars->scene16_figures.front();
+
+ g_vars->scene16_figures.pop_front();
+
+ if (ani) {
+ MessageQueue *mq;
+
+ if (ani->_id == ANI_BOY) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GOBOY), 0, 1);
+
+ mq->replaceKeyCode(-1, ani->_okeyCode);
+ mq->chain(0);
+
+ g_vars->scene16_walkingBoy = ani;
+ g_vars->scene16_walkingGirl = 0;
+ } else if (ani->_id == ANI_GIRL) {
+ if (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging)) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GOGIRL), 0, 1);
+
+ mq->replaceKeyCode(-1, ani->_okeyCode);
+ mq->chain(0);
+
+ g_vars->scene16_walkingBoy = 0;
+ g_vars->scene16_walkingGirl = ani;
+ }
+ }
+ }
+}
+
+void sceneHandler16_girlROTFL() {
+ StaticANIObject *girl = g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1);
+
+ girl->changeStatics2(ST_GRL_LAUGH);
+ girl->startAnim(MV_GRL_FALL, 0, -1);
+
+ g_vars->scene16_girlIsLaughing = false;
+}
+
+int sceneHandler16(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch(cmd->_messageNum) {
+ case MSG_SC16_LAUGHSOUND:
+ sceneHandler16_laughSound();
+ break;
+
+ case MSG_SC16_SHOWBEARDED:
+ sceneHandler16_showBearded();
+ break;
+
+ case MSG_SC16_SHOWMUGFULL:
+ sceneHandler16_showMugFull();
+ break;
+
+ case MSG_SC16_FILLMUG:
+ sceneHandler16_fillMug();
+ break;
+
+ case MSG_SC16_STARTLAUGH:
+ sceneHandler16_startLaugh();
+ break;
+
+ case MSG_SC16_MUGCLICK:
+ if (!g_fp->_aniMan->isIdle() || g_fp->_aniMan->_flags & 0x100)
+ cmd->_messageKind = 0;
+ else
+ sceneHandler16_mugClick();
+
+ break;
+
+ case MSG_SC16_SHOWMAN:
+ sceneHandler16_showMan();
+ break;
+
+ case MSG_SC16_SHOWMUG:
+ sceneHandler16_showMug();
+ break;
+
+ case MSG_SC16_HIDEMAN:
+ sceneHandler16_hideMan();
+ break;
+
+ case MSG_SC16_HIDEMUG:
+ sceneHandler16_hideMug();
+ break;
+
+ case MSG_SC16_HIDEWIRE:
+ sceneHandler16_hideWire();
+ break;
+
+ case MSG_SC16_SHOWWIRE:
+ sceneHandler16_showWire();
+ 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->scene16_placeIsOccupied) {
+ g_vars->scene16_walkingCount++;
+
+ if (g_vars->scene16_walkingCount < 280) {
+ sceneHandler16_putOnWheel();
+
+ g_vars->scene16_walkingCount = 0;
+ }
+ }
+
+ if (g_vars->scene16_girlIsLaughing) {
+ if (g_fp->_aniMan->_movement)
+ if (g_fp->_aniMan->_movement->_id == MV_MAN_TURN_RL)
+ sceneHandler16_girlROTFL();
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene17.cpp b/engines/fullpipe/scenes/scene17.cpp
new file mode 100644
index 0000000000..73bf7ab1c0
--- /dev/null
+++ b/engines/fullpipe/scenes/scene17.cpp
@@ -0,0 +1,285 @@
+/* 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"
+#include "fullpipe/floaters.h"
+
+namespace Fullpipe {
+
+void scene17_initScene(Scene *sc) {
+ g_vars->scene17_flyState = 1;
+ g_vars->scene17_sugarIsShown = false;
+ g_vars->scene17_sceneOldEdgeX = 0;
+ g_vars->scene17_flyCountdown = 0;
+ g_vars->scene17_hand = sc->getStaticANIObject1ById(ANI_HAND17, -1);
+}
+
+void scene17_restoreState() {
+ if (g_fp->getObjectState(sO_UsherHand) == g_fp->getObjectEnumState(sO_UsherHand, sO_WithCoin)) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 0);
+
+ g_vars->scene17_handPhase = false;
+ } else {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 1);
+
+ g_vars->scene17_handPhase = true;
+ }
+
+ g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_17"));
+
+ g_vars->scene17_flyState = g_fp->getObjectState(sO_Fly_17);
+
+ if (g_vars->scene17_flyState <= 0 ) {
+ g_vars->scene17_flyCountdown = g_fp->_rnd->getRandomNumber(600) + 600;
+
+ g_vars->scene17_flyState = g_fp->_rnd->getRandomNumber(4) + 1;
+ }
+
+ g_fp->setObjectState(sO_Fly_17, g_vars->scene17_flyState - 1);
+}
+
+int scene17_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_objectIdAtCursor != PIC_SC17_RTRUBA2 && g_fp->_objectIdAtCursor != PIC_SC17_RTRUBA)
+ return g_fp->_cursorId;
+
+ if (!g_vars->scene17_handPhase)
+ return g_fp->_cursorId;
+
+ int item = g_fp->_inventory->getSelectedItemId();
+
+ if ((g_fp->_cursorId != PIC_CSR_DEFAULT_INV || item != ANI_INV_COIN) && item != ANI_INV_BOOT && item != ANI_INV_HAMMER)
+ ; // empty
+ else
+ g_fp->_cursorId = PIC_CSR_ITN_INV;
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler17_drop() {
+ StaticANIObject *mug = g_fp->_currentScene->getStaticANIObject1ById(ANI_MUG_17, -1);
+ StaticANIObject *jet = g_fp->_currentScene->getStaticANIObject1ById(ANI_JET_17, -1);
+
+ if (mug && mug->_flags & 4) {
+ mug->changeStatics2(ST_MUG17_EMPTY);
+ chainQueue(QU_SC17_FILLMUG_DROP, 0);
+ } else if (jet) {
+ jet->queueMessageQueue(0);
+ chainQueue(QU_JET17_DROP, 0);
+ }
+}
+
+void sceneHandler17_fillBottle() {
+ StaticANIObject *bottle = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_BOTTLE, -1);
+ StaticANIObject *mug = g_fp->_currentScene->getStaticANIObject1ById(ANI_MUG_17, -1);
+ StaticANIObject *boot = g_fp->_currentScene->getStaticANIObject1ById(ANI_BOOT_17, -1);
+
+ if (bottle && (bottle->_flags & 4))
+ chainQueue(QU_SC17_FILLBOTTLE, 1);
+ else if (mug && (mug->_flags & 4) && mug->_statics->_staticsId == ST_MUG17_EMPTY)
+ chainQueue(QU_SC17_FILLMUG, 1);
+ else if (boot && (boot->_flags & 4))
+ chainQueue(QU_SC17_FILLBOOT, 1);
+ else
+ chainQueue(QU_JET17_FLOW, 1);
+}
+
+void sceneHandler17_testTruba() {
+ if (g_vars->scene17_hand->isIdle()) {
+ if (!g_vars->scene17_hand->_movement || g_vars->scene17_hand->_movement->_id != MV_HND17_FIGA) {
+ g_vars->scene17_hand->changeStatics2(ST_HND17_EMPTY);
+ g_vars->scene17_hand->startAnim(MV_HND17_FIGA, 0, -1);
+ }
+ }
+}
+
+void sceneHandler17_showBottle() {
+ chainQueue(QU_SC17_SHOWBOTTLE, 0);
+}
+
+void sceneHandler17_hideSugar() {
+ StaticANIObject *sugar = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_SUGAR, -1);
+
+ if (sugar)
+ sugar->hide();
+}
+
+void sceneHandler17_showSugar() {
+ chainQueue(QU_SC17_SHOWSUGAR, 0);
+
+ g_vars->scene17_sugarIsShown = true;
+}
+
+void sceneHandler17_moonshineFill() {
+ StaticANIObject *moonshiner = g_fp->_currentScene->getStaticANIObject1ById(ANI_SAMOGONSHCHIK, -1);
+
+ if (!(moonshiner->_flags & 0x80)) {
+ moonshiner->changeStatics2(ST_SMG_SIT);
+ chainObjQueue(moonshiner, QU_SMG_FILLBOTTLE, 1);
+
+ g_vars->scene17_sugarIsShown = false;
+ }
+}
+
+void sceneHandler17_updateFlies() {
+ g_fp->_floaters->genFlies(g_fp->_currentScene, 239, -50, 20, 4);
+
+ g_fp->_floaters->_array2[0]->countdown = g_fp->_rnd->getRandomNumber(5) + 6;
+ g_fp->_floaters->_array2[0]->val6 = 239;
+ g_fp->_floaters->_array2[0]->val7 = -50;
+}
+
+
+int sceneHandler17(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC17_DROP:
+ sceneHandler17_drop();
+ break;
+
+ case MSG_SC17_UPDATEHAND:
+ if (g_fp->getObjectState(sO_UsherHand) == g_fp->getObjectEnumState(sO_UsherHand, sO_WithCoin)) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 0);
+
+ g_vars->scene17_handPhase = false;
+ } else {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 1);
+
+ g_vars->scene17_handPhase = true;
+ }
+ break;
+
+ case MSG_SC17_FILLBOTTLE:
+ sceneHandler17_fillBottle();
+ break;
+
+ case MSG_SC17_TESTTRUBA:
+ sceneHandler17_testTruba();
+ break;
+
+ case MSG_SC17_SHOWBOTTLE:
+ sceneHandler17_showBottle();
+ break;
+
+ case MSG_SC17_HIDESUGAR:
+ sceneHandler17_hideSugar();
+ break;
+
+ case MSG_SC17_SHOWSUGAR:
+ sceneHandler17_showSugar();
+ break;
+
+ case 29:
+ {
+ int pic = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (pic == PIC_SC17_RTRUBA2 || pic == PIC_SC17_RTRUBA) {
+ if (cmd->_keyCode == ANI_INV_COIN || cmd->_keyCode == ANI_INV_BOOT || cmd->_keyCode == ANI_INV_HAMMER) {
+ if (g_vars->scene17_handPhase) {
+ if (g_fp->_aniMan->isIdle()) {
+ if (!(g_fp->_aniMan->_flags & 0x100)) {
+ handleObjectInteraction(g_fp->_aniMan, g_vars->scene17_hand, cmd->_keyCode);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case 33:
+ {
+ int x = g_vars->scene17_sceneEdgeX;
+ g_vars->scene17_sceneOldEdgeX = g_vars->scene17_sceneEdgeX;
+
+ if (g_fp->_aniMan2) {
+ x = g_fp->_aniMan2->_ox;
+
+ g_vars->scene17_sceneEdgeX = x;
+
+ if (x < g_fp->_sceneRect.left + 200) {
+ g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left;
+
+ x = g_vars->scene17_sceneEdgeX;
+ }
+
+ if (x > g_fp->_sceneRect.right - 200) {
+ g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right;
+ x = g_vars->scene17_sceneEdgeX;
+ }
+ }
+
+ if (g_vars->scene17_sugarIsShown) {
+ sceneHandler17_moonshineFill();
+ x = g_vars->scene17_sceneEdgeX;
+ }
+
+ if (g_vars->scene17_handPhase) {
+ if (g_vars->scene17_sceneOldEdgeX < 410 && x >= 410) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_ATTRACT, QU_HND17_ATTRACT, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 1);
+ } else if (g_vars->scene17_sceneOldEdgeX > 410 && x <= 410) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 1);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_ATTRACT, QU_HND17_ATTRACT, 1);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0);
+ }
+ }
+
+ --g_vars->scene17_flyCountdown;
+
+ if (!g_vars->scene17_flyCountdown)
+ sceneHandler17_updateFlies();
+
+ g_fp->_floaters->update();
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+
+ break;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene18and19.cpp b/engines/fullpipe/scenes/scene18and19.cpp
new file mode 100644
index 0000000000..a965cfb98e
--- /dev/null
+++ b/engines/fullpipe/scenes/scene18and19.cpp
@@ -0,0 +1,49 @@
+/* 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 {
+
+void scene18_preload() {
+ warning("WARNING: scene18_preload()");
+}
+
+void scene19_preload(Scene *sc, int key) {
+ warning("WARNING: scene19_preload()");
+}
+
+
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene20.cpp b/engines/fullpipe/scenes/scene20.cpp
new file mode 100644
index 0000000000..5fed24aabd
--- /dev/null
+++ b/engines/fullpipe/scenes/scene20.cpp
@@ -0,0 +1,155 @@
+/* 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"
+#include "fullpipe/floaters.h"
+
+namespace Fullpipe {
+
+void scene20_setExits(Scene *sc) {
+ int thingpar;
+
+ if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnStool)
+ || g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnTheFloor))
+ thingpar = 1;
+ else if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipe)
+ || g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipeWithStool)) {
+ getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing, 1);
+ getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing2, 1);
+ getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing3, 0);
+
+ return;
+ } else {
+ thingpar = 0;
+ }
+
+ getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing, thingpar);
+ getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing2, 0);
+ getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing3, 1);
+}
+
+void scene20_initScene(Scene *sc) {
+ Scene *oldsc = g_fp->_currentScene;
+
+ g_vars->scene20_grandma = sc->getStaticANIObject1ById(ANI_GRANDMA_20, -1);
+
+ g_fp->_currentScene = sc;
+
+ if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnTheFloor))
+ g_fp->setObjectState(sO_Grandma, g_fp->getObjectEnumState(sO_Grandma, sO_NearPipe));
+
+ if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnStool)) {
+ g_vars->scene20_grandma->changeStatics2(ST_GMA20_STOOL);
+ } else if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnTheFloor)) {
+ g_vars->scene20_grandma->changeStatics2(ST_GMA20_FLOOR);
+ } else if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipe)
+ || g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipeWithStool)) {
+ g_vars->scene20_grandma->changeStatics2(ST_GMA20_STAND);
+ } else {
+ g_vars->scene20_grandma->hide();
+ }
+
+ scene20_setExits(sc);
+
+ g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_20"));
+
+ for (int i = 0; i < 3; i++) {
+ g_fp->_floaters->genFlies(sc, g_fp->_rnd->getRandomNumber(101) + 70, g_fp->_rnd->getRandomNumber(51) + 175, 100, 0);
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val13 = g_fp->_rnd->getRandomNumber(9);
+ }
+
+ g_fp->_currentScene = oldsc;
+
+ g_vars->scene20_fliesCountdown = g_fp->_rnd->getRandomNumber(200) + 400;
+}
+
+void sceneHandler20_updateFlies() {
+ int sz = g_fp->_floaters->_array2.size();
+
+ if (sz < 3) {
+ g_fp->_floaters->genFlies(g_fp->_currentScene, 253, 650, 200, 0);
+ g_fp->_floaters->_array2[sz - 1]->val2 = 250;
+ g_fp->_floaters->_array2[sz - 1]->val3 = 200;
+ } else {
+ int idx = g_fp->_rnd->getRandomNumber(sz);
+
+ g_fp->_floaters->_array2[idx]->countdown = 0;
+ g_fp->_floaters->_array2[idx]->fflags |= 4u;
+ g_fp->_floaters->_array2[idx]->val2 = 250;
+ g_fp->_floaters->_array2[idx]->val3 = 200;
+ g_fp->_floaters->_array2[idx]->val6 = 253;
+ g_fp->_floaters->_array2[idx]->val7 = 650;
+ g_fp->_floaters->_array2[idx]->ani->_priority = 200;
+ }
+
+ g_vars->scene20_fliesCountdown = g_fp->_rnd->getRandomNumber(200) + 400;
+}
+
+int sceneHandler20(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC20_UPDATELOCKABLE:
+ scene20_setExits(g_fp->_currentScene);
+ 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;
+ }
+
+ --g_vars->scene20_fliesCountdown;
+
+ if (g_vars->scene20_fliesCountdown <= 0)
+ sceneHandler20_updateFlies();
+
+ g_fp->_floaters->update();
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene21.cpp b/engines/fullpipe/scenes/scene21.cpp
new file mode 100644
index 0000000000..5a6509964d
--- /dev/null
+++ b/engines/fullpipe/scenes/scene21.cpp
@@ -0,0 +1,148 @@
+/* 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 {
+
+void scene21_initScene(Scene *sc) {
+ Scene *oldsc = g_fp->_currentScene;
+
+ g_vars->scene21_giraffeBottom = sc->getStaticANIObject1ById(ANI_GIRAFFE_BOTTOM, -1);
+ g_fp->_currentScene = sc;
+
+ if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) {
+ g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_HANG);
+ g_vars->scene21_pipeIsOpen = true;
+ g_vars->scene21_wigglePos = 0.0;
+ g_vars->scene21_giraffeBottomX = g_vars->scene21_giraffeBottom->_ox;
+ g_vars->scene21_giraffeBottomY = g_vars->scene21_giraffeBottom->_oy;
+ g_vars->scene21_wiggleTrigger = false;
+ } else {
+ g_vars->scene21_pipeIsOpen = false;
+ }
+ g_fp->_currentScene = oldsc;
+ g_fp->initArcadeKeys("SC_21");
+}
+
+int scene21_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC21_DTRUBA)
+
+ g_fp->_cursorId = PIC_CSR_GOD;
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler21_doWiggle() {
+ g_vars->scene21_giraffeBottom->setOXY((int)(cos(g_vars->scene21_wigglePos) * 4.0) + g_vars->scene21_giraffeBottom->_ox,
+ g_vars->scene21_giraffeBottom->_oy);
+
+ g_vars->scene21_wigglePos += 0.19635;
+
+ if (g_vars->scene21_wigglePos > 6.2831853) {
+ g_vars->scene21_wigglePos = 0;
+
+ if (!g_vars->scene21_giraffeBottom->_movement)
+ g_vars->scene21_giraffeBottom->setOXY(g_vars->scene21_giraffeBottomX, g_vars->scene21_giraffeBottomY);
+ }
+}
+
+int sceneHandler21(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC21_UPDATEASS:
+ if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) {
+ g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_HANG);
+ g_vars->scene21_giraffeBottom->setOXY(g_vars->scene21_giraffeBottomX, g_vars->scene21_giraffeBottomY);
+ g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_SIT);
+
+ g_vars->scene21_pipeIsOpen = false;
+
+ g_fp->setObjectState(sO_LowerPipe_21, g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsClosed));
+ }
+
+ break;
+
+ case 29:
+ {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+ if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) {
+ int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0);
+
+ if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode) ) {
+ if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1)
+ || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0))
+ g_fp->processArcade(cmd);
+ }
+ }
+
+ break;
+ }
+
+ case 33:
+ if (g_fp->_aniMan2) {
+ int x = g_fp->_aniMan2->_ox;
+
+ if (x <= g_fp->_sceneWidth - 460) {
+ if (x < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left;
+ } else {
+ g_fp->_currentScene->_x = g_fp->_sceneWidth - x;
+ }
+
+ if (x > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right;
+ }
+
+ if (g_vars->scene21_pipeIsOpen && !g_vars->scene21_wiggleTrigger)
+ sceneHandler21_doWiggle();
+
+ g_vars->scene21_wiggleTrigger = !g_vars->scene21_wiggleTrigger;
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene22.cpp b/engines/fullpipe/scenes/scene22.cpp
new file mode 100644
index 0000000000..13c9ab36e9
--- /dev/null
+++ b/engines/fullpipe/scenes/scene22.cpp
@@ -0,0 +1,395 @@
+/* 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 {
+
+void scene22_initScene(Scene *sc) {
+ g_vars->scene22_bag = sc->getStaticANIObject1ById(ANI_MESHOK, -1);
+
+ Scene *oldsc = g_fp->_currentScene;
+ g_fp->_currentScene = sc;
+
+ g_vars->scene22_giraffeMiddle = sc->getStaticANIObject1ById(ANI_GIRAFFE_MIDDLE, -1);
+ g_vars->scene22_dudeIsOnStool = false;
+ g_vars->scene22_interactionIsDisabled = false;
+ g_vars->scene22_craneIsOut = true;
+
+ if (g_fp->getObjectState(sO_Bag_22) == g_fp->getObjectEnumState(sO_Bag_22, sO_NotFallen))
+ g_vars->scene22_numBagFalls = 0;
+ else if (g_fp->getObjectState(sO_Bag_22) == g_fp->getObjectEnumState(sO_Bag_22, sO_FallenOnce))
+ g_vars->scene22_numBagFalls = 1;
+ else if ( g_fp->getObjectState(sO_Bag_22) == g_fp->getObjectEnumState(sO_Bag_22, sO_FallenTwice))
+ g_vars->scene22_numBagFalls = 2;
+ else {
+ g_vars->scene22_numBagFalls = 3;
+ g_vars->scene22_craneIsOut = false;
+ }
+
+
+ if ( g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened))
+ g_vars->scene22_giraffeMiddle->changeStatics2(ST_GRFM_AFTER);
+ else
+ g_vars->scene22_giraffeMiddle->changeStatics2(ST_GRFM_NORM);
+
+ g_fp->_currentScene = oldsc;
+
+ g_fp->initArcadeKeys("SC_22");
+}
+
+int scene22_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_objectIdAtCursor != ANI_HANDLE_L)
+ return g_fp->_cursorId;
+
+ int sel = g_fp->_inventory->getSelectedItemId();
+
+ if (!sel) {
+ g_fp->_cursorId = PIC_CSR_ITN;
+ return g_fp->_cursorId;
+ }
+
+ if (g_vars->scene22_dudeIsOnStool || (sel != ANI_INV_STOOL && sel != ANI_INV_BOX))
+ ; //empty
+ else
+ g_fp->_cursorId = PIC_CSR_ITN_INV;
+
+ return g_fp->_cursorId;
+}
+
+void scene22_setBagState() {
+ if (g_vars->scene22_craneIsOut) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_CRANEOUT, 1);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_MOVE, 0);
+ } else {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_CRANEOUT, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_MOVE, 1);
+ }
+}
+
+void sceneHandler22_showStool() {
+ chainQueue(QU_SC22_SHOWSTOOL, 0);
+}
+
+void sceneHandler22_hideStool() {
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1)->hide();
+}
+
+void sceneHandler22_handleDown() {
+ if (g_vars->scene22_bag->_statics->_staticsId == ST_MSH_SIT) {
+ chainQueue(QU_MSH_CRANEOUT, 1);
+ g_vars->scene22_interactionIsDisabled = false;
+ } else {
+ ++g_vars->scene22_numBagFalls;
+
+ int qid;
+
+ if (g_vars->scene22_numBagFalls == 3) {
+ chainQueue(QU_SC22_FALLSACK_GMA, 1);
+ qid = QU_SC22_FALLBROOM;
+ } else {
+ qid = QU_SC22_FALLSACK;
+ }
+
+ chainQueue(qid, 1);
+
+ int state;
+
+ if (g_vars->scene22_numBagFalls) {
+ if (g_vars->scene22_numBagFalls == 1) {
+ state = g_fp->getObjectEnumState(sO_Bag_22, sO_FallenOnce);
+ } else if (g_vars->scene22_numBagFalls == 2) {
+ state = g_fp->getObjectEnumState(sO_Bag_22, sO_FallenTwice);
+ } else {
+ state = g_fp->getObjectEnumState(sO_Bag_22, sO_BrushHasFallen);
+ }
+ } else {
+ state = g_fp->getObjectEnumState(sO_Bag_22, sO_NotFallen);
+ }
+
+ g_fp->setObjectState(sO_Bag_22, state);
+ }
+
+ g_vars->scene22_craneIsOut = true;
+
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_CRANEOUT, 1);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_MOVE, 0);
+}
+
+void sceneHandler22_fromStool(ExCommand *cmd) {
+ if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC22_FROMSTOOL), 0, 0);
+
+ mq->addExCommandToEnd(cmd->createClone());
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+ }
+}
+
+void sceneHandler22_stoolLogic(ExCommand *cmd) {
+ StaticANIObject *ani;
+ MessageQueue *mq;
+ int xpos;
+ int manId;
+
+ if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
+ if (cmd->_keyCode == ANI_INV_STOOL) {
+ if (abs(841 - g_fp->_aniMan->_ox) <= 1) {
+ if (abs(449 - g_fp->_aniMan->_oy) <= 1) {
+ chainQueue(QU_SC22_PUTSTOOL, 1);
+ g_vars->scene22_interactionIsDisabled = true;
+
+ return;
+ }
+ }
+ goto LABEL_13;
+ }
+
+ if (cmd->_keyCode == ANI_INV_BOX) {
+ ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1);
+ if (!ani || !(ani->_flags & 4)) {
+ if (abs(841 - g_fp->_aniMan->_ox) <= 1) {
+ if (abs(449 - g_fp->_aniMan->_oy) <= 1) {
+ chainObjQueue(g_fp->_aniMan, QU_SC22_TRYBOX, 1);
+ return;
+ }
+ }
+ LABEL_13:
+ xpos = 841;
+ manId = ST_MAN_RIGHT;
+ LABEL_31:
+ mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, xpos, 449, 1, manId);
+
+ if (!mq)
+ return;
+
+ mq->addExCommandToEnd(cmd->createClone());
+
+ postExCommand(g_fp->_aniMan->_id, 2, 841, 449, 0, -1);
+ return;
+ }
+ } else {
+ if (cmd->_keyCode)
+ return;
+
+ if (g_vars->scene22_dudeIsOnStool) {
+ if (g_fp->_aniMan->_movement)
+ return;
+
+ chainQueue(QU_SC22_HANDLEDOWN, 1);
+
+ g_vars->scene22_interactionIsDisabled = true;
+ return;
+ }
+
+ ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1);
+ if (ani && (ani->_flags & 4)) {
+ int x = g_fp->_aniMan->_ox;
+ int y = g_fp->_aniMan->_ox;
+
+ if (sqrt((double)((841 - x) * (841 - x) + (449 - y) * (449 - y)))
+ < sqrt((double)((1075 - x) * (1075 - x) + (449 - y) * (449 - y)))) {
+ if (abs(841 - x) <= 1) {
+ if (abs(449 - y) <= 1) {
+ chainQueue(QU_SC22_TOSTOOL, 1);
+
+ g_vars->scene22_interactionIsDisabled = true;
+ return;
+ }
+ }
+ goto LABEL_13;
+ }
+
+ if (abs(1075 - x) > 1 || abs(449 - y) > 1) {
+ xpos = 1075;
+ manId = ST_MAN_RIGHT | 0x4000;
+ goto LABEL_31;
+ }
+
+ MGM mgm;
+ MGMInfo mgminfo;
+
+ mgm.addItem(ANI_MAN);
+ mgminfo.ani = g_fp->_aniMan;
+ mgminfo.staticsId2 = ST_MAN_RIGHT;
+ mgminfo.x1 = 934;
+ mgminfo.y1 = 391;
+ mgminfo.field_1C = 10;
+ mgminfo.staticsId1 = 0x4145;
+ mgminfo.x2 = 981;
+ mgminfo.y2 = 390;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = 127;
+ mgminfo.movementId = rMV_MAN_TURN_SRL;
+
+ mq = mgm.genMovement(&mgminfo);
+
+ ExCommand *ex = mq->getExCommandByIndex(0);
+
+ mq->deleteExCommandByIndex(0, 0);
+
+ delete mq;
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC22_TOSTOOL_R), 0, 0);
+
+ mq->insertExCommandAt(2, ex);
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+
+ g_vars->scene22_interactionIsDisabled = true;
+ } else {
+ if (abs(1010 - g_fp->_aniMan->_ox) <= 1) {
+ if (abs(443 - g_fp->_aniMan->_oy) <= 1) {
+ chainQueue(QU_SC22_TRYHANDLE, 1);
+ return;
+ }
+ }
+
+ mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1010, 443, 1, ST_MAN_UP);
+
+ if (mq) {
+ mq->addExCommandToEnd(cmd->createClone());
+
+ postExCommand(g_fp->_aniMan->_id, 2, 1010, 443, 0, -1);
+ return;
+ }
+ }
+ }
+ }
+}
+
+int sceneHandler22(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC22_CRANEOUT_GMA:
+ chainQueue(QU_MSH_CRANEOUT_GMA, 1);
+ break;
+
+ case MSG_SC22_CHECKGMABOOT:
+ if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_In_15))
+ g_fp->setObjectState(sO_Boot_15, g_fp->getObjectEnumState(sO_Boot_15, sO_IsPresent));
+
+ break;
+
+ case MSG_SC22_SHOWSTOOL:
+ sceneHandler22_showStool();
+ break;
+
+ case MSG_SC22_HIDESTOOL:
+ sceneHandler22_hideStool();
+ break;
+
+ case MSG_SC22_FROMSTOOL:
+ g_vars->scene22_dudeIsOnStool = false;
+ g_vars->scene22_interactionIsDisabled = false;
+
+ getCurrSceneSc2MotionController()->setEnabled();
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
+ break;
+
+ case MSG_SC22_ONSTOOL:
+ g_vars->scene22_dudeIsOnStool = true;
+ getCurrSceneSc2MotionController()->clearEnabled();
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
+ break;
+
+ case MSG_SC22_HANDLEDOWN:
+ sceneHandler22_handleDown();
+ break;
+
+ case 29:
+ if (!g_vars->scene22_interactionIsDisabled) {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (ani && ani->_id == ANI_HANDLE_L) {
+ sceneHandler22_stoolLogic(cmd);
+ return 0;
+ }
+
+ if (!g_vars->scene22_dudeIsOnStool) {
+ 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);
+ return 0;
+ }
+ }
+ }
+ return 0;
+ }
+
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_RIGHT && !g_fp->_aniMan->_movement) {
+ sceneHandler22_fromStool(cmd);
+
+ return 0;
+ }
+ }
+
+ cmd->_messageKind = 0;
+ break;
+
+ case 33:
+ if (g_fp->_aniMan2) {
+ int x = g_fp->_aniMan2->_ox;
+
+ if (x <= g_fp->_sceneWidth - 460) {
+ if (x < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left;
+ } else {
+ g_fp->_currentScene->_x = g_fp->_sceneWidth - x;
+ }
+
+ if (x > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right;
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+ }
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene23.cpp b/engines/fullpipe/scenes/scene23.cpp
new file mode 100644
index 0000000000..1f2587eba4
--- /dev/null
+++ b/engines/fullpipe/scenes/scene23.cpp
@@ -0,0 +1,555 @@
+/* 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"
+#include "fullpipe/floaters.h"
+
+namespace Fullpipe {
+
+bool sceneHandler23_testCalendar() {
+ int cal0, cal1, cal2, cal3;
+
+ if (g_vars->scene23_calend0->_movement)
+ cal0 = g_vars->scene23_calend0->_movement->_staticsObj2->_staticsId;
+ else
+ cal0 = g_vars->scene23_calend0->_statics->_staticsId;
+
+ if (g_vars->scene23_calend1->_movement)
+ cal1 = g_vars->scene23_calend1->_movement->_staticsObj2->_staticsId;
+ else
+ cal1 = g_vars->scene23_calend1->_statics->_staticsId;
+
+ if (g_vars->scene23_calend2->_movement)
+ cal2 = g_vars->scene23_calend2->_movement->_staticsObj2->_staticsId;
+ else
+ cal2 = g_vars->scene23_calend2->_statics->_staticsId;
+
+ if (g_vars->scene23_calend3->_movement)
+ cal3 = g_vars->scene23_calend3->_movement->_staticsObj2->_staticsId;
+ else
+ cal3 = g_vars->scene23_calend3->_statics->_staticsId;
+
+ return (cal0 == ST_CND_1 && cal1 == ST_CND_4 && cal2 == ST_CND_0 && cal3 == ST_CND_2 && (g_vars->scene23_giraffee->_flags & 4));
+}
+
+void scene23_initScene(Scene *sc) {
+ g_vars->scene23_calend0 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 0);
+ g_vars->scene23_calend1 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 1);
+ g_vars->scene23_calend2 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 2);
+ g_vars->scene23_calend3 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 3);
+ g_vars->scene23_topReached = false;
+ g_vars->scene23_isOnStool = false;
+ g_vars->scene23_someVar = 0;
+ g_vars->scene23_giraffeTop = sc->getStaticANIObject1ById(ANI_GIRAFFE_TOP, -1);
+ g_vars->scene23_giraffee = sc->getStaticANIObject1ById(ANI_GIRAFFEE, -1);
+
+ g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_23"));
+
+ Scene *oldsc = g_fp->_currentScene;
+ g_fp->_currentScene = sc;
+
+ if (g_fp->getObjectState(sO_UpperHatch_23) == g_fp->getObjectEnumState(sO_UpperHatch_23, sO_Opened)) {
+ sc->getPictureObjectById(PIC_SC23_BOXOPEN, 0)->_flags |= 4;
+ sc->getPictureObjectById(PIC_SC23_BOXCLOSED, 0)->_flags &= 0xFFFB;
+ sc->getPictureObjectById(PIC_SC23_BTN1, 0)->_flags |= 4;
+ sc->getPictureObjectById(PIC_SC23_BTN2, 0)->_flags |= 4;
+ sc->getPictureObjectById(PIC_SC23_BTN3, 0)->_flags |= 4;
+ sc->getPictureObjectById(PIC_SC23_BTN4, 0)->_flags |= 4;
+
+ if (g_vars->scene23_giraffee->_statics->_staticsId == ST_GRFG_EMPTY || !(g_vars->scene23_giraffee->_flags & 4)) {
+ g_vars->scene23_giraffee->changeStatics2(ST_GRFG_BALD);
+ g_vars->scene23_giraffee->_flags |= 4;
+ }
+ g_vars->scene23_calend0->show1(-1, -1, -1, 0);
+ g_vars->scene23_calend1->show1(-1, -1, -1, 0);
+ g_vars->scene23_calend2->show1(-1, -1, -1, 0);
+ g_vars->scene23_calend3->show1(-1, -1, -1, 0);
+
+ sc->getStaticANIObject1ById(ANI_LUK23_U, -1)->changeStatics2(ST_LUK23U_OPEN);
+ } else {
+ sc->getPictureObjectById(PIC_SC23_BOXOPEN, 0)->_flags &= 0xFFFB;
+ sc->getPictureObjectById(PIC_SC23_BOXCLOSED, 0)->_flags |= 4;
+ sc->getPictureObjectById(PIC_SC23_BTN1, 0)->_flags &= 0xFFFB;
+ sc->getPictureObjectById(PIC_SC23_BTN2, 0)->_flags &= 0xFFFB;
+ sc->getPictureObjectById(PIC_SC23_BTN3, 0)->_flags &= 0xFFFB;
+ sc->getPictureObjectById(PIC_SC23_BTN4, 0)->_flags &= 0xFFFB;
+
+ g_vars->scene23_giraffee->hide();
+ g_vars->scene23_calend0->hide();
+ g_vars->scene23_calend1->hide();
+ g_vars->scene23_calend2->hide();
+ g_vars->scene23_calend3->hide();
+
+ sc->getStaticANIObject1ById(ANI_LUK23_U, -1)->changeStatics2(ST_LUK23U_CLOSED);
+
+ g_fp->_floaters->genFlies(sc, 600, 90, 0, 0);
+ }
+
+ if (g_fp->getObjectState(sO_LowerHatch_23) == g_fp->getObjectEnumState(sO_LowerHatch_23, sO_Opened)) {
+ g_vars->scene23_giraffeTop->show1(-1, -1, -1, 0);
+ g_vars->scene23_giraffeTop->changeStatics2(ST_GRFU_UP);
+
+ if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) {
+ g_vars->scene23_giraffeTop->changeStatics2(ST_GRFU_KISS);
+ g_vars->scene23_giraffee->hide();
+ } else {
+ if (g_fp->getObjectState(sO_UpperHatch_23) == g_fp->getObjectEnumState(sO_UpperHatch_23, sO_Opened)
+ && (g_vars->scene23_giraffee->_flags & 4))
+ g_vars->scene23_giraffeTop->setOXY(614, 362);
+ else
+ g_vars->scene23_giraffeTop->setOXY(618, 350);
+
+ if (sceneHandler23_testCalendar())
+ g_vars->scene23_calend1->_statics = g_vars->scene23_calend1->getStaticsById(ST_CND_5);
+ }
+
+ sc->getStaticANIObject1ById(ANI_LUK23_D, -1)->changeStatics2(ST_LUK23_OPEN);
+
+ if (g_fp->getObjectState(sO_Lever_23) == g_fp->getObjectEnumState(sO_Lever_23, sO_Taken))
+ sc->getStaticANIObject1ById(ANI_INV_LEVERHANDLE, -1)->hide();
+
+ sc->getStaticANIObject1ById(ANI_HANDLE23, -1)->hide();
+ } else {
+ g_vars->scene23_giraffeTop->hide();
+
+ sc->getStaticANIObject1ById(ANI_LUK23_D, -1)->changeStatics2(ST_LUK23_WHANDLE2);
+
+ sc->getStaticANIObject1ById(ANI_INV_LEVERHANDLE, -1)->hide();
+ }
+
+ g_fp->_currentScene = oldsc;
+}
+
+void scene23_setGiraffeState() {
+ if (g_fp->getObjectState(sO_UpperHatch_23) == g_fp->getObjectEnumState(sO_UpperHatch_23, sO_Opened)) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene23_giraffeTop, ST_GRFU_UP, QU_GRFU_TURN_UL, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene23_giraffeTop, ST_GRFU_UP, QU_GRFU_TURN_UD, 0);
+ }
+}
+
+int scene23_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_objectIdAtCursor == PIC_SC23_LADDERU) {
+ if (g_vars->scene23_topReached)
+ return g_fp->_cursorId;
+
+ g_fp->_cursorId = getGameLoaderInventory()->getSelectedItemId() ? PIC_CSR_GOU : PIC_CSR_ITN; // FIXME check
+ }
+
+ if (g_fp->_objectIdAtCursor == PIC_SC23_BTN1 || g_fp->_objectIdAtCursor == PIC_SC23_BTN2
+ || g_fp->_objectIdAtCursor == PIC_SC23_BTN3 || g_fp->_objectIdAtCursor == PIC_SC23_BTN4
+ || g_fp->_objectIdAtCursor == ANI_CALENDWHEEL)
+ g_fp->_cursorId = PIC_CSR_LIFT;
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler23_showStool() {
+ chainQueue(QU_SC23_SHOWSTOOL, 0);
+}
+
+void sceneHandler23_hideStool() {
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1)->hide();
+}
+
+void sceneHandler23_startKiss() {
+ g_vars->scene23_giraffeTop->changeStatics2(ST_GRFU_UP);
+ g_vars->scene23_giraffeTop->startMQIfIdle(QU_SC23_STARTKISS, 0);
+}
+
+void sceneHandler23_spinWheel1() {
+ int mv = 0;
+
+ switch (g_vars->scene23_calend0->_statics->_staticsId) {
+ case ST_CND_0:
+ mv = MV_CND_0_1;
+ break;
+
+ case ST_CND_1:
+ mv = MV_CND_1_2;
+ break;
+
+ case ST_CND_2:
+ mv = MV_CND_2_3;
+ break;
+
+ case ST_CND_3:
+ g_vars->scene23_calend0->changeStatics2(ST_CND_9);
+ mv = MV_CND_9_0;
+ break;
+
+ default:
+ break;
+ }
+
+ if (mv)
+ g_vars->scene23_calend0->startAnim(mv, 0, -1);
+
+ if (sceneHandler23_testCalendar())
+ sceneHandler23_startKiss();
+}
+
+void sceneHandler23_spinWheel2and4(StaticANIObject *ani) {
+ int mv = 0;
+
+ switch (ani->_statics->_staticsId) {
+ case ST_CND_0:
+ mv = MV_CND_0_1;
+ break;
+
+ case ST_CND_1:
+ mv = MV_CND_1_2;
+ break;
+
+ case ST_CND_2:
+ mv = MV_CND_2_3;
+ break;
+
+ case ST_CND_3:
+ mv = MV_CND_3_4;
+ break;
+
+ case ST_CND_4:
+ mv = MV_CND_4_5;
+ break;
+
+ case ST_CND_5:
+ mv = MV_CND_5_6;
+ break;
+
+ case ST_CND_6:
+ mv = MV_CND_6_7;
+ break;
+
+ case ST_CND_7:
+ mv = MV_CND_7_8;
+ break;
+
+ case ST_CND_8:
+ mv = MV_CND_8_9;
+ break;
+
+ case ST_CND_9:
+ mv = MV_CND_9_0;
+ break;
+
+ default:
+ break;
+ }
+
+ if (mv)
+ ani->startAnim(mv, 0, -1);
+
+ if (sceneHandler23_testCalendar())
+ sceneHandler23_startKiss();
+}
+
+void sceneHandler23_spinWheel3() {
+ if (g_vars->scene23_calend2->_statics->_staticsId == ST_CND_0) {
+ g_vars->scene23_calend2->startAnim(MV_CND_0_1, 0, -1);
+ } else if (g_vars->scene23_calend2->_statics->_staticsId == ST_CND_1) {
+ g_vars->scene23_calend2->changeStatics2(ST_CND_9);
+ g_vars->scene23_calend2->startAnim(MV_CND_9_0, 0, -1);
+ }
+
+ if (sceneHandler23_testCalendar())
+ sceneHandler23_startKiss();
+}
+
+void sceneHandler23_pushButton(ExCommand *cmd) {
+ if (g_fp->_aniMan->isIdle() || !(g_fp->_aniMan->_flags & 0x100)) {
+ if (!g_vars->scene23_topReached) {
+ if (g_fp->_aniMan->_ox != 405 || g_fp->_aniMan->_oy != 220) {
+ if (g_fp->_aniMan->_ox != 276 || g_fp->_aniMan->_oy != 438
+ || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
+ if (g_fp->_msgX == 276 && g_fp->_msgY == 438 )
+ return;
+
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 276, 438, 1, ST_MAN_RIGHT);
+
+ if (mq) {
+ mq->addExCommandToEnd(cmd->createClone());;
+
+ postExCommand(g_fp->_aniMan->_id, 2, 276, 438, 0, -1);
+ }
+ } else {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC23_TOCALENDAR), 0, 0);
+
+ mq->addExCommandToEnd(cmd->createClone());;
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+ }
+
+ if (!g_vars->scene23_topReached)
+ return;
+ } else {
+ g_vars->scene23_topReached = true;
+ }
+ }
+
+ if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER) {
+ int mv = 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC23_CLICKBTN1:
+ mv = MV_MAN23_PUSH1;
+ break;
+
+ case MSG_SC23_CLICKBTN2:
+ mv = MV_MAN23_PUSH2;
+ break;
+
+ case MSG_SC23_CLICKBTN3:
+ mv = MV_MAN23_PUSH3;
+ break;
+
+ case MSG_SC23_CLICKBTN4:
+ mv = MV_MAN23_PUSH4;
+ break;
+
+ default:
+ return;
+ }
+
+ if (mv)
+ g_fp->_aniMan->startAnim(mv, 0, -1);
+
+ }
+ }
+}
+
+void sceneHandler23_sendClick(StaticANIObject *ani) {
+ int msg = 0;
+ switch (ani->_okeyCode) {
+ case 0:
+ msg = MSG_SC23_CLICKBTN1;
+ break;
+ case 1:
+ msg = MSG_SC23_CLICKBTN2;
+ break;
+ case 2:
+ msg = MSG_SC23_CLICKBTN3;
+ break;
+ case 3:
+ msg = MSG_SC23_CLICKBTN4;
+ break;
+ default:
+ break;
+ }
+
+ ExCommand *ex = new ExCommand(0, 17, msg, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+
+ ex->postMessage();
+}
+
+void sceneHandler23_checkReachingTop() {
+ if (g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_STANDLADDER
+ || g_fp->_aniMan->_ox != 405 || g_fp->_aniMan->_oy != 220)
+ g_vars->scene23_topReached = false;
+ else
+ g_vars->scene23_topReached = true;
+}
+
+void sceneHandler23_exitCalendar() {
+ if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER
+ && !g_fp->_aniMan->getMessageQueue() && !(g_fp->_aniMan->_flags & 0x100)) {
+ chainQueue(QU_SC23_FROMCALENDAREXIT, 1);
+ g_vars->scene23_someVar = 2;
+ }
+}
+
+void sceneHandler23_fromCalendar(ExCommand *cmd) {
+ if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER
+ && !g_fp->_aniMan->getMessageQueue() && !(g_fp->_aniMan->_flags & 0x100)) {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC23_FROMCALENDAR), 0, 0);
+
+ mq->addExCommandToEnd(cmd->createClone());
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+
+ g_vars->scene23_topReached = false;
+ g_vars->scene23_someVar = 0;
+ }
+}
+
+void sceneHandler23_fromStool(ExCommand *cmd) {
+ if (!g_fp->_aniMan->getMessageQueue() && !(g_fp->_aniMan->_flags & 0x100)) {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC23_FROMSTOOL), 0, 0);
+
+ mq->addExCommandToEnd(cmd->createClone());
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+
+ cmd->_messageKind = 0;
+ }
+}
+
+int sceneHandler23(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC23_FROMSTOOL:
+ g_vars->scene23_isOnStool = false;
+
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
+ break;
+
+ case MSG_SC23_HIDEGIRAFFEE:
+ g_vars->scene23_giraffee->queueMessageQueue(0);
+ g_vars->scene23_giraffee->_flags &= 0xFFFB;
+ break;
+
+ case MSG_SC23_ONSTOOL:
+ g_vars->scene23_isOnStool = true;
+
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
+ break;
+
+ case MSG_SC22_SHOWSTOOL:
+ sceneHandler23_showStool();
+ break;
+
+ case MSG_SC22_HIDESTOOL:
+ sceneHandler23_hideStool();
+ break;
+
+ case MSG_SC23_SPINWHEEL1:
+ sceneHandler23_spinWheel1();
+ break;
+
+ case MSG_SC23_SPINWHEEL2:
+ sceneHandler23_spinWheel2and4(g_vars->scene23_calend1);
+ break;
+
+ case MSG_SC23_SPINWHEEL3:
+ sceneHandler23_spinWheel3();
+ break;
+
+ case MSG_SC23_SPINWHEEL4:
+ sceneHandler23_spinWheel2and4(g_vars->scene23_calend3);
+ break;
+
+ case MSG_SC23_CLICKBTN1:
+ case MSG_SC23_CLICKBTN2:
+ case MSG_SC23_CLICKBTN3:
+ case MSG_SC23_CLICKBTN4:
+ sceneHandler23_pushButton(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;
+ }
+
+ g_fp->_floaters->update();
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+
+ break;
+
+ case 29:
+ {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+ int picId;
+
+ if (ani && ani->_id == ANI_CALENDWHEEL) {
+ sceneHandler23_sendClick(ani);
+ cmd->_messageKind = 0;
+ }
+
+ sceneHandler23_checkReachingTop();
+
+ if (g_vars->scene23_topReached) {
+ picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (picId == PIC_SC23_LADDER) {
+ sceneHandler23_exitCalendar();
+
+ cmd->_messageKind = 0;
+ break;
+ }
+
+ if (cmd->_sceneClickY > 450) {
+ sceneHandler23_fromCalendar(cmd);
+
+ cmd->_messageKind = 0;
+ break;
+ }
+ break;
+ }
+
+ if (!g_vars->scene23_isOnStool) {
+ picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (picId == PIC_SC23_LADDERU && !g_vars->scene23_topReached) {
+ sceneHandler23_pushButton(cmd);
+
+ cmd->_messageKind = 0;
+ break;
+ }
+ break;
+ }
+
+ if (ani && ani->_id == ANI_HANDLE23) {
+ handleObjectInteraction(g_fp->_aniMan, ani, cmd->_keyCode);
+ cmd->_messageKind = 0;
+ } else {
+ sceneHandler23_fromStool(cmd);
+
+ cmd->_messageKind = 0;
+ }
+
+ break;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene24.cpp b/engines/fullpipe/scenes/scene24.cpp
new file mode 100644
index 0000000000..508f776573
--- /dev/null
+++ b/engines/fullpipe/scenes/scene24.cpp
@@ -0,0 +1,129 @@
+/* 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 {
+
+void scene24_initScene(Scene *sc) {
+ g_vars->scene24_water = sc->getStaticANIObject1ById(ANI_WATER24, -1);
+ g_vars->scene24_jet = sc->getStaticANIObject1ById(ANI_JET24, -1);
+ g_vars->scene24_drop = sc->getStaticANIObject1ById(ANI_DROP_24, -1);
+
+ g_vars->scene24_water->setAlpha(0xa0);
+ g_vars->scene24_jet->setAlpha(0xa0);
+ g_vars->scene24_drop->setAlpha(0xa0);
+
+ Scene *oldsc = g_fp->_currentScene;
+ g_fp->_currentScene = sc;
+
+ if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull)) {
+ g_vars->scene24_jetIsOn = true;
+ g_vars->scene24_flowIsLow = false;
+ } else {
+ g_vars->scene24_jet->hide();
+
+ g_vars->scene24_jetIsOn = false;
+
+ g_vars->scene24_water->changeStatics2(ST_WTR24_FLOWLOWER);
+
+ g_vars->scene24_flowIsLow = true;
+ }
+
+ if (g_fp->getObjectState(sO_Pool) < g_fp->getObjectEnumState(sO_Pool, sO_Full)) {
+ g_vars->scene24_waterIsOn = false;
+
+ g_vars->scene24_water->hide();
+
+ g_fp->setObjectState(sO_StairsDown_24, g_fp->getObjectEnumState(sO_StairsDown_24, sO_IsOpened));
+ } else {
+ g_vars->scene24_waterIsOn = true;
+
+ g_fp->setObjectState(sO_StairsDown_24, g_fp->getObjectEnumState(sO_StairsDown_24, sO_IsClosed));
+ }
+
+ g_fp->_currentScene = oldsc;
+}
+
+void scene24_setPoolState() {
+ if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull)) {
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_vars->scene24_drop, 0);
+
+ g_fp->playSound(SND_24_007, 1);
+ } else if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Full)) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOFLOOR, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER, 1);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER2, 0);
+
+ g_fp->playSound(SND_24_006, 1);
+ } else if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOFLOOR, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER2, 1);
+ } else {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOFLOOR, 1);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER2, 0);
+ }
+}
+
+int sceneHandler24(ExCommand *cmd) {
+ if (cmd->_messageKind == 17 && cmd->_messageNum == 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->scene24_waterIsOn && !g_vars->scene24_water->_movement) {
+ if (g_vars->scene24_flowIsLow)
+ g_vars->scene24_water->startAnim(MV_WTR24_FLOWLOWER, 0, -1);
+ else
+ g_vars->scene24_water->startAnim(MV_WTR24_FLOW, 0, -1);
+ }
+
+ if (g_vars->scene24_jetIsOn && !g_vars->scene24_jet->_movement)
+ g_vars->scene24_jet->startAnim(MV_JET24_FLOW, 0, -1);
+
+ g_fp->_behaviorManager->updateBehaviors();
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene25.cpp b/engines/fullpipe/scenes/scene25.cpp
new file mode 100644
index 0000000000..ba07c3e5b9
--- /dev/null
+++ b/engines/fullpipe/scenes/scene25.cpp
@@ -0,0 +1,723 @@
+/* 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 {
+
+void scene25_showBoardOnRightFar() {
+ g_vars->scene25_board->show1(453, 557, MV_BRD25_RIGHT, 0);
+ g_vars->scene25_board->_priority = 28;
+}
+
+void scene25_showBoardOnRightClose() {
+ g_vars->scene25_board->show1(632, 557, rMV_BRD25_RIGHT, 0);
+ g_vars->scene25_board->_priority = 28;
+}
+
+void scene25_initScene(Scene *sc, int entranceId) {
+ g_vars->scene25_water = sc->getStaticANIObject1ById(ANI_WATER25, -1);
+ g_vars->scene25_board = sc->getStaticANIObject1ById(ANI_BOARD25, -1);
+ g_vars->scene25_drop = sc->getStaticANIObject1ById(ANI_DROP_25, -1);
+ g_vars->scene25_water->setAlpha(0xa0);
+ g_vars->scene25_drop->setAlpha(0xa0);
+ g_vars->scene25_dudeIsOnBoard = false;
+
+ if (g_fp->getObjectState(sO_Pool) < g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)) {
+ g_vars->scene25_waterIsPresent = false;
+
+ g_vars->scene25_water->hide();
+ } else {
+ g_vars->scene25_waterIsPresent = true;
+
+ g_fp->playSound(SND_25_006, 1);
+ }
+
+ int boardState = g_fp->getObjectState(sO_Board_25);
+
+ if (entranceId == TrubaRight) {
+ if (boardState == g_fp->getObjectEnumState(sO_Board_25, sO_FarAway)) {
+ scene25_showBoardOnRightFar();
+
+ g_fp->playSound(SND_25_029, 0);
+
+ g_vars->scene25_boardIsSelectable = false;
+ } else {
+ if (boardState == g_fp->getObjectEnumState(sO_Board_25, sO_Nearby)
+ || boardState == g_fp->getObjectEnumState(sO_Board_25, sO_WithDudeOnRight))
+ scene25_showBoardOnRightClose();
+ g_vars->scene25_boardIsSelectable = false;
+ }
+ } else {
+ if (boardState == g_fp->getObjectEnumState(sO_Board_25, sO_WithDudeOnLeft)) {
+ if (!getGameLoaderInventory()->getCountItemsWithId(ANI_INV_BOARD)) {
+ getGameLoaderInventory()->addItem(ANI_INV_BOARD, 1);
+ getGameLoaderInventory()->rebuildItemRects();
+ }
+ } else {
+ g_vars->scene25_boardIsSelectable = true;
+ }
+ }
+
+ g_vars->scene25_beardersAreThere = false;
+ g_vars->scene25_beardersCounter = 0;
+}
+
+int scene25_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_vars->scene25_waterIsPresent) {
+ int inv = getGameLoaderInventory()->getSelectedItemId();
+
+ if (g_fp->_objectIdAtCursor == ANI_WATER25) {
+ if ((g_vars->scene25_boardIsSelectable && (!inv || inv == ANI_INV_BOARD)) || (g_vars->scene25_dudeIsOnBoard && (inv == ANI_INV_LOPAT || !inv)))
+ g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN : PIC_CSR_ITN_INV; // FIXME check
+ } else if (g_fp->_objectIdAtCursor == ANI_BOARD25 && (!inv || inv == ANI_INV_SWAB || inv == ANI_INV_BROOM || inv == ANI_INV_LOPAT)) {
+ g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN : PIC_CSR_ITN_INV;
+ }
+ }
+
+ return g_fp->_cursorId;
+}
+
+void scene25_setupWater(Scene *a1, int entranceId) {
+ if (g_vars->scene25_waterIsPresent) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOFLOOR, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOWATER, 1);
+
+ if (entranceId != TrubaRight)
+ g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_25"), "MUSIC2", 0);
+ } else {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOFLOOR, 1);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOWATER, 0);
+ }
+}
+
+void sceneHandler25_stopBearders() {
+ g_vars->scene25_beardersAreThere = false;
+
+ g_vars->scene25_bearders.clear();
+}
+
+void sceneHandler25_startBearders() {
+ g_vars->scene25_bearders.clear();
+ g_vars->scene25_beardersCounter = 0;
+
+ StaticANIObject *bearded = g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_BEARDED_CMN, -1);
+
+ for (int i = 0; i < 3; i++) {
+ StaticANIObject *ani = new StaticANIObject(bearded);
+
+ g_vars->scene25_bearders.push_back(ani);
+
+ ani->_statics = ani->getStaticsById(ST_BRDCMN_EMPTY);
+
+ g_fp->_currentScene->addStaticANIObject(ani, 1);
+ }
+
+ g_vars->scene25_beardersAreThere = true;
+}
+
+void sceneHandler25_enterMan() {
+ if (g_vars->scene25_waterIsPresent) {
+ chainQueue(QU_SC25_ENTERUP_WATER, 1);
+
+ getCurrSceneSc2MotionController()->clearEnabled();
+ } else {
+ chainQueue(QU_SC25_ENTERUP_FLOOR, 1);
+ }
+}
+
+void sceneHandler25_enterTruba() {
+ PicAniInfo info;
+
+ g_fp->_aniMan->getPicAniInfo(&info);
+ g_fp->_aniMan->_messageQueueId = 0;
+ g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
+
+ int x = g_fp->_aniMan->_ox;
+ int y = g_fp->_aniMan->_oy;
+
+ g_fp->_aniMan->setPicAniInfo(&info);
+
+ int id = g_fp->_aniMan->_statics->_staticsId;
+ int qid = 0;
+
+ if (id == ST_MAN25_ONBOARD && x == 634 && y == 502) {
+ g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD);
+
+ qid = QU_SC25_MANTOTRUBA;
+ } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 632 && y == 502) {
+ g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000);
+
+ qid = QU_SC25_MANTOTRUBA_R;
+ }
+
+ if (qid) {
+ chainQueue(qid, 1);
+ g_vars->scene25_sneezeFlipper = false;
+ }
+}
+
+void sceneHandler25_saveEntrance(int value) {
+ g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName("SAVEGAME")->setSubVarAsInt("Entrance", value);
+}
+
+void sceneHandler25_toLadder() {
+ PicAniInfo info;
+
+ g_fp->_aniMan->getPicAniInfo(&info);
+ g_fp->_aniMan->_messageQueueId = 0;
+ g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
+
+ int x = g_fp->_aniMan->_ox;
+ int y = g_fp->_aniMan->_oy;
+
+ g_fp->_aniMan->setPicAniInfo(&info);
+
+ int id = g_fp->_aniMan->_statics->_staticsId;
+ int qid = 0;
+
+ if (id == ST_MAN25_ONBOARD && x == 307 && y == 502) {
+ g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD);
+
+ qid = QU_SC25_BACKTOLADDER;
+ } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 192 && y == 502) {
+ g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000);
+
+ qid = QU_SC25_BOARDTOLADDER;
+ }
+
+ if (qid) {
+ chainQueue(qid, 1);
+ g_vars->scene25_dudeIsOnBoard = false;
+ g_vars->scene25_boardIsSelectable = true;
+ g_vars->scene25_sneezeFlipper = false;
+
+ sceneHandler25_saveEntrance(TrubaUp);
+ }
+}
+
+void sceneHandler25_animateBearders() {
+ if (g_fp->_rnd->getRandomNumber(32767) < 218) {
+ MessageQueue *mq;
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene25_bearders[0]->_okeyCode);
+ mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
+ mq->chain(0);
+
+ g_vars->scene25_beardersCounter = 0;
+
+ if (g_fp->_rnd->getRandomNumber(32767) < 0x1FFF) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED2), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene25_bearders[1]->_okeyCode);
+ mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
+ mq->chain(0);
+
+ if (g_fp->_rnd->getRandomNumber(32767) < 8191) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED3), 0, 1);
+
+ mq->replaceKeyCode(-1, g_vars->scene25_bearders[2]->_okeyCode);
+ mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
+ mq->chain(0);
+ }
+ }
+ }
+}
+
+void sceneHandler25_sneeze() {
+ if (g_fp->_rnd->getRandomNumber(32767) % 10) {
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN25_ONBOARD) {
+ g_fp->_aniMan->startAnim(MV_MAN25_ONBOARD, 0, -1);
+ } else if (g_fp->_aniMan->_statics->_staticsId == (ST_MAN25_ONBOARD|0x4000)) {
+ g_fp->_aniMan->startAnim(rMV_MAN25_ONBOARD, 0, -1);
+ }
+ } else if (g_fp->_aniMan->_statics->_staticsId == ST_MAN25_ONBOARD) {
+ g_fp->_aniMan->startAnim(MV_MAN25_CHIH, 0, -1);
+ } else if (g_fp->_aniMan->_statics->_staticsId == (ST_MAN25_ONBOARD|0x4000)) {
+ g_fp->_aniMan->startAnim(rMV_MAN25_CHIH, 0, -1);
+ }
+}
+
+void sceneHandler25_rowShovel() {
+ PicAniInfo info;
+
+ g_fp->_aniMan->getPicAniInfo(&info);
+ g_fp->_aniMan->_messageQueueId = 0;
+ g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
+
+ int x = g_fp->_aniMan->_ox;
+ int y = g_fp->_aniMan->_oy;
+
+ g_fp->_aniMan->setPicAniInfo(&info);
+
+ int id = g_fp->_aniMan->_statics->_staticsId;
+ int qid = 0;
+
+ if (id == ST_MAN25_ONBOARD && x == 370 && y == 502) {
+ g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD);
+
+ qid = QU_SC25_ROWTOTRUBA;
+ } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 632 && y == 502) {
+ g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000);
+
+ qid = QU_SC25_ROWTOLADDER;
+
+ g_fp->playSound(SND_25_030, 0);
+ }
+
+ if (qid) {
+ chainQueue(qid, 1);
+
+ g_vars->scene25_sneezeFlipper = false;
+ }
+}
+
+void sceneHandler25_rowHand() {
+ PicAniInfo info;
+
+ g_fp->_aniMan->getPicAniInfo(&info);
+ g_fp->_aniMan->_messageQueueId = 0;
+ g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
+
+ int x = g_fp->_aniMan->_ox;
+ int y = g_fp->_aniMan->_oy;
+
+ g_fp->_aniMan->setPicAniInfo(&info);
+
+ int id = g_fp->_aniMan->_statics->_staticsId;
+ int qid = 0;
+
+ if (id == ST_MAN25_ONBOARD && x == 370 && y == 502) {
+ g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD);
+
+ qid = QU_SC25_TRYROWHAND;
+ } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 632 && y == 502) {
+ g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000);
+
+ qid = QU_SC25_TRYROWHAND_R;
+ }
+
+ if (qid) {
+ chainObjQueue(g_fp->_aniMan, qid, 1);
+ g_vars->scene25_sneezeFlipper = false;
+ }
+}
+
+void sceneHandler25_putBoard() {
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER
+ || g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN_R) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER);
+ g_fp->_aniMan->setOXY(281, 481);
+
+ chainQueue(QU_SC25_PUTBOARD, 1);
+
+ g_vars->scene25_dudeIsOnBoard = true;
+ g_vars->scene25_sneezeFlipper = false;
+ g_vars->scene25_boardIsSelectable = false;
+ }
+}
+
+void sceneHandler25_tryWater() {
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER
+ || g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN_R) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER);
+
+ chainQueue(QU_SC25_TRYWATER, 1);
+ }
+}
+
+void sceneHandler25_tryRow(int obj) {
+ PicAniInfo info;
+
+ g_fp->_aniMan->getPicAniInfo(&info);
+ g_fp->_aniMan->_messageQueueId = 0;
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+
+ int x = g_fp->_aniMan->_ox;
+ int y = g_fp->_aniMan->_oy;
+
+ g_fp->_aniMan->setPicAniInfo(&info);
+
+ int qid = 0;
+
+ if (x == 788 && y == 468) {
+ if (g_vars->scene25_board->_statics->_staticsId == ST_BRD25_RIGHT2) {
+ if (obj == ANI_INV_BROOM) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+
+ qid = QU_SC25_TRYBROOM;
+ }
+ if (obj == ANI_INV_LOPAT) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+
+ qid = QU_SC25_TRYSPADE;
+ }
+
+ if (qid) {
+ chainQueue(qid, 1);
+
+ g_fp->playSound(SND_25_028, 0);
+
+ return;
+ }
+
+ if (obj == ANI_INV_SWAB) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+
+ chainQueue(QU_SC25_TRYSWAB, 1);
+ } else if (!obj) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+
+ chainObjQueue(g_fp->_aniMan, QU_SC25_TRYHAND, 1);
+
+ g_fp->playSound(SND_25_028, 0);
+ }
+ } else if (g_vars->scene25_board->_statics->_staticsId == (ST_MAN_RIGHT|0x4000) && !obj) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+
+ chainQueue(QU_SC25_TRUBATOBOARD, 1);
+
+ g_vars->scene25_dudeIsOnBoard = true;
+ }
+ }
+}
+
+void sceneHandler25_ladderUp() {
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER
+ || g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN_R) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER);
+
+ chainQueue(QU_SC25_LADDERUP, 1);
+ }
+}
+
+void sceneHandler25_backToPipe() {
+ if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == (ST_MAN_RIGHT|0x4000)) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+
+ chainQueue(QU_SC25_BACKTOTRUBA, 1);
+ }
+}
+
+void sceneHandler25_walkOnLadder(StaticANIObject *ani, Common::Point *pnt, MessageQueue *mq, int flag) {
+ int aniY = ani->_oy;
+ int newx = 0, newy = 0;
+ Common::Point point;
+ ExCommand *ex;
+
+ if (flag) {
+ if (ani->_movement) {
+ ani->_movement->calcSomeXY(point, 0);
+ newx = point.x;
+ aniY = ani->_oy - point.y;
+ }
+ }
+
+ int pntx = pnt->x;
+ int pnty = pnt->y;
+ int numObsolete = -1;
+ int minDistance = 20000;
+ ExCommand *lastEx = 0;
+
+ for (uint i = 0; i < mq->getCount(); i++) {
+ int curDistance = abs(pnty - aniY);
+
+ ex = mq->getExCommandByIndex(i);
+
+ if (ex->_messageKind == 1 && ani->_id == ex->_parentId) {
+ if (ex->_excFlags & 0x10000) {
+ if (ex->_messageNum == MV_MAN_TOLADDER)
+ ex->_messageNum = MV_MAN_TOLADDER2;
+ if (ex->_messageNum == MV_MAN_STARTLADDER)
+ ex->_messageNum = MV_MAN_STARTLADDER2;
+ if (ex->_messageNum == MV_MAN_GOLADDER)
+ ex->_messageNum = MV_MAN_GOLADDER2;
+ if (ex->_messageNum == MV_MAN_STOPLADDER)
+ ex->_messageNum = MV_MAN_STOPLADDER2;
+ }
+
+ if (curDistance < minDistance || numObsolete < 0) {
+ numObsolete = i;
+ minDistance = curDistance;
+ lastEx = ex;
+ newx = pntx;
+ newy = pnty;
+ }
+
+ ani->getMovementById(ex->_messageNum)->calcSomeXY(point, 0);
+ pntx += point.x;
+ pnty += point.y;
+ }
+ }
+
+ for (int i = 0; i < numObsolete; i++)
+ mq->deleteExCommandByIndex(0, 1);
+
+ ex = new ExCommand(ani->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_field_14 = 256;
+ ex->_messageNum = 0;
+ ex->_excFlags |= 3;
+
+ mq->addExCommandToEnd(ex);
+
+ if (flag && ani->_movement && ani->_movement->_id == mq->getExCommandByIndex(0)->_messageNum) {
+ mq->deleteExCommandByIndex(0, 1);
+
+ int movId = ani->_movement->_id;
+ int idx = ani->_movement->_currDynamicPhaseIndex;
+
+ ani->changeStatics2(ani->_movement->_staticsObj1->_staticsId);
+ ani->setOXY(newx, newy);
+
+ ani->startAnim(movId, mq->_id, -1);
+
+ ani->_movement->setDynamicPhaseIndex(idx);
+ } else {
+ if (!lastEx)
+ error("sceneHandler25_walkOnLadder(): Incorrect state. Please report this to sev");
+
+ ani->changeStatics2(ani->getMovementById(lastEx->_messageNum)->_staticsObj1->_staticsId);
+ ani->setOXY(newx, newy);
+ ani->restartMessageQueue(mq);
+ }
+
+ ani->_flags |= 1;
+}
+
+bool sceneHandler25_isOnLadder(ExCommand *cmd) {
+ if ((g_fp->_aniMan->_movement && g_fp->_aniMan->_movement->_id == MV_MAN_GOLADDERDOWN)
+ || g_fp->_aniMan->_statics->_staticsId == ST_MAN_GOLADDERD) {
+ Interaction *inter = getGameLoaderInteractionController()->getInteractionByObjectIds(PIC_SC25_LADDERDOWN, ANI_MAN, cmd->_keyCode);
+
+ if (!inter)
+ return 0;
+
+ MessageQueue *mq = new MessageQueue(inter->_messageQueue, 0, 1);
+ PictureObject *pic = g_fp->_currentScene->getPictureObjectById(PIC_SC25_LADDERDOWN, 0);
+ Common::Point point;
+
+ point.x = inter->_xOffs + pic->_ox;
+ point.y = inter->_yOffs + pic->_oy;
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ sceneHandler25_walkOnLadder(g_fp->_aniMan, &point, mq, 0);
+
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void sceneHandler25_sub03() {
+ warning("STUB: sceneHandler25_sub03()");
+}
+
+int sceneHandler25(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC25_STOPBEARDEDS:
+ sceneHandler25_stopBearders();
+ break;
+
+ case MSG_SC25_STARTBEARDEDS:
+ sceneHandler25_startBearders();
+ break;
+
+ case MSG_SC25_ENTERMAN:
+ sceneHandler25_enterMan();
+ break;
+
+ case MSG_SC25_ENTERTRUBA:
+ sceneHandler25_enterTruba();
+ break;
+
+ case MSG_SC25_TOLADDER:
+ sceneHandler25_toLadder();
+ break;
+
+ case MSG_BRD_TURN:
+ switch (g_fp->_rnd->getRandomNumber(3)) {
+ case 0:
+ g_fp->playSound(SND_25_025, 0);
+ break;
+
+ case 1:
+ g_fp->playSound(SND_25_026, 0);
+ break;
+
+ default:
+ g_fp->playSound(SND_25_027, 0);
+ break;
+ }
+ break;
+
+ case 33:
+ if (g_fp->_aniMan2) {
+ int x = g_fp->_aniMan2->_ox;
+ int y = 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->scene25_waterIsPresent) {
+ if (y < g_fp->_sceneRect.top + 200)
+ g_fp->_currentScene->_y = y - 300 - g_fp->_sceneRect.top;
+
+ if (y > g_fp->_sceneRect.bottom - 200)
+ g_fp->_currentScene->_y = y + 300 - g_fp->_sceneRect.bottom;
+ }
+ }
+
+ if (g_vars->scene25_beardersAreThere) {
+ g_vars->scene25_beardersCounter++;
+
+ if (g_vars->scene25_beardersCounter >= 120)
+ sceneHandler25_animateBearders();
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ if (g_vars->scene25_waterIsPresent && !g_vars->scene25_water->_movement)
+ g_vars->scene25_water->startAnim(MV_WTR25_FLOW, 0, -1);
+
+ if (g_vars->scene25_dudeIsOnBoard && !g_fp->_aniMan->_movement && g_vars->scene25_sneezeFlipper)
+ sceneHandler25_sneeze();
+
+ g_vars->scene25_sneezeFlipper = true;
+
+ if (g_vars->scene25_board->_flags & 4) {
+ if (!g_vars->scene25_board->_movement) {
+ if (g_vars->scene25_board->_statics->_staticsId & 0x4000)
+ g_vars->scene25_board->startAnim(rMV_BRD25_RIGHT, 0, -1);
+ else
+ g_vars->scene25_board->startAnim(MV_BRD25_RIGHT, 0, -1);
+ }
+ }
+ break;
+
+ case 29:
+ {
+ int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (!g_vars->scene25_waterIsPresent) {
+ if ((picId == PIC_SC25_LADDERUP || picId == PIC_SC25_LADDERDOWN) && sceneHandler25_isOnLadder(cmd))
+ cmd->_messageKind = 0;
+
+ break;
+ }
+
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (ani) {
+ if (g_fp->_aniMan != ani) {
+ if (g_fp->_aniMan->isIdle()) {
+ if (!(g_fp->_aniMan->_flags & 0x100)) {
+ if (ani->_id == ANI_WATER25) {
+ if (g_vars->scene25_dudeIsOnBoard) {
+ if (cmd->_keyCode == ANI_INV_LOPAT)
+ sceneHandler25_rowShovel();
+
+ if (!cmd->_keyCode)
+ sceneHandler25_rowHand();
+ } else {
+ if (cmd->_keyCode == ANI_INV_BOARD)
+ sceneHandler25_putBoard();
+
+ if (!cmd->_keyCode)
+ sceneHandler25_tryWater();
+ }
+ } else if (ani->_id == ANI_BOARD25) {
+ sceneHandler25_tryRow(cmd->_keyCode);
+ break;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ if (picId == PIC_SC25_LADDERUP && sceneHandler25_isOnLadder(cmd))
+ cmd->_messageKind = 0;
+
+ if (!g_fp->_aniMan->isIdle() || (g_fp->_aniMan->_flags & 0x100))
+ break;
+
+ if (g_vars->scene25_dudeIsOnBoard) {
+ if (picId == PIC_SC25_RTRUBA && !cmd->_keyCode) {
+ sceneHandler25_enterTruba();
+ break;
+ }
+ } else {
+ if (picId != PIC_SC25_RTRUBA) {
+ if (picId == PIC_SC25_LADDERUP && !cmd->_keyCode)
+ sceneHandler25_ladderUp();
+ break;
+ }
+
+ if (!cmd->_keyCode) {
+ sceneHandler25_backToPipe();
+ break;
+ }
+ }
+ if (g_vars->scene25_dudeIsOnBoard) {
+ if (picId != PIC_SC25_LADDERUP || cmd->_keyCode)
+ break;
+
+ sceneHandler25_toLadder();
+ break;
+ }
+
+ if (picId == PIC_SC25_LADDERUP && !cmd->_keyCode)
+ sceneHandler25_ladderUp();
+
+ break;
+ }
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene26.cpp b/engines/fullpipe/scenes/scene26.cpp
new file mode 100644
index 0000000000..91679347e6
--- /dev/null
+++ b/engines/fullpipe/scenes/scene26.cpp
@@ -0,0 +1,355 @@
+/* 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 {
+
+void scene26_initScene(Scene *sc) {
+ g_vars->scene26_chhi = sc->getStaticANIObject1ById(ANI_CHHI, -1);
+ g_vars->scene26_drop = sc->getStaticANIObject1ById(ANI_DROP_26, -1);
+ g_vars->scene26_sockPic = sc->getPictureObjectById(PIC_SC26_SOCK, 0);
+ g_vars->scene26_sock = sc->getStaticANIObject1ById(ANI_SOCK_26, -1);
+
+ if (g_fp->getObjectState(sO_Hatch_26) == g_fp->getObjectEnumState(sO_Hatch_26, sO_WithSock)) {
+ g_fp->setObjectState(sO_Hatch_26, g_fp->getObjectEnumState(sO_Hatch_26, sO_Closed));
+ g_fp->setObjectState(sO_Sock_26, g_fp->getObjectEnumState(sO_Sock_26, sO_HangsOnPipe));
+ }
+
+ Interaction *inter = getGameLoaderInteractionController()->getInteractionByObjectIds(ANI_LUK26, ANI_MAN, ANI_INV_SOCK);
+
+ if (getGameLoaderInventory()->getCountItemsWithId(ANI_INV_VENT) == 0)
+ inter->_flags &= 0xFFFDFFFF;
+ else
+ inter->_flags |= 0x20000;
+
+ if (g_fp->getObjectState(sO_Sock_26) == g_fp->getObjectEnumState(sO_Sock_26, sO_HangsOnPipe))
+ g_vars->scene26_sockPic->_flags |= 4;
+ else
+ g_vars->scene26_sockPic->_flags &= 0xFFFB;
+
+ if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened))
+ g_fp->playSound(SND_26_018, 1);
+}
+
+int scene26_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_objectIdAtCursor != ANI_VENT || g_fp->_cursorId != PIC_CSR_DEFAULT) {
+ if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC26_LTRUBA)
+ g_fp->_cursorId = PIC_CSR_GOL;
+ } else {
+ g_fp->_cursorId = PIC_CSR_ITN;
+ }
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler26_updateDrop() {
+ if (g_fp->getObjectState(sO_Valve5_26) == g_fp->getObjectEnumState(sO_Valve5_26, sO_Closed))
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_vars->scene26_drop, 0);
+ else
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_vars->scene26_drop, 1);
+}
+
+void scene26_setupDrop(Scene *sc) {
+ sceneHandler26_updateDrop();
+}
+
+void sceneHandler26_showChi() {
+ g_vars->scene26_chhi->changeStatics2(ST_CHI_EMPTY);
+
+ chainQueue(QU_CHI_SHOW, 1);
+}
+
+void sceneHandler26_updatePool() {
+ if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Valve1_26))
+ g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Overfull));
+ else if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull))
+ g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Full));
+
+ if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Valve1_26)) {
+ if (g_fp->getObjectState(sO_Pool) >= g_fp->getObjectEnumState(sO_Pool, sO_Full))
+ g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_HalfFull));
+ }
+
+ if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Valve1_26)) {
+ if (g_fp->getObjectState(sO_Pool) >= g_fp->getObjectEnumState(sO_Pool, sO_HalfFull))
+ g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Empty));
+ }
+}
+
+void sceneHandler26_hideChi() {
+ g_vars->scene26_chhi->changeStatics2(ST_CHI_NORM);
+
+ chainQueue(QU_CHI_HIDE, 1);
+}
+
+void sceneHandler26_testVent() {
+ if (!g_vars->scene26_activeVent)
+ return;
+
+ if (g_vars->scene26_activeVent->_okeyCode == 0) {
+ if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened))
+ g_fp->stopAllSoundInstances(SND_26_018);
+ else
+ g_fp->playSound(SND_26_018, 1);
+
+ if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Opened)) {
+ chainQueue(QU_SC26_AUTOCLOSE2, 0);
+
+ g_fp->playSound(SND_26_020, 0);
+ }
+
+ if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Opened)) {
+ chainQueue(QU_SC26_AUTOCLOSE3, 0);
+
+ g_fp->playSound(SND_26_020, 0);
+ }
+ } else if (g_vars->scene26_activeVent->_okeyCode == 1) {
+ if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Opened))
+ g_fp->playSound(SND_26_020, 0);
+ else
+ g_fp->playSound(SND_26_019, 0);
+
+ if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull)
+ || g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Full))
+ g_fp->playSound(SND_26_003, 0);
+
+ if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) {
+ g_fp->stopAllSoundInstances(SND_26_018);
+
+ chainQueue(QU_SC26_AUTOCLOSE1, 0);
+ }
+ } else if (g_vars->scene26_activeVent->_okeyCode == 2) {
+ if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Opened))
+ g_fp->playSound(SND_26_020, 0);
+ else
+ g_fp->playSound(SND_26_019, 0);
+
+ if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull)
+ || g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Full)
+ || g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_HalfFull))
+ g_fp->playSound(SND_26_003, 0);
+
+ if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) {
+ g_fp->stopAllSoundInstances(SND_26_018);
+
+ chainQueue(QU_SC26_AUTOCLOSE1, 0);
+ }
+ }
+}
+
+void sceneHandler26_showVent() {
+ if (g_vars->scene26_activeVent) {
+ int id = g_vars->scene26_activeVent->_statics->_staticsId;
+
+ if (id == ST_VNT26_UP2) {
+ g_vars->scene26_activeVent->changeStatics2(ST_VNT26_RIGHT2);
+ } else {
+ if (id != ST_VNT26_RIGHT2)
+ return;
+
+ g_vars->scene26_activeVent->changeStatics2(ST_VNT26_UP2);
+ }
+ g_vars->scene26_activeVent->show1(-1, -1, -1, 0);
+ }
+}
+
+void sceneHandler26_hideVent() {
+ if (g_vars->scene26_activeVent)
+ g_vars->scene26_activeVent->hide();
+}
+
+void sceneHandler26_animateVents(StaticANIObject *ani) {
+ int qId = 0;
+
+ switch (ani->_okeyCode) {
+ case 0:
+ if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Closed))
+ qId = QU_SC26_OPEN1;
+ else
+ qId = QU_SC26_CLOSE1;
+
+ break;
+
+ case 1:
+ if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Closed))
+ qId = QU_SC26_OPEN2;
+ else
+ qId = QU_SC26_CLOSE2;
+
+ break;
+
+ case 2:
+ if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Closed))
+ qId = QU_SC26_OPEN3;
+ else
+ qId = QU_SC26_CLOSE3;
+
+ break;
+
+ case 3:
+ if (g_fp->getObjectState(sO_Valve4_26) == g_fp->getObjectEnumState(sO_Valve4_26, sO_Closed))
+ qId = QU_SC26_OPEN4;
+ else
+ qId = QU_SC26_CLOSE4;
+
+ break;
+
+ case 4:
+ if (g_fp->getObjectState(sO_Valve5_26) == g_fp->getObjectEnumState(sO_Valve5_26, sO_Closed))
+ qId = QU_SC26_OPEN5;
+ else
+ qId = QU_SC26_CLOSE5;
+
+ break;
+
+ default:
+ return;
+ }
+
+ if (qId) {
+ MessageQueue *mq = g_fp->_currentScene->getMessageQueueById(qId);
+
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+ }
+}
+
+void sceneHandler26_clickVent(StaticANIObject *ani, ExCommand *cmd) {
+ if (ani->_okeyCode || g_fp->getObjectState(sO_Hatch_26) == g_fp->getObjectEnumState(sO_Hatch_26, sO_Opened)) {
+ if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
+ g_vars->scene26_activeVent = ani;
+
+ int x = ani->_ox - 20;
+ int y = ani->_oy + 61;
+
+ if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(y - g_fp->_aniMan->_oy) > 1 || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) {
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_UP);
+
+ if (mq) {
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC26_CLICKVENT, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_excFlags |= 3;
+ ex->_keyCode = ani->_okeyCode;
+
+ mq->addExCommandToEnd(ex);
+
+ postExCommand(g_fp->_aniMan->_id, 2, x, y, 0, -1);
+ }
+ } else {
+ sceneHandler26_animateVents(ani);
+ }
+ }
+ }
+
+ cmd->_messageKind = 0;
+}
+
+int sceneHandler26(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC26_UPDATEDROP:
+ sceneHandler26_updateDrop();
+ break;
+
+ case MSG_SC26_SHOWCHI:
+ sceneHandler26_showChi();
+ break;
+
+ case MSG_SC26_UPDATEPOOL:
+ sceneHandler26_updatePool();
+ break;
+
+ case MSG_SC26_HIDECHI:
+ sceneHandler26_hideChi();
+ break;
+
+ case MSG_SC26_TESTVENT:
+ sceneHandler26_testVent();
+ break;
+
+ case MSG_SC26_SHOWVENT:
+ sceneHandler26_showVent();
+ break;
+
+ case MSG_SC26_CLICKVENT:
+ {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT, cmd->_keyCode);
+
+ if (ani && ani->_id == ANI_VENT)
+ sceneHandler26_clickVent(ani, cmd);
+
+ break;
+ }
+
+ case MSG_SC26_HIDEVENT:
+ sceneHandler26_hideVent();
+ break;
+
+ case 29:
+ {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (ani && ani->_id == ANI_VENT)
+ sceneHandler26_clickVent(ani, 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;
+ }
+
+ 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
new file mode 100644
index 0000000000..62afd128c2
--- /dev/null
+++ b/engines/fullpipe/scenes/scene28.cpp
@@ -0,0 +1,474 @@
+/* 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"
+#include "fullpipe/floaters.h"
+
+namespace Fullpipe {
+
+void scene28_initScene(Scene *sc) {
+ g_vars->scene28_fliesArePresent = true;
+ g_vars->scene28_beardedDirection = true;
+ g_vars->scene28_darkeningObject = 0;
+ g_vars->scene28_lighteningObject = 0;
+ g_vars->scene28_headDirection = false;
+ g_vars->scene28_headBeardedFlipper = false;
+ g_vars->scene28_lift6inside = false;
+
+ g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28"));
+
+ g_fp->initArcadeKeys("SC_28");
+}
+
+int scene28_updateCursor() {
+ g_fp->updateCursorCommon();
+ if (g_fp->_objectIdAtCursor == ANI_LIFT || g_fp->_objectIdAtCursor == ANI_LIFT_28)
+ if (g_fp->_cursorId == PIC_CSR_DEFAULT)
+ g_fp->_cursorId = PIC_CSR_ITN;
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler28_lift1ShowAfter() {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN_28, -1);
+
+ g_fp->_aniMan->_statics = g_fp->_aniMan->getStaticsById(ST_MAN_SIT|0x4000);
+ g_fp->_aniMan->setOXY(ani->_ox + 7, ani->_oy);
+ g_fp->_aniMan->_priority = ani->_priority;
+ g_fp->_aniMan->show1(-1, -1, -1, 0);
+}
+
+void sceneHandler28_makeFaces(ExCommand *cmd) {
+ g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0)->_flags &= 0xFFFB;
+
+ g_vars->scene28_lighteningObject = 0;
+
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);
+ if (mq) {
+ int frames[5];
+
+ frames[0] = MV_WMN28_IN_1;
+ frames[1] = MV_WMN28_IN_2;
+ frames[2] = MV_WMN28_IN_3;
+ frames[3] = MV_WMN28_IN_4;
+ frames[4] = MV_WMN28_IN_5;
+
+ for (int i = 0; i < 5; i++) {
+ int pos;
+
+ while (frames[pos = g_fp->_rnd->getRandomNumber(4)] == 0)
+ ;
+
+ mq->getExCommandByIndex(i)->_messageNum = frames[pos];
+
+ frames[pos] = 0;
+ }
+ }
+}
+
+void sceneHandler28_trySecondaryPers() {
+ MessageQueue *mq;
+ int x;
+
+ if (g_vars->scene28_headBeardedFlipper) {
+ if (g_vars->scene28_beardedDirection) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1);
+
+ mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.left - 20;
+ mq->getExCommandByIndex(0)->_keyCode = 1;
+ mq->replaceKeyCode(-1, 1);
+ mq->chain(0);
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1);
+
+ mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.left - 40;
+ mq->getExCommandByIndex(0)->_y += 20;
+ mq->getExCommandByIndex(0)->_keyCode = 2;
+ mq->replaceKeyCode(-1, 2);
+ mq->chain(0);
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1);
+
+ x = g_fp->_sceneRect.left - 60;
+ } else {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1);
+
+ mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.right + 20;
+ mq->getExCommandByIndex(0)->_keyCode = 1;
+ mq->replaceKeyCode(-1, 1);
+ mq->chain(0);
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1);
+
+ mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.right + 40;
+ mq->getExCommandByIndex(0)->_y += 20;
+ mq->getExCommandByIndex(0)->_keyCode = 2;
+ mq->replaceKeyCode(-1, 2);
+ mq->chain(0);
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1);
+
+ x = g_fp->_sceneRect.right + 60;
+ }
+
+ mq->getExCommandByIndex(0)->_x = x;
+ mq->getExCommandByIndex(0)->_y += 40;
+ mq->getExCommandByIndex(0)->_keyCode = 3;
+ mq->replaceKeyCode(-1, 3);
+ mq->chain( 0);
+
+ g_vars->scene28_beardedDirection = !g_vars->scene28_beardedDirection;
+ } else {
+ if (g_vars->scene28_headDirection) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_GLV28_GOR), 0, 1);
+
+ x = g_fp->_sceneRect.left - 40;
+ } else {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_GLV28_GOL), 0, 1);
+
+ x = g_fp->_sceneRect.right + 40;
+ }
+
+ mq->getExCommandByIndex(0)->_x = x;
+ mq->chain(0);
+
+ g_vars->scene28_headDirection = !g_vars->scene28_headDirection;
+ }
+
+ g_vars->scene28_headBeardedFlipper = !g_vars->scene28_headBeardedFlipper;
+}
+
+void sceneHandler28_turnOn2() {
+ if (g_vars->scene28_fliesArePresent) {
+ g_fp->_floaters->genFlies(g_fp->_currentScene, 1013, 329, 60, 4);
+
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val15 = 30;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12;
+
+ g_fp->_floaters->genFlies(g_fp->_currentScene, 1074, 311, 60, 4);
+
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val15 = 30;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12;
+ }
+
+ g_vars->scene28_fliesArePresent = false;
+}
+
+void sceneHandler28_startWork1() {
+ g_fp->_aniMan->hide();
+
+ StaticANIObject *man = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN_28, -1);
+
+ man->_statics = man->getStaticsById(ST_MAN28_RIGHT);
+ man->setOXY(g_fp->_aniMan->_ox, g_fp->_aniMan->_oy);
+ man->_priority = g_fp->_aniMan->_priority;
+ man->show1(-1, -1, -1, 0);
+
+ chainQueue(QU_SC28_LIFT1_WORK, 1);
+}
+
+void sceneHandler28_lift0Start() {
+ chainQueue(QU_SC28_LIFT0_START, 1);
+}
+
+void sceneHandler28_lift1Start() {
+ g_fp->_aniMan->_flags |= 1;
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
+
+ chainQueue(QU_SC28_LIFT1_START, 1);
+}
+
+void sceneHandler28_lift2Start() {
+ chainQueue(QU_SC28_LIFT2_START, 1);
+}
+
+void sceneHandler28_lift3Start() {
+ chainQueue(QU_SC28_LIFT3_START, 1);
+}
+
+void sceneHandler28_lift4Start() {
+ g_fp->_aniMan->_flags |= 1;
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
+
+ chainQueue(QU_SC28_WMN_START, 1);
+}
+
+void sceneHandler28_lift5Start() {
+ chainQueue(QU_SC28_LIFT5_START, 1);
+}
+
+void sceneHandler28_lift6Start() {
+ g_fp->_aniMan->_flags |= 1;
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
+
+ StaticANIObject *woman = g_fp->_currentScene->getStaticANIObject1ById(ANI_TIOTIA, -1);
+
+ if (woman && (woman->_flags & 4))
+ chainQueue(QU_SC28_LIFT6_START2, 1);
+ else
+ chainQueue(QU_SC28_LIFT6_START, 1);
+}
+
+void sceneHandler28_clickLift(int keycode) {
+ int x = 0;
+
+ switch (keycode) {
+ case 0: x = 600; break;
+ case 1: x = 824; break;
+ case 2: x = 1055; break;
+ case 3: x = 1286; break;
+ case 4: x = 1517; break;
+ case 5: x = 1748; break;
+ case 6: x = 1979; break;
+ }
+
+ if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(472 - g_fp->_aniMan->_oy) > 1
+ || g_fp->_aniMan->_movement
+ || g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) {
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, 472, 1, ST_MAN_UP);
+ if (mq) {
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC28_CLICKLIFT, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags |= 3;
+
+ mq->addExCommandToEnd(ex);
+
+ postExCommand(g_fp->_aniMan->_id, 2, x, 472, 0, -1);
+ }
+ } else {
+ switch (keycode) {
+ case 0:
+ sceneHandler28_lift0Start();
+ break;
+ case 1:
+ sceneHandler28_lift1Start();
+ break;
+ case 2:
+ sceneHandler28_lift2Start();
+ break;
+ case 3:
+ sceneHandler28_lift3Start();
+ break;
+ case 4:
+ sceneHandler28_lift4Start();
+ break;
+ case 5:
+ sceneHandler28_lift5Start();
+ break;
+ case 6:
+ sceneHandler28_lift6Start();
+ break;
+ default:
+ return;
+ }
+ }
+}
+
+int sceneHandler28(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC28_LIFT6MUSIC:
+ g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28"), "MUSIC_TIOTIA", 1);
+ break;
+
+ case MSG_SC28_LIFT6INSIDE:
+ g_vars->scene28_lift6inside = true;
+ break;
+
+ case MSG_SC28_LIFT1_SHOWAFTER:
+ sceneHandler28_lift1ShowAfter();
+ break;
+
+ case MSG_SC28_MAKEFACES:
+ sceneHandler28_makeFaces(cmd);
+ break;
+
+ case MSG_SC28_TRYVTORPERS:
+ sceneHandler28_trySecondaryPers();
+ break;
+
+ case MSG_SC28_TURNOFF_0:
+ g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0);
+ g_vars->scene28_lighteningObject->_flags |= 4;
+ break;
+
+ case MSG_SC28_TURNON_0:
+ g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0);
+ break;
+
+ case MSG_SC28_TURNON_1:
+ g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0);
+ break;
+
+ case MSG_SC28_TURNOFF_1:
+ g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0);
+ g_vars->scene28_lighteningObject->_flags |= 4;
+ break;
+
+ case MSG_SC28_TURNON_2:
+ g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0);
+ sceneHandler28_turnOn2();
+ break;
+
+ case MSG_SC28_TURNOFF_2:
+ g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0);
+ g_vars->scene28_lighteningObject->_flags |= 4;
+ break;
+
+ case MSG_SC28_TURNON_3:
+ g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0);
+ break;
+
+ case MSG_SC28_TURNOFF_3:
+ g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0);
+ g_vars->scene28_lighteningObject->_flags |= 4;
+ break;
+
+ case MSG_SC28_TURNON_4:
+ g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0);
+ break;
+
+ case MSG_SC28_TURNOFF_4:
+ g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0);
+ g_vars->scene28_lighteningObject->_flags |= 4;
+ break;
+
+ case MSG_SC28_TURNON_6:
+ g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0);
+ break;
+
+ case MSG_SC28_TURNOFF_6:
+ g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0);
+ g_vars->scene28_lighteningObject->_flags |= 4;
+ break;
+
+ case MSG_SC28_STARTWORK1:
+ sceneHandler28_startWork1();
+ break;
+
+ case MSG_SC28_CLICKLIFT:
+ sceneHandler28_clickLift(cmd->_keyCode);
+ break;
+
+ case MSG_SC28_ENDLIFT1:
+ case MSG_SC28_ENDLIFT6:
+ case MSG_SC28_ENDCABIN:
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
+ g_fp->_aniMan->_flags &= 0xFEFF;
+ break;
+
+ case 29:
+ {
+ if (g_vars->scene28_lift6inside) {
+ chainObjQueue(g_fp->_aniMan, QU_SC28_LIFT6_END, 1);
+
+ g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28"), "MUSIC", 1);
+
+ g_vars->scene28_lift6inside = false;
+ }
+
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (ani)
+ if (ani->_id == ANI_LIFT || ani->_id == ANI_LIFT_28 ) {
+ sceneHandler28_clickLift(ani->_okeyCode);
+
+ cmd->_messageKind = 0;
+ break;
+ }
+
+ if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) {
+ int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+ PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0);
+
+ if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) {
+ if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1)
+ || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0))
+ g_fp->processArcade(cmd);
+ }
+ }
+ break;
+ }
+
+ case 33:
+ if (g_fp->_aniMan2) {
+ int x = g_fp->_aniMan2->_ox;
+
+ if (x < g_fp->_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->scene28_darkeningObject) {
+ if (g_vars->scene28_darkeningObject->_picture->getAlpha() > 10) {
+ g_vars->scene28_darkeningObject->_picture->setAlpha(g_vars->scene28_darkeningObject->_picture->getAlpha() - 10);
+ } else {
+ g_vars->scene28_darkeningObject->_flags &= 0xFFFB;
+
+ g_vars->scene28_darkeningObject = 0;
+ }
+ }
+
+ if (g_vars->scene28_lighteningObject) {
+ if (g_vars->scene28_lighteningObject->_picture->getAlpha() < 0xF9u) {
+ g_vars->scene28_lighteningObject->_picture->setAlpha(g_vars->scene28_lighteningObject->_picture->getAlpha() + 6);
+ } else {
+ g_vars->scene28_lighteningObject->_picture->setAlpha(0xff);
+
+ g_vars->scene28_lighteningObject = 0;
+ }
+ }
+
+ g_fp->_floaters->update();
+
+ for (uint i = 0; i < g_fp->_floaters->_array2.size(); i++)
+ if (g_fp->_floaters->_array2[i]->val13 == 1)
+ g_fp->_floaters->_array2[i]->ani->_priority = 15;
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene30.cpp b/engines/fullpipe/scenes/scene30.cpp
new file mode 100644
index 0000000000..59cb83efcd
--- /dev/null
+++ b/engines/fullpipe/scenes/scene30.cpp
@@ -0,0 +1,152 @@
+/* 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 {
+
+void scene30_enablePass(Scene *sc) {
+ MovGraphLink *lnk = getSc2MctlCompoundBySceneId(sc->_sceneId)->getLinkByName(sO_WayToPipe);
+
+ if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithAll))
+ lnk->_flags &= 0xDFFFFFFF;
+ else
+ lnk->_flags |= 0x20000000;
+}
+
+void scene30_initScene(Scene *sc, int flag) {
+ Scene *oldsc = g_fp->_currentScene;
+
+ g_vars->scene30_leg = sc->getStaticANIObject1ById(ANI_LEG, -1);
+ g_fp->_currentScene = sc;
+
+ if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_ShowingHeel))
+ g_vars->scene30_leg->changeStatics2(ST_LEG_UP);
+ else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithoutJugs))
+ g_vars->scene30_leg->changeStatics2(ST_LEG_DOWN);
+ else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithBig))
+ g_vars->scene30_leg->changeStatics2(ST_LEG_DOWN1);
+ else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithSmall))
+ g_vars->scene30_leg->changeStatics2(ST_LEG_DOWN2);
+ else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithAll))
+ g_vars->scene30_leg->changeStatics2(ST_LEG_EMPTY);
+
+ g_fp->_currentScene = oldsc;
+
+ scene30_enablePass(sc);
+
+ if (flag == LiftUp || flag == LiftDown)
+ g_vars->scene30_liftFlag = 0;
+ else
+ g_vars->scene30_liftFlag = 1;
+
+ g_fp->lift_setButton(sO_Level8, ST_LBN_8N);
+
+ g_fp->lift_sub5(sc, QU_SC30_ENTERLIFT, QU_SC30_EXITLIFT);
+}
+
+int scene30_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC30_LTRUBA) {
+ g_fp->_cursorId = PIC_CSR_GOL;
+ }
+ return g_fp->_cursorId;
+}
+
+int sceneHandler30(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch(cmd->_messageNum) {
+ case MSG_LIFT_CLOSEDOOR:
+ g_fp->lift_closedoorSeq();
+ break;
+
+ case MSG_LIFT_EXITLIFT:
+ g_fp->lift_exitSeq(cmd);
+ break;
+
+ case MSG_LIFT_STARTEXITQUEUE:
+ g_fp->lift_startExitQueue();
+ break;
+
+ case MSG_LIFT_CLICKBUTTON:
+ g_fp->lift_animation3();
+ break;
+
+ case MSG_SC30_UPDATEPATH:
+ scene30_enablePass(g_fp->_currentScene);
+ break;
+
+ case 64:
+ g_fp->lift_sub05(cmd);
+ break;
+
+ case MSG_LIFT_GO:
+ g_fp->lift_goAnimation();
+ break;
+
+ case 29:
+ {
+ 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);
+
+ cmd->_messageKind = 0;
+ }
+ 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;
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene31.cpp b/engines/fullpipe/scenes/scene31.cpp
new file mode 100644
index 0000000000..587fc6aaef
--- /dev/null
+++ b/engines/fullpipe/scenes/scene31.cpp
@@ -0,0 +1,126 @@
+/* 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 {
+
+void scene31_initScene(Scene *sc) {
+ g_vars->scene31_chantingCountdown = 0;
+ g_vars->scene31_cactus = sc->getStaticANIObject1ById(ANI_CACTUS_31, -1);
+
+ if (g_fp->getObjectState(sO_Cactus) == g_fp->getObjectEnumState(sO_Cactus, sO_HasGrown)) {
+ Scene *oldsc = g_fp->_currentScene;
+ g_fp->_currentScene = sc;
+
+ g_vars->scene31_cactus->changeStatics2(ST_CTS31_GROWN2);
+ g_vars->scene31_cactus->_priority = 22;
+
+ g_fp->_currentScene = oldsc;
+ } else {
+ g_vars->scene31_cactus->hide();
+ }
+
+ g_vars->scene31_plusMinus = sc->getStaticANIObject1ById(ANI_PLUSMINUS, -1);
+
+ if (g_fp->getObjectState(sO_Guard_3) == g_fp->getObjectEnumState(sO_Guard_3, sO_Off))
+ g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_MINUS);
+ else
+ g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_PLUS);
+}
+
+void sceneHandler31_testCactus(ExCommand *cmd) {
+ if ((g_vars->scene31_cactus->_flags & 4) && g_vars->scene31_cactus->_statics->_staticsId == ST_CTS31_GROWN2) {
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);
+
+ if (mq) {
+ mq->getExCommandByIndex(0)->_messageKind = 0;
+ mq->getExCommandByIndex(0)->_excFlags |= 1;
+
+ mq->getExCommandByIndex(1)->_messageKind = 0;
+ mq->getExCommandByIndex(1)->_excFlags |= 1;
+ }
+ }
+}
+
+int sceneHandler31(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC31_TESTCACTUS:
+ sceneHandler31_testCactus(cmd);
+ break;
+
+ case MSG_SC15_STOPCHANTING:
+ g_fp->stopAllSoundInstances(SND_31_001);
+
+ g_vars->scene31_chantingCountdown = 120;
+ break;
+
+ case MSG_SC31_PULL:
+ if ( g_vars->scene31_plusMinus->_statics->_staticsId == ST_PMS_MINUS)
+ g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_PLUS);
+ else
+ g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_MINUS);
+
+ 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->scene31_chantingCountdown > 0) {
+ --g_vars->scene31_chantingCountdown;
+
+ if (!g_vars->scene31_chantingCountdown)
+ g_fp->playSound(SND_31_001, 1);
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene32.cpp b/engines/fullpipe/scenes/scene32.cpp
new file mode 100644
index 0000000000..c93e888e51
--- /dev/null
+++ b/engines/fullpipe/scenes/scene32.cpp
@@ -0,0 +1,431 @@
+/* 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 {
+
+void scene32_initScene(Scene *sc) {
+ g_vars->scene32_flagIsWaving = false;
+ g_vars->scene32_flagNeedsStopping = false;
+ g_vars->scene32_dudeIsSitting = false;
+ g_vars->scene32_cactusCounter = -1;
+ g_vars->scene32_dudeOnLadder = false;
+ g_vars->scene32_cactusIsGrowing = false;
+ g_vars->scene32_flag = sc->getStaticANIObject1ById(ANI_FLAG, -1);
+ g_vars->scene32_cactus = sc->getStaticANIObject1ById(ANI_CACTUS, -1);
+ g_vars->scene32_massOrange = sc->getStaticANIObject1ById(ANI_TESTO_ORANGE, -1);
+ g_vars->scene32_massBlue = sc->getStaticANIObject1ById(ANI_TESTO_BLUE, -1);
+ g_vars->scene32_massGreen = sc->getStaticANIObject1ById(ANI_TESTO_GREEN, -1);
+ g_vars->scene32_button = sc->getStaticANIObject1ById(ANI_BUTTON_32, -1);
+
+ g_vars->scene32_massOrange->startAnim(MV_TSTO_FLOW, 0, -1);
+ g_vars->scene32_massOrange->_movement->setDynamicPhaseIndex(15);
+
+ g_vars->scene32_massGreen->startAnim(MV_TSTG_FLOW, 0, -1);
+ g_vars->scene32_massGreen->_movement->setDynamicPhaseIndex(26);
+
+ Scene *oldsc = g_fp->_currentScene;
+ StaticANIObject *ani;
+
+ if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Lies)) {
+ ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1);
+ if (ani) {
+ g_fp->_currentScene = sc;
+
+ ani->changeStatics2(ST_HDL_LAID);
+ }
+ } else {
+ if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Sticks)) {
+ ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1);
+
+ g_fp->_currentScene = sc;
+
+ if (ani)
+ ani->changeStatics2(ST_HDL_PLUGGED);
+
+ g_vars->scene32_button->changeStatics2(ST_BTN32_ON);
+ }
+ }
+
+ g_fp->_currentScene = oldsc;
+
+ if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_32)) {
+ MessageQueue *mq = new MessageQueue(sc->getMessageQueueById(QU_KBK32_START), 0, 0);
+
+ mq->sendNextCommand();
+ }
+
+ g_fp->lift_setButton(sO_Level9, ST_LBN_9N);
+ g_fp->lift_sub5(sc, QU_SC32_ENTERLIFT, QU_SC32_EXITLIFT);
+
+ g_fp->initArcadeKeys("SC_32");
+}
+
+void scene32_setupMusic() {
+ if (g_fp->lift_checkButton(sO_Level6))
+ g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_32"), "MUSIC2", 1);
+}
+
+int scene32_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_objectIdAtCursor == PIC_SC32_LADDER && g_fp->_cursorId == PIC_CSR_ITN)
+ g_fp->_cursorId = g_vars->scene32_dudeOnLadder ? PIC_CSR_GOD : PIC_CSR_GOU; // TODO FIXME doublecheck
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler32_tryCube() {
+ if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_33))
+ chainQueue(QU_KBK32_GO, 0);
+}
+
+void sceneHandler32_startCactus() {
+ g_vars->scene32_cactusCounter = 48;
+ g_vars->scene32_cactusIsGrowing = false;
+}
+
+void sceneHandler32_spin(ExCommand *cmd) {
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);
+
+ if (!mq || mq->getCount() == 0)
+ return;
+
+ ExCommand *ex = mq->getExCommandByIndex(0);
+ ExCommand *newex;
+
+ if ((g_vars->scene32_cactus->_movement && g_vars->scene32_cactus->_movement->_id == MV_CTS_DEFAULT)
+ || g_vars->scene32_cactus->_statics->_staticsId == ST_CTS_GROWUP) {
+ for (int i = 0; i < 12; i++) {
+ newex = ex->createClone();
+ newex->_excFlags |= 2;
+ mq->insertExCommandAt(1, newex);
+ }
+
+ g_vars->scene32_cactus->changeStatics2(ST_CTS_GROWUP);
+
+ chainQueue(QU_CTS_BACK, 1);
+
+ g_vars->scene32_cactusIsGrowing = false;
+
+ return;
+ }
+
+ if (g_vars->scene32_cactus->_statics->_staticsId == ST_CTS_EMPTY && g_vars->scene32_cactusCounter < 0) {
+ for (int i = 0; i < 2; i++) {
+ newex = ex->createClone();
+ newex->_excFlags |= 2;
+ mq->insertExCommandAt(1, newex);
+ }
+
+ chainQueue(QU_KDK_DRIZZLE, 0);
+ }
+}
+
+void sceneHandler32_startFlagLeft() {
+ g_vars->scene32_flag->changeStatics2(ST_FLG_NORM);
+ g_vars->scene32_flag->startAnim(MV_FLG_STARTL, 0, -1);
+
+ g_vars->scene32_flagIsWaving = true;
+}
+
+void sceneHandler32_startFlagRight() {
+ g_vars->scene32_flag->changeStatics2(ST_FLG_NORM);
+ g_vars->scene32_flag->startAnim(MV_FLG_STARTR, 0, -1);
+
+ g_vars->scene32_flagIsWaving = true;
+}
+
+void sceneHandler32_trySit(ExCommand *cmd) {
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);
+
+ if (!mq || mq->getCount() == 0)
+ return;
+
+ ExCommand *ex = mq->getExCommandByIndex(0);
+
+ if (g_vars->scene32_cactusIsGrowing || g_vars->scene32_cactus->_movement
+ || g_vars->scene32_cactus->_statics->_staticsId != ST_CTS_EMPTY
+ || (g_vars->scene32_cactusCounter >= 0 && g_vars->scene32_cactusCounter <= 20)) {
+ ex->_messageKind = 0;
+ ex->_excFlags |= 1;
+ } else {
+ ex->_parentId = ANI_MAN;
+ ex->_messageKind = 1;
+ ex->_messageNum = MV_MAN32_SITDOWN;
+ ex->_keyCode = g_fp->_aniMan->_okeyCode;
+
+ g_vars->scene32_dudeIsSitting = true;
+
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+ }
+}
+
+void sceneHandler32_buttonPush() {
+ if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Sticks)) {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_HANDLE, -1);
+ if (ani)
+ ani->changeStatics2(ST_HDL_PLUGGED);
+
+ chainQueue(QU_SC32_FALLHANDLE, 1);
+
+ g_vars->scene32_button->changeStatics2(ST_BTN32_OFF);
+ }
+}
+
+void sceneHandler32_installHandle() {
+ chainQueue(QU_SC32_SHOWHANDLE, 0);
+
+ g_vars->scene32_button->changeStatics2(ST_BTN32_ON);
+}
+
+void sceneHandler32_animateCactus() {
+ if (g_fp->_aniMan->_statics->_staticsId != ST_MAN32_SIT)
+ chainQueue(QU_CTS_GROW, 1);
+ else
+ chainQueue(QU_CTS_GROWMAN, 1);
+
+ g_vars->scene32_cactusCounter = -1;
+ g_vars->scene32_cactusIsGrowing = true;
+}
+
+void sceneHandler32_ladderLogic(ExCommand *cmd) {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC32_FROMLADDER), 0, 0);
+
+ if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) != PIC_SC32_LADDER)
+ mq->addExCommandToEnd(cmd->createClone());
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER);
+ if (!mq->chain(g_fp->_aniMan))
+ delete mq;
+
+ g_vars->scene32_dudeOnLadder = false;
+
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+}
+
+void sceneHandler32_potLogic(ExCommand *cmd) {
+ if (g_vars->scene32_cactusCounter < 0 || g_vars->scene32_cactusCounter > 20) {
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+
+ ExCommand *ex = new ExCommand(ANI_MAN, 1, MV_MAN32_STANDUP, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_excFlags |= 2;
+
+ mq->addExCommandToEnd(ex);
+
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (!ani || ani->_id != ANI_KADKA)
+ mq->addExCommandToEnd(cmd->createClone());
+
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+
+ g_vars->scene32_dudeIsSitting = false;
+ }
+}
+
+int sceneHandler32(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_LIFT_CLOSEDOOR:
+ g_fp->lift_closedoorSeq();
+ break;
+
+ case MSG_LIFT_EXITLIFT:
+ g_fp->lift_exitSeq(cmd);
+ break;
+
+ case MSG_LIFT_STARTEXITQUEUE:
+ g_fp->lift_startExitQueue();
+ break;
+
+ case MSG_SC32_TRUBATOBACK:
+ g_fp->_currentScene->getPictureObjectById(PIC_SC32_RTRUBA, 0)->_priority = 20;
+ break;
+
+ case MSG_SC32_TRUBATOFRONT:
+ g_fp->_currentScene->getPictureObjectById(PIC_SC32_RTRUBA, 0)->_priority = 0;
+ break;
+
+ case MSG_LIFT_CLICKBUTTON:
+ g_fp->lift_animation3();
+ break;
+
+ case MSG_SC33_TRYKUBIK:
+ sceneHandler32_tryCube();
+ break;
+
+ case MSG_SC32_STARTCACTUS:
+ sceneHandler32_startCactus();
+ break;
+
+ case MSG_SC32_STOPFLAG:
+ g_vars->scene32_flagIsWaving = false;
+ g_vars->scene32_flagNeedsStopping = true;
+ break;
+
+ case MSG_SC32_SPIN:
+ sceneHandler32_spin(cmd);
+ break;
+
+ case MSG_SC32_STARTFLAGLEFT :
+ sceneHandler32_startFlagLeft();
+ break;
+
+ case MSG_SC32_STARTFLAGRIGHT:
+ sceneHandler32_startFlagRight();
+ break;
+
+ case MSG_SC32_TRYSIT:
+ sceneHandler32_trySit(cmd);
+ break;
+
+ case MSG_LIFT_GO:
+ g_fp->lift_goAnimation();
+ break;
+
+ case MSG_SC32_ONLADDER:
+ g_vars->scene32_dudeOnLadder = true;
+
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+ break;
+
+ case MSG_SC6_BTNPUSH:
+ sceneHandler32_buttonPush();
+ break;
+
+ case 64:
+ g_fp->lift_sub05(cmd);
+ break;
+
+ case MSG_SC6_INSTHANDLE:
+ sceneHandler32_installHandle();
+ 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->scene32_flag->_movement) {
+ if (g_vars->scene32_flagIsWaving) {
+ if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_RIGHT)
+ g_vars->scene32_flag->startAnim(MV_FLG_CYCLER, 0, -1);
+ else if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_LEFT)
+ g_vars->scene32_flag->startAnim(MV_FLG_CYCLEL, 0, -1);
+ }
+
+ if (g_vars->scene32_flagNeedsStopping && !g_vars->scene32_flagIsWaving) {
+ if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_RIGHT)
+ g_vars->scene32_flag->startAnim(MV_FLG_STOPR, 0, -1);
+ else if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_LEFT)
+ g_vars->scene32_flag->startAnim(MV_FLG_STOPL, 0, -1);
+
+ g_vars->scene32_flagNeedsStopping = false;
+ }
+ }
+
+ if (g_vars->scene32_cactusCounter) {
+ if (g_vars->scene32_cactusCounter > 0)
+ --g_vars->scene32_cactusCounter;
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+ } else {
+ sceneHandler32_animateCactus();
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+
+ }
+ break;
+
+ case 29:
+ if (g_vars->scene32_dudeOnLadder) {
+ sceneHandler32_ladderLogic(cmd);
+ cmd->_messageKind = 0;
+ break;
+ }
+
+ if (!g_vars->scene32_dudeIsSitting || g_fp->_aniMan->_movement) {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (ani && ani->_id == ANI_LIFTBUTTON) {
+ g_fp->lift_sub1(ani);
+
+ cmd->_messageKind = 0;
+ break;
+ }
+
+ if (g_fp->_cursorId == PIC_CSR_GOFAR_R || g_fp->_cursorId == PIC_CSR_GOFAR_L) {
+ 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;
+ }
+
+ if (!g_vars->scene32_cactusIsGrowing)
+ sceneHandler32_potLogic(cmd);
+
+ cmd->_messageKind = 0;
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene33.cpp b/engines/fullpipe/scenes/scene33.cpp
new file mode 100644
index 0000000000..209198c0f3
--- /dev/null
+++ b/engines/fullpipe/scenes/scene33.cpp
@@ -0,0 +1,314 @@
+/* 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 {
+
+const int ventsInit[9] = { 0, 0, 1, 0, 0, 1, 0, 0, 1 };
+
+void scene33_initScene(Scene *sc) {
+ g_vars->scene33_mug = sc->getStaticANIObject1ById(ANI_MUG_33, -1);
+ g_vars->scene33_jettie = sc->getStaticANIObject1ById(ANI_JETTIE_FLOW, -1);
+ g_vars->scene33_cube = 0;
+ g_vars->scene33_cubeX = -1;
+ g_vars->scene33_handleIsDown = false;
+
+ if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_33)) {
+ MessageQueue *mq = new MessageQueue(sc->getMessageQueueById(QU_KBK33_START), 0, 0);
+
+ mq->sendNextCommand();
+ }
+
+
+ for (int i = 0; i < 9; i++) {
+ g_vars->scene33_ventsX[i] = sc->getStaticANIObject1ById(ANI_VENT_33, i)->_ox;
+
+ g_vars->scene33_ventsState[i] = ventsInit[i];
+ }
+
+ g_fp->initArcadeKeys("SC_33");
+}
+
+void scene33_setupMusic() {
+ if (g_fp->lift_checkButton(sO_Level6))
+ g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_33"), "MUSIC2", 1);
+}
+
+int scene33_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_objectIdAtCursor == PIC_SC33_ZONES && g_fp->_cursorId == PIC_CSR_DEFAULT)
+ g_fp->_cursorId = PIC_CSR_ITN;
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler33_processJettie(ExCommand *cmd) {
+ MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);
+
+ if (mq && g_vars->scene33_jettie->_movement) {
+ ExCommand *ex = mq->getExCommandByIndex(0);
+
+ if (ex) {
+ ex->_messageKind = 0;
+ ex->_excFlags |= 1;
+ }
+
+ ex = mq->getExCommandByIndex(1);
+
+ if (ex) {
+ ex->_messageKind = 0;
+ ex->_excFlags |= 1;
+ }
+ }
+}
+
+void sceneHandler33_switchVent(StaticANIObject *ani) {
+ int mv = 0;
+
+ if (ani->_statics->_staticsId == ST_VNT33_DOWN)
+ mv = MV_VNT33_TURNR;
+
+ if (ani->_statics->_staticsId == ST_VNT33_RIGHT)
+ mv = MV_VNT33_TURND;
+
+ if (mv)
+ ani->startAnim(mv, 0, -1);
+
+ g_vars->scene33_ventsState[ani->_okeyCode] = !g_vars->scene33_ventsState[ani->_okeyCode];
+}
+
+void sceneHandler33_processVents() {
+ for (int i = 0; i < 9; i++)
+ if (((g_vars->scene33_cubeX < g_vars->scene33_ventsX[i]) != (g_vars->scene33_cube->_ox < g_vars->scene33_ventsX[i]))
+ && g_vars->scene33_ventsState[i] != ventsInit[i])
+ sceneHandler33_switchVent(g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, i));
+
+ g_vars->scene33_cubeX = g_vars->scene33_cube->_ox;
+}
+
+void sceneHandler33_tryCube() {
+ if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_32))
+ chainQueue(QU_KBK33_GO, 0);
+}
+
+void sceneHandler33_pour() {
+ bool solved = true;
+
+ for (int i = 0; i < 9; i++)
+ if (g_vars->scene33_ventsState[i] != ventsInit[i])
+ solved = false;
+
+ if (solved) {
+ if ((g_vars->scene33_mug->_flags & 4) && g_vars->scene33_mug->_statics->_staticsId == ST_MUG33_EMPTY) {
+ g_vars->scene33_jettie->startAnim(MV_JTI33_POUR, 0, -1);
+
+ g_vars->scene33_handleIsDown = false;
+
+ return;
+ }
+
+ if ((g_vars->scene33_mug->_flags & 4) && g_vars->scene33_mug->_statics->_staticsId == ST_MUG33_FULL) {
+ g_vars->scene33_jettie->startAnim(MV_JTI33_POURFULL, 0, -1);
+
+ g_vars->scene33_handleIsDown = false;
+
+ return;
+ }
+
+ g_vars->scene33_jettie->startAnim(MV_JTI33_FLOW, 0, -1);
+ }
+
+ g_vars->scene33_handleIsDown = false;
+}
+
+void sceneHandler33_handleDown() {
+ if (!g_vars->scene33_handleIsDown && !g_vars->scene33_jettie->_movement && !g_vars->scene33_jettie->getMessageQueue() ) {
+ chainQueue(QU_SC33_STARTWATER, 0);
+
+ g_vars->scene33_handleIsDown = true;
+ }
+}
+
+void sceneHandler33_zoneClickProcess(StaticANIObject *ani) {
+ if (!ani->_movement) {
+ sceneHandler33_switchVent(ani);
+
+ StaticANIObject *vent1 = 0;
+ StaticANIObject *vent2 = 0;
+
+ switch (ani->_okeyCode) {
+ case 0:
+ vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 2);
+ vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 3);
+ break;
+
+ case 1:
+ vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 3);
+ vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 4);
+ break;
+
+ case 2:
+ vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 4);
+ vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 0);
+ break;
+
+ case 3:
+ vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 0);
+ vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 1);
+ break;
+
+ case 4:
+ vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 1);
+ vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 2);
+ break;
+
+ default:
+ return;
+ }
+
+ if (vent1) {
+ sceneHandler33_switchVent(vent1);
+ sceneHandler33_switchVent(vent2);
+ }
+ }
+}
+
+void sceneHandler33_clickZones(ExCommand *cmd) {
+ StaticANIObject *closest = 0;
+ double mindist = 1e10;
+
+ for (uint i = 0; i < g_fp->_currentScene->_staticANIObjectList1.size(); i++) {
+ StaticANIObject *ani = (StaticANIObject *)g_fp->_currentScene->_staticANIObjectList1[i];
+
+ if (ani->_id == ANI_VENT_33) {
+ int dx = ani->_ox - cmd->_sceneClickX;
+ int dy = ani->_oy - cmd->_sceneClickY;
+ double dist = sqrt((double)(dx * dx + dy * dy));
+
+ if (dist < mindist) {
+ mindist = dist;
+ closest = ani;
+ }
+ }
+ }
+
+ if (closest)
+ sceneHandler33_zoneClickProcess(closest);
+}
+
+int sceneHandler33(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC32_TRUBATOFRONT:
+ g_fp->_currentScene->getPictureObjectById(PIC_SC33_LTRUBA, 0)->_priority = 0;
+ break;
+
+ case MSG_SC32_TRUBATOBACK:
+ g_fp->_currentScene->getPictureObjectById(PIC_SC33_LTRUBA, 0)->_priority = 20;
+ break;
+
+ case MSG_SC33_TESTMUG:
+ sceneHandler33_processJettie(cmd);
+ break;
+
+ case MSG_SC33_UPDATEKUBIK:
+ g_vars->scene33_cube = g_fp->_currentScene->getStaticANIObject1ById(ANI_KUBIK, -1);
+
+ if (g_vars->scene33_cube)
+ g_vars->scene33_cubeX = g_vars->scene33_cube->_ox;
+
+ break;
+
+ case MSG_SC33_TRYKUBIK:
+ sceneHandler33_tryCube();
+ break;
+
+ case MSG_SC33_POUR:
+ sceneHandler33_pour();
+ break;
+
+ case MSG_SC33_HANDLEDOWN:
+ sceneHandler33_handleDown();
+ break;
+
+ case 29:
+ {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y);
+
+ 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_SC33_ZONES) {
+ sceneHandler33_clickZones(cmd);
+ 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);
+ }
+ }
+ 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->scene33_cube)
+ sceneHandler33_processVents();
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene34.cpp b/engines/fullpipe/scenes/scene34.cpp
new file mode 100644
index 0000000000..942a0abc6b
--- /dev/null
+++ b/engines/fullpipe/scenes/scene34.cpp
@@ -0,0 +1,479 @@
+/* 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"
+#include "fullpipe/floaters.h"
+
+namespace Fullpipe {
+
+void sceneHandler34_setExits() {
+ int state;
+
+ if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipeWithStool)) {
+ if (g_fp->getObjectState(sO_Hatch_34) == g_fp->getObjectEnumState(sO_Hatch_34, sO_Closed))
+ state = g_fp->getObjectEnumState(sO_Plank_34, sO_ClosedWithBoot);
+ else
+ state = g_fp->getObjectEnumState(sO_Plank_34, sO_OpenedWithBoot);
+ } else {
+ if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnStool)) {
+ if (g_fp->getObjectState(sO_Hatch_34) == g_fp->getObjectEnumState(sO_Hatch_34, sO_Closed))
+ state = g_fp->getObjectEnumState(sO_Plank_34, sO_IsClosed);
+ else
+ state = g_fp->getObjectEnumState(sO_Plank_34, sO_IsOpened);
+ } else {
+ state = g_fp->getObjectEnumState(sO_Plank_34, sO_Passive);
+ }
+ }
+
+ g_fp->setObjectState(sO_Plank_34, state);
+}
+
+void scene34_initScene(Scene *sc) {
+ g_vars->scene34_cactus = sc->getStaticANIObject1ById(ANI_CACTUS_34, -1);
+ g_vars->scene34_vent = sc->getStaticANIObject1ById(ANI_VENT_34, -1);
+ g_vars->scene34_hatch = sc->getStaticANIObject1ById(ANI_LUK_34, -1);
+ g_vars->scene34_boot = sc->getStaticANIObject1ById(ANI_BOOT_34, -1);
+
+ if (g_fp->getObjectState(sO_Cactus) == g_fp->getObjectEnumState(sO_Cactus, sO_HasGrown)) {
+ Scene *oldsc = g_fp->_currentScene;
+
+ g_fp->_currentScene = sc;
+
+ g_vars->scene34_cactus->changeStatics2(ST_CTS34_EMPTY);
+ g_vars->scene34_cactus->setOXY(506, 674);
+ g_vars->scene34_cactus->_priority = 30;
+
+ g_vars->scene34_cactus->changeStatics2(ST_CTS34_GROWNEMPTY2);
+ g_vars->scene34_cactus->_flags |= 4;
+
+ g_fp->_currentScene = oldsc;
+ }
+
+ if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_Strolling))
+ g_fp->setObjectState(sO_Grandma, g_fp->getObjectEnumState(sO_Grandma, sO_OnStool));
+
+ sceneHandler34_setExits();
+
+ g_vars->scene34_dudeClimbed = false;
+ g_vars->scene34_dudeOnBoard = false;
+ g_vars->scene34_dudeOnCactus = false;
+ g_vars->scene34_fliesCountdown = g_fp->_rnd->getRandomNumber(500) + 500;
+
+ g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_34"));
+
+ g_fp->lift_setButton(sO_Level7, ST_LBN_7N);
+ g_fp->lift_sub5(sc, QU_SC34_ENTERLIFT, QU_SC34_EXITLIFT);
+
+ g_fp->initArcadeKeys("SC_34");
+}
+
+void scene34_initBeh() {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene34_cactus, ST_CTS34_GROWNEMPTY2, QU_CTS34_FALLEFT, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene34_cactus, ST_CTS34_GROWNEMPTY2, QU_CTS34_FALLRIGHT, 0);
+}
+
+int scene34_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if ((g_fp->_objectIdAtCursor != ANI_STOOL_34 || getGameLoaderInventory()->getSelectedItemId() != ANI_INV_BOX)
+ && (g_fp->_objectIdAtCursor != ANI_BOX_34 || getGameLoaderInventory()->getSelectedItemId() != ANI_INV_STOOL))
+ ; // emtpy
+ else
+ g_fp->_cursorId = PIC_CSR_ITN_INV;
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler34_leaveBoard() {
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
+
+ g_vars->scene34_dudeOnBoard = false;
+}
+
+void sceneHandler34_onBoard() {
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
+
+ g_vars->scene34_dudeOnBoard = true;
+}
+
+void sceneHandler34_testVent() {
+ if (g_fp->_aniMan->_movement->_id == MV_MAN34_TURNVENT_R) {
+ g_vars->scene34_hatch->changeStatics2(ST_LUK34_CLOSED);
+
+ chainQueue(QU_LUK34_OPEN, 0);
+ } else if (g_fp->_aniMan->_movement->_id == MV_MAN34_TURNVENT_L) {
+ g_vars->scene34_hatch->changeStatics2(ST_LUK34_OPEN);
+
+ chainQueue(QU_LUK34_CLOSE, 0);
+ }
+}
+
+void sceneHandler34_hideStool() {
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_STOOL_34, -1)->hide();
+}
+
+void sceneHandler34_climb() {
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
+
+ g_vars->scene34_dudeClimbed = true;
+}
+
+void sceneHandler34_genFlies() {
+ g_fp->_floaters->genFlies(g_fp->_currentScene, 1072, -50, 100, 4);
+
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = 1;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val6 = 1072;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val7 = -50;
+
+ g_vars->scene34_fliesCountdown = g_fp->_rnd->getRandomNumber(500) + 500;
+}
+
+void sceneHandler34_fromCactus(ExCommand *cmd) {
+ if (g_fp->_aniMan->_movement || g_vars->scene34_cactus->_movement || (g_fp->_aniMan->_flags & 0x100)) {
+ cmd->_messageKind = 0;
+
+ return;
+ }
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC34_FROMCACTUS), 0, 0);
+
+ ExCommand *ex = new ExCommand(ANI_MAN, 34, 256, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_messageNum = 0;
+ ex->_excFlags |= 3;
+ ex->_field_14 = 256;
+ mq->addExCommandToEnd(ex);
+
+ ex = cmd->createClone();
+ mq->addExCommandToEnd(ex);
+
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+
+ g_fp->_aniMan->_flags |= 1;
+}
+
+void sceneHandler34_animateLeaveBoard(ExCommand *cmd) {
+ if (!g_fp->_aniMan->_movement) {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC34_LEAVEBOARD), 0, 0);
+
+ mq->addExCommandToEnd(cmd->createClone());
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+ }
+
+ cmd->_messageKind = 0;
+}
+
+void sceneHandler34_animateAction(ExCommand *cmd) {
+ if (g_fp->_aniMan->_movement)
+ return;
+
+ int ox = g_fp->_aniMan->_ox;
+ int oy = g_fp->_aniMan->_oy;
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y);
+
+ if (!ani || ani->_id != ANI_VENT_34) {
+ int qId = 0;
+
+ if (ox == 887) {
+ if (oy != 370)
+ return;
+
+ qId = QU_SC34_FROMSTOOL;
+ } else {
+ if (ox != 916)
+ return;
+
+ if (oy == 286) {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC34_FROMBOX), 0, 0);
+
+ mq->addExCommandToEnd(cmd->createClone());
+ mq->chain(0);
+
+ sceneHandler34_setExits();
+
+ return;
+ }
+
+ if (oy != 345)
+ return;
+
+ qId = QU_SC34_FROMBOX_FLOOR;
+ }
+
+ if (qId) {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(qId), 0, 0);
+
+ mq->addExCommandToEnd(cmd->createClone());
+ mq->chain(0);
+ }
+
+ return;
+ }
+
+ if (ox == 887) {
+ if (oy == 370)
+ g_fp->_aniMan->startAnim(MV_MAN34_TRYTABUR, 0, -1);
+
+ } else if (ox == 916) {
+ if (oy == 286) {
+ int id = g_vars->scene34_vent->_statics->_staticsId;
+ if (id == ST_VNT34_UP2) {
+ g_fp->_aniMan->startAnim(MV_MAN34_TURNVENT_R, 0, -1);
+ } else if (id == ST_VNT34_RIGHT3) {
+ g_fp->_aniMan->startAnim(MV_MAN34_TURNVENT_L, 0, -1);
+ }
+ } else if (oy == 345) {
+ g_fp->_aniMan->startAnim(MV_MAN34_TRY, 0, -1);
+ }
+ }
+}
+
+void sceneHandler34_showVent() {
+ if (g_vars->scene34_vent->_statics->_staticsId == ST_VNT34_UP2)
+ g_vars->scene34_vent->changeStatics2(ST_VNT34_RIGHT3);
+ else if (g_vars->scene34_vent->_statics->_staticsId == ST_VNT34_RIGHT3)
+ g_vars->scene34_vent->changeStatics2(ST_VNT34_UP2);
+
+ g_vars->scene34_vent->show1(-1, -1, -1, 0);
+}
+
+void sceneHandler34_showBox() {
+ g_fp->_currentScene->getStaticANIObject1ById(ANI_STOOL_34, -1)->changeStatics2(ST_STL34_BOX2);
+}
+
+void sceneHandler34_showStool() {
+ chainQueue(QU_SC34_SHOWSTOOL, 0);
+}
+
+void sceneHandler34_unclimb() {
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
+
+ g_vars->scene34_dudeClimbed = false;
+}
+
+int sceneHandler34(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_SC4_HIDEBOOT:
+ g_vars->scene34_boot->_flags &= 0xFFFB;
+ break;
+
+ case MSG_SC34_LEAVEBOARD:
+ sceneHandler34_leaveBoard();
+ break;
+
+ case MSG_SC34_ONBOARD:
+ sceneHandler34_onBoard();
+ break;
+
+ case MSG_SC34_TESTVENT:
+ sceneHandler34_testVent();
+ break;
+
+ case MSG_LIFT_CLICKBUTTON:
+ g_fp->lift_animation3();
+ break;
+
+ case MSG_SC34_FROMCACTUS:
+ g_vars->scene34_dudeOnCactus = false;
+
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
+
+ break;
+
+ case MSG_SC34_RETRYVENT:
+ if (!g_fp->_aniMan->isIdle())
+ break;
+
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT);
+ g_fp->_aniMan->_flags &= 0xFEFF;
+
+ getGameLoaderInteractionController()->handleInteraction(g_fp->_aniMan, g_vars->scene34_vent, cmd->_keyCode);
+
+ break;
+
+ case MSG_SC34_ONBUMP:
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene34_cactus, ST_CTS34_GROWNEMPTY2, QU_CTS34_FALLEFT, 1);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene34_cactus, ST_CTS34_GROWNEMPTY2, QU_CTS34_FALLRIGHT, 1);
+ break;
+
+ case MSG_LIFT_CLOSEDOOR:
+ g_fp->lift_closedoorSeq();
+ break;
+
+ case MSG_LIFT_EXITLIFT:
+ g_fp->lift_exitSeq(cmd);
+ break;
+
+ case MSG_LIFT_STARTEXITQUEUE:
+ g_fp->lift_startExitQueue();
+ break;
+
+ case MSG_SC22_HIDESTOOL:
+ sceneHandler34_hideStool();
+ break;
+
+ case MSG_SC34_CLIMB:
+ sceneHandler34_climb();
+ break;
+
+ case MSG_SC34_UNCLIMB:
+ sceneHandler34_unclimb();
+ break;
+
+ case MSG_SC22_SHOWSTOOL:
+ sceneHandler34_showStool();
+ break;
+
+ case MSG_SC34_SHOWBOX:
+ sceneHandler34_showBox();
+ break;
+
+ case MSG_SC34_ONCACTUS:
+ g_vars->scene34_dudeOnCactus = true;
+
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+
+ g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
+ break;
+
+ case MSG_SC34_SHOWVENT:
+ sceneHandler34_showVent();
+ break;
+
+ case 64:
+ g_fp->lift_sub05(cmd);
+ break;
+
+ case MSG_LIFT_GO:
+ g_fp->lift_goAnimation();
+ break;
+
+ case 29:
+ {
+ if (g_vars->scene34_dudeClimbed) {
+ sceneHandler34_animateAction(cmd);
+ break;
+ }
+
+ if (g_vars->scene34_dudeOnBoard) {
+ sceneHandler34_animateLeaveBoard(cmd);
+ break;
+ }
+
+ if (g_vars->scene34_dudeOnCactus) {
+ sceneHandler34_fromCactus(cmd);
+ break;
+ }
+
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y);
+
+ if (ani) {
+ if ((ani->_id == ANI_STOOL_34 && cmd->_keyCode == ANI_INV_BOX) || (ani->_id == ANI_BOX_34 && cmd->_keyCode == ANI_INV_STOOL)) {
+ getGameLoaderInteractionController()->handleInteraction(g_fp->_aniMan, g_vars->scene34_vent, cmd->_keyCode);
+
+ cmd->_messageKind = 0;
+ }
+
+ if (ani->_id == ANI_LIFTBUTTON) {
+ g_fp->lift_sub1(ani);
+
+ cmd->_messageKind = 0;
+
+ break;
+ }
+ }
+
+ 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;
+ }
+ }
+ }
+ 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;
+ }
+
+ --g_vars->scene34_fliesCountdown;
+
+ if (!g_vars->scene34_fliesCountdown)
+ sceneHandler34_genFlies();
+
+ g_fp->_floaters->update();
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene35.cpp b/engines/fullpipe/scenes/scene35.cpp
new file mode 100644
index 0000000000..290213c453
--- /dev/null
+++ b/engines/fullpipe/scenes/scene35.cpp
@@ -0,0 +1,264 @@
+/* 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"
+
+#include "fullpipe/floaters.h"
+
+namespace Fullpipe {
+
+void scene35_initScene(Scene *sc) {
+ g_vars->scene35_hose = sc->getStaticANIObject1ById(ANI_HOSE, -1);
+ g_vars->scene35_bellyInflater = sc->getStaticANIObject1ById(ANI_PUZODUV, -1);
+ g_vars->scene35_flowCounter = 0;
+ g_vars->scene35_fliesCounter = 0;
+
+ MovGraphLink *lnk = getSc2MctlCompoundBySceneId(sc->_sceneId)->getLinkByName(sO_CloseThing);
+
+ if (g_vars->scene35_bellyInflater->_statics->_staticsId == ST_PDV_LARGE)
+ lnk->_flags |= 0x20000000;
+ else
+ lnk->_flags &= 0xDFFFFFFF;
+
+ int sndId = 0;
+
+ if (g_fp->getObjectState(sO_Valve_35) == g_fp->getObjectEnumState(sO_Valve_35, sO_TurnedOn)) {
+ if ((g_vars->scene35_hose->_flags & 4) && g_vars->scene35_hose->_statics->_staticsId == ST_HZE_NORM) {
+ sndId = SND_35_012;
+ } else if (g_vars->scene35_bellyInflater->_statics->_staticsId == ST_PDV_SMALL) {
+ sndId = SND_35_011;
+ }
+ }
+
+ if (sndId)
+ g_fp->playSound(sndId, 1);
+
+ g_fp->lift_setButton(sO_Level6, ST_LBN_6N);
+ g_fp->lift_sub5(sc, QU_SC35_ENTERLIFT, QU_SC35_EXITLIFT);
+
+ g_fp->initArcadeKeys("SC_35");
+
+ g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_35"));
+}
+
+void sceneHandler35_stopFlow() {
+ g_fp->setObjectState(sO_Valve_35, g_fp->getObjectEnumState(sO_Valve_35, sO_TurnedOff));
+ g_fp->stopAllSoundInstances(SND_35_011);
+ g_fp->playSound(SND_35_026, 0);
+}
+
+void sceneHandler35_shrink() {
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing, 0);
+}
+
+void sceneHandler35_startFlow() {
+ if (g_fp->getObjectState(sO_Valve_35) == g_fp->getObjectEnumState(sO_Valve_35, sO_TurnedOn)) {
+ if ((g_vars->scene35_hose->_flags & 4) && g_vars->scene35_hose->_statics->_staticsId == ST_HZE_NORM) {
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene35_bellyInflater, ST_PDV_SMALL, QU_PDV_SML_BLINK, 0);
+ g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene35_bellyInflater, ST_PDV_SMALL, QU_PDV_SML_TRY, 0);
+
+ g_vars->scene35_bellyInflater->changeStatics2(ST_PDV_SMALL);
+ g_vars->scene35_bellyInflater->_flags &= 0xFEFF;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC35_EATHOZE), 0, 0);
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ ExCommand *cmd = new ExCommand(g_vars->scene35_bellyInflater->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0);
+
+ cmd->_excFlags |= 3;
+ cmd->_field_14 = 256;
+ cmd->_messageNum = 0;
+
+ mq->addExCommandToEnd(cmd);
+
+ if (!mq->chain(g_vars->scene35_bellyInflater))
+ delete mq;
+
+ g_vars->scene35_bellyInflater->_flags |= 1;
+
+ getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing, 1);
+
+ g_fp->playSound(SND_35_012, 1);
+ } else {
+ if (!g_vars->scene35_flowCounter)
+ g_vars->scene35_flowCounter = 98;
+
+ g_fp->playSound(SND_35_011, 1);
+ }
+ }
+}
+
+void sceneHandler35_genFlies() {
+ StaticANIObject *fly = g_fp->_currentScene->getStaticANIObject1ById(ANI_FLY, -1);
+
+ int xoff = 0;
+ if ((!fly || !(fly->_flags & 4)) && !(g_fp->_rnd->getRandomNumber(32767) % 30)) {
+ int x, y;
+
+ if (g_fp->_rnd->getRandomNumber(1)) {
+ x = 600;
+ y = 0;
+ } else {
+ x = 0;
+ y = 600;
+ }
+
+ int numFlies = g_fp->_rnd->getRandomNumber(3) + 1;
+
+ while (numFlies--) {
+ g_fp->_floaters->genFlies(g_fp->_currentScene, g_fp->_rnd->getRandomNumber(55) + 1057, g_fp->_rnd->getRandomNumber(60) + x + xoff, 4, 1);
+
+ xoff += 40;
+
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val2 = 1084;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val3 = y;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val11 = 8.0;
+ }
+
+ g_vars->scene35_fliesCounter = 0;
+ }
+}
+
+int sceneHandler35(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_LIFT_CLOSEDOOR:
+ g_fp->lift_closedoorSeq();
+ break;
+
+ case MSG_LIFT_EXITLIFT:
+ g_fp->lift_exitSeq(cmd);
+ break;
+
+ case MSG_LIFT_STARTEXITQUEUE:
+ g_fp->lift_startExitQueue();
+ break;
+
+ case MSG_LIFT_CLICKBUTTON:
+ g_fp->lift_animation3();
+ break;
+
+ case MSG_SC35_STOPFLOW:
+ sceneHandler35_stopFlow();
+ break;
+
+ case MSG_SC35_CHECKPIPESOUND:
+ if (g_fp->getObjectState(sO_Valve_35) == g_fp->getObjectEnumState(sO_Valve_35, sO_TurnedOn)) {
+ g_fp->stopAllSoundInstances(SND_35_011);
+ g_fp->playSound(SND_35_012, 1);
+
+ g_vars->scene35_flowCounter = 0;
+ break;
+ }
+ break;
+
+ case MSG_SC35_SHRINK:
+ sceneHandler35_shrink();
+ break;
+
+ case MSG_LIFT_GO:
+ g_fp->lift_goAnimation();
+ break;
+
+ case MSG_SC35_STARTFLOW:
+ case MSG_SC35_PLUGHOSE:
+ sceneHandler35_startFlow();
+ break;
+
+ case 64:
+ g_fp->lift_sub05(cmd);
+ 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_LIFTBUTTON) {
+ g_fp->lift_sub1(ani);
+ cmd->_messageKind = 0;
+ break;
+ }
+
+ 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;
+ }
+ }
+ }
+ 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->scene35_flowCounter > 0) {
+ --g_vars->scene35_flowCounter;
+
+ if (!g_vars->scene35_flowCounter)
+ sceneHandler35_stopFlow();
+ }
+
+ g_vars->scene35_fliesCounter++;
+
+ if (g_vars->scene35_fliesCounter >= 160)
+ sceneHandler35_genFlies();
+
+ g_fp->_floaters->update();
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene36.cpp b/engines/fullpipe/scenes/scene36.cpp
new file mode 100644
index 0000000000..7d237fd395
--- /dev/null
+++ b/engines/fullpipe/scenes/scene36.cpp
@@ -0,0 +1,94 @@
+/* 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 {
+
+void scene36_initScene(Scene *sc) {
+ g_vars->scene36_rotohrust = sc->getStaticANIObject1ById(ANI_ROTOHRUST, -1);
+ g_vars->scene36_scissors = sc->getStaticANIObject1ById(ANI_SCISSORS_36, -1);
+}
+
+int scene36_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_cursorId != PIC_CSR_ITN || g_fp->_objectIdAtCursor != ANI_ROTOHRUST) {
+ if (g_fp->_objectIdAtCursor == PIC_SC36_MASK && g_fp->_cursorId == PIC_CSR_DEFAULT && (g_vars->scene36_scissors->_flags & 4))
+ g_fp->_cursorId = PIC_CSR_ITN;
+ } else if (g_vars->scene36_rotohrust->_statics->_staticsId == ST_RHT_OPEN)
+ g_fp->_cursorId = PIC_CSR_GOL;
+
+ return g_fp->_cursorId;
+}
+
+int sceneHandler36(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case 29:
+ if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) == PIC_SC36_MASK)
+ if (g_vars->scene36_scissors)
+ if (g_vars->scene36_scissors->_flags & 4)
+ if (g_fp->_aniMan->isIdle())
+ if (!(g_fp->_aniMan->_flags & 0x100) && g_fp->_msgObjectId2 != g_vars->scene36_scissors->_id ) {
+ handleObjectInteraction(g_fp->_aniMan, g_vars->scene36_scissors, cmd->_keyCode);
+
+ cmd->_messageKind = 0;
+ }
+
+ 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;
+ }
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene37.cpp b/engines/fullpipe/scenes/scene37.cpp
new file mode 100644
index 0000000000..8324e00af7
--- /dev/null
+++ b/engines/fullpipe/scenes/scene37.cpp
@@ -0,0 +1,316 @@
+/* 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 {
+
+Ring::Ring() {
+ ani = 0;
+ x = 0;
+ y = 0;
+ numSubRings = 0;
+
+ for (int i = 0; i < 10; i++)
+ subRings[i] = 0;
+
+ state = false;
+}
+
+void scene37_initScene(Scene *sc) {
+ Ring *ring;
+ StaticANIObject *ani;
+
+ g_vars->scene37_lastDudeX = -1;
+
+ ring = new Ring();
+ ani = sc->getStaticANIObject1ById(ANI_GUARD_37, 0);
+ ring->ani = ani;
+ ring->x = ani->_ox - 40;
+ ring->y = ani->_ox + 40;
+ ring->numSubRings = 3;
+ ring->subRings[0] = 1;
+ ring->subRings[1] = 4;
+ ring->subRings[2] = 8;
+ ring->state = false;
+ g_vars->scene37_rings.push_back(ring);
+
+ ring = new Ring();
+ ani = sc->getStaticANIObject1ById(ANI_GUARD_37, 1);
+ ring->ani = ani;
+ ring->x = ani->_ox - 40;
+ ring->y = ani->_ox + 40;
+ ring->numSubRings = 3;
+ ring->subRings[0] = 2;
+ ring->subRings[1] = 5;
+ ring->subRings[2] = 9;
+ ring->state = false;
+ g_vars->scene37_rings.push_back(ring);
+
+ ring = new Ring();
+ ani = sc->getStaticANIObject1ById(ANI_GUARD_37, 2);
+ ring->ani = ani;
+ ring->x = ani->_ox - 40;
+ ring->y = ani->_ox + 40;
+ ring->numSubRings = 3;
+ ring->subRings[0] = 3;
+ ring->subRings[1] = 7;
+ ring->subRings[2] = 11;
+ ring->state = false;
+ g_vars->scene37_rings.push_back(ring);
+
+ g_fp->setObjectState(sO_LeftPipe_37, g_fp->getObjectEnumState(sO_LeftPipe_37, sO_IsClosed));
+
+ Scene *oldsc = g_fp->_currentScene;
+
+ g_fp->_currentScene = sc;
+
+ g_vars->scene37_cursorIsLocked = false;
+
+ g_vars->scene37_plusMinus1 = sc->getStaticANIObject1ById(ANI_PLUSMINUS, 1);
+
+ for (int i = 0; i < g_vars->scene37_rings[0]->numSubRings; i++) {
+ ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_RING, g_vars->scene37_rings[0]->subRings[i]);
+
+ if (g_fp->getObjectState(sO_Guard_1) == g_fp->getObjectEnumState(sO_Guard_1, sO_On)) {
+ g_vars->scene37_plusMinus1->_statics = g_vars->scene37_plusMinus1->getStaticsById(ST_PMS_PLUS);
+ ani->changeStatics2(ST_RNG_OPEN);
+ } else {
+ g_vars->scene37_plusMinus1->_statics = g_vars->scene37_plusMinus1->getStaticsById(ST_PMS_MINUS);
+ ani->changeStatics2(ST_RNG_CLOSED2);
+ }
+ }
+
+ g_vars->scene37_plusMinus2 = sc->getStaticANIObject1ById(ANI_PLUSMINUS, 2);
+
+ for (int i = 0; i < g_vars->scene37_rings[1]->numSubRings; i++) {
+ ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_RING, g_vars->scene37_rings[1]->subRings[i]);
+
+ if (g_fp->getObjectState(sO_Guard_2) == g_fp->getObjectEnumState(sO_Guard_2, sO_On)) {
+ g_vars->scene37_plusMinus2->_statics = g_vars->scene37_plusMinus2->getStaticsById(ST_PMS_PLUS);
+ ani->changeStatics2(ST_RNG_OPEN);
+ } else {
+ g_vars->scene37_plusMinus2->_statics = g_vars->scene37_plusMinus2->getStaticsById(ST_PMS_MINUS);
+ ani->changeStatics2(ST_RNG_CLOSED2);
+ }
+ }
+
+ g_vars->scene37_plusMinus3 = sc->getStaticANIObject1ById(ANI_PLUSMINUS, 3);
+
+ for (int i = 0; i < g_vars->scene37_rings[2]->numSubRings; i++) {
+ ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_RING, g_vars->scene37_rings[2]->subRings[i]);
+
+ if (g_fp->getObjectState(sO_Guard_3) == g_fp->getObjectEnumState(sO_Guard_3, sO_On)) {
+ g_vars->scene37_plusMinus3->_statics = g_vars->scene37_plusMinus3->getStaticsById(ST_PMS_PLUS);
+ ani->changeStatics2(ST_RNG_OPEN);
+ } else {
+ g_vars->scene37_plusMinus3->_statics = g_vars->scene37_plusMinus3->getStaticsById(ST_PMS_MINUS);
+ ani->changeStatics2(ST_RNG_CLOSED2);
+ }
+ }
+
+ g_fp->_currentScene = oldsc;
+
+ g_fp->initArcadeKeys("SC_37");
+}
+
+int scene37_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC37_MASK) {
+ if (g_vars->scene37_cursorIsLocked)
+ g_fp->_cursorId = PIC_CSR_GOL;
+ }
+
+ return g_fp->_cursorId;
+}
+
+void sceneHandler37_updateRing(int ringNum) {
+ g_vars->scene37_rings[ringNum]->ani->changeStatics2(ST_GRD37_STAND);
+ g_vars->scene37_rings[ringNum]->ani->startAnim(MV_GRD37_PULL, 0, -1);
+ g_vars->scene37_rings[ringNum]->state = !g_vars->scene37_rings[ringNum]->state;
+
+ StaticANIObject *ani;
+
+ for (int i = 0; i < g_vars->scene37_rings[ringNum]->numSubRings; i++) {
+ ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_RING, g_vars->scene37_rings[ringNum]->subRings[i]);
+
+ if ((ani->_movement && ani->_movement->_id != MV_RNG_CLOSE) || ani->_statics->_staticsId != ST_RNG_CLOSED2) {
+ ani->changeStatics2(ST_RNG_OPEN);
+ ani->startAnim(MV_RNG_CLOSE, 0, -1);
+ } else {
+ ani->changeStatics2(ST_RNG_CLOSED2);
+ ani->startAnim(MV_RNG_OPEN, 0, -1);
+ }
+ }
+
+ g_vars->scene37_cursorIsLocked = true;
+
+ for (uint j = 0; j < g_vars->scene37_rings.size(); j++) {
+ for (int i = 0; i < g_vars->scene37_rings[ringNum]->numSubRings; i++) {
+ ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_RING, g_vars->scene37_rings[j]->subRings[i]);
+
+ if ((ani->_movement && ani->_movement->_id != MV_RNG_CLOSE) || ani->_statics->_staticsId != ST_RNG_CLOSED2)
+ g_vars->scene37_cursorIsLocked = false;
+ }
+ }
+
+ int state;
+
+ if (g_vars->scene37_cursorIsLocked)
+ state = g_fp->getObjectEnumState(sO_LeftPipe_37, sO_IsOpened);
+ else
+ state = g_fp->getObjectEnumState(sO_LeftPipe_37, sO_IsClosed);
+
+ g_fp->setObjectState(sO_LeftPipe_37, state);
+}
+
+void sceneHandler37_setRingsState() {
+ if (g_vars->scene37_lastDudeX == -1) {
+ g_vars->scene37_lastDudeX = g_vars->scene37_dudeX;
+ } else {
+ for (uint i = 0; i < g_vars->scene37_rings.size(); i++) {
+ int x = g_vars->scene37_rings[i]->x;
+
+ if (g_vars->scene37_lastDudeX > x && g_vars->scene37_dudeX <= x && !g_vars->scene37_rings[i]->state)
+ sceneHandler37_updateRing(i);
+
+ x = g_vars->scene37_rings[i]->y;
+
+ if (g_vars->scene37_lastDudeX < x && g_vars->scene37_dudeX >= x) {
+ if (g_vars->scene37_rings[i]->state)
+ sceneHandler37_updateRing(i);
+ }
+ }
+
+ g_vars->scene37_lastDudeX = g_vars->scene37_dudeX;
+ }
+}
+
+int sceneHandler37(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch(cmd->_messageNum) {
+ case MSG_SC37_EXITLEFT:
+ sceneHandler37_updateRing(0);
+ sceneHandler37_updateRing(1);
+ sceneHandler37_updateRing(2);
+
+ break;
+
+ case 29:
+ {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+
+ if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) {
+ int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
+ PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0);
+
+ if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) {
+ if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1)
+ || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) {
+ g_fp->processArcade(cmd);
+ break;
+ }
+ }
+ }
+ }
+
+ break;
+
+ case 33:
+ if (g_fp->_aniMan2) {
+ int x = g_fp->_aniMan2->_ox;
+
+ g_vars->scene37_dudeX = x;
+
+ if (x >= 500) {
+ if (x < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left;
+ } else {
+ g_fp->_currentScene->_x = -g_fp->_sceneRect.left;
+ }
+ x = g_vars->scene37_dudeX;
+
+ if (x > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right;
+ }
+
+ sceneHandler37_setRingsState();
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ ++g_vars->scene37_soundFlipper;
+
+ break;
+
+ case MSG_SC37_PULL:
+ if (g_vars->scene37_rings[0]->ani->_movement && g_vars->scene37_rings[0]->ani->_movement->_id == MV_GRD37_PULL) {
+ if ((g_fp->getObjectState(sO_Guard_1) == g_fp->getObjectEnumState(sO_Guard_1, sO_On) && !g_vars->scene37_rings[0]->state)
+ || (g_fp->getObjectState(sO_Guard_1) == g_fp->getObjectEnumState(sO_Guard_1, sO_Off) && g_vars->scene37_rings[0]->state)) {
+ g_vars->scene37_plusMinus1->_statics = g_vars->scene37_plusMinus1->getStaticsById(ST_PMS_PLUS);
+ } else {
+ g_vars->scene37_plusMinus1->_statics = g_vars->scene37_plusMinus1->getStaticsById(ST_PMS_MINUS);
+ }
+ } else if (g_vars->scene37_rings[1]->ani->_movement && g_vars->scene37_rings[1]->ani->_movement->_id == MV_GRD37_PULL) {
+ if ((g_fp->getObjectState(sO_Guard_2) == g_fp->getObjectEnumState(sO_Guard_2, sO_On) && !g_vars->scene37_rings[1]->state)
+ || (g_fp->getObjectState(sO_Guard_2) == g_fp->getObjectEnumState(sO_Guard_2, sO_Off) && g_vars->scene37_rings[1]->state)) {
+ g_vars->scene37_plusMinus2->_statics = g_vars->scene37_plusMinus2->getStaticsById(ST_PMS_PLUS);
+ } else {
+ g_vars->scene37_plusMinus2->_statics = g_vars->scene37_plusMinus2->getStaticsById(ST_PMS_MINUS);
+ }
+ } else if (g_vars->scene37_rings[2]->ani->_movement && g_vars->scene37_rings[2]->ani->_movement->_id == MV_GRD37_PULL) {
+ if ((g_fp->getObjectState(sO_Guard_3) == g_fp->getObjectEnumState(sO_Guard_3, sO_On) && !g_vars->scene37_rings[2]->state)
+ || (g_fp->getObjectState(sO_Guard_3) == g_fp->getObjectEnumState(sO_Guard_3, sO_Off) && g_vars->scene37_rings[2]->state)) {
+ g_vars->scene37_plusMinus3->_statics = g_vars->scene37_plusMinus3->getStaticsById(ST_PMS_PLUS);
+ } else {
+ g_vars->scene37_plusMinus3->_statics = g_vars->scene37_plusMinus3->getStaticsById(ST_PMS_MINUS);
+ }
+ }
+
+ if (g_vars->scene37_soundFlipper) {
+ g_fp->playSound(SND_37_007, 0);
+
+ g_vars->scene37_soundFlipper = 0;
+ }
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/scene38.cpp b/engines/fullpipe/scenes/scene38.cpp
new file mode 100644
index 0000000000..22ae370391
--- /dev/null
+++ b/engines/fullpipe/scenes/scene38.cpp
@@ -0,0 +1,417 @@
+/* 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 {
+
+void scene38_setBottleState(Scene *sc) {
+ ExCommand *ex = sc->getMessageQueueById(QU_SC38_SHOWBOTTLE_ONTABLE)->getExCommandByIndex(0);
+
+ if (g_vars->scene38_bottle->_ox == ex->_x && g_vars->scene38_bottle->_oy == ex->_y) {
+ if (g_fp->lift_checkButton(sO_Level5) ) {
+ ex = sc->getMessageQueueById(QU_SC38_SHOWBOTTLE)->getExCommandByIndex(0);
+
+ g_vars->scene38_bottle->setOXY(ex->_x, ex->_y);
+ g_vars->scene38_bottle->_priority = ex->_field_14;
+
+ g_fp->setObjectState(sO_Bottle_38, g_fp->getObjectEnumState(sO_Bottle_38, sO_Blocked));
+ }
+ }
+}
+
+void scene38_initScene(Scene *sc) {
+ g_vars->scene38_var01 = 200;
+ g_vars->scene38_var02 = 200;
+ g_vars->scene38_var03 = 300;
+ g_vars->scene38_var04 = 300;
+ g_vars->scene38_boss = sc->getStaticANIObject1ById(ANI_GLAVAR, -1);
+ g_vars->scene38_tally = sc->getStaticANIObject1ById(ANI_DYLDA, -1);
+ g_vars->scene38_shorty = sc->getStaticANIObject1ById(ANI_MALYSH, -1);
+ g_vars->scene38_domino0 = sc->getStaticANIObject1ById(ANI_DOMINO38, 0);
+ g_vars->scene38_dominos = sc->getStaticANIObject1ById(ANI_DOMINOS, 0);
+ g_vars->scene38_domino1 = sc->getStaticANIObject1ById(ANI_DOMINO38, 1);
+ g_vars->scene38_bottle = sc->getStaticANIObject1ById(ANI_BOTTLE38, 0);
+ g_vars->scene38_var05 = 0;
+ g_vars->scene38_var06 = 0;
+ g_vars->scene38_var07 = 0;
+ g_vars->scene38_var08 = 15;
+ g_vars->scene38_var09 = 0;
+ g_vars->scene38_var10 = 0;
+ g_vars->scene38_var11 = 30;
+ g_vars->scene38_var12 = 0;
+ g_vars->scene38_var13 = 0;
+
+ scene38_setBottleState(sc);
+
+ if (g_fp->getObjectState(sO_Boss) == g_fp->getObjectEnumState(sO_Boss, sO_IsSleeping)) {
+ g_vars->scene38_shorty->_flags &= 0xFFFB;
+
+ g_vars->scene38_tally->stopAnim_maybe();
+ g_vars->scene38_tally->_flags &= 0xFFFB;
+
+ g_vars->scene38_domino0->_flags &= 0xFFFB;
+ g_vars->scene38_dominos->_flags &= 0xFFFB;
+ g_vars->scene38_domino1->_flags &= 0xFFFB;
+ }
+
+ g_fp->lift_sub5(sc, QU_SC38_ENTERLIFT, QU_SC38_EXITLIFT);
+ g_fp->lift_sub7(sc, ST_LBN_0N);
+}
+
+void sceneHandler38_tryTakeBottle() {
+ g_vars->scene38_boss->changeStatics2(ST_GLV_NOHAMMER);
+ g_vars->scene38_boss->startAnim(MV_GLV_LOOKMAN, 0, -1);
+
+ g_vars->scene38_var05 = 0;
+}
+
+void sceneHandler38_postHammerKick() {
+ g_vars->scene38_domino1->setOXY(g_vars->scene38_domino1->_ox, g_vars->scene38_domino1->_oy + 2);
+}
+
+void sceneHandler38_propose() {
+ if (!g_vars->scene38_tally->_movement) {
+ if (g_vars->scene38_tally->_flags & 4) {
+ if (!(g_vars->scene38_tally->_flags & 2) && g_vars->scene38_var08 > 0
+ && g_fp->_rnd->getRandomNumber(32767) < 32767) {
+ chainQueue(QU_DLD_DENY, 0);
+ g_vars->scene38_var08 = 0;
+ }
+ }
+ }
+}
+
+void sceneHandler38_point() {
+ if ((!g_vars->scene38_boss->_movement && ((g_vars->scene38_boss->_flags & 4) || !(g_vars->scene38_boss->_flags & 2)))
+ && g_vars->scene38_var05 > 0
+ && g_fp->_rnd->getRandomNumber(32767) < 32767) {
+ if (g_vars->scene38_boss->_statics->_staticsId == ST_GLV_HAMMER) {
+ chainQueue(QU_GLV_TOSMALL, 0);
+ g_vars->scene38_var05 = 0;
+ } else {
+ if (g_vars->scene38_boss->_statics->_staticsId == ST_GLV_NOHAMMER)
+ chainQueue(QU_GLV_TOSMALL_NOHMR, 0);
+
+ g_vars->scene38_var05 = 0;
+ }
+ }
+}
+
+void sceneHandler38_hammerKick() {
+ if (!g_vars->scene38_shorty->_movement) {
+ if (g_vars->scene38_shorty->_flags & 4) {
+ if (!(g_vars->scene38_shorty->_flags & 2) && g_vars->scene38_var11 > 1
+ && g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2
+ && g_fp->_rnd->getRandomNumber(32767) < 3276) {
+ chainQueue(QU_MLS_TURNR, 0);
+ g_vars->scene38_var11 = 0;
+ }
+ }
+ }
+
+ g_vars->scene38_domino1->setOXY(g_vars->scene38_domino1->_ox, g_vars->scene38_domino1->_oy - 2);
+
+ if (g_vars->scene38_dominos->_statics->_staticsId == ST_DMS_3)
+ g_vars->scene38_dominos->startAnim(MV_DMS_THREE, 0, -1);
+ else if (g_vars->scene38_dominos->_statics->_staticsId == ST_DMS_4)
+ g_vars->scene38_dominos->startAnim(MV_DMS_FOUR, 0, -1);
+}
+
+void sceneHandler38_drink() {
+ if (!g_vars->scene38_shorty->_movement) {
+ if (g_vars->scene38_shorty->_flags & 4) {
+ if (!(g_vars->scene38_shorty->_flags & 2) && g_vars->scene38_var11 > 0
+ && g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2
+ && g_fp->_rnd->getRandomNumber(32767) < 3276) {
+ chainQueue(QU_MLS_TURNR, 0);
+ g_vars->scene38_var11 = 0;
+ }
+ }
+ }
+}
+
+void sceneHandler38_animateAlcoholics() {
+ warning("STUB: sceneHandler38_animateAlcoholics()");
+
+#if 0
+ MessageQueue *mq;
+
+ if (g_vars->scene38_boss->_movement || !(g_vars->scene38_boss->_flags & 4) || (g_vars->scene38_boss->_flags & 2)) {
+ g_vars->scene38_var05 = 0;
+ } else {
+ g_vars->scene38_var05++;
+ }
+
+ if (g_vars->scene38_var05 >= 50) {
+ int bossSt = g_vars->scene38_boss->_statics->_staticsId;
+
+ if (bossSt == ST_GLV_SLEEP2) {
+ g_vars->scene38_var05 = 0;
+ } else if ((g_vars->scene38_domino0->_flags & 4) && g_vars->scene38_domino0->_statics->_staticsId == ST_DMN38_6) {
+ if (bossSt == ST_GLV_HAMMER) {
+ chainQueue(QU_GLV_TAKEDOMINO, 1);
+ g_vars->scene38_var05 = 0;
+ }
+
+ if (bossSt == ST_GLV_NOHAMMER) {
+ chainQueue(QU_GLV_TAKEDOMINO_NOHMR, 1);
+ g_vars->scene38_var05 = 0;
+ }
+ } else {
+ if ((g_vars->scene38_bottle->_flags & 4) && g_vars->scene38_bottle->_statics->_staticsId == ST_BTL38_FULL && bossSt == ST_GLV_NOHAMMER) {
+ chainQueue(QU_GLV_DRINKBOTTLE, 1);
+ g_vars->scene38_var05 = 0;
+ } else {
+ int bossAnim = 0;
+
+ if (g_fp->_rnd->getRandomNumber(32767) >= 1310 || g_vars->scene38_boss->_statics->_staticsId != ST_GLV_HAMMER) {
+ if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd->getRandomNumber(32767) < 1310) {
+ if (bossSt == ST_GLV_HAMMER)
+ bossAnim = QU_GLV_DRINK;
+ else if (bossSt == ST_GLV_NOHAMMER)
+ bossAnim = QU_GLV_DRINK_NOHMR;
+ }
+ } else {
+ if (bossSt == ST_GLV_HAMMER)
+ bossAnim = QU_GLV_PROPOSE;
+ else if (bossSt == ST_GLV_NOHAMMER)
+ bossAnim = QU_GLV_PROPOSE_NOHMR;
+ }
+ } else {
+ bossAnim = QU_GLV_HMRKICK;
+ }
+
+ if (g_vars->scene38_var06 == bossAnim) {
+ g_vars->scene38_var07++;
+
+ if (g_vars->scene38_var07 > 2)
+ bossAnim = 0;
+ } else {
+ g_vars->scene38_var06 = bossAnim;
+ g_vars->scene38_var07 = 1;
+ }
+
+ if (bossAnim > 0) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(bossAnim), 0, 0);
+
+ mq->chain(0);
+
+ g_vars->scene38_var05 = 0;
+ }
+ }
+ }
+ }
+
+ if (g_vars->scene38_tally->_movement || !(g_vars->scene38_tally->_flags & 4) || (g_vars->scene38_tally->_flags & 2)) {
+ g_vars->scene38_var08 = 0;
+ } else {
+ g_vars->scene38_var08++;
+ }
+
+ if (g_vars->scene38_var08 >= 50) {
+ int tallyAnim = 0;
+
+ if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd->getRandomNumber(32767) < 1310)
+ tallyAnim = QU_DLD_ICK;
+ } else {
+ tallyAnim = QU_DLD_GLOT;
+ }
+ } else {
+ tallyAnim = QU_DLD_BLINK;
+ }
+ } else {
+ if (g_vars->scene38_domino1->_statics->_staticsId == ST_DMN38_NORM3) {
+ tallyAnim = QU_DLD_TAKE1;
+ } else if (g_vars->scene38_domino1->_statics->_staticsId == ST_DMN38_NORM4) {
+ tallyAnim = QU_DLD_TAKE2;
+ }
+ }
+
+ if (g_vars->scene38_var09 == tallyAnim) {
+ g_vars->scene38_var10++;
+
+ if (g_vars->scene38_var10++ > 2)
+ tallyAnim = 0;
+ } else {
+ g_vars->scene38_var09 = tallyAnim;
+ g_vars->scene38_var10 = 1;
+ }
+ if (tallyAnim > 0) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(tallyAnim), 0, 0);
+
+ mq->chain(0);
+ g_vars->scene38_var08 = 0;
+ }
+ }
+
+ if (g_vars->scene38_shorty->_movement || !(g_vars->scene38_shorty->_flags & 4) || (g_vars->scene38_shorty->_flags & 2)) {
+ g_vars->scene38_var11 = 0;
+ return;
+ }
+
+ g_vars->scene38_var11++;
+
+ if (g_vars->scene38_var11 < 50)
+ return;
+
+ int shortyAnim = 0;
+
+ if (g_fp->_rnd->getRandomNumber(32767) >= 1310) {
+ if (g_fp->_rnd->getRandomNumber(32767) >= 1310 || g_vars->scene38_shorty->_statics->_staticsId != ST_MLS_LEFT2) {
+ if (g_vars->scene38_boss->_statics->_staticsId != ST_GLV_SLEEP2 && g_vars->scene38_var05 > 30 && g_fp->_rnd->getRandomNumber(32767) < 0x3FFF && g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2)
+ shortyAnim = QU_MLS_HAND;
+ } else {
+ shortyAnim = QU_MLS_BLINK;
+ }
+ } else {
+ if (g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_RIGHT2) {
+ shortyAnim = QU_MLS_TURNL;
+ } else if (g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2) {
+ shortyAnim = QU_MLS_TURNR;
+ }
+ }
+
+ if (g_vars->scene38_var12 == shortyAnim) {
+ g_vars->scene38_var13++;
+ if (g_vars->scene38_var13 > 2)
+ return;
+ } else {
+ g_vars->scene38_var12 = shortyAnim;
+ g_vars->scene38_var13 = 1;
+ }
+
+ if (shortyAnim > 0) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(shortyAnim), 0, 0);
+
+ mq->chain(0);
+
+ g_vars->scene38_var11 = 0;
+ }
+#endif
+}
+
+int sceneHandler38(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_LIFT_EXITLIFT:
+ g_fp->lift_exitSeq(cmd);
+ break;
+
+ case MSG_LIFT_CLOSEDOOR:
+ g_fp->lift_closedoorSeq();
+ break;
+
+ case MSG_LIFT_STARTEXITQUEUE:
+ g_fp->lift_startExitQueue();
+ break;
+
+ case MSG_SC38_TRYTAKEBOTTLE:
+ sceneHandler38_tryTakeBottle();
+ break;
+
+ case MSG_SC38_POSTHMRKICK:
+ sceneHandler38_postHammerKick();
+ break;
+
+ case MSG_SC38_PROPOSE:
+ sceneHandler38_propose();
+ break;
+
+ case MSG_LIFT_CLICKBUTTON:
+ g_fp->lift_animation3();
+ break;
+
+ case MSG_SC38_POINT:
+ sceneHandler38_point();
+ break;
+
+ case MSG_LIFT_GO:
+ g_fp->lift_goAnimation();
+ break;
+
+ case MSG_SC38_HMRKICK:
+ sceneHandler38_hammerKick();
+ break;
+
+ case MSG_SC38_DRINK:
+ sceneHandler38_drink();
+ break;
+
+ case 64:
+ g_fp->lift_sub05(cmd);
+ break;
+
+ case 29:
+ {
+ 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);
+
+ cmd->_messageKind = 0;
+ }
+ break;
+ }
+
+ case 33:
+ if (g_fp->_aniMan2) {
+ int x = g_fp->_aniMan2->_ox;
+
+ if (x < g_fp->_sceneRect.left + g_vars->scene38_var01)
+ g_fp->_currentScene->_x = x - g_vars->scene38_var03 - g_fp->_sceneRect.left;
+
+ if (x > g_fp->_sceneRect.right - g_vars->scene38_var01)
+ g_fp->_currentScene->_x = x + g_vars->scene38_var03 - g_fp->_sceneRect.right;
+ }
+
+ sceneHandler38_animateAlcoholics();
+
+ g_fp->_behaviorManager->updateBehaviors();
+
+ g_fp->startSceneTrack();
+
+ break;
+ }
+
+ return 0;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes/sceneDbg.cpp b/engines/fullpipe/scenes/sceneDbg.cpp
index 83f3b64ee5..4a3751940f 100644
--- a/engines/fullpipe/scenes/sceneDbg.cpp
+++ b/engines/fullpipe/scenes/sceneDbg.cpp
@@ -25,6 +25,7 @@
#include "fullpipe/constants.h"
#include "fullpipe/gameloader.h"
+#include "fullpipe/motion.h"
#include "fullpipe/scenes.h"
#include "fullpipe/statics.h"
#include "fullpipe/input.h"
@@ -40,9 +41,9 @@ void sceneDbgMenu_initScene(Scene *sc) {
}
GameObject *sceneHandlerDbgMenu_getObjectAtXY(int x, int y) {
- if (g_fullpipe->_currentScene)
- for (uint i = 0; i < g_fullpipe->_currentScene->_picObjList.size(); i++) {
- PictureObject *pic = (PictureObject *)g_fullpipe->_currentScene->_picObjList[i];
+ if (g_fp->_currentScene)
+ for (uint i = 0; i < g_fp->_currentScene->_picObjList.size(); i++) {
+ PictureObject *pic = (PictureObject *)g_fp->_currentScene->_picObjList[i];
if (x >= pic->_ox && y >= pic->_oy) {
Common::Point point;
@@ -61,8 +62,8 @@ int sceneHandlerDbgMenu(ExCommand *ex) {
if (ex->_messageKind != 17)
return 0;
- int mx = g_fullpipe->_mouseScreenPos.x + g_fullpipe->_sceneRect.left;
- int my = g_fullpipe->_mouseScreenPos.y + g_fullpipe->_sceneRect.top;
+ int mx = g_fp->_mouseScreenPos.x + g_fp->_sceneRect.left;
+ int my = g_fp->_mouseScreenPos.y + g_fp->_sceneRect.top;
if (ex->_messageNum == 29) {
GameObject *obj = sceneHandlerDbgMenu_getObjectAtXY(mx, my);
@@ -74,18 +75,18 @@ int sceneHandlerDbgMenu(ExCommand *ex) {
}
if (ex->_messageNum != 33) {
if (ex->_messageNum == MSG_RESTARTGAME) {
- g_fullpipe->_needRestart = true;
+ g_fp->_needRestart = true;
return 0;
}
return 0;
}
- g_fullpipe->_cursorId = PIC_CSR_DEFAULT;
- GameObject *obj = g_fullpipe->_currentScene->getStaticANIObjectAtPos(mx, my);
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
+ GameObject *obj = g_fp->_currentScene->getStaticANIObjectAtPos(mx, my);
if (obj) {
if (canInteractAny(0, obj, -3)) {
- g_fullpipe->_cursorId = PIC_CSR_DEFAULT;
- g_fullpipe->setCursor(PIC_CSR_DEFAULT);
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
+ g_fp->setCursor(PIC_CSR_DEFAULT);
return 0;
}
} else {
@@ -93,13 +94,13 @@ int sceneHandlerDbgMenu(ExCommand *ex) {
if (obj && canInteractAny(0, obj, -3) ) {
g_vars->selector->_flags |= 4;
g_vars->selector->setOXY(obj->_ox, obj->_oy);
- g_fullpipe->_cursorId = PIC_CSR_DEFAULT;
- g_fullpipe->setCursor(PIC_CSR_DEFAULT);
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
+ g_fp->setCursor(PIC_CSR_DEFAULT);
return 0;
}
g_vars->selector->_flags &= 0xFFFB;
}
- g_fullpipe->setCursor(g_fullpipe->_cursorId);
+ g_fp->setCursor(g_fp->_cursorId);
return 0;
}
diff --git a/engines/fullpipe/scenes/sceneIntro.cpp b/engines/fullpipe/scenes/sceneIntro.cpp
index d60f90faf7..c9f19f3724 100644
--- a/engines/fullpipe/scenes/sceneIntro.cpp
+++ b/engines/fullpipe/scenes/sceneIntro.cpp
@@ -24,6 +24,7 @@
#include "fullpipe/constants.h"
#include "fullpipe/gameloader.h"
+#include "fullpipe/motion.h"
#include "fullpipe/scenes.h"
#include "fullpipe/modal.h"
#include "fullpipe/statics.h"
@@ -31,13 +32,13 @@
namespace Fullpipe {
int sceneIntro_updateCursor() {
- g_fullpipe->_cursorId = 0;
+ g_fp->_cursorId = 0;
return 0;
}
void sceneIntro_initScene(Scene *sc) {
- g_fullpipe->_gameLoader->loadScene(SC_INTRO2);
+ g_fp->_gameLoader->loadScene(SC_INTRO2);
g_vars->sceneIntro_aniin1man = sc->getStaticANIObject1ById(ANI_IN1MAN, -1);
g_vars->sceneIntro_needSleep = true;
@@ -45,19 +46,19 @@ void sceneIntro_initScene(Scene *sc) {
g_vars->sceneIntro_playing = true;
g_vars->sceneIntro_needBlackout = false;
- if (g_fullpipe->_recordEvents || g_fullpipe->_inputArFlag)
+ if (g_fp->_recordEvents || g_fp->_inputArFlag)
g_vars->sceneIntro_skipIntro = false;
- g_fullpipe->_modalObject = new ModalIntro;
+ g_fp->_modalObject = new ModalIntro;
}
void sceneHandlerIntro_part1() {
- g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO1);
+ g_fp->_currentScene = g_fp->accessScene(SC_INTRO1);
chainQueue(QU_INTR_FINISH, 0);
}
void sceneHandlerIntro_part2() {
- g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO2);
+ g_fp->_currentScene = g_fp->accessScene(SC_INTRO2);
chainQueue(QU_IN2_DO, 0);
}
@@ -101,7 +102,7 @@ int sceneHandlerIntro(ExCommand *ex) {
chainQueue(QU_INTR_GETUPMAN, 0);
}
- g_fullpipe->startSceneTrack();
+ g_fp->startSceneTrack();
return 0;
}
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index 6da848a621..cf66cb40a1 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -23,8 +23,13 @@
#include "fullpipe/fullpipe.h"
#include "fullpipe/objects.h"
+#include "fullpipe/scene.h"
#include "fullpipe/sound.h"
#include "fullpipe/ngiarchive.h"
+#include "common/memstream.h"
+#include "audio/audiostream.h"
+#include "audio/decoders/vorbis.h"
+#include "audio/decoders/wave.h"
namespace Fullpipe {
@@ -77,6 +82,9 @@ Sound::Sound() {
_description = 0;
}
+Sound::~Sound() {
+ warning("STUB: Sound::~Sound()");
+}
bool Sound::load(MfcArchive &file, NGIArchive *archive) {
debug(5, "Sound::load()");
@@ -86,7 +94,7 @@ bool Sound::load(MfcArchive &file, NGIArchive *archive) {
_id = file.readUint32LE();
_description = file.readPascalString();
- assert(g_fullpipe->_gameProjectVersion >= 6);
+ assert(g_fp->_gameProjectVersion >= 6);
_objectId = file.readUint16LE();
@@ -113,14 +121,36 @@ void Sound::setPanAndVolumeByStaticAni() {
void FullpipeEngine::setSceneMusicParameters(GameVar *var) {
warning("STUB: FullpipeEngine::setSceneMusicParameters()");
+ // TODO: Finish this (MINDELAY, MAXDELAY, LOCAL, SEQUENCE, STARTDELAY etc)
+ stopAllSoundStreams();
+ _musicGameVar = var;
}
void FullpipeEngine::startSceneTrack() {
- debug(3, "STUB: FullpipeEngine::startSceneTrack()");
+ // TODO: Finish this
+#ifdef USE_VORBIS
+ if (g_fp->_mixer->isSoundHandleActive(_sceneTrackHandle))
+ return;
+
+ GameVar *musicTrackVar = _musicGameVar->getSubVarByName("MUSIC")->getSubVarByName("TRACKS")->_subVars;
+ if (!musicTrackVar)
+ return;
+
+ char *trackName = musicTrackVar->_varName;
+ Common::File *track = new Common::File();
+ if (!track->open(trackName)) {
+ warning("Could not open %s", trackName);
+ delete track;
+ return;
+ }
+ Audio::RewindableAudioStream *ogg = Audio::makeVorbisStream(track, DisposeAfterUse::YES);
+ g_fp->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_sceneTrackHandle, ogg);
+#endif
}
void FullpipeEngine::stopAllSounds() {
- warning("STUB: FullpipeEngine::stopAllSounds()");
+ // TODO: Differences from stopAllSoundStreams()
+ g_fp->_mixer->stopAll();
}
void FullpipeEngine::toggleMute() {
@@ -128,13 +158,45 @@ void FullpipeEngine::toggleMute() {
}
void FullpipeEngine::playSound(int id, int flag) {
- warning("STUB: FullpipeEngine::playSounds(%d, %d)", id, flag);
+ SoundList *soundList = g_fp->_currentScene->_soundList;
+ Sound *sound = soundList->getSoundById(id);
+ if (!sound) {
+ warning("playSound: Can't find sound with ID %d", id);
+ return;
+ }
+ byte *soundData = sound->loadData();
+ Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(soundData, sound->getDataSize());
+ Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES);
+ Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1);
+ Audio::SoundHandle handle = sound->getHandle();
+ g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream);
+}
+
+void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed) {
+ warning("STUB: FullpipeEngine::playTrack(var, %s, %d)", name, delayed);
}
void global_messageHandler_handleSound(ExCommand *cmd) {
debug(0, "STUB: global_messageHandler_handleSound()");
}
+void FullpipeEngine::stopSoundStream2() {
+ warning("STUB: FullpipeEngine::stopSoundStream2()");
+}
+
+void FullpipeEngine::stopAllSoundStreams() {
+ // TODO: Differences from stopAllSounds()
+ g_fp->_mixer->stopAll();
+}
+void FullpipeEngine::stopAllSoundInstances(int id) {
+ SoundList *soundList = g_fp->_currentScene->_soundList;
+ for (int i = 0; i < soundList->getCount(); i++) {
+ Sound *sound = soundList->getSoundByIndex(i);
+ if (sound->getId() == id) {
+ g_fp->_mixer->stopHandle(sound->getHandle());
+ }
+ }
+}
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h
index e2b271fe2c..ca64832c04 100644
--- a/engines/fullpipe/sound.h
+++ b/engines/fullpipe/sound.h
@@ -32,12 +32,17 @@ class Sound : public MemoryObject {
int _directSoundBuffer;
int _directSoundBuffers[7];
byte *_soundData;
+ Audio::SoundHandle _handle;
- public:
+public:
Sound();
+ virtual ~Sound();
+
virtual bool load(MfcArchive &file, NGIArchive *archive);
virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class
void updateVolume();
+ int getId() const { return _id; }
+ Audio::SoundHandle getHandle() const { return _handle; }
void setPanAndVolumeByStaticAni();
};
@@ -55,6 +60,13 @@ class SoundList : public CObject {
int getCount() { return _soundItemsCount; }
Sound *getSoundByIndex(int idx) { return _soundItems[idx]; }
+ Sound *getSoundById(int id) {
+ for (int i = 0; i < _soundItemsCount; i++) {
+ if (_soundItems[i]->getId() == id)
+ return _soundItems[i];
+ }
+ return NULL;
+ }
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 747015e9a1..ccf77ff81a 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -31,6 +31,7 @@
#include "fullpipe/scene.h"
#include "fullpipe/statics.h"
#include "fullpipe/interaction.h"
+#include "fullpipe/gameloader.h"
#include "fullpipe/constants.h"
@@ -82,8 +83,11 @@ bool FullpipeEngine::loadGam(const char *fname, int scene) {
setMusicAllowed(_gameLoader->_gameVar->getSubVarAsInt("MUSIC_ALLOWED"));
if (scene) {
- _gameLoader->loadScene(scene);
- _gameLoader->gotoScene(scene, TrubaLeft);
+ _gameLoader->loadScene(726);
+ _gameLoader->gotoScene(726, TrubaLeft);
+
+ if (scene != 726)
+ _gameLoader->preloadScene(726, getSceneEntrance(scene));
} else {
if (_flgPlayIntro) {
_gameLoader->loadScene(SC_INTRO1);
@@ -115,25 +119,25 @@ bool GameProject::load(MfcArchive &file) {
_headerFilename = 0;
_field_10 = 12;
- g_fullpipe->_gameProjectVersion = file.readUint32LE();
- g_fullpipe->_pictureScale = file.readUint16LE();
- g_fullpipe->_scrollSpeed = file.readUint32LE();
+ g_fp->_gameProjectVersion = file.readUint32LE();
+ g_fp->_pictureScale = file.readUint16LE();
+ g_fp->_scrollSpeed = file.readUint32LE();
_headerFilename = file.readPascalString();
- debug(1, "_gameProjectVersion = %d", g_fullpipe->_gameProjectVersion);
- debug(1, "_pictureScale = %d", g_fullpipe->_pictureScale);
- debug(1, "_scrollSpeed = %d", g_fullpipe->_scrollSpeed);
+ debug(1, "_gameProjectVersion = %d", g_fp->_gameProjectVersion);
+ debug(1, "_pictureScale = %d", g_fp->_pictureScale);
+ debug(1, "_scrollSpeed = %d", g_fp->_scrollSpeed);
debug(1, "_headerFilename = %s", _headerFilename);
_sceneTagList = new SceneTagList();
_sceneTagList->load(file);
- if (g_fullpipe->_gameProjectVersion >= 3)
+ if (g_fp->_gameProjectVersion >= 3)
_field_4 = file.readUint32LE();
- if (g_fullpipe->_gameProjectVersion >= 5) {
+ if (g_fp->_gameProjectVersion >= 5) {
file.readUint32LE();
file.readUint32LE();
}
@@ -143,6 +147,8 @@ bool GameProject::load(MfcArchive &file) {
GameProject::~GameProject() {
free(_headerFilename);
+
+ delete _sceneTagList;
}
GameVar::GameVar() {
@@ -156,6 +162,10 @@ GameVar::GameVar() {
_varName = 0;
}
+GameVar::~GameVar() {
+ warning("STUB: GameVar::~GameVar()");
+}
+
bool GameVar::load(MfcArchive &file) {
_varName = file.readPascalString();
_varType = file.readUint32LE();
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index c86d5abd08..10d9b4dfdf 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -27,6 +27,7 @@
#include "fullpipe/statics.h"
#include "fullpipe/messages.h"
#include "fullpipe/interaction.h"
+#include "fullpipe/motion.h"
#include "fullpipe/constants.h"
#include "fullpipe/objectnames.h"
@@ -126,6 +127,10 @@ StaticANIObject::StaticANIObject() {
_objtype = kObjTypeStaticANIObject;
}
+StaticANIObject::~StaticANIObject() {
+ warning("STUB: StaticANIObject::~StaticANIObject()");
+}
+
StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) {
_shadowsOn = src->_shadowsOn;
_field_30 = src->_field_30;
@@ -152,15 +157,19 @@ StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) {
_statics = 0;
for (uint i = 0; i < src->_movements.size(); i++) {
- Movement *mov;
- if (((Movement *)src->_movements[i])->_currMovement) {
- mov = new Movement(getMovementById(src->getMovementIdById(((Movement *)src->_movements[i])->_id)), this);
- mov->_id = ((Movement *)src->_movements[i])->_id;
+ Movement *newmov;
+ Movement *mov = (Movement *)src->_movements[i];
+
+ if (mov->_currMovement) {
+ // WORKAROUND: Original uses weird construction here:
+ // new Movement(getMovementById(src->getMovementIdById(mov->_id)), this);
+ newmov = new Movement(src->getMovementById(src->getMovementIdById(mov->_id)), this);
+ newmov->_id = mov->_id;
} else {
- mov = new Movement(((Movement *)src->_movements[i]), 0, -1, this);
+ newmov = new Movement(mov, 0, -1, this);
}
- _movements.push_back(mov);
+ _movements.push_back(newmov);
}
}
@@ -186,7 +195,7 @@ bool StaticANIObject::load(MfcArchive &file) {
char *movname = genFileName(_id, movNum, "mov");
- Common::SeekableReadStream *f = g_fullpipe->_currArchive->createReadStreamForMember(movname);
+ Common::SeekableReadStream *f = g_fp->_currArchive->createReadStreamForMember(movname);
Movement *mov = new Movement();
@@ -244,11 +253,11 @@ void StaticANIObject::setFlags40(bool state) {
void StaticANIObject::deleteFromGlobalMessageQueue() {
while (_messageQueueId) {
- if (g_fullpipe->_globalMessageQueueList->getMessageQueueById(_messageQueueId)) {
+ if (g_fp->_globalMessageQueueList->getMessageQueueById(_messageQueueId)) {
if (!isIdle())
return;
- g_fullpipe->_globalMessageQueueList->deleteQueueById(_messageQueueId);
+ g_fp->_globalMessageQueueList->deleteQueueById(_messageQueueId);
} else {
_messageQueueId = 0;
}
@@ -276,11 +285,34 @@ void StaticANIObject::queueMessageQueue(MessageQueue *mq) {
}
}
+void StaticANIObject::restartMessageQueue(MessageQueue *mq) {
+ ExCommand *ex = mq->getExCommandByIndex(0);
+ if (ex) {
+ while (ex->_messageKind != 1 || ex->_parentId != _id) {
+ ex->_parId = 0;
+ ex->_excFlags |= 2;
+ ex->handleMessage();
+
+ mq->deleteExCommandByIndex(0, 0);
+
+ ex = mq->getExCommandByIndex(0);
+
+ if (!ex)
+ return;
+ }
+
+ if (ex) {
+ startAnim(ex->_messageNum, mq->_id, -1);
+ mq->deleteExCommandByIndex(0, 1);
+ }
+ }
+}
+
MessageQueue *StaticANIObject::getMessageQueue() {
if (this->_messageQueueId <= 0)
return 0;
- return g_fullpipe->_globalMessageQueueList->getMessageQueueById(_messageQueueId);
+ return g_fp->_globalMessageQueueList->getMessageQueueById(_messageQueueId);
}
bool StaticANIObject::trySetMessageQueue(int msgNum, int qId) {
@@ -297,9 +329,13 @@ bool StaticANIObject::trySetMessageQueue(int msgNum, int qId) {
return true;
}
+void StaticANIObject::startMQIfIdle(int qId, int flag) {
+ warning("STUB: StaticANIObject::startMQIfIdle()");
+}
+
bool StaticANIObject::isIdle() {
if (_messageQueueId) {
- MessageQueue *m = g_fullpipe->_globalMessageQueueList->getMessageQueueById(_messageQueueId);
+ MessageQueue *m = g_fp->_globalMessageQueueList->getMessageQueueById(_messageQueueId);
if (m && m->getFlags() & 1)
return false;
@@ -424,7 +460,7 @@ void Movement::draw(bool flipFlag, int angle) {
int y = _oy - point.y;
if (_currDynamicPhase->getPaletteData())
- g_fullpipe->_globalPalette = _currDynamicPhase->getPaletteData();
+ g_fp->_globalPalette = _currDynamicPhase->getPaletteData();
if (_currDynamicPhase->getAlpha() < 0xFF) {
warning("Movement::draw: alpha < 0xff: %d", _currDynamicPhase->getAlpha());
@@ -492,9 +528,9 @@ void StaticANIObject::draw() {
Common::Point point;
Common::Rect rect;
- debug(0, "StaticANIObject::draw() (%s) [%d] [%d, %d]", transCyrillic((byte *)_objectName), _id, _ox, _oy);
+ debug(6, "StaticANIObject::draw() (%s) [%d] [%d, %d]", transCyrillic((byte *)_objectName), _id, _ox, _oy);
- if (_shadowsOn && g_fullpipe->_currentScene && g_fullpipe->_currentScene->_shadows
+ if (_shadowsOn && g_fp->_currentScene && g_fp->_currentScene->_shadows
&& (getCurrDimensions(point)->x != 1 || getCurrDimensions(point)->y != 1)) {
DynamicPhase *dyn;
@@ -512,7 +548,7 @@ void StaticANIObject::draw() {
if (dyn->getDynFlags() & 4) {
rect = *dyn->_rect;
- DynamicPhase *shd = g_fullpipe->_currentScene->_shadows->findSize(rect.width(), rect.height());
+ DynamicPhase *shd = g_fp->_currentScene->_shadows->findSize(rect.width(), rect.height());
if (shd) {
shd->getDimensions(&point);
int midx = _ox - point.x / 2 - dyn->_someX;
@@ -552,7 +588,7 @@ void StaticANIObject::draw() {
}
void StaticANIObject::draw2() {
- debug(0, "StatciANIObject::draw2(): id: (%s) %d [%d, %d]", transCyrillic((byte *)_objectName), _id, _ox, _oy);
+ debug(6, "StatciANIObject::draw2(): id: (%s) %d [%d, %d]", transCyrillic((byte *)_objectName), _id, _ox, _oy);
if ((_flags & 4) && (_flags & 0x10)) {
if (_movement) {
@@ -568,7 +604,7 @@ void StaticANIObject::draw2() {
}
MovTable *StaticANIObject::countMovements() {
- GameVar *preloadSubVar = g_fullpipe->getGameLoaderGameVar()->getSubVarByName(getName())->getSubVarByName("PRELOAD");
+ GameVar *preloadSubVar = g_fp->getGameLoaderGameVar()->getSubVarByName(getName())->getSubVarByName("PRELOAD");
if (!preloadSubVar || preloadSubVar->getSubVarsCount() == 0)
return 0;
@@ -594,7 +630,7 @@ MovTable *StaticANIObject::countMovements() {
}
void StaticANIObject::setSpeed(int speed) {
- GameVar *var = g_fullpipe->getGameLoaderGameVar()->getSubVarByName(getName())->getSubVarByName("SpeedUp");
+ GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(getName())->getSubVarByName("SpeedUp");
if (!var)
return;
@@ -627,6 +663,19 @@ void StaticANIObject::initMovements() {
((Movement *)_movements[i])->removeFirstPhase();
}
+void StaticANIObject::preloadMovements(MovTable *mt) {
+ if ( mt ) {
+ for (uint i = 0; i < _movements.size(); i++) {
+ Movement *mov = (Movement *)_movements[i];
+
+ if (mt->movs[i] == 1)
+ mov->loadPixelData();
+ else if (mt->movs[i] == 2)
+ mov->freePixelData();
+ }
+ }
+}
+
Common::Point *StaticANIObject::getCurrDimensions(Common::Point &p) {
Picture *pic;
@@ -703,7 +752,7 @@ void StaticANIObject::update(int counterdiff) {
ex = dyn->getExCommand();
if (ex && ex->_messageKind != 35) {
- newex = new ExCommand(ex);
+ newex = ex->createClone();
newex->_excFlags |= 2;
if (newex->_messageKind == 17) {
newex->_parentId = _id;
@@ -736,7 +785,7 @@ void StaticANIObject::update(int counterdiff) {
ex = dyn->getExCommand();
if (ex) {
if (ex->_messageKind == 35) {
- newex = new ExCommand(ex);
+ newex = ex->createClone();
newex->_excFlags |= 2;
newex->sendMessage();
}
@@ -798,6 +847,44 @@ void StaticANIObject::updateStepPos() {
setOXY(ox + x, oy + y);
}
+Common::Point *StaticANIObject::calcNextStep(Common::Point *pRes) {
+ if (!_movement) {
+ pRes->x = 0;
+ pRes->y = 0;
+
+ return pRes;
+ }
+
+ Common::Point point;
+
+ _movement->calcSomeXY(point, 1);
+
+ int resX = point.x;
+ int resY = point.y;
+
+ int pointN, offset;
+
+ if (_someDynamicPhaseIndex <= 0) {
+ pointN = _stepArray.getCurrPointIndex();
+ offset = _stepArray.getPointsCount() - _stepArray.getCurrPointIndex();
+ } else {
+ pointN = _stepArray.getCurrPointIndex();
+ offset = 1 - _movement->_currDynamicPhaseIndex + _someDynamicPhaseIndex;
+ }
+
+ if (pointN >= 0) {
+ _stepArray.getPoint(&point, pointN, offset);
+
+ resX += point.x;
+ resY += point.y;
+ }
+
+ pRes->x = resX;
+ pRes->y = resY;
+
+ return pRes;
+}
+
void StaticANIObject::stopAnim_maybe() {
debug(6, "StaticANIObject::stopAnim_maybe()");
@@ -866,7 +953,24 @@ void StaticANIObject::stopAnim_maybe() {
}
void StaticANIObject::adjustSomeXY() {
- warning("STUB: StaticANIObject::adjustSomeXY()");
+ if (_movement) {
+ Common::Point point;
+
+ _movement->calcSomeXY(point, 0);
+
+ int diff = abs(point.y) - abs(point.x);
+
+ _movement->calcSomeXY(point, 1);
+
+ if (diff > 0)
+ _ox += point.x;
+ else
+ _oy += point.y;
+
+ _statics = _movement->_staticsObj2;
+ _movement = 0;
+ _someDynamicPhaseIndex = -1;
+ }
}
MessageQueue *StaticANIObject::changeStatics1(int msgNum) {
@@ -876,7 +980,23 @@ MessageQueue *StaticANIObject::changeStatics1(int msgNum) {
}
void StaticANIObject::changeStatics2(int objId) {
- warning("STUB: StaticANIObject::changeStatics2(%d)", objId);
+ _animExFlag = 0;
+
+ deleteFromGlobalMessageQueue();
+
+ if (_movement || _statics) {
+ g_fp->_mgm->addItem(_id);
+ g_fp->_mgm->updateAnimStatics(this, objId);
+ } else {
+ _statics = getStaticsById(objId);
+ }
+
+ if (_messageQueueId) {
+ if (g_fp->_globalMessageQueueList->getMessageQueueById(_messageQueueId))
+ g_fp->_globalMessageQueueList->deleteQueueById(_messageQueueId);
+
+ _messageQueueId = 0;
+ }
}
void StaticANIObject::hide() {
@@ -887,7 +1007,7 @@ void StaticANIObject::hide() {
}
void StaticANIObject::show1(int x, int y, int movId, int mqId) {
- debug(0, "StaticANIObject::show1(%d, %d, %d, %d)", x, y, movId, mqId);
+ debug(6, "StaticANIObject::show1(%d, %d, %d, %d)", x, y, movId, mqId);
if (_messageQueueId)
return;
@@ -994,20 +1114,17 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase
int newy = _oy;
Common::Point point;
- debug(0, "0 %d %d", newx, newy);
if (_movement) {
_movement->getCurrDynamicPhaseXY(point);
newx -= point.x;
newy -= point.y;
- debug(0, "1 %d %d", newx, newy);
} else if (_statics) {
_statics->getSomeXY(point);
newx -= point.x;
newy -= point.y;
- debug(0, "2 %d %d - %d %d assa", newx, newy, point.x, point.y);
}
_movement = mov;
@@ -1025,13 +1142,12 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase
newx += point.x + _movement->_mx;
newy += point.y + _movement->_my;
- debug(0, "3 %d %d", newx, newy);
_stepArray.gotoNextPoint();
ExCommand *ex = _movement->_currDynamicPhase->getExCommand();
if (ex) {
if (ex->_messageKind == 35) {
- ExCommand *newex = new ExCommand(ex);
+ ExCommand *newex = ex->createClone();
newex->_excFlags |= 2;
newex->sendMessage();
}
@@ -1166,6 +1282,10 @@ Movement::Movement() {
_somePoint.y = 0;
}
+Movement::~Movement() {
+ warning("STUB: Movement::~Movement()");
+}
+
Movement::Movement(Movement *src, StaticANIObject *ani) {
_lastFrameSpecialFlag = 0;
_flipFlag = src->_flipFlag;
@@ -1231,7 +1351,7 @@ Movement::Movement(Movement *src, int *oldIdxs, int newSize, StaticANIObject *an
_m2y = src->_m2y;
if (newSize != -1) {
- if (newSize >= src->_dynamicPhases.size() + 1)
+ if (newSize >= (int)src->_dynamicPhases.size() + 1)
newSize = src->_dynamicPhases.size() + 1;
} else {
newSize = src->_dynamicPhases.size();
@@ -1359,10 +1479,10 @@ bool Movement::load(MfcArchive &file, StaticANIObject *ani) {
_flipFlag = 1;
}
- if (g_fullpipe->_gameProjectVersion >= 8)
+ if (g_fp->_gameProjectVersion >= 8)
_field_50 = file.readUint32LE();
- if (g_fullpipe->_gameProjectVersion < 12)
+ if (g_fp->_gameProjectVersion < 12)
_counterMax = 83;
else
_counterMax = file.readUint32LE();
@@ -1511,6 +1631,25 @@ int Movement::calcDuration() {
return res;
}
+int Movement::countPhasesWithFlag(int maxidx, int flag) {
+ int res = 0;
+ int sz;
+
+ if (_currMovement)
+ sz = _currMovement->_dynamicPhases.size();
+ else
+ sz = _dynamicPhases.size();
+
+ if (maxidx < 0)
+ maxidx = sz;
+
+ for (int i = 0; i < maxidx && i < sz; i++)
+ if (getDynamicPhaseByIndex(i)->_dynFlags & flag)
+ res++;
+
+ return res;
+}
+
void Movement::setDynamicPhaseIndex(int index) {
debug(7, "Movement::setDynamicPhaseIndex(%d)", index);
while (_currDynamicPhaseIndex < index)
@@ -1550,6 +1689,15 @@ void Movement::loadPixelData() {
mov->_staticsObj1->getPixelData();
}
+void Movement::freePixelData() {
+ if (!_currMovement)
+ for (uint i = 0; i < _dynamicPhases.size(); i++)
+ ((DynamicPhase *)_dynamicPhases[i])->freePixelData();
+
+ if (_staticsObj1)
+ _staticsObj1->freePixelData();
+}
+
void Movement::removeFirstPhase() {
if (_updateFlag1) {
if (!_currDynamicPhaseIndex)
@@ -1570,7 +1718,7 @@ void Movement::removeFirstPhase() {
_updateFlag1 = 0;
}
-bool Movement::gotoNextFrame(int callback1, void (*callback2)(int *)) {
+bool Movement::gotoNextFrame(void (*callback1)(int, Common::Point *point, int, int), void (*callback2)(int *)) {
debug(8, "Movement::gotoNextFrame()");
if (!callback2) {
@@ -1622,7 +1770,7 @@ bool Movement::gotoNextFrame(int callback1, void (*callback2)(int *)) {
if (_currMovement->_framePosOffsets) {
if (callback1) {
point = *_currMovement->_framePosOffsets[_currDynamicPhaseIndex];
- //callback1(_currDynamicPhaseIndex, &point, _ox, _oy);
+ callback1(_currDynamicPhaseIndex, &point, _ox, _oy);
_ox += deltax - point.x;
_oy += point.y;
@@ -1664,7 +1812,7 @@ bool Movement::gotoNextFrame(int callback1, void (*callback2)(int *)) {
point.x = _framePosOffsets[_currDynamicPhaseIndex]->x;
point.y = _framePosOffsets[_currDynamicPhaseIndex]->y;
- //callback1(_currDynamicPhaseIndex, &point, _ox, _oy);
+ callback1(_currDynamicPhaseIndex, &point, _ox, _oy);
_ox += point.x;
_oy += point.y;
} else if (oldDynIndex >= _currDynamicPhaseIndex) {
@@ -1790,7 +1938,7 @@ DynamicPhase::DynamicPhase(DynamicPhase *src, bool reverse) {
_field_7E = 0;
_rect = new Common::Rect();
- debug(0, "DynamicPhase::DynamicPhase(src, %d)", reverse);
+ debug(1, "DynamicPhase::DynamicPhase(src, %d)", reverse);
if (reverse) {
if (!src->_bitmap)
@@ -1800,9 +1948,9 @@ DynamicPhase::DynamicPhase(DynamicPhase *src, bool reverse) {
_data = _bitmap->_pixels;
_dataSize = src->_dataSize;
- if (g_fullpipe->_currArchive) {
+ if (g_fp->_currArchive) {
_mfield_14 = 0;
- _libHandle = g_fullpipe->_currArchive;
+ _libHandle = g_fp->_currArchive;
}
_mflags |= 1;
@@ -1835,7 +1983,7 @@ DynamicPhase::DynamicPhase(DynamicPhase *src, bool reverse) {
_field_7C = src->_field_7C;
if (src->getExCommand())
- _exCommand = new ExCommand(src->getExCommand());
+ _exCommand = src->getExCommand()->createClone();
else
_exCommand = 0;
@@ -1860,12 +2008,12 @@ bool DynamicPhase::load(MfcArchive &file) {
_rect->right = file.readUint32LE();
_rect->bottom = file.readUint32LE();
- assert (g_fullpipe->_gameProjectVersion >= 1);
+ assert (g_fp->_gameProjectVersion >= 1);
_someX = file.readUint32LE();
_someY = file.readUint32LE();
- assert (g_fullpipe->_gameProjectVersion >= 12);
+ assert (g_fp->_gameProjectVersion >= 12);
_dynFlags = file.readUint32LE();
@@ -1892,13 +2040,15 @@ bool StaticPhase::load(MfcArchive &file) {
_initialCountdown = file.readUint16LE();
_field_6A = file.readUint16LE();
- if (g_fullpipe->_gameProjectVersion >= 12) {
+ if (g_fp->_gameProjectVersion >= 12) {
_exCommand = (ExCommand *)file.readClass();
return true;
}
- assert (g_fullpipe->_gameProjectVersion >= 12);
+ assert (g_fp->_gameProjectVersion >= 12);
+
+ warning("StaticPhase::load(): Code continues here");
return true;
}
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index 15de4ab3be..a620daa528 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -132,6 +132,8 @@ class Movement : public GameObject {
public:
Movement();
+ virtual ~Movement();
+
Movement(Movement *src, StaticANIObject *ani);
Movement(Movement *src, int *flag1, int flag2, StaticANIObject *ani);
@@ -153,14 +155,16 @@ class Movement : public GameObject {
DynamicPhase *getDynamicPhaseByIndex(int idx);
int calcDuration();
+ int countPhasesWithFlag(int maxidx, int flag);
void removeFirstPhase();
- bool gotoNextFrame(int callback1, void (*callback2)(int *));
+ bool gotoNextFrame(void (*_callback1)(int, Common::Point *point, int, int), void (*callback2)(int *));
bool gotoPrevFrame();
void gotoFirstFrame();
void gotoLastFrame();
void loadPixelData();
+ void freePixelData();
void draw(bool flipFlag, int angle);
};
@@ -174,7 +178,7 @@ class StaticANIObject : public GameObject {
int16 _field_32;
int _field_34;
int _initialCounter;
- int _callback1;
+ void (*_callback1)(int, Common::Point *point, int, int);
void (*_callback2)(int *);
PtrList _movements;
PtrList _staticsList;
@@ -186,11 +190,12 @@ class StaticANIObject : public GameObject {
int _counter;
int _someDynamicPhaseIndex;
- public:
+public:
int16 _sceneId;
- public:
+public:
StaticANIObject();
+ virtual ~StaticANIObject();
StaticANIObject(StaticANIObject *src);
virtual bool load(MfcArchive &file);
@@ -212,11 +217,14 @@ class StaticANIObject : public GameObject {
void deleteFromGlobalMessageQueue();
void queueMessageQueue(MessageQueue *msg);
+ void restartMessageQueue(MessageQueue *msg);
MessageQueue *getMessageQueue();
bool trySetMessageQueue(int msgNum, int qId);
+ void startMQIfIdle(int qId, int flag);
void initMovements();
void loadMovementsPixelData();
+ void preloadMovements(MovTable *mt);
void setSomeDynamicPhaseIndex(int val) { _someDynamicPhaseIndex = val; }
void adjustSomeXY();
@@ -240,6 +248,7 @@ class StaticANIObject : public GameObject {
void updateStepPos();
void stopAnim_maybe();
+ Common::Point *calcNextStep(Common::Point *point);
MessageQueue *changeStatics1(int msgNum);
void changeStatics2(int objId);
@@ -250,6 +259,9 @@ class StaticANIObject : public GameObject {
struct MovTable {
int count;
int16 *movs;
+
+ MovTable() { count = 0; movs = 0; }
+ ~MovTable() { free(movs); }
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 3304a93667..b3668ea362 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -138,9 +138,9 @@ bool MemoryObject::load(MfcArchive &file) {
}
}
- if (g_fullpipe->_currArchive) {
+ if (g_fp->_currArchive) {
_mfield_14 = 0;
- _libHandle = g_fullpipe->_currArchive;
+ _libHandle = g_fp->_currArchive;
}
return true;
@@ -148,8 +148,17 @@ bool MemoryObject::load(MfcArchive &file) {
void MemoryObject::loadFile(char *filename) {
debug(5, "MemoryObject::loadFile(<%s>)", filename);
+
+ if (!*filename)
+ return;
+
if (!_data) {
- Common::SeekableReadStream *s = g_fullpipe->_currArchive->createReadStreamForMember(filename);
+ NGIArchive *arr = g_fp->_currArchive;
+
+ if (g_fp->_currArchive != _libHandle && _libHandle)
+ g_fp->_currArchive = _libHandle;
+
+ Common::SeekableReadStream *s = g_fp->_currArchive->createReadStreamForMember(filename);
if (s) {
assert(s->size() > 0);
@@ -161,7 +170,11 @@ void MemoryObject::loadFile(char *filename) {
s->read(_data, _dataSize);
delete s;
+ } else {
+ warning("MemoryObject::loadFile(): reading failure");
}
+
+ g_fp->_currArchive = arr;
}
}
@@ -181,6 +194,8 @@ byte *MemoryObject::loadData() {
}
void MemoryObject::freeData() {
+ debug(8, "MemoryObject::freeData(): file: %s", _memfilename);
+
if (_data)
free(_data);
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index 64f56ced0a..5714fd3b4c 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -66,6 +66,8 @@ class MfcArchive : public Common::SeekableReadStream {
enum ObjType {
kObjTypeDefault,
+ kObjTypeExCommand,
+ kObjTypeExCommand2,
kObjTypeMovGraph,
kObjTypeMovGraphLink,
kObjTypeMovGraphNode,
@@ -115,6 +117,7 @@ class MemoryObject : CObject {
void load() { loadFile(_memfilename); }
byte *getData();
byte *loadData();
+ int getDataSize() const { return _dataSize; }
bool testFlags();